Links
Comment on page

Displaying overridden configuration

It is useful to display the currently applied overridden configuration in your app. We suggest you display this on your app's home screen.
The provided APLConfigurationLabel (Objective-C, Swift, Dart) or nz.co.electricbolt.appfiguratelibrary.ConfigurationLabel (Java, Kotlin) displays overridden configuration drawn in a vertical orientation attached to the left hand side of the screen as follows:
Objective-C
Swift
Java/Kotlin
Dart
You can add the APLConfigurationLabel to your view controller in a viewDidLoad like this:
- (void) viewDidLoad {
APLConfigurationLabel* label = [[APLConfigurationLabel alloc] initWithFrame: CGRectZero];
label.center = CGPointMake(7, self.navigationController.view.bounds.size.height / 2);
[self.navigationController.view addSubview: label];
}
You can add the APLConfigurationLabel to your view controller in a viewDidLoad like this:
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)
}
Embed your original layout inside a FrameLayout. The ConfigurationLabel must come after the original layout for it to appear on top.
<?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>
Make the body of your page a APLConfiguationLabel, and set it's child to the original body:
...
@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(
...

Creating your own label

If APLConfigurationLabel is not sufficient for your needs, you can create your own label as follows:
Objective-C
Swift
Java
Kotlin
Dart
@interface MyLogonController () <APLConfigurationUpdated>
@end
@implementation MyLogonController
- (void) viewDidLoad {
APLAddConfigurationUpdatedListener(self);
}
- (void) configurationUpdated: (NSNotification*) notification {
label.text = [[APLConfiguration sharedConfiguration] modifications];
}
...
extension MyLogonController: APLConfigurationUpdated {
override func viewDidLoad() {
APLAddConfigurationUpdatedListener(self)
}
func configurationUpdated(_ notification: Notification?) {
label.text = APLConfiguration.shared().modifications
}
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Appfigurate.addConfigurationUpdatedListener((String action) -> {
label.text = Configuration.sharedConfiguration().modifications();
});
...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Appfigurate.addConfigurationUpdatedListener { action: String? ->
label.text = Configuration.sharedConfiguration().modifications()
}
...
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()}');
}
...