mirror of
https://github.com/SimpleMobileTools/Simple-App-Launcher.git
synced 2025-04-29 09:08:41 +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 com.simplemobiletools.applauncher.R
|
||||
import com.simplemobiletools.applauncher.adapters.LaunchersDialogAdapter
|
||||
import com.simplemobiletools.applauncher.extensions.config
|
||||
import com.simplemobiletools.applauncher.extensions.dbHelper
|
||||
import com.simplemobiletools.applauncher.models.AppLauncher
|
||||
import com.simplemobiletools.commons.extensions.setupDialogStuff
|
||||
import com.simplemobiletools.commons.views.MyGridLayoutManager
|
||||
import kotlinx.android.synthetic.main.dialog_pick_launchers.view.*
|
||||
|
||||
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
|
||||
|
||||
init {
|
||||
(view.pick_launchers_holder.layoutManager as MyGridLayoutManager).spanCount = activity.config.columnCnt
|
||||
|
||||
AlertDialog.Builder(activity)
|
||||
.setPositiveButton(R.string.ok) { dialogInterface, i -> confirmSelection() }
|
||||
.setNegativeButton(R.string.cancel, null)
|
||||
|
@ -47,7 +47,9 @@ fun Context.getNotDisplayedLaunchers(displayedLaunchers: ArrayList<AppLauncher>)
|
||||
allApps.add(AppLauncher(0, label, packageName, drawable))
|
||||
}
|
||||
|
||||
val sorted = allApps.sortedWith(compareBy { it.title.toLowerCase() })
|
||||
val unique = sorted.distinctBy { it.packageName }
|
||||
AppLauncher.sorting = config.sorting
|
||||
allApps.sort()
|
||||
|
||||
val unique = allApps.distinctBy { it.packageName }
|
||||
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 {
|
||||
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
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.simplemobiletools.commons.views.MyRecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.simplemobiletools.commons.views.MyRecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/pick_launchers_holder"
|
||||
android:layout_width="match_parent"
|
||||
|
Loading…
x
Reference in New Issue
Block a user