mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-22 22:11:27 +01:00
parent
d69e3caf71
commit
9c5500aa83
19 changed files with 25 additions and 37 deletions
|
@ -100,7 +100,7 @@ dependencies {
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
|
||||||
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||||
implementation 'androidx.palette:palette-ktx:1.0.0'
|
implementation 'androidx.palette:palette-ktx:1.0.0'
|
||||||
implementation 'androidx.recyclerview:recyclerview:1.3.2'
|
implementation 'androidx.recyclerview:recyclerview:1.4.0'
|
||||||
implementation 'androidx.preference:preference-ktx:1.2.1'
|
implementation 'androidx.preference:preference-ktx:1.2.1'
|
||||||
implementation 'com.google.android.material:material:1.12.0'
|
implementation 'com.google.android.material:material:1.12.0'
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
||||||
|
|
|
@ -182,5 +182,5 @@ fun getDeviceInfo(): String {
|
||||||
fun copyToClipboard(context: Context, text: String) {
|
fun copyToClipboard(context: Context, text: String) {
|
||||||
val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboardManager = context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
val clipData = ClipData.newPlainText("Debug Info", text)
|
val clipData = ClipData.newPlainText("Debug Info", text)
|
||||||
clipboardManager.setPrimaryClip(clipData);
|
clipboardManager.setPrimaryClip(clipData)
|
||||||
}
|
}
|
|
@ -273,7 +273,7 @@ enum class Gesture(
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun byId(id: String): Gesture? {
|
fun byId(id: String): Gesture? {
|
||||||
return Gesture.values().firstOrNull { it.id == id }
|
return Gesture.entries.firstOrNull { it.id == id }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.os.Build
|
||||||
import android.os.SystemClock
|
import android.os.SystemClock
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import de.jrpie.android.launcher.Application
|
import de.jrpie.android.launcher.Application
|
||||||
import de.jrpie.android.launcher.R
|
import de.jrpie.android.launcher.R
|
||||||
import de.jrpie.android.launcher.apps.AppFilter
|
import de.jrpie.android.launcher.apps.AppFilter
|
||||||
|
@ -134,7 +135,7 @@ enum class LauncherAction(
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getIcon(context: Context): Drawable? {
|
override fun getIcon(context: Context): Drawable? {
|
||||||
return context.getDrawable(icon)
|
return AppCompatResources.getDrawable(context, icon)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun isAvailable(context: Context): Boolean {
|
override fun isAvailable(context: Context): Boolean {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import de.jrpie.android.launcher.Application
|
||||||
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores information used to create [AppsRecyclerAdapter] rows.
|
* Stores information used to create [de.jrpie.android.launcher.ui.list.apps.AppsRecyclerAdapter] rows.
|
||||||
*/
|
*/
|
||||||
class DetailedAppInfo(
|
class DetailedAppInfo(
|
||||||
val app: AppInfo,
|
val app: AppInfo,
|
||||||
|
|
|
@ -68,9 +68,9 @@ private fun Action.Companion.legacyFromPreference(id: String): Action? {
|
||||||
val actionId = preferences.getString("$id.app", "")!!
|
val actionId = preferences.getString("$id.app", "")!!
|
||||||
var u: Int? = preferences.getInt(
|
var u: Int? = preferences.getInt(
|
||||||
"$id.user",
|
"$id.user",
|
||||||
AppInfo.INVALID_USER
|
INVALID_USER
|
||||||
)
|
)
|
||||||
u = if (u == AppInfo.INVALID_USER) null else u
|
u = if (u == INVALID_USER) null else u
|
||||||
|
|
||||||
return Action.legacyFromId(actionId, u)
|
return Action.legacyFromId(actionId, u)
|
||||||
}
|
}
|
||||||
|
@ -80,9 +80,9 @@ private fun migrateAppInfoStringMap(key: String) {
|
||||||
MapAppInfoStringPreferenceSerializer().serialize(
|
MapAppInfoStringPreferenceSerializer().serialize(
|
||||||
preferences.getStringSet(key, setOf())?.mapNotNull { entry ->
|
preferences.getStringSet(key, setOf())?.mapNotNull { entry ->
|
||||||
try {
|
try {
|
||||||
val obj = JSONObject(entry);
|
val obj = JSONObject(entry)
|
||||||
val info = AppInfo.legacyDeserialize(obj.getString("key"))
|
val info = AppInfo.legacyDeserialize(obj.getString("key"))
|
||||||
val value = obj.getString("value");
|
val value = obj.getString("value")
|
||||||
Pair(info, value)
|
Pair(info, value)
|
||||||
} catch (_: JSONException) {
|
} catch (_: JSONException) {
|
||||||
null
|
null
|
||||||
|
|
|
@ -4,7 +4,6 @@ import android.content.Context
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
||||||
import de.jrpie.android.launcher.preferences.PREFERENCE_VERSION
|
|
||||||
import de.jrpie.android.launcher.preferences.theme.Background
|
import de.jrpie.android.launcher.preferences.theme.Background
|
||||||
import de.jrpie.android.launcher.preferences.theme.ColorTheme
|
import de.jrpie.android.launcher.preferences.theme.ColorTheme
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import kotlinx.serialization.json.Json
|
||||||
class SetAppInfoPreferenceSerializer :
|
class SetAppInfoPreferenceSerializer :
|
||||||
PreferenceSerializer<java.util.Set<AppInfo>?, java.util.Set<java.lang.String>?> {
|
PreferenceSerializer<java.util.Set<AppInfo>?, java.util.Set<java.lang.String>?> {
|
||||||
@Throws(PreferenceSerializationException::class)
|
@Throws(PreferenceSerializationException::class)
|
||||||
override fun serialize(value: java.util.Set<AppInfo>?): java.util.Set<java.lang.String>? {
|
override fun serialize(value: java.util.Set<AppInfo>?): java.util.Set<java.lang.String> {
|
||||||
return value?.map(AppInfo::serialize)?.toHashSet() as java.util.Set<java.lang.String>
|
return value?.map(AppInfo::serialize)?.toHashSet() as java.util.Set<java.lang.String>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class SetAppInfoPreferenceSerializer :
|
||||||
class MapAppInfoStringPreferenceSerializer :
|
class MapAppInfoStringPreferenceSerializer :
|
||||||
PreferenceSerializer<java.util.HashMap<AppInfo, String>?, java.util.Set<java.lang.String>?> {
|
PreferenceSerializer<java.util.HashMap<AppInfo, String>?, java.util.Set<java.lang.String>?> {
|
||||||
|
|
||||||
@Serializable()
|
@Serializable
|
||||||
private class MapEntry(val key: AppInfo, val value: String)
|
private class MapEntry(val key: AppInfo, val value: String)
|
||||||
|
|
||||||
@Throws(PreferenceSerializationException::class)
|
@Throws(PreferenceSerializationException::class)
|
||||||
|
|
|
@ -216,7 +216,7 @@ class HomeActivity : UIObject, AppCompatActivity(),
|
||||||
if (e1 == null) return false
|
if (e1 == null) return false
|
||||||
|
|
||||||
|
|
||||||
val displayMetrics: DisplayMetrics = DisplayMetrics()
|
val displayMetrics = DisplayMetrics()
|
||||||
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||||
|
|
||||||
val width = displayMetrics.widthPixels
|
val width = displayMetrics.widthPixels
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.view.View
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import android.window.OnBackInvokedDispatcher
|
import android.window.OnBackInvokedDispatcher
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.appcompat.content.res.AppCompatResources
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.FragmentManager
|
import androidx.fragment.app.FragmentManager
|
||||||
import androidx.fragment.app.FragmentPagerAdapter
|
import androidx.fragment.app.FragmentPagerAdapter
|
||||||
|
@ -52,7 +53,8 @@ class ListActivity : AppCompatActivity(), UIObject {
|
||||||
|
|
||||||
private fun updateLockIcon(locked: Boolean) {
|
private fun updateLockIcon(locked: Boolean) {
|
||||||
binding.listLock.setImageDrawable(
|
binding.listLock.setImageDrawable(
|
||||||
getDrawable(
|
AppCompatResources.getDrawable(
|
||||||
|
this,
|
||||||
if (locked) {
|
if (locked) {
|
||||||
R.drawable.baseline_lock_24
|
R.drawable.baseline_lock_24
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,7 +33,7 @@ fun AppInfo.openSettings(
|
||||||
}
|
}
|
||||||
|
|
||||||
fun AppInfo.uninstall(activity: android.app.Activity) {
|
fun AppInfo.uninstall(activity: android.app.Activity) {
|
||||||
val packageName = this.packageName.toString()
|
val packageName = this.packageName
|
||||||
val userId = this.user
|
val userId = this.user
|
||||||
|
|
||||||
Log.i(LOG_TAG, "uninstalling $this")
|
Log.i(LOG_TAG, "uninstalling $this")
|
||||||
|
|
|
@ -45,21 +45,6 @@ class SettingsFragmentMeta : Fragment(), UIObject {
|
||||||
super<UIObject>.onStart()
|
super<UIObject>.onStart()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rate App
|
|
||||||
// Just copied code from https://stackoverflow.com/q/10816757/12787264
|
|
||||||
// that is how we write good software ^^
|
|
||||||
|
|
||||||
private fun rateIntentForUrl(url: String): Intent {
|
|
||||||
val intent = Intent(
|
|
||||||
Intent.ACTION_VIEW,
|
|
||||||
Uri.parse(String.format("%s?id=%s", url, this.requireContext().packageName))
|
|
||||||
)
|
|
||||||
var flags = Intent.FLAG_ACTIVITY_NO_HISTORY or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
|
|
||||||
flags = flags or Intent.FLAG_ACTIVITY_NEW_DOCUMENT
|
|
||||||
intent.addFlags(flags)
|
|
||||||
return intent
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setOnClicks() {
|
override fun setOnClicks() {
|
||||||
|
|
||||||
binding.settingsMetaButtonViewTutorial.setOnClickListener {
|
binding.settingsMetaButtonViewTutorial.setOnClickListener {
|
||||||
|
|
|
@ -21,7 +21,7 @@ class TutorialFragmentConcept : Fragment(), UIObject {
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
val binding = TutorialConceptBinding.inflate(inflater, container, false)
|
binding = TutorialConceptBinding.inflate(inflater, container, false)
|
||||||
binding.tutorialConceptBadgeVersion.text = BuildConfig.VERSION_NAME
|
binding.tutorialConceptBadgeVersion.text = BuildConfig.VERSION_NAME
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:contentDescription="@string/settings"
|
android:contentDescription="@string/settings"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:paddingLeft="16sp"
|
android:paddingLeft="16sp"
|
||||||
|
@ -62,7 +62,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:includeFontPadding="true"
|
android:includeFontPadding="true"
|
||||||
android:paddingLeft="16sp"
|
android:paddingLeft="16sp"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
android:gravity="start|center_horizontal"
|
android:gravity="start|center_horizontal"
|
||||||
android:padding="5dp"
|
android:padding="5dp"
|
||||||
android:paddingStart="20dp"
|
android:paddingStart="20dp"
|
||||||
|
android:paddingEnd="20dp"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
|
|
@ -22,9 +22,7 @@
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="60sp"
|
android:layout_marginStart="60sp"
|
||||||
android:layout_marginLeft="60sp"
|
|
||||||
android:layout_marginEnd="5dp"
|
android:layout_marginEnd="5dp"
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
android:id="@+id/settings_close"
|
android:id="@+id/settings_close"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:includeFontPadding="true"
|
android:includeFontPadding="true"
|
||||||
android:paddingLeft="16sp"
|
android:paddingLeft="16sp"
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="8dp"
|
android:layout_marginStart="8dp"
|
||||||
android:layout_marginLeft="8dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:includeFontPadding="true"
|
android:includeFontPadding="true"
|
||||||
android:paddingLeft="16sp"
|
android:paddingLeft="16sp"
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground" />
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
|
@ -2,4 +2,5 @@
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<background android:drawable="@mipmap/ic_launcher_background"/>
|
<background android:drawable="@mipmap/ic_launcher_background"/>
|
||||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
|
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
|
||||||
</adaptive-icon>
|
</adaptive-icon>
|
Loading…
Add table
Reference in a new issue