Skip to content

Commit

Permalink
fix(platform): Fix edge to edge glitch in AboutActivity
Browse files Browse the repository at this point in the history
Refs: #1713

Signed-off-by: Stefan Niedermann <[email protected]>
  • Loading branch information
stefan-niedermann committed Jan 3, 2025
1 parent dd5a96c commit c866c16
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ protected void onDestroy() {
public void applyTheme(int color) {
final var utils = ThemeUtils.of(color, this);

utils.platform.themeStatusBar(this);
utils.material.themeToolbar(binding.toolbar);
utils.deck.themeStatusBar(binding.appBarLayout);
utils.material.themeTabLayoutOnSurface(binding.tabLayout);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.widget.TextViewCompat;

import com.google.android.material.bottomsheet.BottomSheetDragHandleView;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.search.SearchBar;
import com.google.android.material.search.SearchView;
import com.google.android.material.tabs.TabLayout;
Expand Down Expand Up @@ -215,22 +215,18 @@ public static void setImageColor(@NonNull Context context, @NonNull ImageView im
imageView.setImageTintList(ColorStateList.valueOf(ContextCompat.getColor(context, colorRes)));
}

/**
* @see <a href="https://github.com/nextcloud/android-common/pull/269">Upstream Pull Request</a>
*/
@Deprecated(forRemoval = true)
public void themeDragHandleView(@NonNull BottomSheetDragHandleView dragHandleView) {
withScheme(dragHandleView.getContext(), scheme -> {
dragHandleView.setImageTintList(ColorStateList.valueOf(scheme.getOnSurfaceVariant()));
return dragHandleView;
});
}

public void colorImageViewBackgroundAndIconSecondary(@NonNull ImageView imageView) {
withScheme(imageView.getContext(), scheme -> {
imageView.setImageTintList(ColorStateList.valueOf(scheme.getOnSecondaryContainer()));
imageView.setBackgroundTintList(ColorStateList.valueOf(scheme.getSecondaryContainer()));
return imageView;
});
}

public void themeStatusBar(@NonNull AppBarLayout appBarLayout) {
withScheme(appBarLayout.getContext(), scheme -> {
appBarLayout.setStatusBarForegroundColor(scheme.getSurface());
return appBarLayout;
});
}
}
24 changes: 16 additions & 8 deletions app/src/main/res/layout/activity_about.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:fitsSystemWindows="true">

<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
app:navigationIcon="@drawable/ic_arrow_back_24dp"
tools:title="@string/about" />

Expand All @@ -24,9 +26,15 @@
app:tabMode="fixed" />
</com.google.android.material.appbar.AppBarLayout>

<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">

</LinearLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>

0 comments on commit c866c16

Please sign in to comment.