Add Top App Bar to Settings, update app theme

This commit is contained in:
Patryk Michalik
2021-03-01 15:27:19 +01:00
parent b83f5d6057
commit c336c88ebf
6 changed files with 73 additions and 33 deletions
+1 -1
View File
@@ -20,7 +20,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name="ch.deletescape.lawnchair.LawnchairApp">
<activity android:name="ch.deletescape.lawnchair.settings.ui.SettingsActivity"
<activity android:name="ch.deletescape.lawnchair.settings.SettingsActivity"
android:autoRemoveFromRecents="true" android:label="@string/settings_button_text"
android:theme="@style/Theme.Lawnchair">
<intent-filter android:priority="1">
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:layout_width="match_parent"
android:layout_height="56dp"
app:title="Settings" />
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
+3 -4
View File
@@ -6,8 +6,8 @@
<style name="Base.Theme.Lawnchair" parent="Base.Theme.MaterialThemeBuilder">
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorSecondary">@color/green_200</item>
<item name="colorSecondaryVariant">@color/green_500</item>
<item name="colorSecondary">@color/purple_500</item>
<item name="colorSecondaryVariant">@color/purple_700</item>
<item name="android:colorBackground">@color/white_50</item>
<item name="colorSurface">@color/white_50</item>
@@ -23,7 +23,7 @@
<item name="shapeAppearanceMediumComponent">@style/ShapeAppearance.LawnchairTheme.MediumComponent</item>
<item name="shapeAppearanceLargeComponent">@style/ShapeAppearance.LawnchairTheme.LargeComponent</item>
<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.PrimarySurface</item>
<item name="toolbarStyle">@style/Widget.MaterialComponents.Toolbar.Surface</item>
</style>
<style name="Base.Theme.MaterialThemeBuilder" parent="Theme.MaterialComponents.DayNight.NoActionBar">
@@ -31,6 +31,5 @@
<item name="android:windowLightStatusBar" tools:ignore="NewApi">true</item>
<item name="android:navigationBarColor" tools:ignore="NewApi">?android:attr/colorBackground</item>
<item name="android:windowLightNavigationBar" tools:ignore="NewApi">true</item>
<item name="android:navigationBarDividerColor" tools:ignore="NewApi">?attr/colorControlHighlight</item>
</style>
</resources>
+9 -28
View File
@@ -1,29 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<androidx.preference.PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.android.launcher3.settings.NotificationDotsPreference
android:key="pref_icon_badging"
android:title="@string/notification_dots_title"
android:persistent="false"
app:iconSpaceReserved="false"
android:widgetLayout="@layout/notification_pref_warning" >
<intent android:action="android.settings.NOTIFICATION_SETTINGS">
<!-- This extra highlights the "Allow notification dots" field in Notification settings -->
<extra
android:name=":settings:fragment_args_key"
android:value="notification_badging" />
@@ -35,25 +20,21 @@
android:title="@string/auto_add_shortcuts_label"
android:summary="@string/auto_add_shortcuts_description"
android:defaultValue="true"
android:persistent="true" />
android:persistent="true"
app:iconSpaceReserved="false"/>
<SwitchPreference
android:key="pref_allowRotation"
android:title="@string/allow_rotation_title"
android:summary="@string/allow_rotation_desc"
android:defaultValue="@bool/allow_rotation"
android:persistent="true" />
android:persistent="true"
app:iconSpaceReserved="false"/>
<SwitchPreference
android:key="pref_grid_options"
android:title="Enable grid options"
android:defaultValue="false"
android:persistent="true" />
<androidx.preference.PreferenceScreen
android:key="pref_developer_options"
android:persistent="false"
android:title="Developer Options"
android:fragment="com.android.launcher3.settings.DeveloperOptionsFragment"/>
android:persistent="true"
app:iconSpaceReserved="false"/>
</androidx.preference.PreferenceScreen>
@@ -0,0 +1,18 @@
package ch.deletescape.lawnchair.settings
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.android.launcher3.R
class SettingsActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.settings_activity)
supportFragmentManager
.beginTransaction()
.replace(R.id.content, SettingsFragment())
.commit()
}
// TODO: Migrate missing code from ch.deletescape.settings.ui.SettingsActivity.
}
@@ -0,0 +1,13 @@
package ch.deletescape.lawnchair.settings
import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import com.android.launcher3.R
class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.lawnchair_preferences, rootKey)
}
// TODO: Migrate missing code from ch.deletescape.settings.ui.SettingsActivity.
}