mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 14:31:30 +01:00
Fix: Also manage laucher info on older SDKs
This commit is contained in:
parent
f1dbaf928d
commit
de6ba2705e
1 changed files with 19 additions and 18 deletions
|
@ -2,10 +2,7 @@ package com.finnmglas.launcher
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.Context
|
import android.content.*
|
||||||
import android.content.DialogInterface
|
|
||||||
import android.content.Intent
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
@ -13,7 +10,6 @@ import android.provider.Settings
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,20 +90,25 @@ class SettingsActivity : AppCompatActivity() {
|
||||||
val callHomeSettingIntent = Intent(Settings.ACTION_HOME_SETTINGS)
|
val callHomeSettingIntent = Intent(Settings.ACTION_HOME_SETTINGS)
|
||||||
startActivity(callHomeSettingIntent)
|
startActivity(callHomeSettingIntent)
|
||||||
}
|
}
|
||||||
// on older sdk: open launcher
|
// on older sdk: manage app details
|
||||||
else {
|
else {
|
||||||
val pm = applicationContext.packageManager
|
AlertDialog.Builder(this)
|
||||||
val intent: Intent? = pm.getLaunchIntentForPackage("com.sec.android.app.launcher")
|
.setTitle("App Info")
|
||||||
|
.setMessage("Your device does not support this feature. Manage application details instead?")
|
||||||
if (intent!=null){
|
.setPositiveButton(android.R.string.yes,
|
||||||
applicationContext.startActivity(intent)
|
DialogInterface.OnClickListener { dialog, which ->
|
||||||
} else {
|
try {
|
||||||
Toast.makeText(
|
val intent = Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
|
||||||
this,
|
intent.data = Uri.parse("package:$packageName")
|
||||||
"Open settings to choose an app for this action",
|
startActivity(intent)
|
||||||
Toast.LENGTH_SHORT
|
} catch ( e : ActivityNotFoundException) {
|
||||||
).show()
|
val intent = Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS)
|
||||||
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(android.R.string.no, null)
|
||||||
|
.setIcon(android.R.drawable.ic_dialog_info)
|
||||||
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue