added button that brings you to app preferences
This commit is contained in:
parent
bae2e134d3
commit
cad109a9d3
2
.idea/vcs.xml
generated
2
.idea/vcs.xml
generated
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
Binary file not shown.
@ -3,10 +3,13 @@ package net.mezimmah.catflipscreen
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.PreferenceFragmentCompat
|
||||
|
||||
|
||||
@ -46,6 +49,17 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
override fun onPreferenceTreeClick(preference: Preference): Boolean {
|
||||
val intent = Intent(
|
||||
Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
|
||||
Uri.fromParts("package", context?.packageName, null)
|
||||
)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
startActivity(intent)
|
||||
return super.onPreferenceTreeClick(preference)
|
||||
}
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
setPreferencesFromResource(R.xml.root_preferences, rootKey)
|
||||
}
|
||||
|
@ -25,5 +25,6 @@
|
||||
<string name="wifi_signal_icon">Wifi Signal Icon</string>
|
||||
<string name="network_signal_icon">Network Signal Icon</string>
|
||||
<string name="battery_status_icon">Battery Status Icon</string>
|
||||
<string name="appPermissionButton">appPermissionButton</string>
|
||||
|
||||
</resources>
|
@ -23,5 +23,8 @@
|
||||
app:enabled="true"
|
||||
app:title=""
|
||||
app:summary="In order for this app to work properly please enable all permissions in the app settings." />
|
||||
<Preference
|
||||
app:title="Go to App Permissions"
|
||||
app:key="appPermissionButton"/>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
x
Reference in New Issue
Block a user