Compare commits

..

No commits in common. "653d16b269f609d9de0c523d9f3bd56930e29302" and "b4608ef15338891d9715ec7ca133c05bbde3ec28" have entirely different histories.

4 changed files with 3 additions and 33 deletions

View file

@ -38,8 +38,6 @@ import androidx.core.net.toUri
const val LOG_TAG = "Launcher" const val LOG_TAG = "Launcher"
const val REQUEST_SET_DEFAULT_HOME = 42
fun isDefaultHomeScreen(context: Context): Boolean { fun isDefaultHomeScreen(context: Context): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
val roleManager = context.getSystemService(RoleManager::class.java) val roleManager = context.getSystemService(RoleManager::class.java)
@ -61,12 +59,11 @@ fun setDefaultHomeScreen(context: Context, checkDefault: Boolean = false) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q
&& context is Activity && context is Activity
&& checkDefault // using role manager only works when µLauncher is not already the default. && !isDefault // using role manager only works when µLauncher is not already the default.
) { ) {
val roleManager = context.getSystemService(RoleManager::class.java) val roleManager = context.getSystemService(RoleManager::class.java)
context.startActivityForResult( context.startActivity(
roleManager.createRequestRoleIntent(RoleManager.ROLE_HOME), roleManager.createRequestRoleIntent(RoleManager.ROLE_HOME)
REQUEST_SET_DEFAULT_HOME
) )
return return
} }

View file

@ -154,12 +154,6 @@ enum class LauncherAction(
R.drawable.baseline_flashlight_on_24, R.drawable.baseline_flashlight_on_24,
::toggleTorch, ::toggleTorch,
), ),
LAUNCH_OTHER_LAUNCHER(
"launcher_other_launcher",
R.string.list_other_launch_other_launcher,
R.drawable.baseline_home_24,
::launchOtherLauncher
),
NOP("nop", R.string.list_other_nop, R.drawable.baseline_not_interested_24, {}); NOP("nop", R.string.list_other_nop, R.drawable.baseline_not_interested_24, {});
override fun invoke(context: Context, rect: Rect?): Boolean { override fun invoke(context: Context, rect: Rect?): Boolean {
@ -264,15 +258,6 @@ private fun expandSettingsPanel(context: Context) {
} }
} }
private fun launchOtherLauncher(context: Context) {
context.startActivity(
Intent.createChooser(
Intent(Intent.ACTION_MAIN).also { it.addCategory(Intent.CATEGORY_HOME) },
context.getString(R.string.list_other_launch_other_launcher)
)
)
}
private fun openSettings(context: Context) { private fun openSettings(context: Context) {
context.startActivity(Intent(context, SettingsActivity::class.java)) context.startActivity(Intent(context, SettingsActivity::class.java))
} }

View file

@ -1,11 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?android:textColor"
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
</vector>

View file

@ -256,7 +256,6 @@
<string name="list_other_nop">Do nothing</string> <string name="list_other_nop">Do nothing</string>
<string name="list_other_lock_screen">Lock Screen</string> <string name="list_other_lock_screen">Lock Screen</string>
<string name="list_other_torch">Toggle Torch</string> <string name="list_other_torch">Toggle Torch</string>
<string name="list_other_launch_other_launcher">Launch other Home Screen</string>
<!-- Pin shortcuts --> <!-- Pin shortcuts -->
<string name="pin_shortcut_title">Add Shortcut</string> <string name="pin_shortcut_title">Add Shortcut</string>