mirror of
https://github.com/jrpie/Launcher.git
synced 2025-04-05 11:54:32 +02:00
action: open quick settings
This commit is contained in:
parent
ab2ed14ab7
commit
ba5a784990
5 changed files with 31 additions and 6 deletions
|
@ -64,6 +64,12 @@ enum class LauncherAction(
|
||||||
R.drawable.baseline_notifications_24,
|
R.drawable.baseline_notifications_24,
|
||||||
::expandNotificationsPanel
|
::expandNotificationsPanel
|
||||||
),
|
),
|
||||||
|
EXPAND_SETTINGS_PANEL(
|
||||||
|
"launcher:expandSettingsPanel",
|
||||||
|
R.string.list_other_expand_settings_panel,
|
||||||
|
R.drawable.baseline_settings_applications_24,
|
||||||
|
::expandSettingsPanel
|
||||||
|
),
|
||||||
NOP("launcher:nop", R.string.list_other_nop, R.drawable.baseline_not_interested_24, {});
|
NOP("launcher: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 {
|
||||||
|
@ -169,7 +175,24 @@ private fun expandNotificationsPanel(context: Context) {
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Toast.makeText(
|
Toast.makeText(
|
||||||
context,
|
context,
|
||||||
context.getString(R.string.alert_cant_expand_notifications_panel),
|
context.getString(R.string.alert_cant_expand_status_bar_panel),
|
||||||
|
Toast.LENGTH_LONG
|
||||||
|
).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun expandSettingsPanel(context: Context) {
|
||||||
|
/* https://stackoverflow.com/a/31898506 */
|
||||||
|
try {
|
||||||
|
@Suppress("SpellCheckingInspection")
|
||||||
|
val statusBarService: Any? = context.getSystemService("statusbar")
|
||||||
|
val statusBarManager = Class.forName("android.app.StatusBarManager")
|
||||||
|
val showStatusBar = statusBarManager.getMethod("expandSettingsPanel")
|
||||||
|
showStatusBar.invoke(statusBarService)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Toast.makeText(
|
||||||
|
context,
|
||||||
|
context.getString(R.string.alert_cant_expand_status_bar_panel),
|
||||||
Toast.LENGTH_LONG
|
Toast.LENGTH_LONG
|
||||||
).show()
|
).show()
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,7 @@
|
||||||
<string name="settings">Einstellungen</string>
|
<string name="settings">Einstellungen</string>
|
||||||
<string name="ic_menu_alt">Mehr Optionen</string>
|
<string name="ic_menu_alt">Mehr Optionen</string>
|
||||||
<string name="list_other_expand_notifications_panel">Benachrichtigungen</string>
|
<string name="list_other_expand_notifications_panel">Benachrichtigungen</string>
|
||||||
<string name="alert_cant_expand_notifications_panel">Fehler: Die Funktion \"Benachrichtigungen\" wird von deinem Gerät leider nicht unterstützt.</string>
|
<string name="alert_cant_expand_status_bar_panel">Fehler: Diese Funktion wird von deinem Gerät leider nicht unterstützt.</string>
|
||||||
<string name="settings_clock_show_seconds">Sekunden anzeigen</string>
|
<string name="settings_clock_show_seconds">Sekunden anzeigen</string>
|
||||||
</resources>
|
<string name="list_other_expand_settings_panel">Schnelleinstellungen</string>
|
||||||
|
</resources>
|
||||||
|
|
|
@ -133,7 +133,7 @@
|
||||||
<string name="settings">Configurações</string>
|
<string name="settings">Configurações</string>
|
||||||
<string name="ic_menu_alt">Mais opções</string>
|
<string name="ic_menu_alt">Mais opções</string>
|
||||||
<string name="list_app_favorite_remove">Remover dos favoritos</string>
|
<string name="list_app_favorite_remove">Remover dos favoritos</string>
|
||||||
<string name="alert_cant_expand_notifications_panel">Erro: Não foi possível expandir a barra de status.
|
<string name="alert_cant_expand_status_bar_panel">Erro: Não foi possível expandir a barra de status.
|
||||||
\nEssa ação usa uma funcionalidade que não faz parte da API do Android publicada. Infelizmente, ela não vai funcionar no seu dispositivo.</string>
|
\nEssa ação usa uma funcionalidade que não faz parte da API do Android publicada. Infelizmente, ela não vai funcionar no seu dispositivo.</string>
|
||||||
<string name="settings_theme_background">Fundo (lista de apps e configurações)</string>
|
<string name="settings_theme_background">Fundo (lista de apps e configurações)</string>
|
||||||
<string name="settings_theme_font">Fonte</string>
|
<string name="settings_theme_font">Fonte</string>
|
||||||
|
|
|
@ -110,6 +110,6 @@
|
||||||
<string name="settings_display_rotate_screen">旋转屏幕</string>
|
<string name="settings_display_rotate_screen">旋转屏幕</string>
|
||||||
<string name="settings_launcher_section_apps">应用</string>
|
<string name="settings_launcher_section_apps">应用</string>
|
||||||
<string name="list_other_expand_notifications_panel">展开通知面板</string>
|
<string name="list_other_expand_notifications_panel">展开通知面板</string>
|
||||||
<string name="alert_cant_expand_notifications_panel">错误:无法打开通知栏。
|
<string name="alert_cant_expand_status_bar_panel">错误:无法打开通知栏。
|
||||||
\n这个动作使用的功能并非现有的 Android API的一部分。不幸的是,它似乎不适用于您的设备。</string>
|
\n这个动作使用的功能并非现有的 Android API的一部分。不幸的是,它似乎不适用于您的设备。</string>
|
||||||
</resources>
|
</resources>
|
|
@ -204,7 +204,8 @@
|
||||||
|
|
||||||
<string name="settings">Settings</string>
|
<string name="settings">Settings</string>
|
||||||
<string name="ic_menu_alt">More options</string>
|
<string name="ic_menu_alt">More options</string>
|
||||||
<string name="alert_cant_expand_notifications_panel">Error: Can\'t expand status bar.\nThis action is using functionality that is not part of the published Android API. Unfortunately, it does not seem to work on your device.</string>
|
<string name="alert_cant_expand_status_bar_panel">Error: Can\'t expand status bar.\nThis action is using functionality that is not part of the published Android API. Unfortunately, it does not seem to work on your device.</string>
|
||||||
<string name="snackbar_app_hidden">App hidden. You can make it visible again in settings.</string>
|
<string name="snackbar_app_hidden">App hidden. You can make it visible again in settings.</string>
|
||||||
<string name="undo">Undo</string>
|
<string name="undo">Undo</string>
|
||||||
|
<string name="list_other_expand_settings_panel">Quick Settings</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Reference in a new issue