</intent-filter>
</activity>
<activity
+ android:name=".activity.KeyboardShortcutActivityLockDevice"
+ android:label="${appName}"
+ android:documentLaunchMode="always"
+ android:excludeFromRecents="true"
+ android:launchMode="singleTask"
+ android:enabled="false"
+ android:theme="@android:style/Theme.NoDisplay">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+
+ <category android:name="android.intent.category.DEFAULT"/>
+ <category android:name="android.intent.category.APP_CALENDAR" />
+ </intent-filter>
+ </activity>
+ <activity
android:name=".activity.ContextMenuActivity"
android:documentLaunchMode="always"
android:excludeFromRecents="true"
else
getPreferenceScreen().removePreference(findPreference("power_menu"));
+ if(!U.isLibrary(this) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
+ findPreference("lock_device").setOnPreferenceClickListener(this);
+ else
+ getPreferenceScreen().removePreference(findPreference("lock_device"));
+
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
findPreference("file_manager").setOnPreferenceClickListener(this);
else
shouldHideTaskbar = true;
contextMenuFix = false;
break;
+ case "lock_device":
+ U.lockDevice(this);
+
+ showStartMenu = false;
+ shouldHideTaskbar = true;
+ contextMenuFix = false;
+ break;
case "power_menu":
U.sendAccessibilityAction(this, AccessibilityService.GLOBAL_ACTION_POWER_DIALOG);
import android.util.SparseArray;
import android.view.Display;
import android.view.DragEvent;
+import android.view.GestureDetector;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
layout.setFitsSystemWindows(true);
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P
+ && isDesktopIconsEnabled
+ && !U.isLibrary(this)) {
+ final GestureDetector detector = new GestureDetector(this, new GestureDetector.OnGestureListener() {
+ @Override
+ public boolean onSingleTapUp(MotionEvent e) {
+ return false;
+ }
+
+ @Override
+ public void onShowPress(MotionEvent e) {}
+
+ @Override
+ public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
+ return false;
+ }
+
+ @Override
+ public void onLongPress(MotionEvent e) {}
+
+ @Override
+ public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
+ return false;
+ }
+
+ @Override
+ public boolean onDown(MotionEvent e) {
+ return false;
+ }
+ });
+
+ detector.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() {
+ @Override
+ public boolean onDoubleTap(MotionEvent e) {
+ if(!pref.getBoolean("dont_show_double_tap_dialog", false)) {
+ if(pref.getBoolean("double_tap_to_sleep", false)) {
+ U.lockDevice(HomeActivityDelegate.this);
+ } else {
+ AlertDialog.Builder builder = new AlertDialog.Builder(U.wrapContext(HomeActivityDelegate.this));
+ builder.setTitle(R.string.tb_double_tap_to_sleep)
+ .setMessage(R.string.tb_enable_double_tap_to_sleep)
+ .setNegativeButton(pref.getBoolean("double_tap_dialog_shown", false)
+ ? R.string.tb_action_dont_show_again
+ : R.string.tb_action_cancel, (dialog, which) -> pref.edit().putBoolean(pref.getBoolean("double_tap_dialog_shown", false)
+ ? "dont_show_double_tap_dialog"
+ : "double_tap_dialog_shown", true).apply())
+ .setPositiveButton(R.string.tb_action_ok, (dialog, which) -> {
+ pref.edit().putBoolean("double_tap_to_sleep", true).apply();
+ U.lockDevice(HomeActivityDelegate.this);
+ });
+
+ AlertDialog dialog = builder.create();
+ dialog.show();
+ }
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean onDoubleTapEvent(MotionEvent e) {
+ return false;
+ }
+
+ @Override
+ public boolean onSingleTapConfirmed(MotionEvent e) {
+ return false;
+ }
+
+ });
+
+ layout.setOnTouchListener((v, event) -> {
+ detector.onTouchEvent(event);
+
+ return false;
+ });
+ }
+
if((this instanceof HomeActivity ||
this instanceof SecondaryHomeActivity
|| U.isLauncherPermanentlyEnabled(this))
--- /dev/null
+/* Copyright 2019 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.farmerbb.taskbar.activity;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import com.farmerbb.taskbar.util.U;
+
+import java.util.Set;
+
+public class KeyboardShortcutActivityLockDevice extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ if(Intent.ACTION_MAIN.equals(getIntent().getAction())) {
+ Intent selector = getIntent().getSelector();
+ Set<String> categories = selector != null ? selector.getCategories() : getIntent().getCategories();
+
+ if(categories.contains(Intent.CATEGORY_APP_CALENDAR))
+ U.lockDevice(this);
+ }
+
+ finish();
+ }
+}
? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
+
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ ComponentName component6 = new ComponentName(this, KeyboardShortcutActivityLockDevice.class);
+ getPackageManager().setComponentEnabledSetting(component6,
+ pref.getBoolean("keyboard_shortcut", false)
+ ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+ : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ }
}
if(!launcherEnabled)
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.net.Uri;
+import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.preference.CheckBoxPreference;
import com.farmerbb.taskbar.BuildConfig;
import com.farmerbb.taskbar.R;
import com.farmerbb.taskbar.activity.ClearDataActivity;
+import com.farmerbb.taskbar.activity.KeyboardShortcutActivityLockDevice;
import com.farmerbb.taskbar.activity.NavigationBarButtonsActivity;
import com.farmerbb.taskbar.activity.SecondaryHomeActivity;
import com.farmerbb.taskbar.activity.dark.ClearDataActivityDark;
getActivity().getPackageManager().setComponentEnabledSetting(component,
((CheckBoxPreference) p).isChecked() ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
PackageManager.DONT_KILL_APP);
+
+ if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
+ ComponentName component2 = new ComponentName(getActivity(), KeyboardShortcutActivityLockDevice.class);
+ getActivity().getPackageManager().setComponentEnabledSetting(component2,
+ ((CheckBoxPreference) p).isChecked() ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+ PackageManager.DONT_KILL_APP);
+ }
break;
case "dashboard_grid_size":
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
package com.farmerbb.taskbar.util;
import android.Manifest;
+import android.accessibilityservice.AccessibilityService;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.ActivityManager;
return dialog;
}
+ @TargetApi(Build.VERSION_CODES.P)
+ public static void lockDevice(Context context) {
+ sendAccessibilityAction(context, AccessibilityService.GLOBAL_ACTION_LOCK_SCREEN);
+ }
+
public static void sendAccessibilityAction(Context context, int action) {
sendAccessibilityAction(context, action, null);
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="tb_pref_description_keyboard_shortcut">Taskbar starten / anhalten\n - Super + M / Suche + M\n\nGerät sperren\n - Super + L / Suche + L\n\nStartmenü anzeigen\n - Super / Suche\n(Muss in den Einstellungen als Suchassistent festgelegt werden)</string>
+
+</resources>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="tb_pref_description_keyboard_shortcut">Taskbar の開始/停止\n• Winキー+M, 検索+M\n\nデバイスのロック\n• Winキー+L, 検索+L\n\nスタートメニューを表示\n• Winキー, 検索\n(設定で Taskbar を検索アシスタントとして設定が必要)</string>
+
+</resources>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="tb_pref_description_keyboard_shortcut">Taakbalk starten/stoppen:   {fou_social-windows} + M   {fou_magnifying-glass} + M\n\nApparaat vergrendelen:   {fou_social-windows} + L   {fou_magnifying-glass} + L\n\nStartmenu tonen:   {fou_social-windows}   {fou_magnifying-glass}\n(Taakbalk moet hiervoor worden ingesteld als assistent-app in de Instellingen)</string>
+ <string name="tb_pref_description_keyboard_shortcut_alt">Taakbalk starten/stoppen\n• WinKey+M / Search+M\n\nApparaat vergrendelen\n• WinKey+L / Search+L\n\nStartmenu tonen\n• WinKey / Search\n(Taakbalk moet hiervoor worden ingesteld als assistent-app in de Instellingen)</string>
+
+</resources>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="tb_pref_description_keyboard_shortcut">Запуск/остановка Taskbar\n• WinKey+M, Search+M\n\nЗаблокировать устройство\n• WinKey+L, Search+L\n\nПоказать меню\n• WinKey, Search\n(нужно установить Taskbar ассистентом по умолчанию)</string>
+
+</resources>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+<string name="tb_pref_description_keyboard_shortcut">"Taskbar başlat/durdur: {fou_social-windows} + M {fou_magnifying-glass} + M
+
+Cihaz kilitlemr: {fou_social-windows} + L {fou_magnifying-glass} + L
+
+Başlat menüsünü gösterme: {fou_social-windows} {fou_magnifying-glass}
+(ayarlarda Taskbar yardımcı uygulaması olarak ayarlanmasını gerektirir)"</string>
+<string name="tb_pref_description_keyboard_shortcut_alt">"Taskbar başlat/durdur
+• WinKey+M / Search+M
+
+Cihaz kilitle
+• WinKey+L / Search+L
+
+Başlat menüsü gösterme
+• WinKey / Search
+(ayarlarda Taskbar yardımcı uygulaması olarak ayarlanmasını gerektirir)"</string>
+
+</resources>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="tb_pref_description_keyboard_shortcut">Start/stop Taskbar:   {fou_social-windows} + M   {fou_magnifying-glass} + M\n\nLock device:   {fou_social-windows} + L   {fou_magnifying-glass} + L\n\nShow start menu:   {fou_social-windows}   {fou_magnifying-glass}\n(requires Taskbar to be set as the assist app in Settings)</string>
+ <string name="tb_pref_description_keyboard_shortcut_alt">Start/stop Taskbar\n• WinKey+M / Search+M\n\nLock device\n• WinKey+L / Search+L\n\nShow start menu\n• WinKey / Search\n(requires Taskbar to be set as the assist app in Settings)</string>
+
+</resources>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<resources>
+
+ <string name="tb_pref_description_keyboard_shortcut">开始/停止任务栏:   {fou_social-windows} + M   {fou_magnifying-glass} + M\n\n锁定设备:   {fou_social-windows} + L   {fou_magnifying-glass} + L\n\n显示开始菜单:   {fou_social-windows}   {fou_magnifying-glass}\n(需要在设置中将任务栏设为辅助应用)</string>
+ <string name="tb_pref_description_keyboard_shortcut_alt">开始/停止任务栏\n• WinKey+M / Search+M\n\n锁定设备\n• WinKey+L / Search+L\n\n显示开始菜单\n• WinKey / Search\n(requires Taskbar to be set as the assist app in Settings)</string>
+
+</resources>
\ No newline at end of file
android:title="@string/tb_volume" />
<Preference
+ android:key="lock_device"
+ android:title="@string/tb_lock_device" />
+
+ <Preference
android:key="file_manager"
android:title="@string/tb_file_manager" />
</intent-filter>
</activity>
<activity
+ android:name=".activity.KeyboardShortcutActivityLockDevice"
+ android:label="${appName}"
+ android:documentLaunchMode="always"
+ android:excludeFromRecents="true"
+ android:launchMode="singleTask"
+ android:enabled="false"
+ android:theme="@android:style/Theme.NoDisplay">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+
+ <category android:name="android.intent.category.DEFAULT"/>
+ <category android:name="android.intent.category.APP_CALENDAR" />
+ </intent-filter>
+ </activity>
+ <activity
android:name=".activity.ContextMenuActivity"
android:documentLaunchMode="always"
android:excludeFromRecents="true"