mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 09:57:26 +00:00
Settings have all options now (not functional).
This commit is contained in:
parent
f602ae569f
commit
40c3e2dd72
7 changed files with 174 additions and 18 deletions
31
app/src/main/java/eu/ottop/yamlauncher/ButtonPreference.kt
Normal file
31
app/src/main/java/eu/ottop/yamlauncher/ButtonPreference.kt
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import androidx.preference.Preference
|
||||||
|
import androidx.preference.PreferenceViewHolder
|
||||||
|
|
||||||
|
|
||||||
|
class ButtonPreference(context: Context?, attrs: AttributeSet?) :
|
||||||
|
Preference(context!!, attrs) {
|
||||||
|
init {
|
||||||
|
widgetLayoutResource = R.layout.location_button;
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onBindViewHolder(holder: PreferenceViewHolder) {
|
||||||
|
super.onBindViewHolder(holder)
|
||||||
|
|
||||||
|
val view = holder.itemView
|
||||||
|
view.setOnClickListener {
|
||||||
|
when (this.key) {
|
||||||
|
"manual_location" -> {
|
||||||
|
println("Location pressed")
|
||||||
|
}
|
||||||
|
|
||||||
|
"hidden_apps" -> {
|
||||||
|
println("Hidden apps pressed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,7 +16,7 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
supportFragmentManager
|
supportFragmentManager
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.settingsLayout, SettingsFragment())
|
.replace(R.id.settings_layout, SettingsFragment())
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,29 @@
|
||||||
package eu.ottop.yamlauncher
|
package eu.ottop.yamlauncher
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
|
import androidx.preference.SwitchPreference
|
||||||
|
|
||||||
class SettingsFragment : PreferenceFragmentCompat() {
|
class SettingsFragment : PreferenceFragmentCompat() {
|
||||||
|
|
||||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||||
|
|
||||||
|
val gpsLocationPref: SwitchPreference? = findPreference("gps_location")
|
||||||
|
val manualLocationPref: ButtonPreference? = findPreference("manual_location")
|
||||||
|
|
||||||
|
if (gpsLocationPref != null && manualLocationPref != null) {
|
||||||
|
// Initial setup
|
||||||
|
manualLocationPref.isEnabled = !gpsLocationPref.isChecked
|
||||||
|
|
||||||
|
// Set up a listener to update the enabled state of manualLocationPref
|
||||||
|
gpsLocationPref.onPreferenceChangeListener =
|
||||||
|
Preference.OnPreferenceChangeListener { _, newValue ->
|
||||||
|
val isGpsEnabled = newValue as Boolean
|
||||||
|
manualLocationPref.isEnabled = !isGpsEnabled
|
||||||
|
true // Returning true means the change is persisted
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/settingsLayout"
|
android:id="@+id/settingsLayout"
|
||||||
|
|
@ -9,6 +9,17 @@
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
tools:context=".SettingsActivity">
|
tools:context=".SettingsActivity">
|
||||||
|
|
||||||
|
<Space
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp" />
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:id="@+id/settings_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
|
@ -449,4 +460,4 @@
|
||||||
tools:layout_editor_absoluteY="810dp" />
|
tools:layout_editor_absoluteY="810dp" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</LinearLayout>
|
||||||
5
app/src/main/res/layout/location_button.xml
Normal file
5
app/src/main/res/layout/location_button.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/location_button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
@ -27,4 +27,10 @@
|
||||||
<item>Medium</item>
|
<item>Medium</item>
|
||||||
<item>Large</item>
|
<item>Large</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="size_values">
|
||||||
|
<item>small</item>
|
||||||
|
<item>medium</item>
|
||||||
|
<item>large</item>
|
||||||
|
</string-array>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
|
||||||
<PreferenceCategory app:title="Alignment">
|
<PreferenceCategory
|
||||||
|
app:allowDividerAbove="false"
|
||||||
|
app:title="Alignment">
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
app:defaultValue="left"
|
app:defaultValue="left"
|
||||||
|
|
@ -25,7 +27,7 @@
|
||||||
app:defaultValue="left"
|
app:defaultValue="left"
|
||||||
app:entries="@array/h_alignment_options"
|
app:entries="@array/h_alignment_options"
|
||||||
app:entryValues="@array/h_alignment_values"
|
app:entryValues="@array/h_alignment_values"
|
||||||
app:key="aappMenuAlignment"
|
app:key="appMenuAlignment"
|
||||||
app:title="App Menu Alignment"
|
app:title="App Menu Alignment"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
|
@ -40,19 +42,102 @@
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory app:title="@string/sync_header">
|
<PreferenceCategory
|
||||||
|
app:allowDividerAbove="false"
|
||||||
<SwitchPreferenceCompat
|
app:title="Dimensions">
|
||||||
app:key="sync"
|
<ListPreference
|
||||||
app:title="@string/sync_title" />
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
<SwitchPreferenceCompat
|
app:defaultValue="medium"
|
||||||
app:dependency="sync"
|
app:entries="@array/size_options"
|
||||||
app:key="attachment"
|
app:entryValues="@array/size_values"
|
||||||
app:summaryOff="@string/attachment_summary_off"
|
app:key="clockSize"
|
||||||
app:summaryOn="@string/attachment_summary_on"
|
app:title="Clock Size"
|
||||||
app:title="@string/attachment_title" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<ListPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:defaultValue="medium"
|
||||||
|
app:entries="@array/size_options"
|
||||||
|
app:entryValues="@array/size_values"
|
||||||
|
app:key="dateSize"
|
||||||
|
app:title="Date Size"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<ListPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:defaultValue="medium"
|
||||||
|
app:entries="@array/size_options"
|
||||||
|
app:entryValues="@array/size_values"
|
||||||
|
app:key="shortcutSize"
|
||||||
|
app:title="Home App Size"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<ListPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:defaultValue="medium"
|
||||||
|
app:entries="@array/size_options"
|
||||||
|
app:entryValues="@array/size_values"
|
||||||
|
app:key="appMenuSize"
|
||||||
|
app:title="App Menu Size"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
<ListPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:defaultValue="medium"
|
||||||
|
app:entries="@array/size_options"
|
||||||
|
app:entryValues="@array/size_values"
|
||||||
|
app:key="searchSize"
|
||||||
|
app:title="Search Size"
|
||||||
|
app:useSimpleSummaryProvider="true" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:allowDividerAbove="false"
|
||||||
|
app:title="Gestures">
|
||||||
|
<SwitchPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:title="Camera Swipe Left"
|
||||||
|
app:key="cameraSwipe" />
|
||||||
|
<SwitchPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:title="Phone Swipe Right"
|
||||||
|
app:key="phoneSwipe" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:allowDividerAbove="false"
|
||||||
|
app:title="Weather">
|
||||||
|
<SwitchPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:title="GPS Location"
|
||||||
|
app:key="gps_location" />
|
||||||
|
<eu.ottop.yamlauncher.ButtonPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:key="manual_location"
|
||||||
|
app:selectable="true"
|
||||||
|
app:title="Set Manual Location" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
<PreferenceCategory
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:allowDividerAbove="false"
|
||||||
|
app:title="Hidden Apps">
|
||||||
|
<eu.ottop.yamlauncher.ButtonPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
app:key="hidden_apps"
|
||||||
|
app:selectable="true"
|
||||||
|
app:title="Manage Hidden Apps" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue