mirror of
https://github.com/jrpie/Launcher.git
synced 2025-04-04 03:14:36 +02:00
Compare commits
9 commits
535bf5747c
...
5077a4604d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5077a4604d | ||
![]() |
26e421d916 | ||
![]() |
f0d761d445 | ||
![]() |
4cc3e3f87f | ||
8e140e2e69 | |||
7fc58fe384 | |||
54409b6312 | |||
865cd47583 | |||
58ddd3c8cc |
17 changed files with 67 additions and 61 deletions
|
@ -23,8 +23,8 @@ android {
|
|||
minSdkVersion 21
|
||||
targetSdkVersion 35
|
||||
compileSdk 35
|
||||
versionCode 41
|
||||
versionName "0.1.1"
|
||||
versionCode 43
|
||||
versionName "0.1.3"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package de.jrpie.android.launcher.ui
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.SharedPreferences
|
||||
import android.content.res.Configuration
|
||||
import android.content.res.Resources
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
|
@ -56,22 +56,11 @@ class HomeActivity : UIObject, AppCompatActivity() {
|
|||
super<AppCompatActivity>.onCreate(savedInstanceState)
|
||||
super<UIObject>.onCreate()
|
||||
|
||||
val displayMetrics = DisplayMetrics()
|
||||
|
||||
@Suppress("deprecation") // required to support API < 30
|
||||
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||
|
||||
val width = displayMetrics.widthPixels
|
||||
val height = displayMetrics.heightPixels
|
||||
|
||||
touchGestureDetector = TouchGestureDetector(
|
||||
this,
|
||||
width,
|
||||
height,
|
||||
this, 0, 0,
|
||||
LauncherPreferences.enabled_gestures().edgeSwipeEdgeWidth() / 100f
|
||||
)
|
||||
|
||||
|
||||
touchGestureDetector.updateScreenSize(windowManager)
|
||||
|
||||
// Initialise layout
|
||||
binding = HomeBinding.inflate(layoutInflater)
|
||||
|
@ -103,6 +92,11 @@ class HomeActivity : UIObject, AppCompatActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
touchGestureDetector.updateScreenSize(windowManager)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super<AppCompatActivity>.onStart()
|
||||
|
||||
|
|
|
@ -5,8 +5,10 @@ import android.graphics.Insets
|
|||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.MotionEvent
|
||||
import android.view.ViewConfiguration
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.RequiresApi
|
||||
import de.jrpie.android.launcher.actions.Gesture
|
||||
import de.jrpie.android.launcher.preferences.LauncherPreferences
|
||||
|
@ -17,8 +19,8 @@ import kotlin.math.tan
|
|||
|
||||
class TouchGestureDetector(
|
||||
private val context: Context,
|
||||
val width: Int,
|
||||
val height: Int,
|
||||
var width: Int,
|
||||
var height: Int,
|
||||
var edgeWidth: Float
|
||||
) {
|
||||
private val ANGULAR_THRESHOLD = tan(Math.PI / 6)
|
||||
|
@ -319,6 +321,14 @@ class TouchGestureDetector(
|
|||
}
|
||||
}
|
||||
|
||||
fun updateScreenSize(windowManager: WindowManager) {
|
||||
val displayMetrics = DisplayMetrics()
|
||||
@Suppress("deprecation") // required to support API < 30
|
||||
windowManager.defaultDisplay.getMetrics(displayMetrics)
|
||||
width = displayMetrics.widthPixels
|
||||
height = displayMetrics.heightPixels
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.Q)
|
||||
fun setSystemGestureInsets(insets: Insets) {
|
||||
systemGestureInsetTop = insets.top
|
||||
|
|
|
@ -9,8 +9,7 @@ import android.window.OnBackInvokedDispatcher
|
|||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import androidx.fragment.app.FragmentPagerAdapter
|
||||
import de.jrpie.android.launcher.Application
|
||||
import de.jrpie.android.launcher.R
|
||||
import de.jrpie.android.launcher.actions.LauncherAction
|
||||
|
@ -225,13 +224,10 @@ class ListActivity : AppCompatActivity(), UIObject {
|
|||
updateTitle()
|
||||
|
||||
val sectionsPagerAdapter = ListSectionsPagerAdapter(this)
|
||||
binding.listViewpager.apply {
|
||||
adapter = sectionsPagerAdapter
|
||||
currentItem = 0
|
||||
binding.listViewpager.let {
|
||||
it.adapter = sectionsPagerAdapter
|
||||
binding.listTabs.setupWithViewPager(it)
|
||||
}
|
||||
TabLayoutMediator(binding.listTabs, binding.listViewpager) { tab, position ->
|
||||
tab.text = sectionsPagerAdapter.getPageTitle(position)
|
||||
}.attach()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -243,11 +239,17 @@ private val TAB_TITLES = arrayOf(
|
|||
/**
|
||||
* The [ListSectionsPagerAdapter] returns the fragment,
|
||||
* which corresponds to the selected tab in [ListActivity].
|
||||
*
|
||||
* This should eventually be replaced by a [FragmentStateAdapter]
|
||||
* However this keyboard does not open when using [ViewPager2]
|
||||
* so currently [ViewPager] is used here.
|
||||
* https://github.com/jrpie/launcher/issues/130
|
||||
*/
|
||||
@Suppress("deprecation")
|
||||
class ListSectionsPagerAdapter(private val activity: ListActivity) :
|
||||
FragmentStateAdapter(activity) {
|
||||
FragmentPagerAdapter(activity.supportFragmentManager) {
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
override fun getItem(position: Int): Fragment {
|
||||
return when (position) {
|
||||
0 -> ListFragmentApps()
|
||||
1 -> ListFragmentOther()
|
||||
|
@ -255,11 +257,11 @@ class ListSectionsPagerAdapter(private val activity: ListActivity) :
|
|||
}
|
||||
}
|
||||
|
||||
fun getPageTitle(position: Int): CharSequence {
|
||||
override fun getPageTitle(position: Int): CharSequence {
|
||||
return activity.resources.getString(TAB_TITLES[position])
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
override fun getCount(): Int {
|
||||
return when (activity.intention) {
|
||||
ListActivity.ListActivityIntention.VIEW -> 1
|
||||
else -> 2
|
||||
|
|
|
@ -109,7 +109,7 @@ class SettingsActivity : AppCompatActivity(), UIObject {
|
|||
}
|
||||
|
||||
private val TAB_TITLES = arrayOf(
|
||||
R.string.settings_tab_app,
|
||||
R.string.settings_tab_actions,
|
||||
R.string.settings_tab_launcher,
|
||||
R.string.settings_tab_meta
|
||||
)
|
||||
|
|
|
@ -95,7 +95,12 @@
|
|||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
<!--
|
||||
Should be replaced by androidx.viewpager2.widget.ViewPager2
|
||||
but there is an issue with opening the keyboard:
|
||||
https://github.com/jrpie/launcher/issues/130
|
||||
-->
|
||||
<androidx.viewpager.widget.ViewPager
|
||||
android:id="@+id/list_viewpager"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
-
|
||||
-->
|
||||
<string name="settings_title">Einstellungen</string>
|
||||
<string name="settings_tab_app">Apps</string>
|
||||
<string name="settings_tab_actions">Aktionen</string>
|
||||
<string name="settings_tab_launcher">Launcher</string>
|
||||
<string name="settings_tab_meta">Meta</string>
|
||||
<!--
|
||||
|
@ -54,9 +54,9 @@
|
|||
<string name="settings_gesture_description_down_left_edge">An der linken Kante nach unten wischen</string>
|
||||
<string name="settings_gesture_down_right_edge">Abwärts (rechts)</string>
|
||||
<string name="settings_gesture_description_down_right_edge">An der rechten Kanten nach unten wischen</string>
|
||||
<string name="settings_gesture_vol_up">Lautstärke +</string>
|
||||
<string name="settings_gesture_vol_up">Lauter-Taste</string>
|
||||
<string name="settings_gesture_description_vol_up">Die Taste \"Lauter\" drücken</string>
|
||||
<string name="settings_gesture_vol_down">Lautstärke -</string>
|
||||
<string name="settings_gesture_vol_down">Leiser-Taste</string>
|
||||
<string name="settings_gesture_description_vol_down">Die Taste \"Leiser\" drücken</string>
|
||||
<string name="settings_gesture_double_click">Doppelklick</string>
|
||||
<string name="settings_gesture_description_double_click">In einem leeren Bereich doppelt klicken</string>
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
-
|
||||
-->
|
||||
<string name="settings_title">Configuración</string>
|
||||
<string name="settings_tab_app">Aplicaciones</string>
|
||||
<string name="settings_tab_launcher">Launcher</string>
|
||||
<string name="settings_tab_meta">Meta</string>
|
||||
<!--
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
-
|
||||
-->
|
||||
<string name="settings_title">Réglages</string>
|
||||
<string name="settings_tab_app">Applications</string>
|
||||
<string name="settings_tab_launcher">Launcher</string>
|
||||
<string name="settings_tab_meta">Meta</string>
|
||||
<!--
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
<string name="alert_cant_open_message">Desideri modificare le impostazioni?</string>
|
||||
<string name="toast_cant_open_message">Apri le impostazioni per abbinare un\'azione a questo gesto</string>
|
||||
<string name="settings_title">Impostazioni</string>
|
||||
<string name="settings_tab_app">Applicazioni</string>
|
||||
<string name="settings_tab_launcher">Launcher</string>
|
||||
<string name="settings_tab_meta">Meta</string>
|
||||
<string name="settings_gesture_description_double_down">Scorri verso il basso con due dita</string>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<string name="alert_cant_open_title">アプリを開けません</string>
|
||||
<string name="alert_cant_open_message">設定を変更しますか?</string>
|
||||
<string name="settings_title">設定</string>
|
||||
<string name="settings_tab_app">アプリ</string>
|
||||
<string name="settings_tab_launcher">ランチャー</string>
|
||||
<string name="settings_tab_meta">その他</string>
|
||||
<string name="toast_cant_open_message">このジェスチャのアクションを選択するには設定を開きます</string>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
-
|
||||
-->
|
||||
<string name="settings_title">Configurações</string>
|
||||
<string name="settings_tab_app">Apps</string>
|
||||
<string name="settings_tab_launcher">Launcher</string>
|
||||
<string name="settings_tab_meta">Meta</string>
|
||||
<!--
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
<string name="alert_cant_open_message">Ayarlarını değiştirmek ister misiniz?</string>
|
||||
<string name="toast_cant_open_message">Bu harekete bir eylem atamak için ayarları açın</string>
|
||||
<string name="settings_title">Ayarlar</string>
|
||||
<string name="settings_tab_app">Uygulamalar</string>
|
||||
<string name="settings_tab_launcher">Başlatıcı</string>
|
||||
<string name="settings_tab_meta">Daha Fazlası</string>
|
||||
<string name="settings_gesture_up">Yukarı</string>
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
<string name="alert_cant_open_title">无法打开应用</string>
|
||||
<string name="alert_cant_open_message">要更改其设置吗?</string>
|
||||
<string name="toast_cant_open_message">打开设置,为该手势绑定一个应用程序</string>
|
||||
<string name="settings_tab_app">应用程序</string>
|
||||
<string name="settings_tab_launcher">启动器</string>
|
||||
<string name="settings_tab_meta">杂项</string>
|
||||
<string name="settings_gesture_left">左</string>
|
||||
|
@ -104,7 +103,7 @@
|
|||
<string name="settings_apps_hide_bound_apps">不要在应用抽屉中显示被绑定到手势的应用</string>
|
||||
<string name="alert_requires_android_m">此功能需要 Android 6 或更高版本。</string>
|
||||
<string name="snackbar_app_hidden">应用程序已隐藏。您可在设置中让它再次显示。</string>
|
||||
<string name="toast_device_admin_not_enabled">µLauncher 需要获得设备管理员权限才能够锁定屏幕。</string>
|
||||
<string name="toast_device_admin_not_enabled">µLauncher 需要激活“设备管理应用”权限才能够锁定屏幕。</string>
|
||||
<string name="device_admin_explanation">这是执行锁屏操作所必需的。</string>
|
||||
<string name="accessibility_service_name">µLauncher - 锁屏</string>
|
||||
<string name="list_title_favorite">收藏的应用</string>
|
||||
|
@ -158,16 +157,16 @@
|
|||
<string name="settings_enabled_gestures_edge_swipe_edge_width">边缘宽度</string>
|
||||
<string name="list_app_rename">重命名</string>
|
||||
<string name="device_admin_description">启用锁屏动作</string>
|
||||
<string name="toast_accessibility_service_not_enabled">μLauncher 的无障碍服务未启用,请在设置中启用它。</string>
|
||||
<string name="toast_lock_screen_not_supported">错误:此设备不支持使用无障碍功能锁定屏幕。请改用设备管理员模式。</string>
|
||||
<string name="screen_lock_method_use_accessibility">使用无障碍服务</string>
|
||||
<string name="screen_lock_method_use_device_admin">使用设备管理员模式</string>
|
||||
<string name="toast_accessibility_service_not_enabled">μLauncher 的“无障碍”服务未启用,请在设置中启用它。</string>
|
||||
<string name="toast_lock_screen_not_supported">错误:此设备不支持使用“无障碍”服务锁定屏幕。请改用激活“设备管理应用”权限。</string>
|
||||
<string name="screen_lock_method_use_accessibility">使用“无障碍”服务</string>
|
||||
<string name="screen_lock_method_use_device_admin">激活“设备管理应用”权限</string>
|
||||
<string name="dialog_cancel">取消</string>
|
||||
<string name="settings_theme_color_theme_item_light">亮色</string>
|
||||
<string name="list_other_expand_settings_panel">快速设置</string>
|
||||
<string name="alert_lock_screen_failed">错误:锁定屏幕失败。(如果您刚刚升级了本启动器,请尝试在手机设置中手动禁用并重新启用无障碍服务)</string>
|
||||
<string name="alert_lock_screen_failed">错误:锁定屏幕失败。(如果您刚刚升级了本启动器,请尝试在手机设置中手动禁用并重新启用“无障碍”服务)</string>
|
||||
<string name="settings_enabled_gestures_edge_swipe_summary">在屏幕边缘滑动</string>
|
||||
<string name="accessibility_service_description">将 µLauncher 设为无障碍服务允许其锁定屏幕。请注意,这需要过多的权限。你永远不应该轻易地授予任何应用程序这样的权限。µLauncher 将仅使用无障碍服务功能锁屏。您可以审核源代码。请注意,锁屏也可以通过授予 µLauncher 设备管理员权限来实现,然而,这种方法不适用于以指纹和面部解锁。</string>
|
||||
<string name="accessibility_service_description">将 µLauncher 设置为“无障碍”服务以允许其锁定屏幕。请注意,这会使 µLauncher 获得额外的权限。你永远不应该轻易地授予任何应用程序这样的权限。获得授权后“无障碍”服务将仅被用于锁定屏幕。您可以审核我们的源代码。请注意,锁定屏幕也可以通过激活 µLauncher 的“设备管理应用”权限来实现,然而,这种方法无法与于指纹解锁和面部解锁兼容。</string>
|
||||
<string name="settings_gesture_back">返回</string>
|
||||
<string name="dialog_select_color_red">红色</string>
|
||||
<string name="dialog_select_color_blue">蓝色</string>
|
||||
|
@ -193,8 +192,8 @@
|
|||
<string name="dialog_report_bug_button_clipboard">复制到剪贴板</string>
|
||||
<string name="alert_requires_android_v">此功能需要 Android 15 或更高版本。</string>
|
||||
<string name="list_other_toggle_private_space_lock">切换私人空间锁</string>
|
||||
<string name="dialog_consent_accessibility_ok">激活无障碍服务</string>
|
||||
<string name="dialog_consent_accessibility_title">正在激活无障碍服务</string>
|
||||
<string name="dialog_consent_accessibility_ok">激活“无障碍”服务</string>
|
||||
<string name="dialog_consent_accessibility_title">正在激活“无障碍”服务</string>
|
||||
<string name="settings_meta_licenses">开源许可证</string>
|
||||
<string name="legal_info_title">开源许可证</string>
|
||||
<string name="pin_shortcut_switch_visible">在应用列表中显示</string>
|
||||
|
@ -219,8 +218,8 @@
|
|||
有2种方式可以用来锁定屏幕。
|
||||
遗憾的是,两者都有缺点:<br/><br/>
|
||||
|
||||
<h3>通过设置“设备管理应用”</h3>
|
||||
无法和指纹解锁和脸部解锁共同使用。
|
||||
<h3>通过激活“设备管理应用”权限</h3>
|
||||
该方法无法和指纹解锁和脸部解锁共同使用。
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
@ -229,16 +228,16 @@
|
|||
需要更多的权限。
|
||||
μLauncher 将这些权限仅用于锁定屏幕。
|
||||
<br/>
|
||||
(对于任何一个从网上下载的应用所做的类似声明,你都不应该抱持“默认为可信”的态度,你可以并应该检查一下它的<a href=\"https://github.com/jrpie/Launcher\">源代码</a>.)
|
||||
(对于任何一个从网上下载的应用所做的类似声明,你都不应该抱持“默认为可信”的态度,你可以并应该检查一下它的<a href=\"https://github.com/jrpie/Launcher\">源代码</a>.)
|
||||
<br/>
|
||||
在某些设备上,激活辅助功能服务后,启动PIN码将不再用于加密数据。
|
||||
如果遇到该问题,可以通过<a href="https://issuetracker.google.com/issues/37010136#comment36">该方法</a>重新激活启动PIN码用于数据加密。
|
||||
在某些设备上,激活“无障碍”服务后,启动 PIN 码将不再用于加密数据。
|
||||
如果遇到该问题,可以通过<a href="https://issuetracker.google.com/issues/37010136#comment36">该方法</a>重新激活启动 PIN 码用于数据加密。
|
||||
|
||||
<br/><br/><br/><br/>
|
||||
你可以在设置中随时更改这个选项。
|
||||
]]></string>
|
||||
<string name="list_apps_search_hint_no_auto_launch">搜索(不触发自动启动匹配项)</string>
|
||||
<string name="dialog_consent_accessibility_text"><![CDATA[您即将激活“无障碍”服务。这将授予 μLauncher <strong>广泛且重要的权限</strong>。<br/>μLauncher 将这些权限<strong>仅用于锁定屏幕</strong>。µLauncher <strong>绝不会收集任何数据</strong>。尤其是,μLauncher 不会使用“无障碍”服务来收集任何数据。]]></string>
|
||||
<string name="dialog_consent_accessibility_text"><![CDATA[您即将激活“无障碍”服务。这将授予 μLauncher <strong>广泛且重要的权限</strong>。<br/>但 μLauncher <strong>仅会在需要锁定屏幕时</strong>使用这些权限。µLauncher <strong>绝不会收集任何数据</strong>。尤其是,μLauncher 不会使用“无障碍”服务来收集任何数据。]]></string>
|
||||
<string name="settings_gesture_description_swipe_larger">(从)左上 (滑向)中右(滑向)左下</string>
|
||||
<string name="settings_gesture_tap_up">单击 + 上滑</string>
|
||||
<string name="settings_gesture_tap_down">单击 + 下滑</string>
|
||||
|
@ -263,7 +262,7 @@
|
|||
<string name="dialog_report_bug_button_security">报告安全漏洞</string>
|
||||
<string name="dialog_report_bug_security_info">请不要在 Github 上以公开的方式报告安全漏洞,请使用以下方式进行报告:</string>
|
||||
<string name="dialog_report_bug_info">感谢您帮助改进 µLauncher!\n请考虑在您的应用程序错误反馈中添加以下信息:</string>
|
||||
<string name="dialog_consent_accessibility_other_options">我已知晓,还有其他替代方法(使用设备管理员模式或电源按键)。</string>
|
||||
<string name="dialog_consent_accessibility_other_options">我已知晓,还有其他替代方法(激活“设备管理应用”权限或通过电源按键)。</string>
|
||||
<string name="dialog_consent_accessibility_data_collection">我同意 μLauncher 不收集任何数据。</string>
|
||||
<string name="settings_meta_donate">捐赠</string>
|
||||
<string name="list_other_volume_adjust">调整音量</string>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
-->
|
||||
<string name="settings_title">Settings</string>
|
||||
|
||||
<string name="settings_tab_app">Apps</string>
|
||||
<string name="settings_tab_actions">Actions</string>
|
||||
<string name="settings_tab_launcher">Launcher</string>
|
||||
<string name="settings_tab_meta">Meta</string>
|
||||
|
||||
|
@ -85,9 +85,9 @@
|
|||
<string name="settings_gesture_swipe_lambda_reverse">Λ (Reverse)</string>
|
||||
<string name="settings_gesture_description_swipe_lambda_reverse">Bottom right -> top mid -> bottom left</string>
|
||||
|
||||
<string name="settings_gesture_vol_up">Volume Up</string>
|
||||
<string name="settings_gesture_vol_up">Volume Up Key</string>
|
||||
<string name="settings_gesture_description_vol_up">Press the volume up button</string>
|
||||
<string name="settings_gesture_vol_down">Volume Down</string>
|
||||
<string name="settings_gesture_vol_down">Volume Down Key</string>
|
||||
<string name="settings_gesture_description_vol_down">Press the volume down button</string>
|
||||
<string name="settings_gesture_double_click">Double Click</string>
|
||||
<string name="settings_gesture_description_double_click">Double click an empty area</string>
|
||||
|
|
1
fastlane/metadata/android/en-US/changelogs/42.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/42.txt
Normal file
|
@ -0,0 +1 @@
|
|||
* Fixed bug where keyboard does not open automatically
|
1
fastlane/metadata/android/en-US/changelogs/43.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/43.txt
Normal file
|
@ -0,0 +1 @@
|
|||
* Fixed gesture detection in landscape orientation
|
Loading…
Add table
Reference in a new issue