mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 05:01:52 +01:00
Add shortcut to open extension package in system settings
This commit is contained in:
parent
361b0284fa
commit
ce22b2c29a
@ -2,7 +2,10 @@ package eu.kanade.tachiyomi.ui.browse.extension.details
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.provider.Settings
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
@ -180,6 +183,7 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.action_enable_all -> toggleAllSources(true)
|
R.id.action_enable_all -> toggleAllSources(true)
|
||||||
R.id.action_disable_all -> toggleAllSources(false)
|
R.id.action_disable_all -> toggleAllSources(false)
|
||||||
|
R.id.action_open_in_settings -> openInSettings()
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
@ -204,6 +208,13 @@ class ExtensionDetailsController(bundle: Bundle? = null) :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun openInSettings() {
|
||||||
|
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS).apply {
|
||||||
|
data = Uri.fromParts("package", presenter.pkgName, null)
|
||||||
|
}
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
|
|
||||||
private fun Source.isEnabled(): Boolean {
|
private fun Source.isEnabled(): Boolean {
|
||||||
return id.toString() !in preferences.disabledSources().get()
|
return id.toString() !in preferences.disabledSources().get()
|
||||||
}
|
}
|
||||||
|
@ -11,4 +11,9 @@
|
|||||||
android:title="@string/action_disable_all"
|
android:title="@string/action_disable_all"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/action_open_in_settings"
|
||||||
|
android:title="@string/action_open_in_settings"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
<string name="action_move">Move</string>
|
<string name="action_move">Move</string>
|
||||||
<string name="action_open_in_browser">Open in browser</string>
|
<string name="action_open_in_browser">Open in browser</string>
|
||||||
<string name="action_open_in_web_view">Open in WebView</string>
|
<string name="action_open_in_web_view">Open in WebView</string>
|
||||||
|
<string name="action_open_in_settings">Open in Settings</string>
|
||||||
<string name="action_migrate">Migrate</string>
|
<string name="action_migrate">Migrate</string>
|
||||||
<string name="action_display_mode">Display mode</string>
|
<string name="action_display_mode">Display mode</string>
|
||||||
<string name="action_display">Display</string>
|
<string name="action_display">Display</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user