Skip to content

Commit 5b40d1f

Browse files
committed
Android 15 Update
1 parent de5dd2c commit 5b40d1f

File tree

133 files changed

+3002
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+3002
-250
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@ WebInterface/ssl/ssl/
4747
WebInterface/ssl/backup/
4848
icon.bmp
4949
icon.jpg
50+
XAMPP_Full_Install/xampp/
51+
deleteTooBigFiles - gitfilter.ps1
52+
deleteTooBigFilesBFG.ps1
53+
wiki/03-Installation-Guide.md

AI_MultiBarcodes_Capture/build.gradle.kts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ android {
1414
applicationId = "com.zebra.ai_multibarcodes_capture.dev"
1515
minSdk = 34
1616
targetSdk = 35
17-
versionCode = 33
18-
versionName = "1.33"
17+
versionCode = 34
18+
versionName = "1.34"
1919

2020
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
21+
22+
// Add dependency versions to BuildConfig for dynamic display in About screen
23+
buildConfigField("String", "ZEBRA_AI_VISION_SDK_VERSION", "\"${libs.versions.zebraAIVisionSdk.get()}\"")
24+
buildConfigField("String", "BARCODE_LOCALIZER_VERSION", "\"${libs.versions.barcodeLocalizer.get()}\"")
25+
buildConfigField("String", "CRITICAL_PERMISSION_HELPER_VERSION", "\"${libs.versions.criticalpermissionhelper.get()}\"")
26+
buildConfigField("String", "DATAWEDGE_INTENT_WRAPPER_VERSION", "\"${libs.versions.datawedgeintentwrapper.get()}\"")
2127
}
2228

