Skip to content

Commit

Permalink
md3 lift on scroll + fixed appbar
Browse files Browse the repository at this point in the history
  • Loading branch information
jamie-mh committed Sep 11, 2023
1 parent 61909d4 commit d2dcfa4
Show file tree
Hide file tree
Showing 27 changed files with 451 additions and 423 deletions.
2 changes: 0 additions & 2 deletions AuthenticatorPro.Core/src/Util/StringUtil.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (C) 2022 jmh
// SPDX-License-Identifier: GPL-3.0-only

using System;

namespace AuthenticatorPro.Core.Util
{
public static class StringUtil
Expand Down
25 changes: 16 additions & 9 deletions AuthenticatorPro.Droid/Resources/layout/activityAbout.axml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
layout="@layout/includeAppBar"/>

<android.webkit.WebView
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"
android:id="@+id/webView"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior">

</RelativeLayout>
<android.webkit.WebView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/webView"/>

</androidx.core.widget.NestedScrollView>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
14 changes: 3 additions & 11 deletions AuthenticatorPro.Droid/Resources/layout/activityCategories.axml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.AppBarLayout
app:elevation="0dp"
<include
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/toolbar"/>
</com.google.android.material.appbar.AppBarLayout>
android:layout_height="wrap_content"
layout="@layout/includeAppBar"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
Expand Down
22 changes: 11 additions & 11 deletions AuthenticatorPro.Droid/Resources/layout/activityError.axml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
layout="@layout/includeAppBar"/>

<ScrollView
android:fillViewport="true"
<androidx.core.widget.NestedScrollView
android:id="@+id/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
android:orientation="vertical"
Expand Down Expand Up @@ -47,6 +47,6 @@
android:id="@+id/errorText"/>
</LinearLayout>

</ScrollView>
</androidx.core.widget.NestedScrollView>

</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
22 changes: 12 additions & 10 deletions AuthenticatorPro.Droid/Resources/layout/activityGuide.axml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
layout="@layout/includeAppBar"/>

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

<LinearLayout
android:orientation="vertical"
Expand Down Expand Up @@ -231,5 +233,5 @@

</com.google.android.material.card.MaterialCardView>
</LinearLayout>
</ScrollView>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
30 changes: 3 additions & 27 deletions AuthenticatorPro.Droid/Resources/layout/activityIconPacks.axml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.AppBarLayout
app:elevation="0dp"
<include
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/toolbar"/>

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/progressIndicator"
android:indeterminate="true"
android:visibility="invisible"
app:trackThickness="2dp"
app:trackColor="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>

</com.google.android.material.appbar.AppBarLayout>
android:layout_height="wrap_content"
layout="@layout/includeAppBar"/>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
Expand Down
6 changes: 3 additions & 3 deletions AuthenticatorPro.Droid/Resources/layout/activityIntro.axml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">

Expand All @@ -16,7 +17,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:labelVisibilityMode="unlabeled"
app:elevation="30dp"
app:menu="@menu/intro"/>

</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
38 changes: 6 additions & 32 deletions AuthenticatorPro.Droid/Resources/layout/activityMain.axml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,10 @@
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinatorLayout"
android:id="@+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
app:elevation="0dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:id="@+id/toolbarWrapLayout"
app:layout_scrollFlags="scroll"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/toolbar"/>

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/appBarProgressIndicator"
android:indeterminate="true"
app:trackThickness="2dp"
app:trackColor="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>

</com.google.android.material.appbar.AppBarLayout>

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/list"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
Expand All @@ -46,6 +15,11 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"/>

<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/includeAppBar"/>

<LinearLayout
android:id="@+id/layoutEmptyState"
android:orientation="vertical"
Expand Down
13 changes: 8 additions & 5 deletions AuthenticatorPro.Droid/Resources/layout/activityScan.axml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">

<androidx.camera.view.PreviewView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/previewView"/>

<LinearLayout
android:id="@+id/topLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down Expand Up @@ -45,6 +47,7 @@
android:layout_weight="0.8"/>

<LinearLayout
android:id="@+id/bottomLayout"
android:orientation="vertical"
android:background="#80000000"
android:layout_width="match_parent"
Expand Down Expand Up @@ -76,4 +79,4 @@

</LinearLayout>
</LinearLayout>
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
14 changes: 7 additions & 7 deletions AuthenticatorPro.Droid/Resources/layout/activitySettings.axml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/layoutRoot"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
<include
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar"/>
layout="@layout/includeAppBar"/>

<FrameLayout
android:id="@+id/layoutFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>

</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
33 changes: 33 additions & 0 deletions AuthenticatorPro.Droid/Resources/layout/includeAppBar.axml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.AppBarLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?attr/appBarLayoutStyle">

<LinearLayout
android:id="@+id/toolbarWrapLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">

<com.google.android.material.appbar.MaterialToolbar
style="Widget.Material3.Toolbar"
android:minHeight="?android:attr/actionBarSize"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/toolbar"/>

<com.google.android.material.progressindicator.LinearProgressIndicator
android:id="@+id/appBarProgressIndicator"
android:indeterminate="true"
android:visibility="invisible"
app:trackThickness="2dp"
app:trackColor="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>

</com.google.android.material.appbar.AppBarLayout>
5 changes: 5 additions & 0 deletions AuthenticatorPro.Droid/Resources/values-night/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@
<item name="colorSurface">@android:color/black</item>
<item name="colorSurfaceVariant">@android:color/black</item>
<item name="cardStyle">@style/CardStyle.Black</item>
<item name="appBarLayoutStyle">@style/AppBarLayoutStyle.Black</item>
<item name="bottomAppBarStyle">@style/BottomAppBarStyle.Black</item>
<item name="bottomSheetDialogTheme">@style/ModalBottomSheetDialog.Black</item>
<item name="progressIndicatorStyle">@style/ProgressIndicatorStyle.Black</item>
</style>

<style name="CardStyle.Black" parent="Widget.Material3.CardView.Outlined"/>

<style name="AppBarLayoutStyle.Black" parent="Widget.Material3.AppBarLayout">
<item name="liftOnScrollColor">@android:color/black</item>
</style>

<style name="BottomAppBarStyle.Black" parent="Widget.Material3.BottomAppBar">
<item name="elevation">0dp</item>
</style>
Expand Down
2 changes: 2 additions & 0 deletions AuthenticatorPro.Droid/Resources/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
<attr name="colorPrimaryDark" format="color"/>

<attr name="cardStyle" format="reference"/>
<attr name="appBarLayoutStyle" format="reference"/>
<attr name="bottomAppBarStyle" format="reference"/>
<attr name="progressIndicatorStyle" format="reference"/>
</declare-styleable>

<declare-styleable name="CardStyle"/>
<declare-styleable name="AppBarLayoutStyle"/>
<declare-styleable name="BottomAppBarStyle"/>
<declare-styleable name="ProgressIndicatorStyle"/>
</resources>
Loading

0 comments on commit d2dcfa4

Please sign in to comment.