implement #113: option to reverse app list
Some checks are pending
Android CI / build (push) Waiting to run

This commit is contained in:
Josia Pietsch 2025-03-04 16:49:29 +01:00
parent 5ea03d39fa
commit 1f825d6f00
Signed by: jrpie
GPG key ID: E70B571D66986A2D
5 changed files with 19 additions and 1 deletions

View file

@ -33,7 +33,8 @@ import eu.jonahbauer.android.preference.annotations.Preferences;
@Preference(name = "hide_private_space_apps", type = boolean.class, defaultValue = "false"),
}),
@PreferenceGroup(name = "list", prefix = "settings_list_", suffix = "_key", value = {
@Preference(name = "layout", type = ListLayout.class, defaultValue = "DEFAULT")
@Preference(name = "layout", type = ListLayout.class, defaultValue = "DEFAULT"),
@Preference(name = "reverse_layout", type = boolean.class, defaultValue = "false")
}),
@PreferenceGroup(name = "gestures", prefix = "settings_gesture_", suffix = "_key", value = {
}),

View file

@ -9,6 +9,8 @@ import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.apps.AppFilter
import de.jrpie.android.launcher.databinding.ListAppsBinding
@ -79,11 +81,18 @@ class ListFragmentApps : Fragment(), UIObject {
layout = LauncherPreferences.list().layout()
)
// set up the list / recycler
binding.listAppsRview.apply {
// improve performance (since content changes don't change the layout size)
setHasFixedSize(true)
layoutManager = LauncherPreferences.list().layout().layoutManager(context)
.also {
if (LauncherPreferences.list().reverseLayout()) {
(it as? LinearLayoutManager)?.reverseLayout = true
(it as? GridLayoutManager)?.reverseLayout = true
}
}
adapter = appsRecyclerAdapter
}

View file

@ -16,6 +16,7 @@
<string name="settings_apps_hide_paused_apps_key" translatable="false">apps.hide_paused_apps</string>
<string name="settings_apps_hide_private_space_apps_key" translatable="false">apps.hide_private_space_apps</string>
<string name="settings_list_layout_key" translatable="false">list.layout</string>
<string name="settings_list_reverse_layout_key" translatable="false">list.reverse_layout</string>
<string name="settings_general_choose_home_screen_key" translatable="false">general.select_launcher</string>
<!-- values of de.jrpie.android.launcher.preferences.ListLayout -->

View file

@ -178,6 +178,7 @@
<string name="settings_apps_hide_paused_apps">Hide paused apps</string>
<string name="settings_apps_hide_private_space_apps">Hide private space from app list</string>
<string name="settings_list_layout">Layout of app list</string>
<string name="settings_list_reverse_layout">Reverse app list</string>
<string name="settings_list_layout_item_default">Default</string>
<string name="settings_list_layout_item_text">Text</string>

View file

@ -164,6 +164,12 @@
android:summary="%s"
android:defaultValue="DEFAULT"/>
<SwitchPreference
android:key="@string/settings_list_reverse_layout_key"
android:title="@string/settings_list_reverse_layout"
android:defaultValue="false"/>
</PreferenceCategory>
<PreferenceCategory
android:title="@string/settings_launcher_section_display"