mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Added an action bar to launcher settings
This commit is contained in:
parent
e845ce7983
commit
05e29c5140
14 changed files with 83 additions and 78 deletions
|
|
@ -12,7 +12,7 @@ import androidx.fragment.app.Fragment
|
||||||
import eu.ottop.yamlauncher.R
|
import eu.ottop.yamlauncher.R
|
||||||
import eu.ottop.yamlauncher.utils.StringUtils
|
import eu.ottop.yamlauncher.utils.StringUtils
|
||||||
|
|
||||||
class AboutFragment : Fragment() {
|
class AboutFragment : Fragment(), TitleProvider {
|
||||||
|
|
||||||
private val stringUtils = StringUtils()
|
private val stringUtils = StringUtils()
|
||||||
|
|
||||||
|
|
@ -41,4 +41,8 @@ class AboutFragment : Fragment() {
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "About YAM Launcher"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4,9 +4,13 @@ import android.os.Bundle
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import eu.ottop.yamlauncher.R
|
import eu.ottop.yamlauncher.R
|
||||||
|
|
||||||
class AppMenuSettingsFragment : PreferenceFragmentCompat() {
|
class AppMenuSettingsFragment : PreferenceFragmentCompat(), TitleProvider {
|
||||||
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
setPreferencesFromResource(R.xml.app_menu_preferences, rootKey)
|
setPreferencesFromResource(R.xml.app_menu_preferences, rootKey)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "App Menu Settings"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +23,7 @@ import eu.ottop.yamlauncher.utils.UIUtils
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class GestureAppsFragment(private val direction: String) : Fragment(),
|
class GestureAppsFragment(private val direction: String) : Fragment(),
|
||||||
GestureAppsAdapter.OnItemClickListener {
|
GestureAppsAdapter.OnItemClickListener, TitleProvider {
|
||||||
|
|
||||||
private var adapter: GestureAppsAdapter? = null
|
private var adapter: GestureAppsAdapter? = null
|
||||||
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
||||||
|
|
@ -64,7 +64,6 @@ class GestureAppsFragment(private val direction: String) : Fragment(),
|
||||||
|
|
||||||
val searchView = view.findViewById<TextInputEditText>(R.id.gestureAppSearch)
|
val searchView = view.findViewById<TextInputEditText>(R.id.gestureAppSearch)
|
||||||
|
|
||||||
uiUtils.setMenuTitleAlignment(view.findViewById(R.id.gestureMenuTitle))
|
|
||||||
uiUtils.setSearchAlignment(searchView)
|
uiUtils.setSearchAlignment(searchView)
|
||||||
uiUtils.setSearchSize(searchView)
|
uiUtils.setSearchSize(searchView)
|
||||||
|
|
||||||
|
|
@ -165,5 +164,8 @@ class GestureAppsFragment(private val direction: String) : Fragment(),
|
||||||
).toString(), profile)
|
).toString(), profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "Select an App"
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -23,7 +23,7 @@ import eu.ottop.yamlauncher.utils.StringUtils
|
||||||
import eu.ottop.yamlauncher.utils.UIUtils
|
import eu.ottop.yamlauncher.utils.UIUtils
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener, TitleProvider {
|
||||||
|
|
||||||
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
||||||
private var adapter: HiddenAppsAdapter? = null
|
private var adapter: HiddenAppsAdapter? = null
|
||||||
|
|
@ -62,7 +62,6 @@ class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
|
|
||||||
val searchView = view.findViewById<TextInputEditText>(R.id.hiddenAppSearch)
|
val searchView = view.findViewById<TextInputEditText>(R.id.hiddenAppSearch)
|
||||||
|
|
||||||
uiUtils.setMenuTitleAlignment(view.findViewById(R.id.hiddenMenuTitle))
|
|
||||||
uiUtils.setSearchAlignment(searchView)
|
uiUtils.setSearchAlignment(searchView)
|
||||||
uiUtils.setSearchSize(searchView)
|
uiUtils.setSearchSize(searchView)
|
||||||
|
|
||||||
|
|
@ -162,4 +161,8 @@ class HiddenAppsFragment : Fragment(), HiddenAppsAdapter.OnItemClickListener {
|
||||||
).toString(), profile)
|
).toString(), profile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "Hidden Apps"
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ import androidx.preference.PreferenceFragmentCompat
|
||||||
import androidx.preference.SwitchPreference
|
import androidx.preference.SwitchPreference
|
||||||
import eu.ottop.yamlauncher.R
|
import eu.ottop.yamlauncher.R
|
||||||
|
|
||||||
class HomeSettingsFragment : PreferenceFragmentCompat() {
|
class HomeSettingsFragment : PreferenceFragmentCompat(), TitleProvider {
|
||||||
|
|
||||||
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
||||||
|
|
||||||
|
|
@ -73,4 +73,8 @@ class HomeSettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
rightSwipePref?.summary = sharedPreferenceManager.getGestureName("right")
|
rightSwipePref?.summary = sharedPreferenceManager.getGestureName("right")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "Home Screen Settings"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -22,7 +22,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
||||||
class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener, TitleProvider {
|
||||||
|
|
||||||
private var adapter: LocationListAdapter? = null
|
private var adapter: LocationListAdapter? = null
|
||||||
private lateinit var weatherSystem: WeatherSystem
|
private lateinit var weatherSystem: WeatherSystem
|
||||||
|
|
@ -58,7 +58,6 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
||||||
adapter = LocationListAdapter(requireContext(), locationList, this)
|
adapter = LocationListAdapter(requireContext(), locationList, this)
|
||||||
val recyclerView = view.findViewById<RecyclerView>(R.id.locationRecycler)
|
val recyclerView = view.findViewById<RecyclerView>(R.id.locationRecycler)
|
||||||
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
val appMenuEdgeFactory = AppMenuEdgeFactory(requireActivity())
|
||||||
uiUtils.setMenuTitleAlignment(view.findViewById(R.id.locationMenuTitle))
|
|
||||||
uiUtils.setSearchAlignment(searchView)
|
uiUtils.setSearchAlignment(searchView)
|
||||||
uiUtils.setSearchSize(searchView)
|
uiUtils.setSearchSize(searchView)
|
||||||
|
|
||||||
|
|
@ -130,6 +129,8 @@ class LocationFragment : Fragment(), LocationListAdapter.OnItemClickListener {
|
||||||
showConfirmationDialog(name, latitude, longitude)
|
showConfirmationDialog(name, latitude, longitude)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "Search for Your City"
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -13,10 +13,37 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivitySettingsBinding.inflate(layoutInflater)
|
binding = ActivitySettingsBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
|
supportActionBar?.title = "Launcher Settings"
|
||||||
|
supportActionBar?.setDisplayShowTitleEnabled(true)
|
||||||
|
|
||||||
supportFragmentManager
|
supportFragmentManager
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.settingsLayout, SettingsFragment())
|
.replace(R.id.settingsLayout, SettingsFragment())
|
||||||
.commit()
|
.commit()
|
||||||
|
|
||||||
|
supportFragmentManager.addOnBackStackChangedListener {
|
||||||
|
updateActionBarTitle()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onSupportNavigateUp(): Boolean {
|
||||||
|
// Handle the back arrow button in the ActionBar
|
||||||
|
if (supportFragmentManager.backStackEntryCount > 0) {
|
||||||
|
supportFragmentManager.popBackStack()
|
||||||
|
} else {
|
||||||
|
onBackPressedDispatcher.onBackPressed()
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateActionBarTitle() {
|
||||||
|
val fragment = supportFragmentManager.findFragmentById(R.id.settingsLayout)
|
||||||
|
if (fragment is TitleProvider) {
|
||||||
|
supportActionBar?.title = fragment.getTitle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -8,7 +8,7 @@ import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import eu.ottop.yamlauncher.R
|
import eu.ottop.yamlauncher.R
|
||||||
|
|
||||||
class SettingsFragment : PreferenceFragmentCompat() {
|
class SettingsFragment : PreferenceFragmentCompat(), TitleProvider {
|
||||||
|
|
||||||
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
private lateinit var sharedPreferenceManager: SharedPreferenceManager
|
||||||
|
|
||||||
|
|
@ -73,4 +73,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getTitle(): String {
|
||||||
|
return "Launcher Settings"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package eu.ottop.yamlauncher.settings
|
||||||
|
|
||||||
|
interface TitleProvider {
|
||||||
|
fun getTitle(): String
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
android:id="@+id/settingsLayout"
|
android:id="@+id/settingsLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:paddingTop="40dp">
|
android:paddingTop="5dp">
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,24 +8,6 @@
|
||||||
android:gravity="bottom"
|
android:gravity="bottom"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="60dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/gestureMenuTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clickable="false"
|
|
||||||
android:gravity="start"
|
|
||||||
android:paddingLeft="40dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:paddingRight="40dp"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:text="@string/select_an_app"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
|
||||||
android:textColor="#C1F3F3F3"
|
|
||||||
android:textSize="36sp" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/gestureAppRecycler"
|
android:id="@+id/gestureAppRecycler"
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,6 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="60dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/hiddenMenuTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clickable="false"
|
|
||||||
android:gravity="start"
|
|
||||||
android:paddingLeft="40dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:paddingRight="40dp"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:text="@string/unhide_an_app"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
|
||||||
android:textColor="#C1F3F3F3"
|
|
||||||
android:textSize="36sp" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/hiddenAppRecycler"
|
android:id="@+id/hiddenAppRecycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -9,25 +9,6 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
|
||||||
<Space
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="60dp" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/locationMenuTitle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:clickable="false"
|
|
||||||
android:gravity="start"
|
|
||||||
android:paddingLeft="40dp"
|
|
||||||
android:paddingTop="20dp"
|
|
||||||
android:paddingRight="40dp"
|
|
||||||
android:paddingBottom="20dp"
|
|
||||||
android:text="@string/find_your_city"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.DeviceDefault"
|
|
||||||
android:textColor="#C1F3F3F3"
|
|
||||||
android:textSize="36sp" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/locationRecycler"
|
android:id="@+id/locationRecycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources>
|
||||||
<!-- Base application theme. -->
|
<!-- Base application theme. -->
|
||||||
<style name="Base.Theme.YamLauncher" parent="Theme.Material3.DynamicColors.DayNight.NoActionBar">
|
<style name="Base.Theme.YamLauncher" parent="Theme.Material3.DynamicColors.DayNight.NoActionBar">
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="SettingsTheme" parent="Theme.AppCompat.NoActionBar">
|
<style name="SettingsTheme" parent="Theme.AppCompat">
|
||||||
<item name="android:windowBackground">@color/settings_bg</item>
|
<item name="android:windowBackground">@color/settings_bg</item>
|
||||||
<item name="android:windowShowWallpaper">false</item>
|
<item name="android:windowShowWallpaper">false</item>
|
||||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||||
|
|
@ -24,6 +24,13 @@
|
||||||
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
|
||||||
<item name="android:enforceNavigationBarContrast">false</item>
|
<item name="android:enforceNavigationBarContrast">false</item>
|
||||||
<item name="android:enforceStatusBarContrast">false</item>
|
<item name="android:enforceStatusBarContrast">false</item>
|
||||||
|
<item name="actionBarStyle">@style/TransparentActionBar</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="TransparentActionBar" parent="Widget.AppCompat.ActionBar">
|
||||||
|
<!-- Transparent background for ActionBar -->
|
||||||
|
<item name="background">@android:color/transparent</item>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AppSearchView" parent="Widget.AppCompat.SearchView" >
|
<style name="AppSearchView" parent="Widget.AppCompat.SearchView" >
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue