mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-04-30 09:38:50 +02:00
apply the selected column count at the app picker too
This commit is contained in:
parent
4765b23831
commit
5c609d6acb
@ -5,9 +5,11 @@ import android.view.ViewGroup
|
|||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import com.simplemobiletools.applauncher.R
|
import com.simplemobiletools.applauncher.R
|
||||||
import com.simplemobiletools.applauncher.adapters.LaunchersDialogAdapter
|
import com.simplemobiletools.applauncher.adapters.LaunchersDialogAdapter
|
||||||
|
import com.simplemobiletools.applauncher.extensions.config
|
||||||
import com.simplemobiletools.applauncher.extensions.dbHelper
|
import com.simplemobiletools.applauncher.extensions.dbHelper
|
||||||
import com.simplemobiletools.applauncher.models.AppLauncher
|
import com.simplemobiletools.applauncher.models.AppLauncher
|
||||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||||
|
import com.simplemobiletools.commons.views.MyGridLayoutManager
|
||||||
import kotlinx.android.synthetic.main.dialog_pick_launchers.view.*
|
import kotlinx.android.synthetic.main.dialog_pick_launchers.view.*
|
||||||
|
|
||||||
class AddAppLauncherDialog(val activity: Activity, val notDisplayedLaunchers: ArrayList<AppLauncher>, val callback: () -> Unit) {
|
class AddAppLauncherDialog(val activity: Activity, val notDisplayedLaunchers: ArrayList<AppLauncher>, val callback: () -> Unit) {
|
||||||
@ -15,6 +17,8 @@ class AddAppLauncherDialog(val activity: Activity, val notDisplayedLaunchers: Ar
|
|||||||
private var adapter: LaunchersDialogAdapter? = null
|
private var adapter: LaunchersDialogAdapter? = null
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
(view.pick_launchers_holder.layoutManager as MyGridLayoutManager).spanCount = activity.config.columnCnt
|
||||||
|
|
||||||
AlertDialog.Builder(activity)
|
AlertDialog.Builder(activity)
|
||||||
.setPositiveButton(R.string.ok) { dialogInterface, i -> confirmSelection() }
|
.setPositiveButton(R.string.ok) { dialogInterface, i -> confirmSelection() }
|
||||||
.setNegativeButton(R.string.cancel, null)
|
.setNegativeButton(R.string.cancel, null)
|
||||||
|
@ -47,7 +47,9 @@ fun Context.getNotDisplayedLaunchers(displayedLaunchers: ArrayList<AppLauncher>)
|
|||||||
allApps.add(AppLauncher(0, label, packageName, drawable))
|
allApps.add(AppLauncher(0, label, packageName, drawable))
|
||||||
}
|
}
|
||||||
|
|
||||||
val sorted = allApps.sortedWith(compareBy { it.title.toLowerCase() })
|
AppLauncher.sorting = config.sorting
|
||||||
val unique = sorted.distinctBy { it.packageName }
|
allApps.sort()
|
||||||
|
|
||||||
|
val unique = allApps.distinctBy { it.packageName }
|
||||||
return unique.filter { !displayedLaunchers.contains(it) && it.packageName != "com.simplemobiletools.applauncher" } as ArrayList<AppLauncher>
|
return unique.filter { !displayedLaunchers.contains(it) && it.packageName != "com.simplemobiletools.applauncher" } as ArrayList<AppLauncher>
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ data class AppLauncher(val id: Int, var title: String, val packageName: String,
|
|||||||
|
|
||||||
override fun compareTo(other: AppLauncher): Int {
|
override fun compareTo(other: AppLauncher): Int {
|
||||||
var result = when {
|
var result = when {
|
||||||
sorting and SORT_BY_TITLE != 0 -> title.compareTo(other.title)
|
sorting and SORT_BY_TITLE != 0 -> title.toLowerCase().compareTo(other.title.toLowerCase())
|
||||||
else -> 1
|
else -> 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
<com.simplemobiletools.commons.views.MyRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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"
|
||||||
android:id="@+id/pick_launchers_holder"
|
android:id="@+id/pick_launchers_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user