mirror of https://github.com/tasks/tasks
Update task list and edit preferences
Move out of 'Look and feel' into top level menuspull/1818/head
parent
a27047b6f8
commit
7bb0d0a84f
@ -0,0 +1,25 @@
|
||||
package org.tasks.preferences.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.tasks.R
|
||||
import org.tasks.injection.InjectingPreferenceFragment
|
||||
import org.tasks.preferences.IconPreference
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TaskEditPreferences : InjectingPreferenceFragment() {
|
||||
|
||||
override fun getPreferenceXml() = R.xml.preferences_task_edit
|
||||
|
||||
override suspend fun setupPreferences(savedInstanceState: Bundle?) {
|
||||
(findPreference(R.string.customize_edit_screen) as IconPreference).apply {
|
||||
drawable = AppCompatResources.getDrawable(
|
||||
requireContext(),
|
||||
R.drawable.ic_keyboard_arrow_right_24px
|
||||
)?.mutate()
|
||||
tint = context?.getColor(R.color.icon_tint_with_alpha)
|
||||
iconVisible = true
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.tasks.preferences.fragments
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.tasks.R
|
||||
import org.tasks.injection.InjectingPreferenceFragment
|
||||
import org.tasks.preferences.Preferences
|
||||
import org.tasks.ui.ChipProvider
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class TaskListPreferences : InjectingPreferenceFragment() {
|
||||
|
||||
@Inject lateinit var preferences: Preferences
|
||||
@Inject lateinit var chipProvider: ChipProvider
|
||||
|
||||
override fun getPreferenceXml() = R.xml.preferences_task_list
|
||||
|
||||
override suspend fun setupPreferences(savedInstanceState: Bundle?) {
|
||||
findPreference(R.string.p_chip_style).setOnPreferenceChangeListener { _, newValue ->
|
||||
chipProvider.setStyle(Integer.parseInt(newValue as String))
|
||||
true
|
||||
}
|
||||
|
||||
findPreference(R.string.p_chip_appearance).setOnPreferenceChangeListener { _, newValue ->
|
||||
chipProvider.setAppearance(Integer.parseInt(newValue as String))
|
||||
true
|
||||
}
|
||||
|
||||
val sortGroups = findPreference(R.string.p_disable_sort_groups) as SwitchPreferenceCompat
|
||||
sortGroups.isChecked = sortGroups.isChecked || preferences.usePagedQueries()
|
||||
findPreference(R.string.p_use_paged_queries).setOnPreferenceChangeListener { _, value ->
|
||||
sortGroups.isChecked = value as Boolean
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
<?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"
|
||||
android:key="@string/preference_screen">
|
||||
|
||||
<org.tasks.preferences.IconPreference
|
||||
android:key="@string/customize_edit_screen"
|
||||
android:title="@string/customize_edit_screen"
|
||||
android:layout="@layout/preference_icon"
|
||||
android:summary="@string/customize_edit_screen_summary">
|
||||
<intent
|
||||
android:targetClass="com.todoroo.astrid.activity.BeastModePreferences"
|
||||
android:targetPackage="@string/app_package" />
|
||||
</org.tasks.preferences.IconPreference>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/p_linkify_task_edit"
|
||||
android:summary="@string/linkify_description"
|
||||
android:title="@string/linkify" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/p_back_button_saves_task"
|
||||
android:title="@string/back_button_saves_task" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/p_hide_check_button"
|
||||
android:title="@string/hide_check_button" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/p_show_task_edit_comments"
|
||||
android:title="@string/EPr_show_task_edit_comments"
|
||||
app:singleLineTitle="false" />
|
||||
|
||||
</PreferenceScreen>
|
@ -0,0 +1,129 @@
|
||||
<?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"
|
||||
android:key="@string/preference_screen">
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="@integer/default_app_bar_position"
|
||||
android:entries="@array/app_bar_position"
|
||||
android:entryValues="@array/two_values"
|
||||
android:key="@string/p_app_bar_position"
|
||||
android:summary="%s"
|
||||
android:title="@string/app_bar_position" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_app_bar_collapse"
|
||||
android:title="@string/app_bar_collapse" />
|
||||
|
||||
<SeekBarPreference
|
||||
android:defaultValue="16"
|
||||
android:key="@string/p_fontSize"
|
||||
android:max="48"
|
||||
android:title="@string/font_size"
|
||||
app:min="10"
|
||||
app:showSeekBarValue="true" />
|
||||
|
||||
<SeekBarPreference
|
||||
android:defaultValue="16"
|
||||
android:key="@string/p_rowPadding"
|
||||
android:max="16"
|
||||
android:title="@string/row_spacing"
|
||||
app:min="0"
|
||||
app:showSeekBarValue="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/p_fullTaskTitle"
|
||||
android:title="@string/EPr_fullTask_title"
|
||||
app:singleLineTitle="false" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_show_description"
|
||||
android:title="@string/show_description" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/p_show_description"
|
||||
android:key="@string/p_show_full_description"
|
||||
android:title="@string/show_full_description" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="@string/p_linkify_task_list"
|
||||
android:summary="@string/linkify_description"
|
||||
android:title="@string/linkify" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_completed_tasks_at_bottom"
|
||||
android:title="@string/completed_tasks_at_bottom"
|
||||
app:allowDividerAbove="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:dependency="@string/p_completed_tasks_at_bottom"
|
||||
android:key="@string/p_completed_tasks_sort"
|
||||
android:title="@string/completed_tasks_sort" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:disableDependentsState="true"
|
||||
android:key="@string/p_use_paged_queries"
|
||||
android:summary="@string/improve_performance_summary"
|
||||
android:title="@string/improve_performance"
|
||||
app:allowDividerAbove="true" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:dependency="@string/p_use_paged_queries"
|
||||
android:key="@string/p_disable_sort_groups"
|
||||
android:title="@string/disable_sort_groups" />
|
||||
|
||||
<PreferenceCategory android:title="@string/chips">
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/chip_styles"
|
||||
android:entryValues="@array/chip_style_values"
|
||||
android:key="@string/p_chip_style"
|
||||
android:summary="%s"
|
||||
android:title="@string/chip_style" />
|
||||
|
||||
<ListPreference
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/chip_appearance"
|
||||
android:entryValues="@array/chip_appearance_values"
|
||||
android:key="@string/p_chip_appearance"
|
||||
android:summary="%s"
|
||||
android:title="@string/chip_appearance" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_subtask_chips"
|
||||
android:title="@string/subtasks" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_start_date_chip"
|
||||
android:title="@string/start_date" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_place_chips"
|
||||
android:title="@string/places" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_list_chips"
|
||||
android:title="@string/lists" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="@string/p_tag_chips"
|
||||
android:title="@string/tags" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in New Issue