Loading View¶
The first view of the Boarding pass flow is the loading view, it appears when the boarding pass feature is initializing.
It contains a title(1), a message(2), an image(3) and a background that can be customized.
Branding¶
You can apply your own branding to our screens by overriding the resources we use.
Text resources¶
You can add your own texts and localization by overriding the following string resources:
<string name="boarding_pass_loading_title_sdk_enrolment">Loading settings</string>
<string name="boarding_pass_loading_subtitle_sdk_enrolment">It won\'t take long</string>
The best way to override strings is by adding your key through the Theme class
Theme.shared.strings.boardingPassScan.initialization
Theme.shared.strings.boardingPassScan.initializationSubtitle
Colors¶
You can change the text colors by overriding the following color resource (It affects all texts):
<color name="colorFaceCaptureTxtDarkSdkEnrolment">#1A1C1E</color>
You can change the background color by overriding the following color resource:
<color name="colorOverlayFeedbackBgSdkEnrolment">#EAEEF6</color>
You can change the text colors by overriding the following color in Theme class (It affects all Loading Screens):
Theme.shared.colors.checkPermission.title
Theme.shared.colors.checkPermission.subtitle
Theme.shared.colors.checkPermission.background
Styles¶
You can extend the styles we use and override any properties (textColor, textSize, fontFamily, etc...) you want.
<style name="Theme.Sdk.Enrolment.TextView.Dark.Title.Centered">
<style name="Theme.Sdk.Enrolment.TextView.Dark.Subtitle.Centered">
You can change the font through the theme class (this will affect all text in the app):
Theme.shared.fonts.bold
Theme.shared.fonts.regular
Animation¶
You can change the loading animation by adding a raw json animation file with this name:
loading_boardingpass_sdk_enrolment
You can change the loading animation by adding a raw json animation file and overriding the following animation name in Theme class
Theme.shared.animations.boardingPass.loadingBoardingPass
Use your own layouts¶
To use your own loading screen for boarding pass feature, you need to implement the MobileID SDK Interface for that view.
In this case: ICustomBoardingPass.LoadingView
interface LoadingView {
fun onPreFeatureLoading()
fun onFeatureLoading()
fun onPostFeatureLoading()
fun hideLoading()
}
For example create a class BoardingPassLoadingCustomView, create a layout file and bind it.
class BoardingPassLoadingCustomView(context: Context) :
ConstraintLayout(context), ICustomBoardingPass.LoadingView {
private var binding: ViewBoardingPassLoadingBinding
init {
binding = ViewBoardingPassLoadingBinding.inflate(LayoutInflater.from(context), this)
}
override fun onPreFeatureLoading() {
// Do nothing
}
override fun onFeatureLoading() {
// Do nothing
}
override fun onPostFeatureLoading() {
// Do nothing
}
override fun hideLoading() {
// Do nothing
}
}
You need to register a class of type BoardingPassLoadingViewType through the following function of EnrolmentViewRegister
public func registerBoardingPassScannerLoadingView(_ viewType: BoardingPassLoadingViewType)
The BoardingPassLoadingViewType class needs to respect the following protocols:
public protocol BoardingPassLoadingViewInterface: FeatureLoadingView {}
public typealias BoardingPassLoadingViewType = BoardingPassLoadingView.Type
public typealias BoardingPassLoadingView = UIView & BoardingPassLoadingViewInterface
public protocol FeatureLoadingViewInterface {
func onPreFeatureLoading()
func onPostFeatureLoading()
func hideLoading()
}
public typealias FeatureLoadingViewType = FeatureLoadingView.Type
public typealias FeatureLoadingView = UIView & FeatureLoadingViewInterface
Example:
class LoadingView: BoardingPassLoadingView {
// MARK: - Initialization
override init(frame: CGRect) {
super.init(frame: frame)
//add any UI customization you need
}
// MARK: - Functions
func onPreFeatureLoading() {
//add any UI customization you need
}
func onPostFeatureLoading() {
//add any UI customization you need
}
func hideLoading() {
//You can stop animations or other activities that consumes resources
}
}