File tree Expand file tree Collapse file tree 6 files changed +67
-2
lines changed
java/it/niedermann/owncloud/notes Expand file tree Collapse file tree 6 files changed +67
-2
lines changed Original file line number Diff line number Diff line change 88
99import static it .niedermann .owncloud .notes .branding .BrandingUtil .readBrandMainColorLiveData ;
1010
11+ import android .os .Bundle ;
1112import android .util .TypedValue ;
1213import android .view .Menu ;
1314
1415import androidx .annotation .ColorInt ;
16+ import androidx .annotation .Nullable ;
1517import androidx .appcompat .app .AppCompatActivity ;
1618
1719import com .google .android .material .R ;
1820
21+ import it .niedermann .owncloud .notes .shared .util .extensions .AppCompatActivityExtensionsKt ;
22+
1923public abstract class BrandedActivity extends AppCompatActivity implements Branded {
2024
2125 @ ColorInt
2226 protected int colorAccent ;
2327
28+ @ Override
29+ protected void onCreate (@ Nullable Bundle savedInstanceState ) {
30+ AppCompatActivityExtensionsKt .adjustUIForAPILevel35 (this );
31+ super .onCreate (savedInstanceState );
32+ }
33+
2434 @ Override
2535 protected void onStart () {
2636 super .onStart ();
Original file line number Diff line number Diff line change 2323import it .niedermann .owncloud .notes .R ;
2424import it .niedermann .owncloud .notes .databinding .ActivityExceptionBinding ;
2525import it .niedermann .owncloud .notes .exception .tips .TipsAdapter ;
26+ import it .niedermann .owncloud .notes .shared .util .extensions .AppCompatActivityExtensionsKt ;
2627
2728public class ExceptionActivity extends AppCompatActivity {
2829
2930 private static final String KEY_THROWABLE = "throwable" ;
3031
3132 @ Override
3233 protected void onCreate (@ Nullable Bundle savedInstanceState ) {
34+ AppCompatActivityExtensionsKt .adjustUIForAPILevel35 (this );
3335 super .onCreate (savedInstanceState );
3436
3537 final var binding = ActivityExceptionBinding .inflate (getLayoutInflater ());
Original file line number Diff line number Diff line change 4040import it .niedermann .owncloud .notes .persistence .SyncWorker ;
4141import it .niedermann .owncloud .notes .persistence .entity .Account ;
4242import it .niedermann .owncloud .notes .shared .model .IResponseCallback ;
43+ import it .niedermann .owncloud .notes .shared .util .extensions .AppCompatActivityExtensionsKt ;
4344
4445public class ImportAccountActivity extends AppCompatActivity {
4546
@@ -53,6 +54,7 @@ public class ImportAccountActivity extends AppCompatActivity {
5354
5455 @ Override
5556 protected void onCreate (Bundle savedInstanceState ) {
57+ AppCompatActivityExtensionsKt .adjustUIForAPILevel35 (this );
5658 super .onCreate (savedInstanceState );
5759
5860 Thread .currentThread ().setUncaughtExceptionHandler (new ExceptionHandler (this ));
Original file line number Diff line number Diff line change 1+ package it.niedermann.owncloud.notes.shared.util.extensions
2+
3+ import android.graphics.Color
4+ import android.os.Build
5+ import androidx.activity.SystemBarStyle
6+ import androidx.activity.enableEdgeToEdge
7+ import androidx.appcompat.app.AppCompatActivity
8+
9+ fun AppCompatActivity.adjustUIForAPILevel35 () {
10+ val isApiLevel35OrHigher = (Build .VERSION .SDK_INT >= 35 )
11+ if (! isApiLevel35OrHigher) {
12+ return
13+ }
14+
15+ val style = SystemBarStyle .auto(Color .TRANSPARENT , Color .TRANSPARENT )
16+ enableEdgeToEdge(style, style)
17+
18+ window.addSystemBarPaddings()
19+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * Nextcloud - Android Client
3+ *
4+ * SPDX-FileCopyrightText: 2024 Alper Ozturk <[email protected] > 5+ * SPDX-License-Identifier: AGPL-3.0-or-later
6+ */
7+
8+ package it.niedermann.owncloud.notes.shared.util.extensions
9+
10+ import android.view.View
11+ import android.view.Window
12+ import androidx.core.view.ViewCompat
13+ import androidx.core.view.WindowInsetsCompat
14+ import androidx.core.view.updatePadding
15+
16+ fun Window?.addSystemBarPaddings () {
17+ if (this == null ) {
18+ return
19+ }
20+
21+ ViewCompat .setOnApplyWindowInsetsListener(decorView) { v: View , insets: WindowInsetsCompat ->
22+ val bars = insets.getInsets(WindowInsetsCompat .Type .systemBars())
23+
24+ v.updatePadding(
25+ left = bars.left,
26+ top = bars.top,
27+ right = bars.right,
28+ bottom = bars.bottom
29+ )
30+
31+ WindowInsetsCompat .CONSUMED
32+ }
33+ }
Original file line number Diff line number Diff line change 2323 android : id =" @+id/navigation_view"
2424 android : layout_width =" wrap_content"
2525 android : layout_height =" match_parent"
26- android : layout_gravity =" start"
27- android : fitsSystemWindows =" true" >
26+ android : layout_gravity =" start" >
2827
2928 <androidx .core.widget.NestedScrollView
3029 android : id =" @+id/scrollView"
You can’t perform that action at this time.
0 commit comments