2329
buildTypes {
@@ -29,6 +35,20 @@ android {
2935
)
3036
}
3137
}
38+
39+
// Configure APK output naming
40+
applicationVariants.all {
41+
outputs.all {
42+
val output = this as com.android.build.gradle.internal.api.BaseVariantOutputImpl
43+
val versionName = defaultConfig.versionName
44+
val versionCode = defaultConfig.versionCode
45+
val buildType = buildType.name
46+
47+
// Format: AI_Multibarcode_Capture-v1.8-release.apk or AI_Multibarcode_Capture-v1.8-debug.apk
48+
output.outputFileName = "AI_Multibarcode_Capture-v${versionName}-${buildType}.apk"
49+
}
50+
}
51+
3252
buildFeatures {
3353
viewBinding = true
3454
buildConfig = true

AI_MultiBarcodes_Capture/src/main/java/com/zebra/ai_multibarcodes_capture/AboutActivity.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,22 +173,22 @@ private void copyAssetToCache(String assetName, File outputFile) throws IOExcept
173173

174174
/**
175175
* Gets version string for a dependency from gradle version catalog.
176-
* This is a placeholder that returns the version from the libs.versions.toml
176+
* Versions are dynamically loaded from BuildConfig which reads from libs.versions.toml
177177
*
178178
* @param dependencyName Name of the dependency
179179
* @return Version string
180180
*/
181181
private String getVersionString(String dependencyName) {
182-
// Version strings from gradle/libs.versions.toml
182+
// Version strings dynamically loaded from gradle/libs.versions.toml via BuildConfig
183183
switch (dependencyName) {
184184
case "zebraAIVisionSdk":
185-
return "3.0.2";
185+
return BuildConfig.ZEBRA_AI_VISION_SDK_VERSION;
186186
case "barcodeLocalizer":
187-
return "5.0.1";
187+
return BuildConfig.BARCODE_LOCALIZER_VERSION;
188188
case "criticalpermissionhelper":
189-
return "0.8.1";
189+
return BuildConfig.CRITICAL_PERMISSION_HELPER_VERSION;
190190
case "datawedgeintentwrapper":
191-
return "14.10";
191+
return BuildConfig.DATAWEDGE_INTENT_WRAPPER_VERSION;
192192
default:
193193
return "Unknown";
194194
}

AI_MultiBarcodes_Capture/src/main/java/com/zebra/ai_multibarcodes_capture/EntryChoiceActivity.java

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@
88
import android.content.IntentFilter;
99
import android.content.SharedPreferences;
1010
import android.content.pm.PackageManager;
11+
import android.graphics.Color;
1112
import android.net.Uri;
13+
import android.os.Build;
1214
import android.os.Bundle;
1315
import android.provider.Settings;
1416
import android.util.Log;
1517
import android.view.MenuInflater;
1618
import android.view.MenuItem;
1719
import android.view.View;
20+
import android.view.ViewGroup;
21+
import android.view.Window;
22+
import android.view.WindowInsets;
23+
import android.view.WindowManager;
1824
import android.widget.PopupMenu;
1925
import android.widget.TextView;
2026
import android.widget.Toast;
@@ -28,6 +34,10 @@
2834
import androidx.appcompat.widget.Toolbar;
2935
import androidx.core.app.ActivityCompat;
3036
import androidx.core.content.ContextCompat;
37+
import androidx.core.view.ViewCompat;
38+
import androidx.core.view.WindowCompat;
39+
import androidx.core.view.WindowInsetsCompat;
40+
import androidx.core.view.WindowInsetsControllerCompat;
3141

3242
import com.zebra.ai.vision.detector.AIVisionSDK;
3343
import com.zebra.ai_multibarcodes_capture.databinding.ActivityEntryChoiceBinding;
@@ -123,9 +133,13 @@ public void run() {
123133
@Override
124134
protected void onCreate(Bundle savedInstanceState) {
125135
super.onCreate(savedInstanceState);
136+
126137
binding = ActivityEntryChoiceBinding.inflate(getLayoutInflater());
127138
setContentView(binding.getRoot());
128139

140+
// Configure system bar colors
141+
configureSystemBars();
142+
129143
// Initializing the AI Vision SDK
130144
try {
131145
boolean isInitDone = AIVisionSDK.getInstance(this.getApplicationContext()).init();
@@ -326,6 +340,86 @@ public void onClick(View view) {
326340
);
327341
}
328342

343+
344+
345+
private void configureSystemBars() {
346+
Window window = getWindow();
347+
348+
// 1. Set the Navigation Bar Background Color to Black
349+
window.setNavigationBarColor(Color.BLACK);
350+
351+
// 2. Control the Navigation Bar Icon Color (Light/White)
352+
// Ensure the system bars are drawn over the app's content
353+
WindowCompat.setDecorFitsSystemWindows(window, false);
354+
355+
// Use the compatibility controller for managing bar appearance
356+
WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, window.getDecorView());
357+
358+
// Request light navigation bar icons (white)
359+
// Setting this to 'false' tells the system to use light icons on a dark background.
360+
controller.setAppearanceLightNavigationBars(false);
361+
362+
// Force status bar color
363+
View rootLayout = findViewById(R.id.cl_entry_choice_activity);
364+
365+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { // Android 15+
366+
367+
// 1. Set Navigation Bar background color using the WindowInsetsListener on decorView
368+
window.getDecorView().setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
369+
@Override
370+
public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
371+
// Set the background color to the view (decorView) - BLACK for navigation bar
372+
view.setBackgroundColor(Color.BLACK);
373+
return insets;
374+
}
375+
});
376+
377+
// 2. Handle Status Bar color and Root Layout padding using ViewCompat
378+
ViewCompat.setOnApplyWindowInsetsListener(rootLayout, (v, windowInsets) -> {
379+
// Get the system bar insets (status bar and navigation bar area)
380+
// Use getInsets(WindowInsetsCompat.Type.systemBars())
381+
// equivalent to the Kotlin line
382+
androidx.core.graphics.Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
383+
int statusBarHeight = insets.top;
384+
385+
// Below code is for adding padding top and bottom (setting margins on the rootLayout)
386+
ViewGroup.LayoutParams lp = v.getLayoutParams();
387+
if (lp instanceof ViewGroup.MarginLayoutParams) {
388+
ViewGroup.MarginLayoutParams marginLp = (ViewGroup.MarginLayoutParams) lp;
389+
390+
// The Kotlin updateLayoutParams<MarginLayoutParams> block is equivalent to this:
391+
marginLp.topMargin = insets.top;
392+
marginLp.bottomMargin = insets.bottom;
393+
v.setLayoutParams(marginLp); // Apply the updated layout params
394+
}
395+
396+
397+
// 3. Create and add a separate Status Bar View
398+
View statusBarView = new View(getApplicationContext());
399+
400+
// Below code is for setting color and height to notification bar
401+
// Height is the status bar height
402+
statusBarView.setLayoutParams(new ViewGroup.LayoutParams(
403+
ViewGroup.LayoutParams.MATCH_PARENT,
404+
statusBarHeight
405+
));
406+
407+
// Set the status bar color using ContextCompat
408+
statusBarView.setBackgroundColor(getColor(R.color.zebra));
409+
410+
// Add the view to the activity's content view group
411+
addContentView(statusBarView, statusBarView.getLayoutParams());
412+
413+
// Consume the insets so they aren't passed down further
414+
return WindowInsetsCompat.CONSUMED;
415+
});
416+
417+
} else {
418+
// For Android 14 and below
419+
window.setStatusBarColor(getColor(R.color.zebra));
420+
}
421+
}
422+
329423
private void updateCards()
330424
{
331425
if (eProcessingMode == EProcessingMode.FILE) {
@@ -376,6 +470,9 @@ private void updateCards()
376470
protected void onResume() {
377471
super.onResume();
378472

473+
// Re-apply system bar appearance to ensure it persists
474+
configureSystemBars();
475+
379476
checkCameraPermission();
380477

381478
// Initializing the AI Vision SDK

AI_MultiBarcodes_Capture/src/main/java/com/zebra/ai_multibarcodes_capture/java/CapturedBarcodesActivity.java

Lines changed: 85 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.os.Build;
88
import android.os.Bundle;
99
import android.view.Window;
10+
import android.view.WindowInsets;
1011
import android.view.WindowManager;
1112
import android.view.GestureDetector;
1213
import android.view.LayoutInflater;
@@ -30,7 +31,9 @@
3031
import androidx.core.content.ContextCompat;
3132
import androidx.core.graphics.Insets;
3233
import androidx.core.view.ViewCompat;
34+
import androidx.core.view.WindowCompat;
3335
import androidx.core.view.WindowInsetsCompat;
36+
import androidx.core.view.WindowInsetsControllerCompat;
3437

3538
import com.zebra.ai_multibarcodes_capture.R;
3639
import com.zebra.ai_multibarcodes_capture.dataeditor.BarcodeDataEditorActivity;
@@ -138,7 +141,7 @@ protected void onCreate(Bundle savedInstanceState) {
138141

139142
// Configure system bars
140143
configureSystemBars();
141-
144+
142145
// Setup toolbar
143146
Toolbar toolbar = findViewById(R.id.toolbar);
144147
setSupportActionBar(toolbar);
@@ -337,6 +340,14 @@ public void onClick(View view) {
337340
});
338341
}
339342

343+
@Override
344+
protected void onResume() {
345+
super.onResume();
346+
// Configure system bars
347+
configureSystemBars();
348+
349+
}
350+
340351
public static Integer getKeyFromValue(HashMap<Integer, String> map, String value) {
341352
for (Map.Entry<Integer, String> entry : map.entrySet()) {
342353
if (entry.getValue().equals(value)) {
@@ -978,28 +989,79 @@ private void resetAllSwipeStates() {
978989

979990
private void configureSystemBars() {
980991
Window window = getWindow();
981-
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
982-
983-
// Set status bar color to zebra blue
984-
window.setStatusBarColor(ContextCompat.getColor(this, R.color.zebra));
985-
986-
// Set navigation bar color to black for consistent theming
987-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
988-
window.setNavigationBarColor(ContextCompat.getColor(this, android.R.color.black));
989-
}
990-
991-
// Set status bar text to light (white) to contrast with blue background
992-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
993-
View decorView = window.getDecorView();
994-
// Remove SYSTEM_UI_FLAG_LIGHT_STATUS_BAR to use light (white) text
995-
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
996-
}
997-
998-
// Set navigation bar text to light (white)
999-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
1000-
View decorView = window.getDecorView();
1001-
// Remove SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR to use light (white) icons
1002-
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
992+
993+
// 1. Set the Navigation Bar Background Color to Black
994+
window.setNavigationBarColor(Color.BLACK);
995+
996+
// 2. Control the Navigation Bar Icon Color (Light/White)
997+
// Ensure the system bars are drawn over the app's content
998+
WindowCompat.setDecorFitsSystemWindows(window, false);
999+
1000+
// Use the compatibility controller for managing bar appearance
1001+
WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, window.getDecorView());
1002+
1003+
// Request light navigation bar icons (white)
1004+
// Setting this to 'false' tells the system to use light icons on a dark background.
1005+
controller.setAppearanceLightNavigationBars(false);
1006+
1007+
// Setup status bar color
1008+
View rootLayout = findViewById(R.id.cl_captured_barcodes_activity);
1009+
1010+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) { // Android 15+
1011+
1012+
// 1. Set Navigation Bar background color using the WindowInsetsListener on decorView
1013+
window.getDecorView().setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
1014+
@Override
1015+
public WindowInsets onApplyWindowInsets(View view, WindowInsets insets) {
1016+
// Set the background color to the view (decorView) - BLACK for navigation bar
1017+
view.setBackgroundColor(Color.BLACK);
1018+
return insets;
1019+
}
1020+
});
1021+
1022+
// 2. Handle Status Bar color and Root Layout padding using ViewCompat
1023+
ViewCompat.setOnApplyWindowInsetsListener(rootLayout, (v, windowInsets) -> {
1024+
// Get the system bar insets (status bar and navigation bar area)
1025+
// Use getInsets(WindowInsetsCompat.Type.systemBars())
1026+
// equivalent to the Kotlin line
1027+
androidx.core.graphics.Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
1028+
int statusBarHeight = insets.top;
1029+
1030+
// Below code is for adding padding top and bottom (setting margins on the rootLayout)
1031+
ViewGroup.LayoutParams lp = v.getLayoutParams();
1032+
if (lp instanceof ViewGroup.MarginLayoutParams) {
1033+
ViewGroup.MarginLayoutParams marginLp = (ViewGroup.MarginLayoutParams) lp;
1034+
1035+
// The Kotlin updateLayoutParams<MarginLayoutParams> block is equivalent to this:
1036+
marginLp.topMargin = insets.top;
1037+
marginLp.bottomMargin = insets.bottom;
1038+
v.setLayoutParams(marginLp); // Apply the updated layout params
1039+
}
1040+
1041+
1042+
// 3. Create and add a separate Status Bar View
1043+
View statusBarView = new View(getApplicationContext());
1044+
1045+
// Below code is for setting color and height to notification bar
1046+
// Height is the status bar height
1047+
statusBarView.setLayoutParams(new ViewGroup.LayoutParams(
1048+
ViewGroup.LayoutParams.MATCH_PARENT,
1049+
statusBarHeight
1050+
));
1051+
1052+
// Set the status bar color using ContextCompat
1053+
statusBarView.setBackgroundColor(getColor(R.color.zebra));
1054+
1055+
// Add the view to the activity's content view group
1056+
addContentView(statusBarView, statusBarView.getLayoutParams());
1057+
1058+
// Consume the insets so they aren't passed down further
1059+
return WindowInsetsCompat.CONSUMED;
1060+
});
1061+
1062+
} else {
1063+
// For Android 14 and below
1064+
window.setStatusBarColor(getColor(R.color.zebra));
10031065
}
10041066
}
10051067

0 commit comments

Comments
 (0)