UI Components
UIComponents library provides components such as ListMenuFragment, InfoDialog, InputListFragment and NumPadDialog which will be explained below.
Building The Project
In order to use UI Components, you have to migrate your Android project to AndroidX. In Android Studio, on top menu, click on Refactor and then Migrate to AndroidX, proceed to further steps.
Download the zip file below and extract it under your project folder; MyApplication\app\libs
Changelog
Added color and numpad screen for 330TR devices.
02.05.2024
Validation bug fixed when default value set on customInputFormat.
23.07.2024
Multi-conditional and multi-message added for customInputFormat.
Validate control updated fragment on first call
05.08.2024
Turkish character support added to QR.
02.09.2024
Bug fix for 1000TR menu
09.09.2024
QrScreen330 updated.
12.09.2024
Multi Currency amount support added.
28.11.2024
1000TR menu change old type.
18.12.2024
JPY Amount input upd.
15.01.2025
Info dialog button texts have been made configurable.
12.05.2025
AmountNone was added to hide the currency symbol in the amount input.
23.06.2025
Adding a menu item without a listener has been fixed.
28.07.2025
Lib Update: 28.07.2025
Place the uicomponents-release.aar library file into your project's "libs" folder and add it as dependency inside your app level build.gradle file like below and build your project in order to create build classes of library.
Minimum SDK version must be 25 or higher in your app level build.gradle file.
App Theme
For creating all the apps identical, you have to set the colors and themes. Under your application res folder, values -> colors.xml copy and paste these resources.
Under your res -> values -> themes.xml file or res -> values -> themes -> themes.xml file copy and paste the theme resources.
If your device is 330TR, you can use blue_theme in colors for update the AppTheme's color. By default, it is dark gray.
Right click to your values folder and click to new value resource file, name it as attrs.xml
res -> values -> attrs.xml file
Finally you have to change the theme name under your AndroidManifest.xml file.
After setting your theme, your activities have to look like this(empty activity);
ListMenuFragment



A fragment component which allows you to show menu items, listen menu item click events and create an automate menu tree process.
First, create your menu item class by implementing IListMenuItem interface or implement this interface from your existing data class which will be listed as menu items. Override implemented methods; getName(): Return the string that will be dislayed on menu item. getSubMenuItemList(): If a sub menu will be shown on menu item click, return list of your menu items, otherwise return null. @Nullable MenuItemClickListener getClickListener(): Each menu item's click listener seperately. @Nullable IAuthenticator getAuthenticator(): If a menu item's click event must be authorized, return an IAuthenticator object, then a pinpad screen will be shown when this menu item clicked. Authorize the password and menu item's click event will be executed. If authorization not necessary, return null for this method.
Example:
You can create a class named BaseActivity and use the addFragment, replaceFragment, removeFragment and also, you can use InfoDialog's with calling from the BaseActivity.
In your MainActivity (or another Activity class) you can list the menu items like this;
Before runing your app you have to set the activity layout file, in your activity_main.xml or another layout file which you are using.
ListMenuFragment - SubList



With help of clicking to a menu item you can update the fragment and create a sub menu with sub menu items. Under the prepareData() which we created previously, you have to add another list of sub menu items.
ConfirmationDialog



At the previous example; we created a BaseActivity and implemented it from MainActivity, you can add your Confirmation Dialog methods to there.
NOTE: Modifications to the buttonOkName and buttonCancelName apply only to X30TR and do not affect models 400 or 1000.
Confirmation Dialog can have various information types. The base code to call a Confirmation Dialog is;



For this example we have a warning info type. After the InfoType. you can add Uploading, QR, Progress, Processing, None, Info, Error, Downloading, Declined, Connecting, Confirmed. Also, you can cahnge the confirmation type.
After the InfoDialog.InfoDialogButtons. you can add Both, Confirm, Cancel for restricting the buttons.
Implementing the confirm and cancel actions.
InfoDialog
InfoDialog component to show the user information about the process.
InfoDialog's have same Dialog types Uploading, QR, Progress, Processing, None, Info, Error, Downloading, Declined, Connecting, Confirmed and has a isCancelable selection true or false.



Usage is like below(you can place the code in the BaseActivity.java):
Calling the InfoDialog;
Updating The InfoDialog; In the InfoDialog library there is an update method for changing the existing InfoDialog.
Example usage of the update dialog;
QR Code



Showing a QR Code on the InfoDialog; In the InfoDialog library there is a setQr method for showing a QR code on the existing InfoDialog.
For a QR Code payment first of all you have to use the google.zxing library. Implementation of the library;
Add the QR Payment object to the ReadCard Method, detailed explanation; Card Service
Sample QR Request Method
InputListFragment



You can create an input list by creating a CustomInputFormat list and setting it to an InputListFragment.
Create your CustomInputFormat list like below:
You can set default text to inputs by setting text to CustomInputFormat
If you want special validator for multi conditional input you can use example code block. This code block allows instant multi-conditional and message serving for the validator:
Pass your CustomInputFormat list to InputListFragment constructor method and add your fragment:
You can check if all fields are valid or not by calling isValid() method of fragment:
If any of the fields has an invalid input, isValid() method will return "false", if all field inputs are valid, it will return "true".
After validating the inputs, you can get the input list by calling getInputList() method which will return list of input strings in order:
If you activate the Input list fragment on another fragment or activity and want to return to the previous activity, you have to set the addToBackStack false;
NumPadDialog
Numeric PIN input dialog which is shown automatically if a ListMenu item has authenticator, or you can use it independently like below:


Adding Visual Details to Your App
Your app theme has a harmony but also UIComponents Library gives you permission to customize your app in a limit. You can add your logo and titles to the fragments of your app, you can use backButton's or Android navigation buttons.
Add your my_logo.png file under the res -> drawable folder and call as R.drawable.my_logo.png
Under your Activity.java file, inside the onCreate method you have to create a fragment.
Info Dialog - Dialog Types
Dialog types: Confirmed, Warning, Error, Info, Declined, Connecting, Downloading, Uploading, Processing, Progress, None


















Confirmation Dialog - Dialog Types
Dialog types: Confirmed, Warning, Error, Info, Declined, Connecting, Downloading, Uploading, Processing, Progress, None


















Last updated