It is useful to display the currently applied overridden configuration in your app. We suggest you display this on your app's home screen.
Swift (UIKit) Objective-C (UIKit) Android (Layout) Dart (Flutter)
You can add the to your view controller in a viewDidLoad
like this:
Copy override func viewDidLoad() {
let label = APLConfigurationLabel(frame: .zero)
label.center = CGPoint(x: 7, y: self.navigationController!.view.bounds.size.height / 2)
self.navigationController!.view.addSubview(label)
}
You can add the to your view controller in a viewDidLoad
like this:
Copy - (void) viewDidLoad {
APLConfigurationLabel* label = [[APLConfigurationLabel alloc] initWithFrame: CGRectZero];
label.center = CGPointMake(7, self.navigationController.view.bounds.size.height / 2);
[self.navigationController.view addSubview: label];
}
Embed your original layout inside a FrameLayout
. The must come after the original layout for it to appear on top.
Copy <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<original-layout-here/>
<nz.co.electricbolt.appfiguratelibrary.ConfigurationLabel
android:id="@+id/configuration_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"/>
</FrameLayout>
Copy ...
@override
Widget build(BuildContext context) {
var media = MediaQuery.of(context);
var padding = media.padding.left == 0.0 ? 8.0 : media.padding.left;
return Scaffold(
appBar: AppBar(
title: Text('Example'),
),
body: APLConfigurationLabel(child:
ListView(
...
Swift Objective-C Kotlin Java Dart
Swift example
Copy extension MyLogonController: APLConfigurationUpdated {
override func viewDidLoad() {
APLAddConfigurationUpdatedListener(self)
}
func configurationUpdated(_ notification: Notification?) {
label.text = APLConfiguration.shared().modifications
}
...
Objective-C example
Copy @interface MyLogonController () <APLConfigurationUpdated>
@end
@implementation MyLogonController
- (void) viewDidLoad {
APLAddConfigurationUpdatedListener(self);
}
- (void) configurationUpdated: (NSNotification*) notification {
label.text = [[APLConfiguration sharedConfiguration] modifications];
}
...
Copy override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Appfigurate.addConfigurationUpdatedListener { action: String? ->
label.text = Configuration.sharedConfiguration().modifications()
}
...
Copy @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Appfigurate.addConfigurationUpdatedListener((String action) -> {
label.text = Configuration.sharedConfiguration().modifications();
});
...
Copy class _MyLabelState extends State<MyLabel> {
@override
void initState() {
super.initState();
APLAddConfigurationUpdatedListener(configurationUpdated);
}
@override
void dispose() {
APLRemoveConfigurationUpdatedListener(configurationUpdated);
super.dispose();
}
void configurationUpdated(String? action) {
setState(() {});
}
@override
Widget build(BuildContext context) {
return Text('${APLNativeConfiguration.sharedConfiguration().modifications()}');
}
...