Skip to content

Commit 0792bb1

Browse files
Merge pull request #2378 from CatimaLoyalty/feature/android15
Target Android 15
2 parents 6e9a053 + cc75538 commit 0792bb1

16 files changed

+41
-3
lines changed

app/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ android {
2121
defaultConfig {
2222
applicationId = "me.hackerchick.catima"
2323
minSdk = 21
24-
targetSdk = 34
24+
targetSdk = 35
2525
versionCode = 146
2626
versionName = "2.34.4"
2727

app/src/main/java/protect/card_locker/BarcodeSelectorActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ protected void onCreate(Bundle savedInstanceState) {
4545
binding = BarcodeSelectorActivityBinding.inflate(getLayoutInflater());
4646
setTitle(R.string.selectBarcodeTitle);
4747
setContentView(binding.getRoot());
48+
Utils.applyWindowInsets(binding.getRoot());
4849
Toolbar toolbar = binding.toolbar;
4950
setSupportActionBar(toolbar);
5051
enableToolbarBackButton();

app/src/main/java/protect/card_locker/CardShortcutConfigure.java

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public void onCreate(Bundle bundle) {
3636
setResult(RESULT_CANCELED);
3737

3838
setContentView(binding.getRoot());
39+
Utils.applyWindowInsets(binding.getRoot());
3940
Toolbar toolbar = binding.toolbar;
4041
toolbar.setTitle(R.string.shortcutSelectCard);
4142
setSupportActionBar(toolbar);

app/src/main/java/protect/card_locker/CatimaAppCompatActivity.java

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.view.View;
88
import android.view.Window;
99

10+
import androidx.activity.EdgeToEdge;
1011
import androidx.annotation.NonNull;
1112
import androidx.annotation.Nullable;
1213
import androidx.appcompat.app.ActionBar;
@@ -24,6 +25,7 @@ protected void attachBaseContext(Context base) {
2425

2526
@Override
2627
protected void onCreate(@Nullable Bundle savedInstanceState) {
28+
EdgeToEdge.enable(this);
2729
super.onCreate(savedInstanceState);
2830
Utils.patchColors(this);
2931
}

app/src/main/java/protect/card_locker/ImportExportActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ protected void onCreate(Bundle savedInstanceState) {
6060
binding = ImportExportActivityBinding.inflate(getLayoutInflater());
6161
setTitle(R.string.importExport);
6262
setContentView(binding.getRoot());
63+
Utils.applyWindowInsets(binding.getRoot());
6364
Toolbar toolbar = binding.toolbar;
6465
setSupportActionBar(toolbar);
6566
enableToolbarBackButton();

app/src/main/java/protect/card_locker/LoyaltyCardEditActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ protected void onCreate(Bundle savedInstanceState) {
297297
super.onCreate(savedInstanceState);
298298
binding = LoyaltyCardEditActivityBinding.inflate(getLayoutInflater());
299299
setContentView(binding.getRoot());
300+
Utils.applyWindowInsets(binding.getRoot());
300301

301302
viewModel = new ViewModelProvider(this).get(LoyaltyCardEditActivityViewModel.class);
302303

app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ protected void onCreate(Bundle savedInstanceState) {
248248
super.onCreate(savedInstanceState);
249249
binding = LoyaltyCardViewLayoutBinding.inflate(getLayoutInflater());
250250
setContentView(binding.getRoot());
251+
Utils.applyWindowInsets(binding.getRoot());
251252
Toolbar toolbar = binding.toolbar;
252253
setSupportActionBar(toolbar);
253254

app/src/main/java/protect/card_locker/MainActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ protected void onCreate(Bundle inputSavedInstanceState) {
229229

230230
binding = MainActivityBinding.inflate(getLayoutInflater());
231231
setContentView(binding.getRoot());
232+
Utils.applyWindowInsets(binding.getRoot());
232233
setSupportActionBar(binding.toolbar);
233234
groupsTabLayout = binding.groups;
234235
contentMainBinding = ContentMainBinding.bind(binding.include.getRoot());

app/src/main/java/protect/card_locker/ManageGroupActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ protected void onCreate(Bundle inputSavedInstanceState) {
4848
super.onCreate(inputSavedInstanceState);
4949
binding = ActivityManageGroupBinding.inflate(getLayoutInflater());
5050
setContentView(binding.getRoot());
51+
Utils.applyWindowInsets(binding.getRoot());
5152
Toolbar toolbar = binding.toolbar;
5253
setSupportActionBar(toolbar);
5354

app/src/main/java/protect/card_locker/ManageGroupsActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ protected void onCreate(Bundle savedInstanceState) {
4242
binding = ManageGroupsActivityBinding.inflate(getLayoutInflater());
4343
setTitle(R.string.groups);
4444
setContentView(binding.getRoot());
45+
Utils.applyWindowInsets(binding.getRoot());
4546
Toolbar toolbar = binding.toolbar;
4647
setSupportActionBar(toolbar);
4748
enableToolbarBackButton();

app/src/main/java/protect/card_locker/ScanActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ protected void onCreate(Bundle savedInstanceState) {
100100
customBarcodeScannerBinding = CustomBarcodeScannerBinding.bind(binding.zxingBarcodeScanner);
101101
setTitle(R.string.scanCardBarcode);
102102
setContentView(binding.getRoot());
103+
Utils.applyWindowInsets(binding.getRoot());
103104
Toolbar toolbar = binding.toolbar;
104105
setSupportActionBar(toolbar);
105106
enableToolbarBackButton();

app/src/main/java/protect/card_locker/UCropWrapper.java

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
public class UCropWrapper extends UCropActivity {
2525
public static final String UCROP_TOOLBAR_TYPEFACE_STYLE = "ucop_toolbar_typeface_style";
2626

27+
@Override
28+
public void onCreate(Bundle savedInstanceState) {
29+
super.onCreate(savedInstanceState);
30+
31+
Utils.applyWindowInsets(findViewById(android.R.id.content));
32+
}
33+
2734
@Override
2835
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
2936
super.onPostCreate(savedInstanceState);

app/src/main/java/protect/card_locker/Utils.java

+20
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import android.util.TypedValue;
2828
import android.view.MotionEvent;
2929
import android.view.View;
30+
import android.view.ViewGroup;
3031
import android.view.Window;
3132
import android.widget.ImageView;
3233
import android.widget.TextView;
@@ -38,7 +39,10 @@
3839
import androidx.appcompat.app.AppCompatActivity;
3940
import androidx.appcompat.app.AppCompatDelegate;
4041
import androidx.core.graphics.ColorUtils;
42+
import androidx.core.graphics.Insets;
4143
import androidx.core.os.LocaleListCompat;
44+
import androidx.core.view.ViewCompat;
45+
import androidx.core.view.WindowInsetsCompat;
4246
import androidx.core.view.WindowInsetsControllerCompat;
4347
import androidx.core.widget.TextViewCompat;
4448
import androidx.exifinterface.media.ExifInterface;
@@ -1093,4 +1097,20 @@ public static boolean deviceHasCamera(Context context) {
10931097
return false;
10941098
}
10951099
}
1100+
1101+
public static void applyWindowInsets(View root) {
1102+
/* This function basically fakes the activity being edge-to-edge. Useful for those activities that are really hard to get to behave well */
1103+
ViewCompat.setOnApplyWindowInsetsListener(root, (view, windowInsets) -> {
1104+
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
1105+
1106+
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
1107+
layoutParams.leftMargin = insets.left;
1108+
layoutParams.bottomMargin = insets.bottom;
1109+
layoutParams.rightMargin = insets.right;
1110+
layoutParams.topMargin = insets.top;
1111+
view.setLayoutParams(layoutParams);
1112+
1113+
return WindowInsetsCompat.CONSUMED;
1114+
});
1115+
}
10961116
}

app/src/main/java/protect/card_locker/preferences/SettingsActivity.java

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ protected void onCreate(Bundle savedInstanceState) {
4242
binding = SettingsActivityBinding.inflate(getLayoutInflater());
4343
setTitle(R.string.settings);
4444
setContentView(binding.getRoot());
45+
Utils.applyWindowInsets(binding.getRoot());
4546
Toolbar toolbar = binding.toolbar;
4647
setSupportActionBar(toolbar);
4748
enableToolbarBackButton();

app/src/main/res/layout/group_main.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
android:layout_width="match_parent"
77
android:layout_height="match_parent"
88
app:layout_behavior="@string/appbar_scrolling_view_behavior"
9-
tools:context="protect.card_locker.MainActivity"
9+
tools:context="protect.card_locker.ManageGroupActivity"
1010
tools:showIn="@layout/main_activity">
1111

1212
<TextView

settings.gradle.kts

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencyResolutionManagement {
1515
filter {
1616
// limit jitpack repository to these groups
1717
includeGroup("com.github.yalantis")
18-
includeGroup("com.github.invissvenska")
1918
}
2019
}
2120
}

0 commit comments

Comments
 (0)