-
-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Move `Schemas`, `Appearance`(`Themes` and `Colors`) to top tree - Refactor some preference items' titles - Hide the options menu in sub settings page
- Loading branch information
1 parent
aeaea94
commit eec38f7
Showing
12 changed files
with
109 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/java/com/osfans/trime/settings/fragments/AppearanceFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.osfans.trime.settings.fragments | ||
|
||
import android.os.Bundle | ||
import android.view.Menu | ||
import androidx.core.view.forEach | ||
import androidx.core.view.forEachIndexed | ||
import androidx.preference.Preference | ||
import androidx.preference.PreferenceFragmentCompat | ||
import com.osfans.trime.R | ||
import com.osfans.trime.settings.components.ColorPickerDialog | ||
import com.osfans.trime.settings.components.ThemePickerDialog | ||
|
||
class AppearanceFragment: PreferenceFragmentCompat() { | ||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) { | ||
addPreferencesFromResource(R.xml.appearance_preference) | ||
|
||
setHasOptionsMenu(true) | ||
} | ||
|
||
override fun onPrepareOptionsMenu(menu: Menu) { | ||
menu.forEach { item -> item.isVisible = false} | ||
super.onPrepareOptionsMenu(menu) | ||
} | ||
|
||
override fun onPreferenceTreeClick(preference: Preference?): Boolean { | ||
return when (preference?.key) { | ||
"pref_themes" -> { | ||
ThemePickerDialog(requireContext()).show() | ||
true | ||
} | ||
"pref_colors" -> { | ||
ColorPickerDialog(requireContext()).show() | ||
true | ||
} | ||
else -> super.onPreferenceTreeClick(preference) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
<Preference android:key="pref_themes" | ||
app:iconSpaceReserved="false" | ||
android:title="@string/pref_themes" | ||
android:summary="@string/pref_themes_summary" /> | ||
<Preference android:key="pref_colors" | ||
app:iconSpaceReserved="false" | ||
android:title="@string/pref_colors" | ||
android:summary="@string/pref_colors_summary" /> | ||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters