Twelve: Add settings icon
Change-Id: I47195064b7876c751e7759c044e29095fd2a65ef
diff --git a/app/src/main/java/org/lineageos/twelve/fragments/MainFragment.kt b/app/src/main/java/org/lineageos/twelve/fragments/MainFragment.kt
index b32eb76..4f03f27 100644
--- a/app/src/main/java/org/lineageos/twelve/fragments/MainFragment.kt
+++ b/app/src/main/java/org/lineageos/twelve/fragments/MainFragment.kt
@@ -5,6 +5,7 @@
package org.lineageos.twelve.fragments
+import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.core.view.ViewCompat
@@ -24,6 +25,7 @@
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import org.lineageos.twelve.R
+import org.lineageos.twelve.SettingsActivity
import org.lineageos.twelve.ext.getViewProperty
import org.lineageos.twelve.ext.isLandscape
import org.lineageos.twelve.ext.updatePadding
@@ -44,6 +46,7 @@
private val navigationBarView by getViewProperty<NavigationBarView>(R.id.navigationBarView)
private val nowPlayingBar by getViewProperty<NowPlayingBar>(R.id.nowPlayingBar)
private val providerMaterialButton by getViewProperty<MaterialButton>(R.id.providerMaterialButton)
+ private val settingsMaterialButton by getViewProperty<MaterialButton>(R.id.settingsMaterialButton)
private val toolbar by getViewProperty<MaterialToolbar>(R.id.toolbar)
private val viewPager2 by getViewProperty<ViewPager2>(R.id.viewPager2)
@@ -112,6 +115,11 @@
)
}
+ settingsMaterialButton.setOnClickListener {
+ val intent = Intent(context, SettingsActivity::class.java)
+ startActivity(intent)
+ }
+
viewPager2.isUserInputEnabled = false
viewPager2.adapter = object : FragmentStateAdapter(this) {
override fun getItemCount() = fragments.size
diff --git a/app/src/main/res/drawable/ic_settings.xml b/app/src/main/res/drawable/ic_settings.xml
new file mode 100644
index 0000000..d121f1c
--- /dev/null
+++ b/app/src/main/res/drawable/ic_settings.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ SPDX-FileCopyrightText: Material Design Authors / Google LLC
+ SPDX-License-Identifier: Apache-2.0
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:tint="#000000"
+ android:viewportWidth="960"
+ android:viewportHeight="960">
+
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M370,880L354,752Q341,747 329.5,740Q318,733 307,725L188,775L78,585L181,507Q180,500 180,493.5Q180,487 180,480Q180,473 180,466.5Q180,460 181,453L78,375L188,185L307,235Q318,227 330,220Q342,213 354,208L370,80L590,80L606,208Q619,213 630.5,220Q642,227 653,235L772,185L882,375L779,453Q780,460 780,466.5Q780,473 780,480Q780,487 780,493.5Q780,500 778,507L881,585L771,775L653,725Q642,733 630,740Q618,747 606,752L590,880L370,880ZM440,800L519,800L533,694Q564,686 590.5,670.5Q617,655 639,633L738,674L777,606L691,541Q696,527 698,511.5Q700,496 700,480Q700,464 698,448.5Q696,433 691,419L777,354L738,286L639,328Q617,305 590.5,289.5Q564,274 533,266L520,160L441,160L427,266Q396,274 369.5,289.5Q343,305 321,327L222,286L183,354L269,418Q264,433 262,448Q260,463 260,480Q260,496 262,511Q264,526 269,541L183,606L222,674L321,632Q343,655 369.5,670.5Q396,686 427,694L440,800ZM482,620Q540,620 581,579Q622,538 622,480Q622,422 581,381Q540,340 482,340Q423,340 382.5,381Q342,422 342,480Q342,538 382.5,579Q423,620 482,620ZM480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480Z" />
+
+</vector>
diff --git a/app/src/main/res/layout-land/fragment_main.xml b/app/src/main/res/layout-land/fragment_main.xml
index 8df5917..cf12111 100644
--- a/app/src/main/res/layout-land/fragment_main.xml
+++ b/app/src/main/res/layout-land/fragment_main.xml
@@ -25,12 +25,21 @@
tools:title="@string/app_name">
<com.google.android.material.button.MaterialButton
+ android:id="@+id/settingsMaterialButton"
+ style="@style/Widget.Material3.Button.IconButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end"
+ android:layout_marginEnd="16dp"
+ app:icon="@drawable/ic_settings" />
+
+ <com.google.android.material.button.MaterialButton
android:id="@+id/providerMaterialButton"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
- android:layout_marginHorizontal="16dp"
+ android:layout_marginEnd="8dp"
tools:icon="@drawable/ic_shelves"
tools:text="Pixel 7 Pro" />
diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml
index f5bfa8e..aedaecd 100644
--- a/app/src/main/res/layout/fragment_main.xml
+++ b/app/src/main/res/layout/fragment_main.xml
@@ -25,12 +25,21 @@
tools:title="@string/app_name">
<com.google.android.material.button.MaterialButton
+ android:id="@+id/settingsMaterialButton"
+ style="@style/Widget.Material3.Button.IconButton"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="end"
+ android:layout_marginEnd="16dp"
+ app:icon="@drawable/ic_settings" />
+
+ <com.google.android.material.button.MaterialButton
android:id="@+id/providerMaterialButton"
style="@style/Widget.Material3.Button.TextButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
- android:layout_marginHorizontal="16dp"
+ android:layout_marginEnd="8dp"
tools:icon="@drawable/ic_shelves"
tools:text="Pixel 7 Pro" />