summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAmit Kumar <amitkma@e.email>2021-05-15 01:18:21 +0530
committerAmit Kumar <amitkma@e.email>2021-05-15 01:18:21 +0530
commit47194484d7c2ca6ce8103312b9dbfb1244e8c4e6 (patch)
tree643171c9af65cd56ffe1fe854ae52f535f5c077a /app
parentda842396556248654acacfdebbc01f5e20132eb6 (diff)
Use MaterialToolbar from MDC instead of android Toolbar
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt4
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt5
-rw-r--r--app/src/main/res/layout/fragment_dashboard.xml8
-rw-r--r--app/src/main/res/layout/fragment_fake_location.xml10
-rw-r--r--app/src/main/res/layout/fragment_internet_activity_policy.xml8
-rw-r--r--app/src/main/res/layout/fragment_permission_apps.xml7
-rw-r--r--app/src/main/res/layout/fragment_permissions.xml7
-rw-r--r--app/src/main/res/layout/fragment_quick_protection.xml7
-rw-r--r--app/src/main/res/layout/topbar.xml (renamed from app/src/main/res/layout/toolbar.xml)23
9 files changed, 43 insertions, 36 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt
index 0a9d102..52197cd 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/common/NavToolbarFragment.kt
@@ -17,12 +17,12 @@
package foundation.e.privacycentralapp.common
-import android.widget.Toolbar
import androidx.annotation.LayoutRes
+import com.google.android.material.appbar.MaterialToolbar
abstract class NavToolbarFragment(@LayoutRes contentLayoutId: Int) : ToolbarFragment(contentLayoutId) {
- override fun setupToolbar(toolbar: Toolbar) {
+ override fun setupToolbar(toolbar: MaterialToolbar) {
super.setupToolbar(toolbar)
toolbar.apply {
setNavigationIcon(lineageos.platform.R.drawable.ic_back)
diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt
index c316340..f156e09 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/common/ToolbarFragment.kt
@@ -19,9 +19,9 @@ package foundation.e.privacycentralapp.common
import android.os.Bundle
import android.view.View
-import android.widget.Toolbar
import androidx.annotation.LayoutRes
import androidx.fragment.app.Fragment
+import com.google.android.material.appbar.MaterialToolbar
import foundation.e.privacycentralapp.R
abstract class ToolbarFragment(@LayoutRes contentLayoutId: Int) : Fragment(contentLayoutId) {
@@ -33,10 +33,11 @@ abstract class ToolbarFragment(@LayoutRes contentLayoutId: Int) : Fragment(conte
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
+
setupToolbar(view.findViewById(R.id.toolbar))
}
- open fun setupToolbar(toolbar: Toolbar) {
+ open fun setupToolbar(toolbar: MaterialToolbar) {
toolbar.title = getTitle()
}
}
diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml
index 027945d..dc79878 100644
--- a/app/src/main/res/layout/fragment_dashboard.xml
+++ b/app/src/main/res/layout/fragment_dashboard.xml
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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"
>
- <include layout="@layout/toolbar"/>
+ <include layout="@layout/topbar"/>
<ProgressBar
android:id="@+id/loadingSpinner"
@@ -20,8 +20,8 @@
android:id="@+id/scrollContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="?android:attr/actionBarSize"
android:visibility="gone"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
@@ -340,4 +340,4 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_fake_location.xml b/app/src/main/res/layout/fragment_fake_location.xml
index de62537..40324a1 100644
--- a/app/src/main/res/layout/fragment_fake_location.xml
+++ b/app/src/main/res/layout/fragment_fake_location.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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:mapbox="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
@@ -8,19 +8,19 @@
android:layout_width="match_parent"
>
- <include layout="@layout/toolbar"/>
+ <include layout="@layout/topbar"/>
<androidx.core.widget.NestedScrollView
android:layout_height="match_parent"
- android:layout_marginBottom="32dp"
- android:layout_marginTop="?android:attr/actionBarSize"
android:layout_width="match_parent"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
+ android:layout_marginBottom="32dp"
tools:context=".main.MainActivity"
>
@@ -131,4 +131,4 @@
</LinearLayout>
</androidx.core.widget.NestedScrollView>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_internet_activity_policy.xml b/app/src/main/res/layout/fragment_internet_activity_policy.xml
index 66ff2b4..7a5d8b5 100644
--- a/app/src/main/res/layout/fragment_internet_activity_policy.xml
+++ b/app/src/main/res/layout/fragment_internet_activity_policy.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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"
@@ -7,13 +7,13 @@
android:background="@color/white"
>
- <include layout="@layout/toolbar"/>
+ <include layout="@layout/topbar"/>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginTop="?android:attr/actionBarSize"
android:layout_marginBottom="32dp"
+ app:layout_behavior="@string/appbar_scrolling_view_behavior"
>
<LinearLayout
@@ -95,4 +95,4 @@
</RadioGroup>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_permission_apps.xml b/app/src/main/res/layout/fragment_permission_apps.xml
index 605b6ff..65f4169 100644
--- a/app/src/main/res/layout/fragment_permission_apps.xml
+++ b/app/src/main/res/layout/fragment_permission_apps.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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"
@@ -7,13 +7,12 @@
android:background="@color/white"
>
- <include layout="@layout/toolbar"/>
+ <include layout="@layout/topbar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:layout_marginTop="?android:attr/actionBarSize"
tools:context=".main.MainActivity"
>
@@ -36,4 +35,4 @@
tools:listitem="@layout/item_permission_apps"
android:id="@+id/recylcer_view_permission_apps"/>
</LinearLayout>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_permissions.xml b/app/src/main/res/layout/fragment_permissions.xml
index 72748b4..a452570 100644
--- a/app/src/main/res/layout/fragment_permissions.xml
+++ b/app/src/main/res/layout/fragment_permissions.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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"
@@ -7,7 +7,7 @@
android:background="@color/white"
>
- <include layout="@layout/toolbar"/>
+ <include layout="@layout/topbar"/>
<LinearLayout
android:layout_width="match_parent"
@@ -15,7 +15,6 @@
android:orientation="vertical"
android:paddingLeft="32dp"
android:paddingRight="32dp"
- android:layout_marginTop="?android:attr/actionBarSize"
tools:context=".main.MainActivity"
>
@@ -47,4 +46,4 @@
tools:listitem="@layout/item_permission"
android:id="@+id/recylcer_view_permissions"/>
</LinearLayout>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_quick_protection.xml b/app/src/main/res/layout/fragment_quick_protection.xml
index 55d6f71..d57a101 100644
--- a/app/src/main/res/layout/fragment_quick_protection.xml
+++ b/app/src/main/res/layout/fragment_quick_protection.xml
@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
>
- <include layout="@layout/toolbar"/>
+ <include layout="@layout/topbar"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
- android:layout_marginTop="?android:attr/actionBarSize"
android:layout_marginBottom="56dp"
tools:context=".main.MainActivity"
>
@@ -57,4 +56,4 @@
android:textSize="14sp"
android:fontFamily="sans-serif-medium"
android:layout_gravity="bottom|right"/>
-</FrameLayout> \ No newline at end of file
+</androidx.coordinatorlayout.widget.CoordinatorLayout> \ No newline at end of file
diff --git a/app/src/main/res/layout/toolbar.xml b/app/src/main/res/layout/topbar.xml
index 29c1fa1..9142d79 100644
--- a/app/src/main/res/layout/toolbar.xml
+++ b/app/src/main/res/layout/topbar.xml
@@ -17,12 +17,21 @@
~ along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
-<Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
+<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
- android:background="@color/white"
- android:id="@+id/toolbar"
- android:layout_gravity="top|center"
- android:layout_height="?android:attr/actionBarSize"
+ android:layout_height="wrap_content"
android:layout_width="match_parent"
- tools:layout_height="56dp"
- /> \ No newline at end of file
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ app:elevation="0dp"
+ >
+
+ <com.google.android.material.appbar.MaterialToolbar
+ android:background="@color/white"
+ android:id="@+id/toolbar"
+ app:titleCentered="true"
+ android:elevation="0dp"
+ android:layout_height="?android:attr/actionBarSize"
+ android:layout_width="match_parent"
+ tools:layout_height="56dp"
+ />
+</com.google.android.material.appbar.AppBarLayout>