From c80bd72a9a415ab51170a499546eb4ca84c4a868 Mon Sep 17 00:00:00 2001 From: hdydgsgg58-svg Date: Sat, 25 Oct 2025 23:27:12 +0300 Subject: [PATCH] Delete app directory@Saw_failure @Ljbenz @deon10x @Wsfilegiver @joinhider_bot @Juandruck008 @bay3061990 @VISHAL_8_4 @Meomeo3991 @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @Robin_Hood_A @Robin_Hood_A @Robin_Hood_A @ryuxx_x @ryuxx_x @ryuxx_x termux-shared/src/main/java/com/termux/shared/termux/TermuxBootstrap.java @ElisjANi @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot +234 704 789 3243 +234 708 798 4256 2 +234 802 255 6021 +234 802 833 6548 +234 810 1219448 +234 810 335 2999 +234 810 645 0269 +234 812 369 6149 +234 813 818 9727 +234 814 6811342 +234 901 372 1277 +234 903 070 5326 +234 903 135 8718 +234 903 735 5234 +234 905 565 8539 +234 906 620 8143 +234 911 0424910 +234 913 852 2703 +234 915 048 1222 +234 915 762 8218 +249 12 201 6587 +252 68 2889084 @FF_KING0011 @ar_ridoy_29 @profv1231 @cbrexpt404 @Grrrooott @Gk_cm @Cepticode @SILIENCE1950 @rxffyq @kertimos @chedidd_othman9 @cost_arb @Rudrokhan1234 @FF_KING0011 @FF_KING0011 @FF_KING0011 @Rudrokhan1234 @Rudrokhan1234 @Rudrokhan1234 @Panicsold @cc3aaa @cc3aaa @Wp_qiuckly_ub @mesteral @TU8RZC @bpass25_25 @RUXANONBLACK @GaNzOry01 @AhmedAlbarouni @batch_7z @kali_100 @V7xAcademy @batch_7z @V7xOfficial @Vairous7x @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @FF_KING0011 @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot @therealyashvirgamingbot --- app/.gitignore | 1 - app/build.gradle | 78 -- app/proguard-rules.pro | 21 - .../ExampleInstrumentedTest.java | 27 - app/src/main/AndroidManifest.xml | 164 --- .../taskerlaunchershortcut/AppsLab.java | 66 -- .../FakeLauncherHome.java | 7 - .../LauncherHomeActivity.java | 38 - .../LauncherHomeFragment.java | 326 ------ .../PluginApplication.java | 67 -- .../ShortcutChooserActivity.java | 77 -- .../ShortcutTypeChooserFragment.java | 212 ---- .../taskerlaunchershortcut/ShortcutsLab.java | 303 ----- .../SingleFragmentActivity.java | 27 - ...aticAndDynamicShortcutChooserFragment.java | 397 ------- .../taskerlaunchershortcut/TaskerPlugin.java | 1041 ----------------- .../bundle/PluginBundleValues.java | 122 -- .../model/AppInfoItem.java | 40 - .../model/ShortcutInfoItem.java | 318 ----- .../receiver/FireReceiver.java | 88 -- .../shortcuts/InstallShortcutReceiver.java | 20 - .../shortcuts/PinShortcutReceiver.java | 19 - .../shortcuts/ShortcutFirer.java | 171 --- .../shortcuts/ShortcutReceiver.java | 187 --- .../ui/activity/EditActivity.java | 209 ---- .../utils/BundleUtils.java | 99 -- .../utils/LauncherUtils.java | 59 - .../taskerlaunchershortcut/utils/Logger.java | 68 -- .../utils/PermissionsUtils.java | 74 -- .../utils/QueryPreferences.java | 38 - .../main/res/drawable-anydpi/ic_search.xml | 11 - app/src/main/res/drawable-hdpi/ic_search.png | Bin 453 -> 0 bytes app/src/main/res/drawable-mdpi/ic_search.png | Bin 229 -> 0 bytes app/src/main/res/drawable-xhdpi/ic_search.png | Bin 401 -> 0 bytes .../main/res/drawable-xxhdpi/ic_search.png | Bin 660 -> 0 bytes app/src/main/res/layout/activity_edit.xml | 38 - app/src/main/res/layout/activity_fragment.xml | 6 - .../res/layout/fragment_launcher_home.xml | 19 - .../layout/fragment_shortcut_type_chooser.xml | 10 - ...nt_static_and_dynamic_shortcut_chooser.xml | 19 - app/src/main/res/layout/list_item_app.xml | 21 - .../main/res/layout/list_item_shortcut.xml | 39 - app/src/main/res/menu/activity_edit.xml | 11 - .../main/res/menu/fragment_launcher_home.xml | 17 - ...nt_static_and_dynamic_shortcut_chooser.xml | 13 - .../res/mipmap-anydpi-v26/ic_launcher.png | Bin 1674 -> 0 bytes .../main/res/mipmap-anydpi-v26/ic_plugin.png | Bin 1674 -> 0 bytes app/src/main/res/mipmap-hdpi/ic_launcher.png | Bin 677 -> 0 bytes app/src/main/res/mipmap-hdpi/ic_plugin.png | Bin 677 -> 0 bytes app/src/main/res/mipmap-mdpi/ic_launcher.png | Bin 427 -> 0 bytes app/src/main/res/mipmap-mdpi/ic_plugin.png | Bin 427 -> 0 bytes app/src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 762 -> 0 bytes app/src/main/res/mipmap-xhdpi/ic_plugin.png | Bin 762 -> 0 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 1326 -> 0 bytes app/src/main/res/mipmap-xxhdpi/ic_plugin.png | Bin 1326 -> 0 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 1674 -> 0 bytes app/src/main/res/mipmap-xxxhdpi/ic_plugin.png | Bin 1674 -> 0 bytes app/src/main/res/values/arrays.xml | 3 - app/src/main/res/values/colors.xml | 6 - app/src/main/res/values/strings.xml | 34 - app/src/main/res/values/styles.xml | 11 - .../ExampleUnitTest.java | 17 - 62 files changed, 4639 deletions(-) delete mode 100644 app/.gitignore delete mode 100644 app/build.gradle delete mode 100644 app/proguard-rules.pro delete mode 100644 app/src/androidTest/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleInstrumentedTest.java delete mode 100644 app/src/main/AndroidManifest.xml delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/AppsLab.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/FakeLauncherHome.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeActivity.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeFragment.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/PluginApplication.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutChooserActivity.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutTypeChooserFragment.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutsLab.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/SingleFragmentActivity.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/StaticAndDynamicShortcutChooserFragment.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/TaskerPlugin.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/bundle/PluginBundleValues.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/AppInfoItem.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/ShortcutInfoItem.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/receiver/FireReceiver.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/InstallShortcutReceiver.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/PinShortcutReceiver.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutFirer.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutReceiver.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ui/activity/EditActivity.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/BundleUtils.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/LauncherUtils.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/Logger.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/PermissionsUtils.java delete mode 100644 app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/QueryPreferences.java delete mode 100644 app/src/main/res/drawable-anydpi/ic_search.xml delete mode 100644 app/src/main/res/drawable-hdpi/ic_search.png delete mode 100644 app/src/main/res/drawable-mdpi/ic_search.png delete mode 100644 app/src/main/res/drawable-xhdpi/ic_search.png delete mode 100644 app/src/main/res/drawable-xxhdpi/ic_search.png delete mode 100644 app/src/main/res/layout/activity_edit.xml delete mode 100644 app/src/main/res/layout/activity_fragment.xml delete mode 100644 app/src/main/res/layout/fragment_launcher_home.xml delete mode 100644 app/src/main/res/layout/fragment_shortcut_type_chooser.xml delete mode 100644 app/src/main/res/layout/fragment_static_and_dynamic_shortcut_chooser.xml delete mode 100644 app/src/main/res/layout/list_item_app.xml delete mode 100644 app/src/main/res/layout/list_item_shortcut.xml delete mode 100644 app/src/main/res/menu/activity_edit.xml delete mode 100644 app/src/main/res/menu/fragment_launcher_home.xml delete mode 100644 app/src/main/res/menu/fragment_static_and_dynamic_shortcut_chooser.xml delete mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_plugin.png delete mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-hdpi/ic_plugin.png delete mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-mdpi/ic_plugin.png delete mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xhdpi/ic_plugin.png delete mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xxhdpi/ic_plugin.png delete mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.png delete mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_plugin.png delete mode 100644 app/src/main/res/values/arrays.xml delete mode 100644 app/src/main/res/values/colors.xml delete mode 100644 app/src/main/res/values/strings.xml delete mode 100644 app/src/main/res/values/styles.xml delete mode 100644 app/src/test/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleUnitTest.java diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index bfa7fd4..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,78 +0,0 @@ -apply plugin: 'com.android.application' - -// Load keystore.properties file that contains info of the signing key for release build apks -// The keystore.properties file should exist in the root directory of the project (not app directory) -// It must have the following 4 values in the format: -// storeFile= -// storePassword= -// keyAlias= -// keyPassword= -// Remove the following keystoreProperties* lines, signingConfigs release section and signingConfig line in -// buildTypes release section below if you do not want to sign with your own special key and want to use defaults -def keystorePropertiesFile = rootProject.file("keystore.properties") -def keystoreProperties = new Properties() -keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) - -android { - compileSdkVersion 29 - buildToolsVersion "29.0.2" - defaultConfig { - applicationId "com.agnostic.apollo.taskerlaunchershortcut" - minSdkVersion 16 - targetSdkVersion 29 - versionCode 1 - versionName "1.1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - signingConfigs { - release { - storeFile file(keystoreProperties['storeFile']) - storePassword keystoreProperties['storePassword'] - keyAlias keystoreProperties['keyAlias'] - keyPassword keystoreProperties['keyPassword'] - } - } - buildTypes { - release { - minifyEnabled false - useProguard false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - } - } -} - -dependencies { - implementation fileTree(dir: 'libs', include: ['*.jar']) - - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test:runner:1.2.0' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' - - implementation fileTree(dir: 'libs', include: ['*.jar']) - - - implementation 'androidx.appcompat:appcompat:1.1.0' - implementation 'androidx.recyclerview:recyclerview:1.1.0' - implementation "androidx.annotation:annotation:1.1.0" - - implementation group:'net.jcip', name:'jcip-annotations', version:"1.0" - - // Import com.twofortyfouram locale plugin library directories stored in root directory of project for targetSdkVersion 29 - implementation project(':annotationLib') - implementation project(':assertionLib') - implementation project(':pluginApiLib') - implementation project(':pluginClientSdkLib') - implementation project(':pluginHostSdkLib') - implementation project(':spackleLib') - //androidTestImplementation project(':testLib') - - // Import com.twofortyfouram locale plugin libraries from official repository for targetSdkVersion 25 - //implementation group:'com.twofortyfouram', name:'android-annotation', version:'[3.0.0,4.0[' - //implementation group:'com.twofortyfouram', name:'android-assertion', version:'[2.0.0,3.0)' - //implementation group:'com.twofortyfouram', name:'android-plugin-api-for-locale', version:'[1.0.2,2.0[' - //implementation group:'com.twofortyfouram', name:'android-plugin-client-sdk-for-locale', version:'[4.0.3, 5.0[' - //implementation group:'com.twofortyfouram', name:'android-plugin-host-sdk-for-locale', version:'[2.0.3,3.0[' - //implementation group:'com.twofortyfouram', name:'android-spackle', version:'[2.0.0,4.0[' - //androidTestImplementation group:'com.twofortyfouram', name:'android-test', version:'[6.0.1,7.0)' -} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/app/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/app/src/androidTest/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleInstrumentedTest.java deleted file mode 100644 index 6596911..0000000 --- a/app/src/androidTest/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleInstrumentedTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - - assertEquals("com.agnostic.apollo.taskerlaunchershortcut", appContext.getPackageName()); - } -} diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml deleted file mode 100644 index a432e2c..0000000 --- a/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/AppsLab.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/AppsLab.java deleted file mode 100644 index b46c245..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/AppsLab.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.database.sqlite.SQLiteDatabase; -import com.agnostic.apollo.taskerlaunchershortcut.model.AppInfoItem; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - - -public class AppsLab { - - private static AppsLab sAppsLab; - private Context mContext; - private SQLiteDatabase mDatabase; - - public static AppsLab get(Context context) { - if (sAppsLab == null) { - sAppsLab = new AppsLab(context); - } - return sAppsLab; - } - private AppsLab(Context context) - { - mContext = context.getApplicationContext(); - } - - public List getApps() - { - - PackageManager pm = mContext.getPackageManager(); - List apps = new ArrayList<>(); - - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_LAUNCHER); - - List allApps = pm.queryIntentActivities(intent, 0); - for(ResolveInfo resolveInfo:allApps) { - AppInfoItem app = new AppInfoItem(); - app.setLabel(resolveInfo.loadLabel(pm)); - app.setPackageName(resolveInfo.activityInfo.packageName); - app.setIcon(resolveInfo.activityInfo.loadIcon(pm)); - apps.add(app); - } - - Collections.sort(apps); - - return apps; - } - - public List searchAppsByName(String search) - { - List apps = getApps(); - List matchedApps = new ArrayList<>(); - - for(AppInfoItem app:apps) { - if(app.getLabel().toString().toLowerCase().contains(search.toLowerCase())) - matchedApps.add(app); - } - return matchedApps; - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/FakeLauncherHome.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/FakeLauncherHome.java deleted file mode 100644 index c6457c6..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/FakeLauncherHome.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.app.Activity; - -public class FakeLauncherHome extends Activity { - -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeActivity.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeActivity.java deleted file mode 100644 index 64a0cfa..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeActivity.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.content.Context; -import android.content.Intent; - -import androidx.fragment.app.Fragment; - -public class LauncherHomeActivity extends SingleFragmentActivity { - - public static final String ARG_SHORTCUT_INTENT_URI = "arg_shortcut_intent_uri"; - public static final String ARG_FIRE_INTENT_FROM_HOST = "arg_fire_intent_from_host"; - public static final String ACTION_FIRE_SHORTCUT_INTENT_URI = "action_fire_shortcut_intent_uri"; - - public static Intent newFireShortcutIntentUriIntent(Context context, String shortcutIntentUri, Intent fireIntentFromHost) { - //Logger.logDebug(context, "Creating Intent For: \"" + shortcutIntentUri + "\""); - Intent newIntent = new Intent(context, LauncherHomeActivity.class); - newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY); - newIntent.setAction(ACTION_FIRE_SHORTCUT_INTENT_URI); - newIntent.putExtra(ARG_SHORTCUT_INTENT_URI, shortcutIntentUri); - newIntent.putExtra(ARG_FIRE_INTENT_FROM_HOST, fireIntentFromHost); - return newIntent; - } - - @Override - public void onNewIntent(Intent intent) { - super.onNewIntent(intent); - setIntent(intent); - - LauncherHomeFragment fragment = (LauncherHomeFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container); - if(fragment!=null) - fragment.updateUI(); - } - - @Override - protected Fragment createFragment() { - return LauncherHomeFragment.newInstance(); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeFragment.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeFragment.java deleted file mode 100644 index 1a470c6..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/LauncherHomeFragment.java +++ /dev/null @@ -1,326 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.widget.ImageView; -import android.widget.TextView; - -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.SearchView; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import java.util.List; - -import com.agnostic.apollo.taskerlaunchershortcut.model.AppInfoItem; -import com.agnostic.apollo.taskerlaunchershortcut.shortcuts.ShortcutFirer; -import com.agnostic.apollo.taskerlaunchershortcut.utils.LauncherUtils; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; - -import static com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity.ACTION_FIRE_SHORTCUT_INTENT_URI; -import static com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity.ARG_SHORTCUT_INTENT_URI; - - -public class LauncherHomeFragment extends Fragment { - - private RecyclerView mAppsRecyclerView; - private TextView mAppsTextView; - private AppsAdapter mAppsAdapter; - private String mQuery; - private FragmentActivity mContext; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - - mContext = getActivity(); - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_launcher_home, container, false); - - mAppsRecyclerView = (RecyclerView) view.findViewById(R.id.apps_recycler_view); - mAppsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); - - mAppsTextView = (TextView) view.findViewById(R.id.empty_view); - - updateUI(); - return view; - } - - @Override - public void onResume() { - super.onResume(); - updateUI(); - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - inflater.inflate(R.menu.fragment_launcher_home, menu); - - MenuItem searchItem = menu.findItem(R.id.menu_item_search); - final SearchView searchView = (SearchView) searchItem.getActionView(); - searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { - @Override - public boolean onQueryTextSubmit(String s) { - mQuery=s; - updateUI(); - return true; - } - @Override - public boolean onQueryTextChange(String s) { - return false; - } - }); - - searchView.setOnSearchClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - searchView.setQuery(mQuery, false); - } - }); - - searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() - { - @Override - public boolean onMenuItemActionCollapse(MenuItem item) - { - mQuery=null; - updateUI(); - return true; // Return true to collapse action view - } - - @Override - public boolean onMenuItemActionExpand(MenuItem item) - { - return true; - } - }); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_item_change_launcher: - LauncherUtils.changeDefaultLauncherInitiate(mContext); - return true; - case R.id.menu_item_search_shortcuts: - startActivity(ShortcutChooserActivity.newShortcutTypeChooserIntent(mContext).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - return true; - default: - return super.onOptionsItemSelected(item); - } - } - - protected void updateUI() { - - processIntent(); - - AppsLab appsLab = AppsLab.get(mContext); - List apps; - if(mQuery==null) - apps = appsLab.getApps(); - else - apps = appsLab.searchAppsByName(mQuery); - - if (mAppsAdapter == null) { - mAppsAdapter = new AppsAdapter(apps); - mAppsRecyclerView.setAdapter(mAppsAdapter); - } else { - mAppsAdapter.setApps(apps); - mAppsAdapter.notifyDataSetChanged(); - //mAdapter.notifyItemChanged(mAdapter.getPosition()); - } - - int appsSize = apps.size(); - - if (appsSize==0) { - mAppsRecyclerView.setVisibility(View.GONE); - mAppsTextView.setVisibility(View.VISIBLE); - } - else { - mAppsRecyclerView.setVisibility(View.VISIBLE); - mAppsTextView.setVisibility(View.GONE); - } - - updateSubtitle(); - } - - private void updateSubtitle() { - - if(mContext==null) - return; - - AppsLab appsLab = AppsLab.get(mContext); - - int appsSize = mAppsAdapter.getItemCount(); - String subtitle = getResources() - .getQuantityString(R.plurals.subtitle_apps_plural, appsSize, appsSize); - - AppCompatActivity activity = (AppCompatActivity) getActivity(); - if(activity!=null) { - ActionBar actionBar = activity.getSupportActionBar(); - if(actionBar!=null) - actionBar.setSubtitle(subtitle); - } - } - - private void processIntent() { - if(mContext==null) - return; - - Intent intent = mContext.getIntent(); - if (intent != null) { - Logger.logDebug(mContext, "Processing Intent To LauncherHome: \"" + intent.toString()); - - if (intent.getAction() != null) { - if (intent.getAction().equals(ACTION_FIRE_SHORTCUT_INTENT_URI)) - ShortcutFirer.fireShortcutIntentUriIntent(mContext, intent); - cancelFireShortcutIntentUriIntent(intent); - } - } - } - - private void cancelFireShortcutIntentUriIntent(Intent intent) { - if(mContext==null) - return; - - if(intent!=null) { - //cancel already received intent - intent.putExtra(ARG_SHORTCUT_INTENT_URI, ""); - mContext.setIntent(intent); - } - - } - - private class AppsHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - - private TextView mLabelTextView; - private ImageView mIconImageView; - private AppInfoItem mApp; - private AppsAdapter mAdapter; - int imageViewWidth=0; - int imageViewHeight=0; - - public AppsHolder(View itemView, AppsAdapter adaptor ) { - super(itemView); - mLabelTextView = (TextView) - itemView.findViewById(R.id.list_item_app_label); - mIconImageView = (ImageView) - itemView.findViewById(R.id.list_item_app_icon); - final ViewTreeObserver vto = mIconImageView.getViewTreeObserver(); - vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - - imageViewWidth = mIconImageView.getWidth(); - imageViewHeight = mIconImageView.getHeight(); - mIconImageView.setImageDrawable(mApp.getIcon()); - - //Then remove layoutChange Listener - ViewTreeObserver vto = mIconImageView.getViewTreeObserver(); - vto.removeOnGlobalLayoutListener(this); - } - }); - - itemView.setOnClickListener(this); - mAdapter=adaptor; - } - - public void bindApp(AppInfoItem app) { - mApp = app; - mLabelTextView.setText(mApp.getLabel()); - mIconImageView.setImageDrawable(mApp.getIcon()); - } - - @Override - public void onClick(View v) { - mAdapter.setPosition(getAdapterPosition()); - - Context context = v.getContext(); - - Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(mApp.getPackageName().toString()); - startActivity(launchIntent); - } - } - - private class AppsAdapter extends RecyclerView.Adapter { - - private List mApps; - - private int position; - - public AppsAdapter(List apps) { - mApps = apps; - } - - @Override - public AppsHolder onCreateViewHolder(ViewGroup parent, int viewType) { - LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); - View view = layoutInflater - .inflate(R.layout.list_item_app, parent, false); - return new AppsHolder(view,this); - } - - @Override - public void onBindViewHolder(AppsHolder holder, int position) { - AppInfoItem app = mApps.get(position); - holder.bindApp(app); - } - - @Override - public int getItemCount() { - return mApps.size(); - } - - public void setApps(List apps) { - mApps = apps; - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (resultCode != Activity.RESULT_OK) { - return; - } - - updateUI(); - } - - public static LauncherHomeFragment newInstance() { - Bundle args = new Bundle(); - LauncherHomeFragment fragment = new LauncherHomeFragment(); - return fragment; - } - -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/PluginApplication.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/PluginApplication.java deleted file mode 100644 index 41f8a0b..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/PluginApplication.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * android-toast-setting-plugin-for-locale - * Copyright 2014 two forty four a.m. LLC - * - * 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.agnostic.apollo.taskerlaunchershortcut; - -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; -import com.twofortyfouram.log.Lumberjack; - -import android.app.Application; - -/** - * Implements an application object for the plug-in. - */ -/* - * This application is non-essential for the plug-in's operation; it simply enables debugging - * options globally for the app. - */ -public final class PluginApplication extends Application { - - // uncaught exception handler variable - private Thread.UncaughtExceptionHandler defaultUncaughtExceptionHandler; - - @Override - public void onCreate() { - super.onCreate(); - - _setDefaultUncaughtExceptionHandler(); - - Lumberjack.init(getApplicationContext()); - } - - private void _setDefaultUncaughtExceptionHandler() { - super.onCreate(); - - // handler listener - Thread.UncaughtExceptionHandler _uncaughtExceptionHandler = new Thread.UncaughtExceptionHandler() { - @Override - public void uncaughtException(final Thread thread, final Throwable e) { - Logger.logStackTrace(getApplicationContext(), new Exception(e)); - Logger.logError(getApplicationContext(), "Uncaught Exception caught: " + e.getMessage()); - - if(thread!=null && defaultUncaughtExceptionHandler!=null) { - // re-throw critical exception further to the os (important) - defaultUncaughtExceptionHandler.uncaughtException(thread, e); - } - } - }; - - // setup handler for uncaught exception - defaultUncaughtExceptionHandler = Thread.getDefaultUncaughtExceptionHandler(); - Thread.setDefaultUncaughtExceptionHandler(_uncaughtExceptionHandler); - - Lumberjack.init(getApplicationContext()); - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutChooserActivity.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutChooserActivity.java deleted file mode 100644 index 517412a..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutChooserActivity.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.app.Activity; -import android.content.ClipData; -import android.content.ClipboardManager; -import android.content.Context; -import android.content.Intent; - -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; - -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; - -public class ShortcutChooserActivity extends SingleFragmentActivity { - - public static final String ARG_SHORTCUT_INTENT_URI = "arg_shortcut_intent_uri"; - public static final String ACTION_CHOOSE_SHORTCUT = "action_choose_shortcut"; - public static final int REQUEST_CHOOSE_SHORTCUT = 0; - public static final int REQUEST_CREATE_SHORTCUT = 1; - public static final String CHOOSE_SHORTCUT_RETURN_STATE = "choose_shortcut_return_state"; - public static final int CHOOSE_SHORTCUT_RETURN_STATE_SUCCESS = 0; - public static final int CHOOSE_SHORTCUT_RETURN_STATE_FAILED = 0; - - public static Intent newShortcutTypeChooserIntent(Context context) { - Intent newIntent = new Intent(context, ShortcutChooserActivity.class); - newIntent.setAction(ACTION_CHOOSE_SHORTCUT); - newIntent.setFlags(Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); - return newIntent; - } - - public static void returnShortcutIntentUri(FragmentActivity context, String shortcutIntentUri) { - if(context == null || shortcutIntentUri==null) - return; - - Logger.logDebug(context, "Returning Shortcut Intent Uri From ShortcutChooserActivity: \"" + shortcutIntentUri + "\""); - Logger.showToast(context, "Shortcut Intent Uri: \"" + shortcutIntentUri + "\""); - - if(context.getCallingActivity()!=null) { - - Intent resultIntent = new Intent(); - resultIntent.putExtra(CHOOSE_SHORTCUT_RETURN_STATE, CHOOSE_SHORTCUT_RETURN_STATE_SUCCESS); - resultIntent.putExtra(ARG_SHORTCUT_INTENT_URI, shortcutIntentUri); - context.setResult(Activity.RESULT_OK, resultIntent); - context.finish(); - } else { - ClipboardManager clipboard = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE); - if (clipboard != null) { - clipboard.setPrimaryClip(ClipData.newPlainText("text", shortcutIntentUri)); - Logger.showToast(context, "Shortcut Uri Copied To Clipboard"); - } - } - } - - public static void cancel(FragmentActivity context) { - Intent resultIntent = new Intent(); - resultIntent.putExtra(CHOOSE_SHORTCUT_RETURN_STATE, CHOOSE_SHORTCUT_RETURN_STATE_FAILED); - if(context!=null) { - context.setResult(Activity.RESULT_OK, resultIntent); - context.finish(); - } - } - - @Override - public void onNewIntent(Intent intent) { - super.onNewIntent(intent); - setIntent(intent); - - ShortcutTypeChooserFragment fragment = (ShortcutTypeChooserFragment) getSupportFragmentManager().findFragmentById(R.id.fragment_container); - if(fragment!=null) - fragment.updateUI(); - } - - @Override - protected Fragment createFragment() { - return ShortcutTypeChooserFragment.newInstance(); - } -} \ No newline at end of file diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutTypeChooserFragment.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutTypeChooserFragment.java deleted file mode 100644 index fd380e3..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutTypeChooserFragment.java +++ /dev/null @@ -1,212 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.app.Activity; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.os.Build; -import android.os.Bundle; -import android.provider.Settings; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; - -import android.widget.ListView; - -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; - -import com.agnostic.apollo.taskerlaunchershortcut.utils.LauncherUtils; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; -import com.agnostic.apollo.taskerlaunchershortcut.utils.PermissionsUtils; -import com.agnostic.apollo.taskerlaunchershortcut.utils.QueryPreferences; - -import java.util.ArrayList; -import java.util.List; - -import static com.agnostic.apollo.taskerlaunchershortcut.utils.PermissionsUtils.ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE; - -public class ShortcutTypeChooserFragment extends Fragment { - - private ListView mShortcutTypesListView; - private FragmentActivity mContext; - - public static final String ARG_SHORTCUT_TYPE = "arg_shortcut_type"; - public static final String SHORTCUT_TYPE_STATIC = "Static Shortcut"; - public static final String SHORTCUT_TYPE_DYNAMIC = "Dynamic Shortcut"; - public static final String SHORTCUT_TYPE_PINNED = "Pinned Shortcut"; - private String mShortcutIntentUri; - - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - - mContext = getActivity(); - QueryPreferences.setPinnedShortcutIntentUri(mContext, ""); - - boolean permissionsGranted = true; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) - permissionsGranted = PermissionsUtils.checkSystemAlertWindowPermission(mContext); - - if(!permissionsGranted) { - Logger.showToast(mContext, "Apps Require SYSTEM_ALERT_WINDOW Permission To Start Activities From Background For Android>=10"); - PermissionsUtils.askSystemAlertWindowPermission(mContext); - } - - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_shortcut_type_chooser, container, false); - - if(mContext == null) - return view; - - List shortcutTypesArray= new ArrayList<>(); - shortcutTypesArray.add(SHORTCUT_TYPE_STATIC); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) - shortcutTypesArray.add(SHORTCUT_TYPE_DYNAMIC); - shortcutTypesArray.add(SHORTCUT_TYPE_PINNED); - - mShortcutTypesListView = (ListView) view.findViewById(R.id.shortcut_types_list_view); - ArrayAdapter shortcutTypesAdapter = new ArrayAdapter(mContext, android.R.layout.simple_list_item_1, shortcutTypesArray); - mShortcutTypesListView.setAdapter(shortcutTypesAdapter); - mShortcutTypesListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView adapter, View view, int position, long id) { - String selectedShortcutType = (String)adapter.getItemAtPosition(position); - Logger.logDebug(mContext, "Selected Shortcut Type: \"" + selectedShortcutType + "\""); - setFragment(selectedShortcutType); - } - }); - - updateUI(); - return view; - } - - @Override - public void onResume() { - super.onResume(); - - String shortcutIntentUri = QueryPreferences.getPinnedShortcutIntentUri(mContext); - if (shortcutIntentUri != null && !shortcutIntentUri.isEmpty()) { - ShortcutChooserActivity.returnShortcutIntentUri(mContext, shortcutIntentUri); - QueryPreferences.setPinnedShortcutIntentUri(mContext, ""); - } - - updateUI(); - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - } - - protected void updateUI() { - - processIntent(); - - } - - private void setFragment(String selectedShortcutType) { - if(mContext == null) - return; - - Fragment fragment; - - if (selectedShortcutType.equals(SHORTCUT_TYPE_STATIC)) { - fragment = StaticAndDynamicShortcutChooserFragment.newInstance(selectedShortcutType); - } else if (selectedShortcutType.equals(SHORTCUT_TYPE_DYNAMIC)) { - if(!LauncherUtils.isMyAppLauncherDefault(mContext)) { - Logger.logDebugAndShowToast(mContext, "Dynamic Shortcuts Can Only Be Queried By Default Launcher App"); - Logger.logDebugAndShowToast(mContext, "Set TaskerLauncherShortcut As Default Launcher And Try Again"); - LauncherUtils.changeDefaultLauncherInitiate(mContext); - return; - } - - fragment = StaticAndDynamicShortcutChooserFragment.newInstance(selectedShortcutType); - } else if (selectedShortcutType.equals(SHORTCUT_TYPE_PINNED)) { - if(!LauncherUtils.isMyAppLauncherDefault(mContext)) { - Logger.logDebugAndShowToast(mContext, "Pinned Shortcuts Can Only Be Received By The Default Launcher App"); - Logger.logDebugAndShowToast(mContext, "Set TaskerLauncherShortcut As Default Launcher And Try Again"); - LauncherUtils.changeDefaultLauncherInitiate(mContext); - return; - } else { - mShortcutIntentUri=null; - QueryPreferences.setPinnedShortcutIntentUri(mContext, ""); - Logger.showToast(mContext, "Go To Desired App And Create Shortcut With An Option Like \"Add To Home screen\""); - LauncherUtils.startLauncherHome(mContext); - return; - } - //fragment = PinnedShortcutChooserFragment.newInstance(); - } else { - Logger.logError(mContext, "Unknown Selected Shortcut Type: \"" + selectedShortcutType + "\""); - return; - } - - mContext.getSupportFragmentManager().beginTransaction() - .replace(R.id.fragment_container, fragment) - .commitAllowingStateLoss(); - - } - - private void processIntent() { - if(mContext == null) - return; - - Intent intent = mContext.getIntent(); - if (intent != null) { - } - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - if (resultCode != Activity.RESULT_OK) { - return; - } - - if (requestCode == ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - //permission granted - if (PermissionsUtils.checkSystemAlertWindowPermission(mContext)) { - Logger.showToast(mContext, "Permissions Granted"); - } else { // permission not granted - Logger.showToast(mContext, "Permissions Not Granted"); - try {Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();} - ShortcutChooserActivity.cancel(mContext); - } - } - } - updateUI(); - } - - @Override - public void onRequestPermissionsResult(int requestCode, - String permissions[], int[] grantResults) { - super.onRequestPermissionsResult(requestCode, permissions, grantResults); - switch (requestCode) { - case 0: { - if (grantResults.length > 0 //permission granted - && grantResults[0] == PackageManager.PERMISSION_GRANTED) { - Logger.showToast(mContext, "Permissions Granted"); - } else { // permission not granted - Logger.showToast(mContext, "Permissions Not Granted"); - try {Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();} - ShortcutChooserActivity.cancel(mContext); - } - return; - } - } - } - - public static ShortcutTypeChooserFragment newInstance() { - Bundle args = new Bundle(); - ShortcutTypeChooserFragment fragment = new ShortcutTypeChooserFragment(); - return fragment; - } - -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutsLab.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutsLab.java deleted file mode 100644 index 463137d..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ShortcutsLab.java +++ /dev/null @@ -1,303 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.ApplicationInfo; -import android.content.pm.LauncherApps; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.content.pm.ShortcutInfo; -import android.database.sqlite.SQLiteDatabase; -import android.graphics.drawable.Drawable; -import android.os.Build; -import android.os.Parcel; -import android.os.Process; -import android.os.UserHandle; -import android.util.DisplayMetrics; - -import androidx.annotation.RequiresApi; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import com.agnostic.apollo.taskerlaunchershortcut.model.ShortcutInfoItem; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; - -import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK; -import static android.content.Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED; -import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC; -import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_MANIFEST; -import static android.content.pm.LauncherApps.ShortcutQuery.FLAG_MATCH_PINNED; - - -public class ShortcutsLab { - - private static ShortcutsLab sShortcutsLab; - private Context mContext; - private SQLiteDatabase mDatabase; - - public static final String TYPE_STATIC_SHORTCUTS = "static_shortcuts"; - public static final String TYPE_DYNAMIC_SHORTCUTS = "dynamic_shortcuts"; - public static final String TYPE_PINNED_SHORTCUTS = "pinned_shortcuts"; - public static final String TYPE_ALL_SHORTCUTS = "all_shortcuts"; - - public static ShortcutsLab get(Context context) { - if (sShortcutsLab == null) { - sShortcutsLab = new ShortcutsLab(context); - } - return sShortcutsLab; - } - private ShortcutsLab(Context context) - { - mContext = context.getApplicationContext(); - } - - public List getStaticShortcuts(String packageName) - { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { - List shortcuts = new ArrayList<>(); - shortcuts.addAll(getStaticShortcutsFromPackageManager(packageName)); - shortcuts.addAll(getShortcutsFromShortcutManager(TYPE_STATIC_SHORTCUTS, packageName)); - Collections.sort(shortcuts); - return shortcuts; - } - else - return getStaticShortcutsFromPackageManager(packageName); - } - - public List getDynamicShortcuts(String packageName) - { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) - return getShortcutsFromShortcutManager(TYPE_DYNAMIC_SHORTCUTS, packageName); - else - return new ArrayList<>(); - } - - public List getPinnedShortcuts(String packageName) - { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) - return getShortcutsFromShortcutManager(TYPE_PINNED_SHORTCUTS, packageName); - else - return new ArrayList<>(); - } - - @RequiresApi(api = Build.VERSION_CODES.N_MR1) - private List getShortcutsFromShortcutManager(String type, String packageName) { - PackageManager pm = mContext.getPackageManager(); - LauncherApps launcherApps = (LauncherApps) mContext.getSystemService(Context.LAUNCHER_APPS_SERVICE); - - List shortcuts = new ArrayList<>(); - - if(launcherApps==null) { - Logger.logError(mContext, "LAUNCHER_APPS_SERVICE is Unexpectedly Null"); - return shortcuts; - } - // Only the default launcher is allowed to start shortcuts - if (!launcherApps.hasShortcutHostPermission()) { - Logger.logError(mContext, "Calling ShortcutsLab.getShortcutsFromShortcutManager(), but does not have launcherApps.hasShortcutHostPermission()"); - return shortcuts; - } - - LauncherApps.ShortcutQuery query = new LauncherApps.ShortcutQuery(); - - if(packageName!=null && !packageName.isEmpty()) - query.setPackage(packageName); - - if(type.equals(TYPE_STATIC_SHORTCUTS)) - query.setQueryFlags(FLAG_MATCH_MANIFEST); - else if(type.equals(TYPE_DYNAMIC_SHORTCUTS)) - query.setQueryFlags(FLAG_MATCH_DYNAMIC); - else if(type.equals(TYPE_PINNED_SHORTCUTS)) - query.setQueryFlags(FLAG_MATCH_PINNED); - else if(type.equals(TYPE_ALL_SHORTCUTS)) - query.setQueryFlags(FLAG_MATCH_MANIFEST | FLAG_MATCH_DYNAMIC | FLAG_MATCH_PINNED); - else - return shortcuts; - - List userHandles = new ArrayList<>(); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) - userHandles = launcherApps.getProfiles(); - else { - - userHandles.add(Process.myUserHandle()); - } - - List shortcutInfos = new ArrayList<>(); - - for (UserHandle userHandle : userHandles) { - List currentShortcutInfos = launcherApps.getShortcuts(query, userHandle); - if (currentShortcutInfos != null && currentShortcutInfos.size() > 0) { - shortcutInfos.addAll(currentShortcutInfos); - } - } - - for (ShortcutInfo shortcutInfo : shortcutInfos) { - ShortcutInfoItem shortcut = new ShortcutInfoItem(); - - if(!shortcutInfo.isEnabled()) - continue; - - shortcut.setId(shortcutInfo.getId()); - shortcut.setShortLabel(shortcutInfo.getShortLabel()); - shortcut.setLongLabel(shortcutInfo.getLongLabel()); - shortcut.setAppLabel(getAppLabelFromComponentName(mContext, shortcutInfo.getActivity())); - shortcut.setActivity(shortcutInfo.getActivity()); - shortcut.setUserHandle(shortcutInfo.getUserHandle()); - int userId = getUserIdFromShortcutInfo(shortcutInfo); - shortcut.setUserId(userId); - shortcut.setIcon(launcherApps.getShortcutIconDrawable(shortcutInfo, DisplayMetrics.DENSITY_DEFAULT)); - if(shortcutInfo.getIntent()!=null) { - Intent[] intents = shortcutInfo.getIntents(); - shortcut.setIntents(intents); - } - shortcut.setExtras(shortcutInfo.getExtras()); - shortcuts.add(shortcut); - } - - Collections.sort(shortcuts); - - return shortcuts; - } - - private List getStaticShortcutsFromPackageManager(String packageName) { - PackageManager pm = mContext.getPackageManager(); - List shortcuts = new ArrayList<>(); - - Intent intent = new Intent(Intent.ACTION_CREATE_SHORTCUT); - - List allApps = pm.queryIntentActivities(intent, 0); - for(ResolveInfo resolveInfo:allApps) { - - ShortcutInfoItem shortcut = new ShortcutInfoItem(); - ComponentName componentName = new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name); - - if(packageName!=null && !packageName.isEmpty() && !packageName.equals(componentName.getPackageName())) - continue; - - shortcut.setId(resolveInfo.loadLabel(pm).toString().replace(" ", "-")); - shortcut.setShortLabel(resolveInfo.loadLabel(pm)); - shortcut.setAppLabel(getAppLabelFromComponentName(mContext, componentName)); - shortcut.setActivity(componentName); - shortcut.setIcon(resolveInfo.activityInfo.loadIcon(pm)); - shortcut.setIntent(new Intent(Intent.ACTION_CREATE_SHORTCUT) - .setComponent(componentName)); - shortcuts.add(shortcut); - } - - Collections.sort(shortcuts); - - return shortcuts; - } - - public List searchShortcuts(List shortcuts, String search) - { - List matchedShortcuts = new ArrayList<>(); - - for(ShortcutInfoItem shortcut:shortcuts) { - if(shortcut.getShortLabel().toString().toLowerCase().contains(search.toLowerCase()) || - shortcut.getIntent().toString().toLowerCase().contains(search.toLowerCase())) - matchedShortcuts.add(shortcut); - } - return matchedShortcuts; - } - - public static String getAppLabelFromComponentName(Context context, ComponentName componentName) { - if(componentName==null) - return ""; - - try { - PackageManager pm = context.getPackageManager(); - ApplicationInfo info = pm.getApplicationInfo(componentName.getPackageName(), PackageManager.GET_META_DATA); - return (String) pm.getApplicationLabel(info); - } catch (PackageManager.NameNotFoundException e) { - Logger.logStackTrace(context, e); - return ""; - } - } - - private Drawable getActivityIcon(ComponentName componentName) { - if(componentName==null) - return null; - - PackageManager pm = mContext.getPackageManager(); - - Intent intent = new Intent(); - intent.setComponent(componentName); - ResolveInfo resolveInfo = pm.resolveActivity(intent, 0); - - if (resolveInfo != null) - return resolveInfo.loadIcon(pm); - else - return null; - } - - public Intent createDeepShortcutFromShortcutInfoItem(ShortcutInfoItem shortcutInfo) { - Intent intent = new Intent(); - intent.setAction("android.intent.action.MAIN"); - intent.addCategory("com.android.launcher3.DEEP_SHORTCUT"); - ComponentName componentName = shortcutInfo.getActivity(); - if(componentName!=null) { - intent.setComponent(componentName); - intent.setPackage(componentName.getPackageName()); - } else - return null; - - intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); - intent.putExtra("shortcut_id", shortcutInfo.getId()); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - intent.putExtra("profile", shortcutInfo.getUserId()); - } else - intent.putExtra("profile", "-1"); - - return intent; - } - - @RequiresApi(api = Build.VERSION_CODES.N_MR1) - public Intent createDeepShortcutFromShortcutInfo(ShortcutInfo shortcutInfo) { - Intent intent = new Intent(); - intent.setAction("android.intent.action.MAIN"); - intent.addCategory("com.android.launcher3.DEEP_SHORTCUT"); - intent.setComponent(shortcutInfo.getActivity()); - intent.setPackage(shortcutInfo.getPackage()); - intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); - intent.putExtra("shortcut_id", shortcutInfo.getId()); - int userId = getUserIdFromShortcutInfo(shortcutInfo); - intent.putExtra("profile", userId); - return intent; - } - - public Intent createStaticShortcutFromShortcutInfoItemAndExtras(ShortcutInfoItem shortcutInfo, Intent extras_intent) { - Intent intent = new Intent(); - intent.setAction("android.intent.action.MAIN"); - intent.addCategory("com.android.launcher3.DEEP_SHORTCUT"); - ComponentName componentName = shortcutInfo.getActivity(); - if(componentName!=null) { - intent.setComponent(componentName); - intent.setPackage(componentName.getPackageName()); - } else - return null; - - intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); - intent.putExtra("shortcut_id", shortcutInfo.getId()); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { - intent.putExtra("profile", shortcutInfo.getUserId()); - } else - intent.putExtra("profile", "-1"); - - return intent; - } - - @RequiresApi(api = Build.VERSION_CODES.N_MR1) - public int getUserIdFromShortcutInfo(ShortcutInfo shortcutInfo) { - - Parcel parcel = Parcel.obtain(); - shortcutInfo.writeToParcel(parcel, 0); - return parcel.readInt(); - - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/SingleFragmentActivity.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/SingleFragmentActivity.java deleted file mode 100644 index 2b608d0..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/SingleFragmentActivity.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - - -import android.os.Bundle; - -import androidx.appcompat.app.AppCompatActivity; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentManager; - -public abstract class SingleFragmentActivity extends AppCompatActivity { - - protected abstract Fragment createFragment(); - @Override - public void onCreate(Bundle savedInstanceState) { - setTheme(R.style.AppTheme); - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_fragment); - FragmentManager fm = getSupportFragmentManager(); - Fragment fragment = fm.findFragmentById(R.id.fragment_container); - if (fragment == null) { - fragment = createFragment(); - fm.beginTransaction() - .add(R.id.fragment_container, fragment) - .commit(); - } - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/StaticAndDynamicShortcutChooserFragment.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/StaticAndDynamicShortcutChooserFragment.java deleted file mode 100644 index 11b1330..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/StaticAndDynamicShortcutChooserFragment.java +++ /dev/null @@ -1,397 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import android.app.Activity; -import android.content.ActivityNotFoundException; -import android.content.Intent; -import android.os.Build; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuInflater; -import android.view.MenuItem; -import android.view.View; -import android.view.ViewGroup; -import android.view.ViewTreeObserver; -import android.widget.ImageView; -import android.widget.TextView; -import java.util.List; -import androidx.appcompat.app.ActionBar; -import androidx.appcompat.app.AppCompatActivity; -import androidx.appcompat.widget.SearchView; -import androidx.fragment.app.Fragment; -import androidx.fragment.app.FragmentActivity; -import androidx.recyclerview.widget.LinearLayoutManager; -import androidx.recyclerview.widget.RecyclerView; - -import com.agnostic.apollo.taskerlaunchershortcut.model.ShortcutInfoItem; -import com.agnostic.apollo.taskerlaunchershortcut.utils.LauncherUtils; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; - -import static com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity.ARG_SHORTCUT_INTENT_URI; -import static com.agnostic.apollo.taskerlaunchershortcut.ShortcutChooserActivity.REQUEST_CREATE_SHORTCUT; -import static com.agnostic.apollo.taskerlaunchershortcut.ShortcutTypeChooserFragment.ARG_SHORTCUT_TYPE; -import static com.agnostic.apollo.taskerlaunchershortcut.ShortcutTypeChooserFragment.SHORTCUT_TYPE_DYNAMIC; -import static com.agnostic.apollo.taskerlaunchershortcut.ShortcutTypeChooserFragment.SHORTCUT_TYPE_STATIC; - -public class StaticAndDynamicShortcutChooserFragment extends Fragment { - - private RecyclerView mShortcutsRecyclerView; - private TextView mShortcutsTextView; - private ShortcutsAdapter mShortcutsAdapter; - private String mQuery; - private FragmentActivity mContext; - private String mShortcutType; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setHasOptionsMenu(true); - - mContext = getActivity(); - - if(savedInstanceState != null){ - Logger.logDebug(mContext, "A SavedInstanceState exists"); - mShortcutType = savedInstanceState.getString(ARG_SHORTCUT_TYPE); - }else{ - Logger.logDebug(mContext, "A SavedInstanceState doesn't exist"); - if(getArguments()!=null) { - mShortcutType = getArguments().getString(ARG_SHORTCUT_TYPE); - } - } - - - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.fragment_static_and_dynamic_shortcut_chooser, container, false); - - mShortcutsRecyclerView = (RecyclerView) view.findViewById(R.id.shortcuts_recycler_view); - mShortcutsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); - - mShortcutsTextView = (TextView) view.findViewById(R.id.empty_view); - - updateUI(); - return view; - } - - @Override - public void onResume() { - super.onResume(); - updateUI(); - } - - @Override - public void onSaveInstanceState(Bundle outState) { - super.onSaveInstanceState(outState); - - if (mShortcutType != null) { - outState.putString(ARG_SHORTCUT_TYPE, mShortcutType); - } - } - - @Override - public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { - super.onCreateOptionsMenu(menu, inflater); - inflater.inflate(R.menu.fragment_static_and_dynamic_shortcut_chooser, menu); - - MenuItem searchItem = menu.findItem(R.id.menu_item_search); - final SearchView searchView = (SearchView) searchItem.getActionView(); - searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { - @Override - public boolean onQueryTextSubmit(String s) { - mQuery=s; - updateUI(); - return true; - } - @Override - public boolean onQueryTextChange(String s) { - return false; - } - }); - - searchView.setOnSearchClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - searchView.setQuery(mQuery, false); - } - }); - - searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() - { - @Override - public boolean onMenuItemActionCollapse(MenuItem item) - { - mQuery=null; - updateUI(); - return true; // Return true to collapse action view - } - - @Override - public boolean onMenuItemActionExpand(MenuItem item) - { - return true; - } - }); - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.menu_item_change_launcher: - LauncherUtils.changeDefaultLauncherInitiate(mContext); - return true; - default: - return super.onOptionsItemSelected(item); - } - } - - protected void updateUI() { - - processIntent(); - - ShortcutsLab shortcutsLab = ShortcutsLab.get(mContext); - List shortcuts; - - if (mShortcutType.equals(SHORTCUT_TYPE_STATIC)) { - shortcuts = shortcutsLab.getStaticShortcuts(""); - } else if (mShortcutType.equals(SHORTCUT_TYPE_DYNAMIC)) { - shortcuts = shortcutsLab.getDynamicShortcuts(""); - } else { - Logger.logError(mContext, "Unknown Shortcut Type Passed To StaticAndDynamicShortcutChooserFragment: \"" + mShortcutType + "\""); - return; - } - - if(mQuery!=null) - shortcuts = shortcutsLab.searchShortcuts(shortcuts, mQuery); - - if (mShortcutsAdapter == null) { - mShortcutsAdapter = new ShortcutsAdapter(shortcuts); - mShortcutsRecyclerView.setAdapter(mShortcutsAdapter); - } else { - mShortcutsAdapter.setShortcuts(shortcuts); - mShortcutsAdapter.notifyDataSetChanged(); - //mAdapter.notifyItemChanged(mAdapter.getPosition()); - } - - int shortcutsSize = shortcuts.size(); - - if (shortcutsSize==0) { - mShortcutsRecyclerView.setVisibility(View.GONE); - mShortcutsTextView.setVisibility(View.VISIBLE); - } - else { - mShortcutsRecyclerView.setVisibility(View.VISIBLE); - mShortcutsTextView.setVisibility(View.GONE); - } - - //Logger.logDebug(mContext, "Static Shortcuts:\n" + TextUtils.join("\n", shortcutsLab.getStaticShortcuts(""))); - //Logger.logDebug(mContext, "Dynamic Shortcuts:\n" + TextUtils.join("\n", shortcutsLab.getDynamicShortcuts(""))); - //Logger.logDebug(mContext, "Pinned Shortcuts:\n" + TextUtils.join("\n", shortcutsLab.getPinnedShortcuts(""))); - - updateSubtitle(); - } - - private void updateSubtitle() { - - if(mContext==null) - return; - - ShortcutsLab shortcutsLab = ShortcutsLab.get(mContext); - - int shortuctsSize = mShortcutsAdapter.getItemCount(); - String subtitle = getResources() - .getQuantityString(R.plurals.subtitle_shortcuts_plural, shortuctsSize, shortuctsSize); - - AppCompatActivity activity = (AppCompatActivity) getActivity(); - if(activity!=null) { - ActionBar actionBar = activity.getSupportActionBar(); - if(actionBar!=null) - actionBar.setSubtitle(subtitle); - } - } - - private void processIntent() { - if(mContext==null) - return; - - Intent intent = mContext.getIntent(); - } - - private void cancelFireShortcutIntentUriIntent(Intent intent) { - if(mContext==null) - return; - - if(intent!=null) { - //cancel already received intent - intent.putExtra(ARG_SHORTCUT_INTENT_URI, ""); - mContext.setIntent(intent); - } - } - - private class ShortcutsHolder extends RecyclerView.ViewHolder implements View.OnClickListener { - - private TextView mAppLabelTextView; - private TextView mShortcutLabelTextView; - private ImageView mIconImageView; - private ShortcutInfoItem mShortcut; - private ShortcutsAdapter mAdapter; - int imageViewWidth=0; - int imageViewHeight=0; - - public ShortcutsHolder(View itemView, ShortcutsAdapter adaptor ) { - super(itemView); - mAppLabelTextView = (TextView) - itemView.findViewById(R.id.list_item_app_label); - mShortcutLabelTextView = (TextView) - itemView.findViewById(R.id.list_item_shortcut_label); - mIconImageView = (ImageView) - itemView.findViewById(R.id.list_item_shortcut_icon); - final ViewTreeObserver vto = mIconImageView.getViewTreeObserver(); - vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { - @Override - public void onGlobalLayout() { - - imageViewWidth = mIconImageView.getWidth(); - imageViewHeight = mIconImageView.getHeight(); - mIconImageView.setImageDrawable(mShortcut.getIcon()); - - //Then remove layoutChange Listener - ViewTreeObserver vto = mIconImageView.getViewTreeObserver(); - vto.removeOnGlobalLayoutListener(this); - } - }); - - itemView.setOnClickListener(this); - mAdapter=adaptor; - } - - public void bindApp(ShortcutInfoItem shortcut) { - mShortcut = shortcut; - mAppLabelTextView.setText(mShortcut.getAppLabel()); - mShortcutLabelTextView.setText(mShortcut.getShortLabel()); - mIconImageView.setImageDrawable(mShortcut.getIcon()); - } - - @Override - public void onClick(View v) { - mAdapter.setPosition(getAdapterPosition()); - - onClickShortcut(mShortcut); - } - } - - private class ShortcutsAdapter extends RecyclerView.Adapter { - - private List mShortcuts; - - private int position; - - public ShortcutsAdapter(List apps) { - mShortcuts = apps; - } - - @Override - public ShortcutsHolder onCreateViewHolder(ViewGroup parent, int viewType) { - LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); - View view = layoutInflater - .inflate(R.layout.list_item_shortcut, parent, false); - return new ShortcutsHolder(view,this); - } - - @Override - public void onBindViewHolder(ShortcutsHolder holder, int position) { - ShortcutInfoItem shortcut = mShortcuts.get(position); - holder.bindApp(shortcut); - } - - @Override - public int getItemCount() { - return mShortcuts.size(); - } - - public void setShortcuts(List shortcuts) { - mShortcuts = shortcuts; - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - } - - private void onClickShortcut(ShortcutInfoItem shortcut) { - if(mContext==null || shortcut == null) - return; - - ShortcutsLab shortcutsLab = ShortcutsLab.get(mContext); - - if (mShortcutType.equals(SHORTCUT_TYPE_STATIC)) { - Intent intent = shortcut.getIntent(); - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1 && (intent==null || intent.getAction() == null || !intent.getAction().equals(Intent.ACTION_CREATE_SHORTCUT))) - ShortcutChooserActivity.returnShortcutIntentUri(mContext, shortcutsLab.createDeepShortcutFromShortcutInfoItem(shortcut).toUri(0)); - else - startStaticShortcutConfigActivity(shortcut.getIntent()); - } else if (mShortcutType.equals(SHORTCUT_TYPE_DYNAMIC)) { - ShortcutChooserActivity.returnShortcutIntentUri(mContext, shortcutsLab.createDeepShortcutFromShortcutInfoItem(shortcut).toUri(0)); - } else { - Logger.logError(mContext, "Unknown Shortcut Type Passed To StaticAndDynamicShortcutChooserFragment: \"" + mShortcutType + "\""); - } - } - - private void startStaticShortcutConfigActivity(Intent intent) { - if(intent==null) - return; - - try { - Logger.logDebug(mContext, "Starting Static Shortcut Config Activity With Intent: \"" + intent.toUri(0) + "\""); - startActivityForResult(intent, REQUEST_CREATE_SHORTCUT); - } catch (ActivityNotFoundException e) { - Logger.logErrorAndShowToast(mContext, "ActivityNotFoundException: " + e.getMessage()); - Logger.logStackTrace(mContext, e); - } catch (SecurityException e) { - Logger.logErrorAndShowToast(mContext, "SecurityException: " + e.getMessage()); - Logger.logError(mContext, "Launcher does not have the permission to launch " + intent + - ". Make sure to create a MAIN intent-filter for the corresponding activity " + - "or use the exported attribute for this activity."); - Logger.logStackTrace(mContext, e); - } - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent intent) { - if (resultCode != Activity.RESULT_OK) { - return; - } - - if (requestCode == ShortcutChooserActivity.REQUEST_CREATE_SHORTCUT) { - if(intent!=null) { - Logger.logDebug(mContext, "Intent Returned To StaticAndDynamicShortcutChooserFragment By App: \"" + intent.toUri(0)); - - Intent shortcut_intent = (Intent) intent.getParcelableExtra("android.intent.extra.shortcut.INTENT"); - if(shortcut_intent!=null) { - Logger.logDebug(mContext, "Shortcut Intent: \"" + shortcut_intent.toUri(0)); - ShortcutChooserActivity.returnShortcutIntentUri(mContext, shortcut_intent.toUri(0)); - return; - } - } - - Logger.logErrorAndShowToast(mContext, "Invalid Shortcut Intent Returned By App"); - } - } - - public static StaticAndDynamicShortcutChooserFragment newInstance(String selectedShortcutType) { - Bundle args = new Bundle(); - args.putString(ARG_SHORTCUT_TYPE, selectedShortcutType); - StaticAndDynamicShortcutChooserFragment fragment = new StaticAndDynamicShortcutChooserFragment(); - fragment.setArguments(args); - return fragment; - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/TaskerPlugin.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/TaskerPlugin.java deleted file mode 100644 index 58f92c4..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/TaskerPlugin.java +++ /dev/null @@ -1,1041 +0,0 @@ -//package com.yourcompany.yourcondition; -//package com.yourcompany.yoursetting; -package com.agnostic.apollo.taskerlaunchershortcut; - -// Constants and functions for Tasker *extensions* to the plugin protocol -// See Also: http://tasker.dinglisch.net/plugins.html - -// Release Notes - -// v1.1 20140202 -// added function variableNameValid() -// fixed some javadoc entries (thanks to David Stone) - -// v1.2 20140211 -// added ACTION_EDIT_EVENT - -// v1.3 20140227 -// added REQUESTED_TIMEOUT_MS_NONE, REQUESTED_TIMEOUT_MS_MAX and REQUESTED_TIMEOUT_MS_NEVER -// requestTimeoutMS(): added range check - -// v1.4 20140516 -// support for data pass through in REQUEST_QUERY intent -// some javadoc entries fixed (thanks again David :-)) - -// v1.5 20141120 -// added RESULT_CODE_FAILED_PLUGIN_FIRST -// added Setting.VARNAME_ERROR_MESSAGE - -// v1.6 20150213 -// added Setting.getHintTimeoutMS() -// added Host.addHintTimeoutMS() - -// v1.7 20160619 -// null check for getCallingActivity() in hostSupportsOnFireVariableReplacement( Activity editActivity ) - -// v1.8 20161002 -// added hostSupportsKeyEncoding(), setKeyEncoding() and Host.getKeysWithEncoding() - -import java.net.URISyntaxException; -import java.security.SecureRandom; -import java.util.regex.Pattern; - -import android.app.Activity; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.os.Bundle; -import android.os.ResultReceiver; -import android.util.Log; - -public class TaskerPlugin { - - private final static String TAG = "TaskerPlugin"; - - private final static String BASE_KEY = "net.dinglisch.android.tasker"; - - private final static String EXTRAS_PREFIX = BASE_KEY + ".extras."; - - private final static int FIRST_ON_FIRE_VARIABLES_TASKER_VERSION = 80; - - public final static String VARIABLE_PREFIX = "%"; - - // when generating non-repeating integers, look this far back for repeats - // see getPositiveNonRepeatingRandomInteger() - private final static int RANDOM_HISTORY_SIZE = 100; - - /** - * Action that the EditActivity for an event plugin should be launched by - */ - public final static String ACTION_EDIT_EVENT = BASE_KEY + ".ACTION_EDIT_EVENT"; - - private final static String VARIABLE_NAME_START_EXPRESSION = "[\\w&&[^_]]"; - private final static String VARIABLE_NAME_MID_EXPRESSION = "[\\w0-9]+"; - private final static String VARIABLE_NAME_END_EXPRESSION = "[\\w0-9&&[^_]]"; - - public final static String VARIABLE_NAME_MAIN_PART_MATCH_EXPRESSION = - VARIABLE_NAME_START_EXPRESSION + VARIABLE_NAME_MID_EXPRESSION + VARIABLE_NAME_END_EXPRESSION - ; - - public final static String VARIABLE_NAME_MATCH_EXPRESSION = - VARIABLE_PREFIX + "+" + - VARIABLE_NAME_MAIN_PART_MATCH_EXPRESSION - ; - - private static Pattern VARIABLE_NAME_MATCH_PATTERN = null; - - /** - * @see #addVariableBundle(Bundle, Bundle) - * @see Host#getVariablesBundle(Bundle) - */ - private final static String EXTRA_VARIABLES_BUNDLE = EXTRAS_PREFIX + "VARIABLES"; - - /** - * Host capabilities, passed to plugin with edit intents - */ - private final static String EXTRA_HOST_CAPABILITIES = EXTRAS_PREFIX + "HOST_CAPABILITIES"; - - /** - * @see Setting#hostSupportsVariableReturn(Bundle) - */ - public final static int EXTRA_HOST_CAPABILITY_SETTING_RETURN_VARIABLES = 2; - - /** - * @see Condition#hostSupportsVariableReturn(Bundle) - */ - public final static int EXTRA_HOST_CAPABILITY_CONDITION_RETURN_VARIABLES = 4; - - /** - * @see Setting#hostSupportsOnFireVariableReplacement(Bundle) - */ - public final static int EXTRA_HOST_CAPABILITY_SETTING_FIRE_VARIABLE_REPLACEMENT = 8; - - /** - * @see Setting#hostSupportsVariableReturn(Bundle) - */ - private final static int EXTRA_HOST_CAPABILITY_RELEVANT_VARIABLES = 16; - - public final static int EXTRA_HOST_CAPABILITY_SETTING_SYNCHRONOUS_EXECUTION = 32; - - public final static int EXTRA_HOST_CAPABILITY_REQUEST_QUERY_DATA_PASS_THROUGH = 64; - - public final static int EXTRA_HOST_CAPABILITY_ENCODING_JSON = 128; - - public final static int EXTRA_HOST_CAPABILITY_ALL = - EXTRA_HOST_CAPABILITY_SETTING_RETURN_VARIABLES | - EXTRA_HOST_CAPABILITY_CONDITION_RETURN_VARIABLES | - EXTRA_HOST_CAPABILITY_SETTING_FIRE_VARIABLE_REPLACEMENT | - EXTRA_HOST_CAPABILITY_RELEVANT_VARIABLES| - EXTRA_HOST_CAPABILITY_SETTING_SYNCHRONOUS_EXECUTION | - EXTRA_HOST_CAPABILITY_REQUEST_QUERY_DATA_PASS_THROUGH | - EXTRA_HOST_CAPABILITY_ENCODING_JSON - ; - - /** - * Possible encodings of text in bundle values - * - * @see #setKeyEncoding(Bundle,String[],Encoding) - */ - public enum Encoding { JSON } - - private final static String BUNDLE_KEY_ENCODING_JSON_KEYS = BASE_KEY + ".JSON_ENCODED_KEYS"; - - public static boolean hostSupportsKeyEncoding( Bundle extrasFromHost, Encoding encoding ) { - switch ( encoding ) { - case JSON: - return hostSupports( extrasFromHost, EXTRA_HOST_CAPABILITY_ENCODING_JSON ); - default: - return false; - } - } - - /** - * - * Miscellaneous operational hints going one way or the other - * @see Setting#hostSupportsVariableReturn(Bundle) - */ - - private final static String EXTRA_HINTS_BUNDLE = EXTRAS_PREFIX + "HINTS"; - - private final static String BUNDLE_KEY_HINT_PREFIX = ".hints."; - - private final static String BUNDLE_KEY_HINT_TIMEOUT_MS = BUNDLE_KEY_HINT_PREFIX + "TIMEOUT"; - - /** - * - * @see #hostSupportsRelevantVariables(Bundle) - * @see #addRelevantVariableList(Intent, String[]) - * @see #getRelevantVariableList(Bundle) - */ - private final static String BUNDLE_KEY_RELEVANT_VARIABLES = BASE_KEY + ".RELEVANT_VARIABLES"; - - - public static boolean hostSupportsRelevantVariables( Bundle extrasFromHost ) { - return hostSupports( extrasFromHost, EXTRA_HOST_CAPABILITY_RELEVANT_VARIABLES ); - } - - /** - * Specifies to host which variables might be used by the plugin. - * - * Used in EditActivity, before setResult(). - * - * @param intentToHost the intent being returned to the host - * @param variableNames array of relevant variable names - */ - public static void addRelevantVariableList( Intent intentToHost, String [] variableNames ) { - intentToHost.putExtra( BUNDLE_KEY_RELEVANT_VARIABLES, variableNames ); - } - - /** - * Validate a variable name. - * - * The basic requirement for variables from a plugin is that they must be all lower-case. - * - * @param varName name to check - */ - public static boolean variableNameValid( String varName ) { - - boolean validFlag = false; - - if ( varName == null ) - Log.d( TAG, "variableNameValid: null name" ); - else { - if ( VARIABLE_NAME_MATCH_PATTERN == null ) - VARIABLE_NAME_MATCH_PATTERN = Pattern.compile( VARIABLE_NAME_MATCH_EXPRESSION, 0 ); - - if ( VARIABLE_NAME_MATCH_PATTERN.matcher( varName ).matches() ) { - - if ( variableNameIsLocal( varName ) ) - validFlag = true; - else - Log.d( TAG, "variableNameValid: name not local: " + varName ); - } - else - Log.d( TAG, "variableNameValid: invalid name: " + varName ); - } - - return validFlag; - } - - /** - * Allows the plugin/host to indicate to each other a set of variables which they are referencing. - * The host may use this to e.g. show a variable selection list in it's UI. - * The host should use this if it previously indicated to the plugin that it supports relevant vars - * - * @param fromHostIntentExtras usually from getIntent().getExtras() - * @return variableNames an array of relevant variable names - */ - public static String [] getRelevantVariableList( Bundle fromHostIntentExtras ) { - - String [] relevantVars = (String []) getBundleValueSafe( fromHostIntentExtras, BUNDLE_KEY_RELEVANT_VARIABLES, String [].class, "getRelevantVariableList" ); - - if ( relevantVars == null ) - relevantVars = new String [0]; - - return relevantVars; - } - - /** - * Used by: plugin QueryReceiver, FireReceiver - * - * Add a bundle of variable name/value pairs. - * - * Names must be valid Tasker local variable names. - * Values must be String, String [] or ArrayList - * Null values cause deletion of possible already-existing variables - * A null value where the variable does not already exist results in attempted deletion - * of any existing array indices (%arr1, %arr2 etc) - * - * @param resultExtras the result extras from the receiver onReceive (from a call to getResultExtras()) - * @param variables the variables to send - * @see Setting#hostSupportsVariableReturn(Bundle) - * @see #variableNameValid(String) - */ - public static void addVariableBundle( Bundle resultExtras, Bundle variables ) { - resultExtras.putBundle( EXTRA_VARIABLES_BUNDLE, variables ); - } - - /** - * Used by: plugin EditActivity - * - * Specify the encoding for a set of bundle keys. - * - * This is completely optional and currently only necessary if using Setting#setVariableReplaceKeys - * where the corresponding values of some of the keys specified are JSON encoded. - * - * @param resultBundleToHost the bundle being returned to the host - * @param keys the keys being returned to the host which are encoded in some way - * @param encoding the encoding of the values corresponding to the specified keys - * @see #setVariableReplaceKeys(Bundle, String[]) - * @see #hostSupportsKeyEncoding(Bundle, Encoding) - */ - public static void setKeyEncoding( Bundle resultBundleToHost, String [] keys, Encoding encoding ) { - if ( Encoding.JSON.equals( encoding ) ) - addStringArrayToBundleAsString( - keys, resultBundleToHost, BUNDLE_KEY_ENCODING_JSON_KEYS, "setValueEncoding" - ); - else - Log.e( TAG, "unknown encoding: " + encoding ); - } - - // ----------------------------- SETTING PLUGIN ONLY --------------------------------- // - - public static class Setting { - - /** - * Variable name into which a description of any error that occurred can be placed - * for the user to process. - * - * Should *only* be set when the BroadcastReceiver result code indicates a failure. - * - * Note that the user needs to have configured the task to continue after failure of the plugin - * action otherwise they will not be able to make use of the error message. - * - * For use with #addRelevantVariableList(Intent, String[]) and #addVariableBundle(Bundle, Bundle) - * - */ - public final static String VARNAME_ERROR_MESSAGE = VARIABLE_PREFIX + "errmsg"; - - /** - * @see #setVariableReplaceKeys(Bundle, String[]) - */ - private final static String BUNDLE_KEY_VARIABLE_REPLACE_STRINGS = EXTRAS_PREFIX + "VARIABLE_REPLACE_KEYS"; - - /** - * @see #requestTimeoutMS(Intent, int) - */ - private final static String EXTRA_REQUESTED_TIMEOUT = EXTRAS_PREFIX + "REQUESTED_TIMEOUT"; - - /** - * @see #requestTimeoutMS(Intent, int) - */ - - public final static int REQUESTED_TIMEOUT_MS_NONE = 0; - - /** - * @see #requestTimeoutMS(Intent, int) - */ - - public final static int REQUESTED_TIMEOUT_MS_MAX = 3599000; - - /** - * @see #requestTimeoutMS(Intent, int) - */ - - public final static int REQUESTED_TIMEOUT_MS_NEVER = REQUESTED_TIMEOUT_MS_MAX + 1000; - - /** - * @see #signalFinish(Context, Intent, int, Bundle) - * @see #addCompletionIntent(Intent, Intent, ComponentName, boolean) - */ - private final static String EXTRA_PLUGIN_COMPLETION_INTENT = EXTRAS_PREFIX + "COMPLETION_INTENT"; - - /** - * @see #signalFinish(Context, Intent, int, Bundle) - * @see Host#getSettingResultCode(Intent) - */ - public final static String EXTRA_RESULT_CODE = EXTRAS_PREFIX + "RESULT_CODE"; - - /** - * - * @see #signalFinish(Context, Intent, int, Bundle) - * @see #addCompletionIntent(Intent, Intent, ComponentName, boolean) - */ - public final static String EXTRA_CALL_SERVICE_PACKAGE = BASE_KEY + ".EXTRA_CALL_SERVICE_PACKAGE"; - public final static String EXTRA_CALL_SERVICE = BASE_KEY + ".EXTRA_CALL_SERVICE"; - public final static String EXTRA_CALL_SERVICE_FOREGROUND = BASE_KEY + ".EXTRA_CALL_SERVICE_FOREGROUND"; - /** - * @see #signalFinish(Context, Intent, int, Bundle) - * @see Host#getSettingResultCode(Intent) - */ - - public final static int RESULT_CODE_OK = Activity.RESULT_OK; - public final static int RESULT_CODE_OK_MINOR_FAILURES = Activity.RESULT_FIRST_USER; - public final static int RESULT_CODE_FAILED = Activity.RESULT_FIRST_USER + 1; - public final static int RESULT_CODE_PENDING = Activity.RESULT_FIRST_USER + 2; - public final static int RESULT_CODE_UNKNOWN = Activity.RESULT_FIRST_USER + 3; - - /** - * If a plugin wants to define it's own error codes, start numbering them here. - * The code will be placed in an error variable (%err in the case of Tasker) for - * the user to process after the plugin action. - */ - - public final static int RESULT_CODE_FAILED_PLUGIN_FIRST = Activity.RESULT_FIRST_USER + 9; - - /** - * Used by: plugin EditActivity. - * - * Indicates to plugin that host will replace variables in specified bundle keys. - * - * Replacement takes place every time the setting is fired, before the bundle is - * passed to the plugin FireReceiver. - * - * @param extrasFromHost intent extras from the intent received by the edit activity - * @see #setVariableReplaceKeys(Bundle, String[]) - */ - public static boolean hostSupportsOnFireVariableReplacement( Bundle extrasFromHost ) { - return hostSupports( extrasFromHost, EXTRA_HOST_CAPABILITY_SETTING_FIRE_VARIABLE_REPLACEMENT ); - } - - /** - * Used by: plugin EditActivity. - * - * Description as above. - * - * This version also includes backwards compatibility with pre 4.2 Tasker versions. - * At some point this function will be deprecated. - * - * @param editActivity the plugin edit activity, needed to test calling Tasker version - * @see #setVariableReplaceKeys(Bundle, String[]) - */ - - public static boolean hostSupportsOnFireVariableReplacement( Activity editActivity ) { - - boolean supportedFlag = hostSupportsOnFireVariableReplacement( editActivity.getIntent().getExtras() ); - - if ( ! supportedFlag ) { - - ComponentName callingActivity = editActivity.getCallingActivity(); - - if ( callingActivity == null ) - Log.w( TAG, "hostSupportsOnFireVariableReplacement: null callingActivity, defaulting to false" ); - else { - String callerPackage = callingActivity.getPackageName(); - - // Tasker only supporteed this from 1.0.10 - supportedFlag = - ( callerPackage.startsWith( BASE_KEY ) ) && - ( getPackageVersionCode( editActivity.getPackageManager(), callerPackage ) > FIRST_ON_FIRE_VARIABLES_TASKER_VERSION ) - ; - } - } - - return supportedFlag; - } - - public static boolean hostSupportsSynchronousExecution( Bundle extrasFromHost ) { - return hostSupports( extrasFromHost, EXTRA_HOST_CAPABILITY_SETTING_SYNCHRONOUS_EXECUTION ); - } - - /** - * Request the host to wait the specified number of milliseconds before continuing. - * Note that the host may choose to ignore the request. - * - * Maximum value is REQUESTED_TIMEOUT_MS_MAX. - * Also available are REQUESTED_TIMEOUT_MS_NONE (continue immediately without waiting - * for the plugin to finish) and REQUESTED_TIMEOUT_MS_NEVER (wait forever for - * a result). - * - * Used in EditActivity, before setResult(). - * - * @param intentToHost the intent being returned to the host - * @param timeoutMS - */ - public static void requestTimeoutMS( Intent intentToHost, int timeoutMS ) { - if ( timeoutMS < 0 ) - Log.w( TAG, "requestTimeoutMS: ignoring negative timeout (" + timeoutMS + ")" ); - else { - if ( - ( timeoutMS > REQUESTED_TIMEOUT_MS_MAX ) && - ( timeoutMS != REQUESTED_TIMEOUT_MS_NEVER ) - ) { - Log.w( TAG, "requestTimeoutMS: requested timeout " + timeoutMS + " exceeds maximum, setting to max (" + REQUESTED_TIMEOUT_MS_MAX + ")" ); - timeoutMS = REQUESTED_TIMEOUT_MS_MAX; - } - intentToHost.putExtra( EXTRA_REQUESTED_TIMEOUT, timeoutMS ); - } - } - - /** - * Used by: plugin EditActivity - * - * Indicates to host which bundle keys should be replaced. - * - * @param resultBundleToHost the bundle being returned to the host - * @param listOfKeyNames which bundle keys to replace variables in when setting fires - * @see #hostSupportsOnFireVariableReplacement(Bundle) - * @see #setKeyEncoding(Bundle,String[],Encoding) - */ - public static void setVariableReplaceKeys( Bundle resultBundleToHost, String [] listOfKeyNames ) { - addStringArrayToBundleAsString( - listOfKeyNames, resultBundleToHost, BUNDLE_KEY_VARIABLE_REPLACE_STRINGS, - "setVariableReplaceKeys" - ); - } - - /** - * Used by: plugin FireReceiver - * - * Indicates to plugin whether the host will process variables which it passes back - * - * @param extrasFromHost intent extras from the intent received by the FireReceiver - * @see #signalFinish(Context, Intent, int, Bundle) - */ - public static boolean hostSupportsVariableReturn( Bundle extrasFromHost ) { - return hostSupports( extrasFromHost, EXTRA_HOST_CAPABILITY_SETTING_RETURN_VARIABLES ); - } - - /** - * Used by: plugin FireReceiver - * - * Tell the host that the plugin has finished execution. - * - * This should only be used if RESULT_CODE_PENDING was returned by FireReceiver.onReceive(). - * - * @param originalFireIntent the intent received from the host (via onReceive()) - * @param resultCode level of success in performing the settings - * @param vars any variables that the plugin wants to set in the host - * @see #hostSupportsSynchronousExecution(Bundle) - */ - public static boolean signalFinish( Context context, Intent originalFireIntent, int resultCode, Bundle vars ) { - - String errorPrefix = "signalFinish: "; - - boolean okFlag = false; - - String completionIntentString = (String) getExtraValueSafe( originalFireIntent, Setting.EXTRA_PLUGIN_COMPLETION_INTENT, String.class, "signalFinish" ); - - if ( completionIntentString != null ) { - - Uri completionIntentUri = null; - try { - completionIntentUri = Uri.parse( completionIntentString ); - } - // should only throw NullPointer but don't particularly trust it - catch ( Exception e ) { - Log.w( TAG, errorPrefix + "couldn't parse " + completionIntentString ); - } - - if ( completionIntentUri != null ) { - try { - Intent completionIntent = Intent.parseUri( completionIntentString, Intent.URI_INTENT_SCHEME ); - - completionIntent.putExtra( EXTRA_RESULT_CODE, resultCode ); - - if ( vars != null ) - completionIntent.putExtra( EXTRA_VARIABLES_BUNDLE, vars ); - - String callServicePackage = (String) getExtraValueSafe(completionIntent, Setting.EXTRA_CALL_SERVICE_PACKAGE, String.class, "signalFinish"); - String callService = (String) getExtraValueSafe(completionIntent, Setting.EXTRA_CALL_SERVICE, String.class, "signalFinish"); - Boolean foreground = (Boolean) getExtraValueSafe(completionIntent, Setting.EXTRA_CALL_SERVICE_FOREGROUND, Boolean.class, "signalFinish"); - if (callServicePackage != null && callService != null && foreground != null) { - completionIntent.setComponent(new ComponentName(callServicePackage, callService)); - if (foreground && android.os.Build.VERSION.SDK_INT >= 26) { - context.startForegroundService(completionIntent); - } else { - context.startService(completionIntent); - } - } else { - context.sendBroadcast(completionIntent); - } - - okFlag = true; - } - catch ( URISyntaxException e ) { - Log.w( TAG, errorPrefix + "bad URI: " + completionIntentUri ); - } - } - } - - return okFlag; - } - - /** - * Check for a hint on the timeout value the host is using. - * Used by: plugin FireReceiver. - * Requires Tasker 4.7+ - * - * @param extrasFromHost intent extras from the intent received by the FireReceiver - * @return timeoutMS the hosts timeout setting for the action or -1 if no hint is available. - * - * @see #REQUESTED_TIMEOUT_MS_NONE, REQUESTED_TIMEOUT_MS_MAX, REQUESTED_TIMEOUT_MS_NEVER - */ - public static int getHintTimeoutMS( Bundle extrasFromHost ) { - - int timeoutMS = -1; - - Bundle hintsBundle = (Bundle) TaskerPlugin.getBundleValueSafe( extrasFromHost, EXTRA_HINTS_BUNDLE, Bundle.class, "getHintTimeoutMS" ); - - if ( hintsBundle != null ) { - - Integer val = (Integer) getBundleValueSafe( hintsBundle, BUNDLE_KEY_HINT_TIMEOUT_MS, Integer.class, "getHintTimeoutMS" ); - - if ( val != null ) - timeoutMS = val; - } - - return timeoutMS; - } - } - - // ----------------------------- CONDITION/EVENT PLUGIN ONLY --------------------------------- // - - public static class Condition { - - /** - * @see #getResultReceiver(Intent) - */ - public final static String EXTRA_RESULT_RECEIVER = BASE_KEY + ".EXTRA_RESULT_RECEIVER"; - /** - * Used by: plugin QueryReceiver - * - * Indicates to plugin whether the host will process variables which it passes back - * - * @param extrasFromHost intent extras from the intent received by the QueryReceiver - * @see #addVariableBundle(Bundle, Bundle) - */ - public static boolean hostSupportsVariableReturn( Bundle extrasFromHost ) { - return hostSupports( extrasFromHost, EXTRA_HOST_CAPABILITY_CONDITION_RETURN_VARIABLES ); - } - - public static ResultReceiver getResultReceiver(Intent intentFromHost) { - if (intentFromHost == null) { - return null; - } - return (ResultReceiver) getExtraValueSafe(intentFromHost, EXTRA_RESULT_RECEIVER, ResultReceiver.class, "getResultReceiver"); - - } - } - - // ----------------------------- EVENT PLUGIN ONLY --------------------------------- // - - public static class Event { - - public final static String PASS_THROUGH_BUNDLE_MESSAGE_ID_KEY = BASE_KEY + ".MESSAGE_ID"; - - private final static String EXTRA_REQUEST_QUERY_PASS_THROUGH_DATA = EXTRAS_PREFIX + "PASS_THROUGH_DATA"; - - /** - * @param extrasFromHost intent extras from the intent received by the QueryReceiver - * @see #addPassThroughData(Intent, Bundle) - */ - public static boolean hostSupportsRequestQueryDataPassThrough( Bundle extrasFromHost ) { - return hostSupports( extrasFromHost, EXTRA_HOST_CAPABILITY_REQUEST_QUERY_DATA_PASS_THROUGH ); - } - - /** - * Specify a bundle of data (probably representing whatever change happened in the condition) - * which will be included in the QUERY_CONDITION broadcast sent by the host for each - * event instance of the plugin. - * - * The minimal purpose is to enable the plugin to associate a QUERY_CONDITION to the - * with the REQUEST_QUERY that caused it. - * - * Note that for security reasons it is advisable to also store a message ID with the bundle - * which can be compared to known IDs on receipt. The host cannot validate the source of - * REQUEST_QUERY intents so fake data may be passed. Replay attacks are also possible. - * addPassThroughMesssageID() can be used to add an ID if the plugin doesn't wish to add it's - * own ID to the pass through bundle. - * - * Note also that there are several situations where REQUEST_QUERY will not result in a - * QUERY_CONDITION intent (e.g. event throttling by the host), so plugin-local data - * indexed with a message ID needs to be timestamped and eventually timed-out. - * - * This function can be called multiple times, each time all keys in data will be added to - * that of previous calls. - * - * @param requestQueryIntent intent being sent to the host - * @param data the data to be passed-through - * @see #hostSupportsRequestQueryDataPassThrough(Bundle) - * @see #retrievePassThroughData(Intent) - * @see #addPassThroughMessageID - * - */ - public static void addPassThroughData( Intent requestQueryIntent, Bundle data ) { - - Bundle passThroughBundle = retrieveOrCreatePassThroughBundle( requestQueryIntent ); - - passThroughBundle.putAll( data ); - } - - /** - * Retrieve the pass through data from a QUERY_REQUEST from the host which was generated - * by a REQUEST_QUERY from the plugin. - * - * Note that if addPassThroughMessageID() was previously called, the data will contain an extra - * key TaskerPlugin.Event.PASS_THOUGH_BUNDLE_MESSAGE_ID_KEY. - * - * @param queryConditionIntent QUERY_REQUEST sent from host - * @return data previously added to the REQUEST_QUERY intent - * @see #hostSupportsRequestQueryDataPassThrough(Bundle) - * @see #addPassThroughData(Intent,Bundle) - */ - public static Bundle retrievePassThroughData( Intent queryConditionIntent ) { - return (Bundle) getExtraValueSafe( - queryConditionIntent, - EXTRA_REQUEST_QUERY_PASS_THROUGH_DATA, - Bundle.class, - "retrievePassThroughData" - ); - } - - /** - * Add a message ID to a REQUEST_QUERY intent which will then be included in the corresponding - * QUERY_CONDITION broadcast sent by the host for each event instance of the plugin. - * - * The minimal purpose is to enable the plugin to associate a QUERY_CONDITION to the - * with the REQUEST_QUERY that caused it. It also allows the message to be verified - * by the plugin to prevent e.g. replay attacks - * - * @param requestQueryIntent intent being sent to the host - * @return a guaranteed non-repeating within 100 calls message ID - * @see #hostSupportsRequestQueryDataPassThrough(Bundle) - * @see #retrievePassThroughData(Intent) - * @return an ID for the bundle so it can be identified and the caller verified when it is again received by the plugin - * - */ - public static int addPassThroughMessageID( Intent requestQueryIntent ) { - - Bundle passThroughBundle = retrieveOrCreatePassThroughBundle( requestQueryIntent ); - - int id = getPositiveNonRepeatingRandomInteger(); - - passThroughBundle.putInt( PASS_THROUGH_BUNDLE_MESSAGE_ID_KEY, id ); - - return id; - } - - /* - * Retrieve the pass through data from a QUERY_REQUEST from the host which was generated - * by a REQUEST_QUERY from the plugin. - * - * @param queryConditionIntent QUERY_REQUEST sent from host - * @return the ID which was passed through by the host, or -1 if no ID was found - * @see #hostSupportsRequestQueryDataPassThrough(Bundle) - * @see #addPassThroughData(Intent,Bundle) - */ - public static int retrievePassThroughMessageID( Intent queryConditionIntent ) { - - int toReturn = -1; - - Bundle passThroughData = Event.retrievePassThroughData( queryConditionIntent ); - - if ( passThroughData != null ) { - Integer id = (Integer) getBundleValueSafe( - passThroughData, - PASS_THROUGH_BUNDLE_MESSAGE_ID_KEY, - Integer.class, - "retrievePassThroughMessageID" - ); - - if ( id != null ) - toReturn = id; - } - - return toReturn; - } - - // internal use - private static Bundle retrieveOrCreatePassThroughBundle( Intent requestQueryIntent ) { - - Bundle passThroughBundle; - - if ( requestQueryIntent.hasExtra( EXTRA_REQUEST_QUERY_PASS_THROUGH_DATA ) ) - passThroughBundle = requestQueryIntent.getBundleExtra( EXTRA_REQUEST_QUERY_PASS_THROUGH_DATA ); - else { - passThroughBundle = new Bundle(); - requestQueryIntent.putExtra( EXTRA_REQUEST_QUERY_PASS_THROUGH_DATA, passThroughBundle ); - } - - return passThroughBundle; - } - } - // ---------------------------------- HOST ----------------------------------------- // - - public static class Host { - - /** - * Tell the plugin what capabilities the host support. This should be called when sending - * intents to any EditActivity, FireReceiver or QueryReceiver. - * - * @param toPlugin the intent we're sending - * @return capabilities one or more of the EXTRA_HOST_CAPABILITY_XXX flags - */ - public static Intent addCapabilities( Intent toPlugin, int capabilities ) { - return toPlugin.putExtra( EXTRA_HOST_CAPABILITIES, capabilities ); - } - - /** - * Add an intent to the fire intent before it goes to the plugin FireReceiver, which the plugin - * can use to signal when it is finished. Only use if @code{pluginWantsSychronousExecution} is true. - * - * @param fireIntent fire intent going to the plugin - * @param completionIntent intent which will signal the host that the plugin is finished. - * Implementation is host-dependent. - */ - public static void addCompletionIntent(Intent fireIntent, Intent completionIntent, ComponentName callService, boolean foreground) { - if (callService != null) { - completionIntent.putExtra(Setting.EXTRA_CALL_SERVICE_PACKAGE, callService.getPackageName()); - completionIntent.putExtra(Setting.EXTRA_CALL_SERVICE, callService.getClassName()); - completionIntent.putExtra(Setting.EXTRA_CALL_SERVICE_FOREGROUND, foreground); - } - fireIntent.putExtra( - Setting.EXTRA_PLUGIN_COMPLETION_INTENT, - completionIntent.toUri(Intent.URI_INTENT_SCHEME) - ); - } - - /** - * When a setting plugin is finished, it sends the host the intent which was passed to it - * via @code{addCompletionIntent}. - * - * @param completionIntent intent returned from the plugin when it finished. - * @return resultCode measure of plugin success, defaults to UNKNOWN - */ - public static int getSettingResultCode( Intent completionIntent ) { - - Integer val = (Integer) getExtraValueSafe( completionIntent, Setting.EXTRA_RESULT_CODE, Integer.class, "getSettingResultCode" ); - - return ( val == null ) ? Setting.RESULT_CODE_UNKNOWN : val; - } - - /** - * Extract a bundle of variables from an intent received from the FireReceiver. This - * should be called if the host previously indicated to the plugin - * that it supports setting variable return. - * - * @param resultExtras getResultExtras() from BroadcastReceiver:onReceive() - * @return variables a bundle of variable name/value pairs - * @see #addCapabilities(Intent, int) - */ - - public static Bundle getVariablesBundle( Bundle resultExtras ) { - return (Bundle) getBundleValueSafe( - resultExtras, EXTRA_VARIABLES_BUNDLE, Bundle.class, "getVariablesBundle" - ); - } - - /** - * Inform a setting plugin of the timeout value the host is using. - * - * @param toPlugin the intent we're sending - * @param timeoutMS the hosts timeout setting for the action. Note that this may differ from - * that which the plugin requests. - * @see #REQUESTED_TIMEOUT_MS_NONE, REQUESTED_TIMEOUT_MS_MAX, REQUESTED_TIMEOUT_MS_NEVER - */ - public static void addHintTimeoutMS( Intent toPlugin, int timeoutMS ) { - getHintsBundle( toPlugin, "addHintTimeoutMS" ).putInt( BUNDLE_KEY_HINT_TIMEOUT_MS, timeoutMS ); - } - - private static Bundle getHintsBundle( Intent intent, String funcName ) { - - Bundle hintsBundle = (Bundle) getExtraValueSafe( intent, EXTRA_HINTS_BUNDLE, Bundle.class, funcName ); - - if ( hintsBundle == null ) { - hintsBundle = new Bundle(); - intent.putExtra( EXTRA_HINTS_BUNDLE, hintsBundle ); - } - - return hintsBundle; - } - - public static boolean haveRequestedTimeout( Bundle extrasFromPluginEditActivity ) { - return extrasFromPluginEditActivity.containsKey( Setting.EXTRA_REQUESTED_TIMEOUT ); - } - - public static int getRequestedTimeoutMS( Bundle extrasFromPluginEditActivity ) { - return - (Integer) getBundleValueSafe( - extrasFromPluginEditActivity, Setting.EXTRA_REQUESTED_TIMEOUT, Integer.class, "getRequestedTimeout" - ) - ; - } - - public static String [] getSettingVariableReplaceKeys( Bundle fromPluginEditActivity ) { - return getStringArrayFromBundleString( - fromPluginEditActivity, Setting.BUNDLE_KEY_VARIABLE_REPLACE_STRINGS, - "getSettingVariableReplaceKeys" - ); - } - - public static String [] getKeysWithEncoding( Bundle fromPluginEditActivity, Encoding encoding ) { - - String [] toReturn = null; - - if ( Encoding.JSON.equals( encoding ) ) - toReturn = getStringArrayFromBundleString( - fromPluginEditActivity, TaskerPlugin.BUNDLE_KEY_ENCODING_JSON_KEYS, - "getKeyEncoding:JSON" - ); - else - Log.w( TAG, "Host.getKeyEncoding: unknown encoding " + encoding ); - - return toReturn; - } - - public static boolean haveRelevantVariables( Bundle b ) { - return b.containsKey( BUNDLE_KEY_RELEVANT_VARIABLES ); - } - - public static void cleanRelevantVariables( Bundle b ) { - b.remove( BUNDLE_KEY_RELEVANT_VARIABLES ); - } - - public static void cleanHints( Bundle extras ) { - extras.remove( TaskerPlugin.EXTRA_HINTS_BUNDLE ); - } - - public static void cleanRequestedTimeout( Bundle extras ) { - extras.remove( Setting.EXTRA_REQUESTED_TIMEOUT ); - } - - public static void cleanSettingReplaceVariables( Bundle b ) { - b.remove( Setting.BUNDLE_KEY_VARIABLE_REPLACE_STRINGS ); - } - } - - // ---------------------------------- HELPER FUNCTIONS -------------------------------- // - - private static Object getBundleValueSafe( Bundle b, String key, Class expectedClass, String funcName ) { - Object value = null; - - if ( b != null ) { - if ( b.containsKey( key ) ) { - Object obj = b.get( key ); - if ( obj == null ) - Log.w( TAG, funcName + ": " + key + ": null value" ); - else if ( obj.getClass() != expectedClass ) - Log.w( TAG, funcName + ": " + key + ": expected " + expectedClass.getClass().getName() + ", got " + obj.getClass().getName() ); - else - value = obj; - } - } - return value; - } - - private static Object getExtraValueSafe( Intent i, String key, Class expectedClass, String funcName ) { - return ( i.hasExtra( key ) ) ? - getBundleValueSafe( i.getExtras(), key, expectedClass, funcName ) : - null; - } - - private static boolean hostSupports( Bundle extrasFromHost, int capabilityFlag ) { - Integer flags = (Integer) getBundleValueSafe( extrasFromHost, EXTRA_HOST_CAPABILITIES, Integer.class, "hostSupports" ); - return - ( flags != null ) && - ( ( flags & capabilityFlag ) > 0 ) - ; - } - - public static int getPackageVersionCode( PackageManager pm, String packageName ) { - - int code = -1; - - if ( pm != null ) { - try { - PackageInfo pi = pm.getPackageInfo( packageName, 0 ); - if ( pi != null ) - code = pi.versionCode; - } - catch ( Exception e ) { - Log.e( TAG, "getPackageVersionCode: exception getting package info" ); - } - } - - return code; - } - - private static boolean variableNameIsLocal( String varName ) { - - int digitCount = 0; - int length = varName.length(); - - for ( int x = 0; x < length; x++ ) { - char ch = varName.charAt( x ); - - if ( Character.isUpperCase( ch ) ) - return false; - else if ( Character.isDigit( ch ) ) - digitCount++; - } - - if ( digitCount == ( varName.length() - 1 ) ) - return false; - - return true; - } - - private static String [] getStringArrayFromBundleString( Bundle bundle, String key, String funcName ) { - - String spec = (String) getBundleValueSafe( bundle, key, String.class, funcName ); - - String [] toReturn = null; - - if ( spec != null ) - toReturn = spec.split( " " ); - - return toReturn; - } - - private static void addStringArrayToBundleAsString( String [] toAdd, Bundle bundle, String key, String callerName ) { - - StringBuilder builder = new StringBuilder(); - - if ( toAdd != null ) { - - for ( String keyName : toAdd ) { - - if ( keyName.contains( " " ) ) - Log.w( TAG, callerName + ": ignoring bad keyName containing space: " + keyName ); - else { - if ( builder.length() > 0 ) - builder.append( ' ' ); - - builder.append( keyName ); - } - - if ( builder.length() > 0 ) - bundle.putString( key, builder.toString() ); - } - } - } - - // state tracking for random number sequence - private static int [] lastRandomsSeen = null; - private static int randomInsertPointer = 0; - private static SecureRandom sr = null; - - /** - * Generate a sequence of secure random positive integers which is guaranteed not to repeat - * in the last 100 calls to this function. - * - * @return a random positive integer - */ - public static int getPositiveNonRepeatingRandomInteger() { - - // initialize on first call - if ( sr == null ) { - sr = new SecureRandom(); - lastRandomsSeen = new int[RANDOM_HISTORY_SIZE]; - - for ( int x = 0; x < lastRandomsSeen.length; x++ ) - lastRandomsSeen[x] = -1; - } - - int toReturn; - do { - // pick a number - toReturn = sr.nextInt( Integer.MAX_VALUE ); - - // check we havn't see it recently - for ( int seen : lastRandomsSeen ) { - if ( seen == toReturn ) { - toReturn = -1; - break; - } - } - } - while ( toReturn == -1 ); - - // update history - lastRandomsSeen[randomInsertPointer] = toReturn; - randomInsertPointer = ( randomInsertPointer + 1 ) % lastRandomsSeen.length; - - return toReturn; - } - -} \ No newline at end of file diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/bundle/PluginBundleValues.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/bundle/PluginBundleValues.java deleted file mode 100644 index de085c2..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/bundle/PluginBundleValues.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * android-toast-setting-plugin-for-locale - * Copyright 2014 two forty four a.m. LLC - * - * 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.agnostic.apollo.taskerlaunchershortcut.bundle; - -import android.content.Context; -import android.os.Bundle; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import net.jcip.annotations.ThreadSafe; - -import com.twofortyfouram.assertion.BundleAssertions; -import com.twofortyfouram.log.Lumberjack; -import com.twofortyfouram.spackle.AppBuildInfo; -import static com.twofortyfouram.assertion.Assertions.assertNotEmpty; -import static com.twofortyfouram.assertion.Assertions.assertNotNull; - -/** - * Manages the {@link com.twofortyfouram.locale.api.Intent#EXTRA_BUNDLE EXTRA_BUNDLE} for this - * plug-in. - */ -@ThreadSafe -public final class PluginBundleValues { - - /** - * Type: {@code String}. - *

- * String message to display in a Toast message. - */ - @NonNull - public static final String BUNDLE_EXTRA_STRING_SHORTCUT_INTENT_URI - = "com.agnostic.apollo.taskerlaunchershortcut.extra.STRING_SHORTCUT_INTENT_URI"; //$NON-NLS-1$ - - /** - * Type: {@code int}. - *

- * versionCode of the plug-in that saved the Bundle. - */ - /* - * This extra is not strictly required, however it makes backward and forward compatibility - * significantly easier. For example, suppose a bug is found in how some version of the plug-in - * stored its Bundle. By having the version, the plug-in can better detect when such bugs occur. - */ - @NonNull - public static final String BUNDLE_EXTRA_INT_VERSION_CODE - = "com.agnostic.apollo.taskerlaunchershortcut.extra.INT_VERSION_CODE"; //$NON-NLS-1$ - - /** - * Method to verify the content of the bundle are correct. - *

- * This method will not mutate {@code bundle}. - * - * @param bundle bundle to verify. May be null, which will always return false. - * @return true if the Bundle is valid, false if the bundle is invalid. - */ - public static boolean isBundleValid(@Nullable final Bundle bundle) { - if (null == bundle) { - return false; - } - - try { - BundleAssertions.assertHasString(bundle, BUNDLE_EXTRA_STRING_SHORTCUT_INTENT_URI, false, false); - BundleAssertions.assertHasInt(bundle, BUNDLE_EXTRA_INT_VERSION_CODE); - //range is required because optionally the BUNDLE_KEY_VARIABLE_REPLACE_STRINGS may exist if TaskerPlugin.Setting.setVariableReplaceKeys is called - BundleAssertions.assertKeyCount(bundle, 2, 3); - } catch (final AssertionError e) { - Lumberjack.e("Bundle failed verification%s", e); //$NON-NLS-1$ - return false; - } - - return true; - } - - /** - * @param context Application context. - * @param message The toast message to be displayed by the plug-in. - * @return A plug-in bundle. - */ - @NonNull - public static Bundle generateBundle(@NonNull final Context context, - @NonNull final String message) { - assertNotNull(context, "context"); //$NON-NLS-1$ - assertNotEmpty(message, "message"); //$NON-NLS-1$ - - final Bundle result = new Bundle(); - result.putInt(BUNDLE_EXTRA_INT_VERSION_CODE, AppBuildInfo.getVersionCode(context)); - result.putString(BUNDLE_EXTRA_STRING_SHORTCUT_INTENT_URI, message); - - return result; - } - - /** - * @param bundle A valid plug-in bundle. - * @return The message inside the plug-in bundle. - */ - @NonNull - public static String getMessage(@NonNull final Bundle bundle) { - return bundle.getString(BUNDLE_EXTRA_STRING_SHORTCUT_INTENT_URI); - } - - /** - * Private constructor prevents instantiation - * - * @throws UnsupportedOperationException because this class cannot be instantiated. - */ - private PluginBundleValues() { - throw new UnsupportedOperationException("This class is non-instantiable"); //$NON-NLS-1$ - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/AppInfoItem.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/AppInfoItem.java deleted file mode 100644 index 3571de3..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/AppInfoItem.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.model; - -import android.graphics.drawable.Drawable; - - -public class AppInfoItem implements Comparable { - - private CharSequence label; - private CharSequence packageName; - private Drawable icon; - - public CharSequence getLabel() { - return label; - } - - public void setLabel(CharSequence label) { - this.label = label; - } - - public CharSequence getPackageName() { - return packageName; - } - - public void setPackageName(CharSequence packageName) { - this.packageName = packageName; - } - - public Drawable getIcon() { - return icon; - } - - public void setIcon(Drawable icon) { - this.icon = icon; - } - - @Override - public int compareTo(AppInfoItem app) { - return this.getLabel().toString().compareTo(app.getLabel().toString()); - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/ShortcutInfoItem.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/ShortcutInfoItem.java deleted file mode 100644 index de99d1a..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/model/ShortcutInfoItem.java +++ /dev/null @@ -1,318 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.model; - -import android.content.ComponentName; -import android.content.Intent; -import android.graphics.drawable.Drawable; -import android.os.Build; -import android.os.Bundle; -import android.os.PersistableBundle; -import android.os.UserHandle; -import android.text.TextUtils; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.RequiresApi; - -import com.agnostic.apollo.taskerlaunchershortcut.utils.BundleUtils; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -//check ShortcutInfo or ShortcutInfoCompat for details -public class ShortcutInfoItem implements Comparable { - - private String mId; - - private CharSequence mLabel; - private CharSequence mLongLabel; - - private String mAppLabel; - private ComponentName mActivity; - private Drawable mIcon; - private UserHandle mUserHandle; - private int mUserId; - - private Intent[] mIntents; - private Set mCategories; - private PersistableBundle[] mIntentPersistableExtrases; - private PersistableBundle mExtras; - - - - @NonNull - public String getId() { - return mId; - } - - @NonNull - public CharSequence getShortLabel() { - return mLabel; - } - - @Nullable - public CharSequence getLongLabel() { - return mLongLabel; - } - - @Nullable - public String getAppLabel() { - return mAppLabel; - } - - @Nullable - public ComponentName getActivity() { - return mActivity; - } - - public Drawable getIcon() { - return mIcon; - } - - public UserHandle getUserHandle() { - return mUserHandle; - } - - public int getUserId() { - return mUserId; - } - - @NonNull - public Intent getIntent() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { - if (mIntents == null || mIntents.length == 0) { - return null; - } - final int last = mIntents.length - 1; - final Intent intent = new Intent(mIntents[last]); - return setIntentExtras(intent, mIntentPersistableExtrases[last]); - } else { - return mIntents[mIntents.length - 1]; - } - } - - @NonNull - public Intent[] getIntents() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) { - final Intent[] ret = new Intent[mIntents.length]; - - for (int i = 0; i < ret.length; i++) { - ret[i] = new Intent(mIntents[i]); - setIntentExtras(ret[i], mIntentPersistableExtrases[i]); - } - - return ret; - } else { - return Arrays.copyOf(mIntents, mIntents.length); - } - } - - public Set getCategories() { - return mCategories; - } - - public PersistableBundle getExtras() { - return mExtras; - } - - public void setId(String id) { - this.mId = id; - } - - public void setShortLabel(@NonNull CharSequence shortLabel) { - this.mLabel = shortLabel; - } - - public void setLongLabel(@NonNull CharSequence longLabel) { - this.mLongLabel = longLabel; - } - - public void setAppLabel(String appLabel) { - mAppLabel = appLabel; - } - - public void setActivity(@NonNull ComponentName activity) { - this.mActivity = activity; - } - - public void setIcon(Drawable icon) { - this.mIcon = icon; - } - - @RequiresApi(api = Build.VERSION_CODES.N) - public void setUserHandle(int userId) { - this.mUserHandle = UserHandle.getUserHandleForUid(userId); - } - - public void setUserHandle(UserHandle userHandle) { - this.mUserHandle = userHandle; - } - - public void setUserId(int userId) { - this.mUserId = userId; - } - - public void setIntent(@NonNull Intent intent) { - setIntents(new Intent[]{intent}); - } - - public void setIntents(@NonNull Intent[] intents) { - this.mIntents = cloneIntents(intents); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) - fixUpIntentExtras(); - } - - public void setCategories(@NonNull Set categories) { - this.mCategories = cloneCategories(categories); - } - - public void setExtras(@NonNull PersistableBundle extras) { - this.mExtras = extras; - } - - - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) - public static Intent setIntentExtras(Intent intent, PersistableBundle extras) { - if (extras == null) { - intent.replaceExtras((Bundle) null); - } else { - intent.replaceExtras(new Bundle(extras)); - } - return intent; - } - - private static Set cloneCategories(Set source) { - if (source == null) { - return null; - } - final Set ret = new HashSet<>(source.size()); - for (CharSequence s : source) { - if (!TextUtils.isEmpty(s)) { - ret.add(s.toString().intern()); - } - } - return ret; - } - - private static Intent[] cloneIntents(Intent[] intents) { - if (intents == null) { - return null; - } - final Intent[] ret = new Intent[intents.length]; - for (int i = 0; i < ret.length; i++) { - if (intents[i] != null) { - ret[i] = new Intent(intents[i]); - } - } - return ret; - } - - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) - private void fixUpIntentExtras() { - if (mIntents == null) { - mIntentPersistableExtrases = null; - return; - } - mIntentPersistableExtrases = new PersistableBundle[mIntents.length]; - for (int i = 0; i < mIntents.length; i++) { - final Intent intent = mIntents[i]; - final Bundle extras = intent.getExtras(); - if (extras == null) { - mIntentPersistableExtrases[i] = null; - } else { - mIntentPersistableExtrases[i] = BundleUtils.toPersistableBundle(extras); - intent.replaceExtras((Bundle) null); - } - } - } - - @Override - public int compareTo(ShortcutInfoItem shortcut) { - - if(this.getActivity()!=null && shortcut.getActivity()!=null) { - int i = this.getActivity().toString().compareTo(shortcut.getActivity().toString()); - if (i != 0) return i; - } - - return this.getShortLabel().toString().compareTo(shortcut.getShortLabel().toString()); - } - - public String toString() { - final StringBuilder sb = new StringBuilder(); - - sb.append("ShortcutInfoItem {"); - - sb.append("id="); - if (mId == null) - sb.append("null"); - else - sb.append(mId); - sb.append(", "); - - - sb.append("activity="); - if (mActivity == null) - sb.append("null"); - else - sb.append(mActivity); - sb.append(", "); - - sb.append("shortLabel="); - if (mLabel == null) - sb.append("null"); - else - sb.append(mLabel); - sb.append(", "); - - sb.append("longLabel="); - if (mLongLabel == null) - sb.append("null"); - else - sb.append(mLongLabel); - sb.append(", "); - - sb.append("categories="); - if (mCategories == null) - sb.append("null"); - else - sb.append(mCategories); - sb.append(", "); - - sb.append("icon="); - if (mIcon == null) - sb.append("null"); - else - sb.append(mIcon); - sb.append(", "); - - sb.append("intents="); - if (mIntents == null) { - sb.append("null"); - } else { - final int size = mIntents.length; - sb.append("["); - String sep = ""; - for (int i = 0; i < size; i++) { - sb.append(sep); - sep = ", "; - sb.append(mIntents[i]); - if (mIntentPersistableExtrases != null) { - sb.append("/"); - sb.append(mIntentPersistableExtrases[i]); - } - } - sb.append("]"); - } - - sb.append(", "); - - sb.append("extras="); - if (mExtras == null) - sb.append("null"); - else - sb.append(mExtras); - - sb.append("}"); - return sb.toString(); - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/receiver/FireReceiver.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/receiver/FireReceiver.java deleted file mode 100644 index 5bf271e..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/receiver/FireReceiver.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * android-toast-setting-plugin-for-locale - * Copyright 2014 two forty four a.m. LLC - * - * 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.agnostic.apollo.taskerlaunchershortcut.receiver; - -import android.content.Context; -import android.content.Intent; -import android.os.Build; -import android.os.Bundle; - -import androidx.annotation.NonNull; - -import com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity; -import com.agnostic.apollo.taskerlaunchershortcut.TaskerPlugin; -import com.agnostic.apollo.taskerlaunchershortcut.bundle.PluginBundleValues; -import com.agnostic.apollo.taskerlaunchershortcut.shortcuts.ShortcutFirer; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; -import com.twofortyfouram.locale.sdk.client.receiver.AbstractPluginSettingReceiver; - -import static com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity.ARG_FIRE_INTENT_FROM_HOST; -import static com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity.ARG_SHORTCUT_INTENT_URI; - -public final class FireReceiver extends AbstractPluginSettingReceiver { - - @Override - protected boolean isBundleValid(@NonNull final Bundle bundle) { - return PluginBundleValues.isBundleValid(bundle); - } - - @Override - protected boolean isAsync() { - return false; - } - - @Override - protected void firePluginSetting(@NonNull final Context context, @NonNull final Intent fireIntentFromHost, @NonNull final Bundle fireBundleFromHost) { - final String shortcutIntentUri = PluginBundleValues.getMessage(fireBundleFromHost); - - if(!shortcutIntentUri.isEmpty()) - { - //This is required because of android 10 background activity start restrictions - //If an activity wasn't started that sent the shortcut and the receiver was use to send the shortcut, - // the shortcuts wouldn't send and there were exceptions in the logcat - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { - context.startActivity(LauncherHomeActivity.newFireShortcutIntentUriIntent(context, shortcutIntentUri, fireIntentFromHost)); - } else { - Logger.logDebug(context, "Shortcut Intent Received By FireReceiver: \"" + shortcutIntentUri + "\""); - Intent newIntent = new Intent(); - newIntent.putExtra(ARG_SHORTCUT_INTENT_URI, shortcutIntentUri); - newIntent.putExtra(ARG_FIRE_INTENT_FROM_HOST, fireIntentFromHost); - ShortcutFirer.fireShortcutIntentUriIntent(context, newIntent); - } - /* - // Send result back to Tasker now - if ( isOrderedBroadcast() ) { - - setResultCode( TaskerPlugin.Setting.RESULT_CODE_OK ); - - if ( TaskerPlugin.Setting.hostSupportsVariableReturn( fireIntentFromHost.getExtras() ) ) { - Bundle resultBundle = new Bundle(); - resultBundle.putString( "%result_code", "0" ); - - TaskerPlugin.addVariableBundle( getResultExtras( true ), resultBundle ); - } - } -* */ - - // Notify Tasker that result will be sent later - if ( isOrderedBroadcast() ) { - setResultCode(TaskerPlugin.Setting.RESULT_CODE_PENDING); - } - - //Sending result back to Tasker with either of the ways above is not necessary, it would depend on the plugin - } - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/InstallShortcutReceiver.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/InstallShortcutReceiver.java deleted file mode 100644 index 1d5cdde..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/InstallShortcutReceiver.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.shortcuts; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; - -//Intent receiver used to install legacy shortcuts from other applications on Android < 8 -public class InstallShortcutReceiver extends BroadcastReceiver { - - public void onReceive(Context context, Intent intent) { - if (intent != null) { - Logger.logDebug(context, "Processing Intent: \"" + intent.toUri(0)); - - if (intent.getAction() != null) { - ShortcutReceiver.processReceivedShortcutIntent(context, intent); - } - } - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/PinShortcutReceiver.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/PinShortcutReceiver.java deleted file mode 100644 index 11ff2bd..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/PinShortcutReceiver.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.shortcuts; - -import android.annotation.TargetApi; -import android.app.Activity; -import android.os.Build; -import android.os.Bundle; - -//Activity to process pin shortcuts requests from other applications on Android >= 8 -@TargetApi(Build.VERSION_CODES.O) -public class PinShortcutReceiver extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - ShortcutReceiver.processReceivedShortcutIntent(this, getIntent()); - finish(); - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutFirer.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutFirer.java deleted file mode 100644 index d8287ff..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutFirer.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.shortcuts; - -import android.content.ActivityNotFoundException; -import android.content.Context; -import android.content.Intent; -import android.content.pm.LauncherApps; -import android.graphics.Rect; -import android.os.Build; -import android.os.Bundle; -import android.os.UserHandle; - -import com.agnostic.apollo.taskerlaunchershortcut.TaskerPlugin; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; -import com.agnostic.apollo.taskerlaunchershortcut.utils.PermissionsUtils; - -import java.net.URISyntaxException; - -import static android.content.Context.LAUNCHER_APPS_SERVICE; -import static com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity.ARG_FIRE_INTENT_FROM_HOST; -import static com.agnostic.apollo.taskerlaunchershortcut.LauncherHomeActivity.ARG_SHORTCUT_INTENT_URI; -import static com.agnostic.apollo.taskerlaunchershortcut.TaskerPlugin.Setting.RESULT_CODE_FAILED_PLUGIN_FIRST; -import static com.agnostic.apollo.taskerlaunchershortcut.TaskerPlugin.Setting.VARNAME_ERROR_MESSAGE; -import static com.agnostic.apollo.taskerlaunchershortcut.TaskerPlugin.VARIABLE_PREFIX; - -public class ShortcutFirer { - - public static void fireShortcutIntentUriIntent(Context context, Intent intent) { - try { - if(context==null) - return; - - //if an intent is received to send an intent uri - String shortcutIntentUri = intent.getStringExtra(ARG_SHORTCUT_INTENT_URI); - Intent fireIntentFromHost = intent.getParcelableExtra(ARG_FIRE_INTENT_FROM_HOST); - - //Logger.logDebug(context, "Fire Shortcut Intent Received: \"" + shortcutIntentUri + "\""); - if (shortcutIntentUri != null && !shortcutIntentUri.isEmpty()) { - - Intent shortcutIntentUriIntent; - int result_code = 1; - String error_message = ""; - - - //This is required because of android 10 background activity start restrictions - boolean permissionsGranted = true; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) - permissionsGranted = PermissionsUtils.checkSystemAlertWindowPermission(context); - - if(!permissionsGranted) { - error_message = "Permission Exception: Apps Cannot Start Activities From Background Without SYSTEM_ALERT_WINDOW Permission"; - Logger.logErrorAndShowToast(context, error_message); - sendResultBundleToTasker(context, fireIntentFromHost, result_code, error_message); - return; - } - - try { - shortcutIntentUriIntent = Intent.parseUri(shortcutIntentUri, 0); - } catch (URISyntaxException e) { - error_message = "URISyntaxException: Invalid Shortcut Intent Uri"; - Logger.logErrorAndShowToast(context, error_message); - Logger.logStackTrace(context, e); - sendResultBundleToTasker(context, fireIntentFromHost, result_code, error_message); - return; - } - - if (shortcutIntentUriIntent.hasCategory("com.android.launcher3.DEEP_SHORTCUT")) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N_MR1) { - error_message = "Dynamic or Pinned DEEP_SHORTCUT Intents Can Only Be Sent On API>=" + Build.VERSION_CODES.N_MR1; - Logger.logErrorAndShowToast(context, error_message); - sendResultBundleToTasker(context, fireIntentFromHost, result_code, error_message); - return; - } - - LauncherApps launcherApps = (LauncherApps) context.getSystemService(LAUNCHER_APPS_SERVICE); - if (launcherApps == null) { - error_message = "LAUNCHER_APPS_SERVICE is Unexpectedly Null"; - Logger.logErrorAndShowToast(context, error_message); - sendResultBundleToTasker(context, fireIntentFromHost, result_code, error_message); - return; - } - - if (!launcherApps.hasShortcutHostPermission()) { - error_message = "TaskerLauncherShortcut Must Be Set As Default Launcher To Send Dynamic or Pinned DEEP_SHORTCUT Intents"; - Logger.logErrorAndShowToast(context, error_message); - sendResultBundleToTasker(context, fireIntentFromHost, result_code, error_message); - return; - } - - String packageName = shortcutIntentUriIntent.getPackage(); - String shortcutId = shortcutIntentUriIntent.getStringExtra("shortcut_id"); - int profile = shortcutIntentUriIntent.getIntExtra("profile", -1); - - Logger.logDebug(context, "packageName: \"" + packageName + "\", shortcutId: \"" + shortcutId + "\", profile: \"" + profile + "\""); - - if (packageName == null || shortcutId==null) { - error_message = "Package Name or Shortcut ID is null: Invalid Shortcut Intent Uri"; - Logger.logErrorAndShowToast(context, error_message); - sendResultBundleToTasker(context, fireIntentFromHost, result_code, error_message); - return; - } - - try { - //send dynamic shortcut intent - Logger.logDebug(context, "Sending Shortcut Intent"); - launcherApps.startShortcut(packageName, shortcutId, (Rect) null, (Bundle) null, UserHandle.getUserHandleForUid(profile)); - Logger.logDebug(context, "Shortcut Intent Sent"); - result_code = 0; - } catch (ActivityNotFoundException e) { - error_message = "ActivityNotFoundException: Invalid Shortcut Intent Uri"; - Logger.logErrorAndShowToast(context, error_message); - Logger.logStackTrace(context, e); - } - - } else { - try { - //send shortcut intent - Logger.logDebug(context, "Sending Shortcut Intent"); - shortcutIntentUriIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - context.startActivity(shortcutIntentUriIntent); - Logger.logDebug(context, "Shortcut Intent Sent"); - result_code = 0; - } catch (ActivityNotFoundException e) { - error_message = "ActivityNotFoundException: Invalid Shortcut Intent Uri"; - Logger.logErrorAndShowToast(context, error_message); - Logger.logStackTrace(context, e); - } - } - - sendResultBundleToTasker(context, fireIntentFromHost, result_code, error_message); - } - - - - } catch (Exception e) { - Logger.logStackTrace(context, e); - } - } - - private static void sendResultBundleToTasker(Context context, Intent fireIntentFromHost, int result_code, String error_message) { - - Bundle resultBundle = new Bundle(); - - Logger.logDebug(context, "result_code: \"" + result_code + "\", error_message: \"" + error_message + "\""); - - // If result_code is not negative - if(result_code>=0) { - // Set %result_code - String result_code_variable_name = VARIABLE_PREFIX + "result_code"; - if (TaskerPlugin.variableNameValid(result_code_variable_name)) - resultBundle.putString(result_code_variable_name, String.valueOf(result_code)); - - // If plugin action failed - if (result_code > 0) { - // Set %err. does not work currently for unknown reason - String err_variable_name = VARIABLE_PREFIX + "err"; - if (TaskerPlugin.variableNameValid(err_variable_name)) - resultBundle.putString(err_variable_name, String.valueOf(RESULT_CODE_FAILED_PLUGIN_FIRST + result_code)); - - // Set %errmsg - String errmsg_variable_name = VARNAME_ERROR_MESSAGE; - if (TaskerPlugin.variableNameValid(errmsg_variable_name)) - resultBundle.putString(errmsg_variable_name, error_message); - } - } - - // Send result back to Tasker - if(fireIntentFromHost!=null) - TaskerPlugin.Setting.signalFinish( context, fireIntentFromHost, TaskerPlugin.Setting.RESULT_CODE_OK, resultBundle ); - } - -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutReceiver.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutReceiver.java deleted file mode 100644 index 80879a4..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/shortcuts/ShortcutReceiver.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.shortcuts; - -import android.app.AppOpsManager; -import android.content.Context; -import android.content.Intent; -import android.content.pm.LauncherApps; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.content.pm.ShortcutInfo; -import android.os.Build; -import android.os.Parcelable; -import android.os.Process; -import android.text.TextUtils; -import androidx.annotation.RequiresApi; - -import com.agnostic.apollo.taskerlaunchershortcut.ShortcutChooserActivity; -import com.agnostic.apollo.taskerlaunchershortcut.ShortcutsLab; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; -import com.agnostic.apollo.taskerlaunchershortcut.utils.QueryPreferences; - -public class ShortcutReceiver { - - private static final String ACTION_INSTALL_SHORTCUT = - "com.android.launcher.action.INSTALL_SHORTCUT"; - - public static void processReceivedShortcutIntent(Context context, Intent intent) { - if (intent!=null) - Logger.logDebug(context, "Processing Intent To ShortcutReceiver: \"" + intent.toUri(0)); - else - return; - - if (intent.getComponent() == null) { - Logger.logError(context, "Ignoring intent that does not have a component set"); - return; - } - - String shortcutIntentUri = convertShortcutIntentToUri(context, intent); - if (shortcutIntentUri!=null) { - Logger.logDebug(context, "shortcutIntentUri: \"" + shortcutIntentUri + "\""); - Logger.showToast(context, "Pinned Shortcut Received\nPlease Return To Shortcut Chooser Screen"); - QueryPreferences.setPinnedShortcutIntentUri(context, shortcutIntentUri); - } else { - Logger.logError(context, "Failed to convert shortcut intent to Uri"); - } - - } - - public static String convertShortcutIntentToUri(Context context, Intent intent) { - - if (intent==null) - return null; - - if (intent.getComponent() == null) { - return null; - } - - ShortcutInfo shortcutInfo = null; - String shortcutName = null; - Intent shortcutIntent = null; - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - shortcutInfo = createShortcutInfoFromPinItemRequest(context, getPinItemRequest(intent)); - if (shortcutInfo != null) { - Logger.logDebug(context, "shortcutInfo: \"" + shortcutInfo.toString() + "\""); - if (shortcutInfo.getShortLabel() != null) { - shortcutName = shortcutInfo.getShortLabel().toString(); - } else { - shortcutName = ""; - } - ShortcutsLab shortcutsLab = ShortcutsLab.get(context); - shortcutIntent = shortcutsLab.createDeepShortcutFromShortcutInfo(shortcutInfo); - } else { - Logger.logError(context, "Pin Request ShortcutInfo is null"); - return null; - } - - } else { - - if (intent.getAction() != null) { - if (!intent.getAction().equals(ACTION_INSTALL_SHORTCUT)) { - Logger.logError(context, "Ignoring intent that does not have an action that equals \"" + ACTION_INSTALL_SHORTCUT + "\""); - return null; - } - } - - shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME); - shortcutIntent = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT); - - // Legacy shortcuts are only supported for primary profile. - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN && Process.myUserHandle().equals(intent.getParcelableExtra(Intent.EXTRA_USER))) { - Logger.logError(context, "Legacy shortcuts are only supported for primary profile"); - return null; - } - } - - if (shortcutName == null || shortcutName.isEmpty()) { - Logger.logError(context, "Shortcut name is null or empty"); - return null; - } else - Logger.logDebug(context, "shortcutName: \"" + shortcutName + "\""); - - if (shortcutIntent == null) { - Logger.logError(context, "Shortcut intent is null"); - return null; - } else - Logger.logDebug(context, "shortcutIntent: \"" + shortcutIntent.toUri(0) + "\""); - - if (!hasPermissionForActivity(context, shortcutIntent, intent.getComponent().getPackageName())) { - // The app is trying to add a shortcut without sufficient permissions - Logger.logError(context, "Ignoring malicious intent " + intent.toUri(0)); - return null; - } - - return shortcutIntent.toUri(0); - } - - @RequiresApi(api = Build.VERSION_CODES.O) - private static ShortcutInfo createShortcutInfoFromPinItemRequest(Context context, LauncherApps.PinItemRequest request) { - if (request != null && - request.getRequestType() == LauncherApps.PinItemRequest.REQUEST_TYPE_SHORTCUT && - request.isValid()) { - ShortcutInfo shortcutInfo = request.getShortcutInfo(); - if (shortcutInfo!=null && shortcutInfo.getIntent() != null) - Logger.logDebug(context, "shortcutIntent: \"" + shortcutInfo.getIntent().toUri(0) + "\""); - request.accept(); - return shortcutInfo; - } else { - return null; - } - } - - @RequiresApi(api = Build.VERSION_CODES.O) - private static LauncherApps.PinItemRequest getPinItemRequest(Intent intent) { - Parcelable extra = intent.getParcelableExtra(LauncherApps.EXTRA_PIN_ITEM_REQUEST); - return extra instanceof LauncherApps.PinItemRequest ? (LauncherApps.PinItemRequest) extra : null; - } - - /** - * Returns true if {@param srcPackage} has the permission required to start the activity from - * {@param intent}. If {@param srcPackage} is null, then the activity should not need - * any permissions - */ - public static boolean hasPermissionForActivity(Context context, Intent intent, String srcPackage) { - - PackageManager mPm = context.getPackageManager(); - - ResolveInfo target = mPm.resolveActivity(intent, 0); - if (target == null) { - // Not a valid target - return false; - } - if (TextUtils.isEmpty(target.activityInfo.permission)) { - // No permission is needed - return true; - } - if (TextUtils.isEmpty(srcPackage)) { - // The activity requires some permission but there is no source. - return false; - } - - // Source does not have sufficient permissions. - if(mPm.checkPermission(target.activityInfo.permission, srcPackage) != - PackageManager.PERMISSION_GRANTED) { - return false; - } - - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { - // These checks are sufficient for below M devices. - return true; - } - - // On M and above also check AppOpsManager for compatibility mode permissions. - if (TextUtils.isEmpty(AppOpsManager.permissionToOp(target.activityInfo.permission))) { - // There is no app-op for this permission, which could have been disabled. - return true; - } - - // There is no direct way to check if the app-op is allowed for a particular app. Since - // app-op is only enabled for apps running in compatibility mode, simply block such apps. - - try { - return mPm.getApplicationInfo(srcPackage, 0).targetSdkVersion >= Build.VERSION_CODES.M; - } catch (PackageManager.NameNotFoundException e) { Logger.logError(context, e.getMessage()); } - - return false; - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ui/activity/EditActivity.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ui/activity/EditActivity.java deleted file mode 100644 index 1f099f5..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/ui/activity/EditActivity.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * android-toast-setting-plugin-for-locale - * Copyright 2014 two forty four a.m. LLC - * - * 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.agnostic.apollo.taskerlaunchershortcut.ui.activity; - -import android.app.Activity; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.os.Bundle; -import android.text.TextUtils; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.widget.EditText; -import android.widget.ImageButton; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import net.jcip.annotations.NotThreadSafe; - -import com.agnostic.apollo.taskerlaunchershortcut.R; -import com.agnostic.apollo.taskerlaunchershortcut.ShortcutChooserActivity; -import com.agnostic.apollo.taskerlaunchershortcut.TaskerPlugin; -import com.agnostic.apollo.taskerlaunchershortcut.bundle.PluginBundleValues; -import com.agnostic.apollo.taskerlaunchershortcut.utils.Logger; -import com.twofortyfouram.locale.sdk.client.ui.activity.AbstractAppCompatPluginActivity; -import com.twofortyfouram.log.Lumberjack; - -import static com.agnostic.apollo.taskerlaunchershortcut.bundle.PluginBundleValues.BUNDLE_EXTRA_STRING_SHORTCUT_INTENT_URI; - - -@NotThreadSafe -public final class EditActivity extends AbstractAppCompatPluginActivity { - - @Override - protected void onCreate(final Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.activity_edit); - - /* - * To help the user keep context, the title shows the host's name and the subtitle - * shows the plug-in's name. - */ - CharSequence callingApplicationLabel = null; - try { - callingApplicationLabel = - getPackageManager().getApplicationLabel( - getPackageManager().getApplicationInfo(getCallingPackage(), - 0)); - } catch (final PackageManager.NameNotFoundException e) { - Lumberjack.e("Calling package couldn't be found%s", e); //$NON-NLS-1$ - } - if (null != callingApplicationLabel) { - setTitle(callingApplicationLabel); - } - - getSupportActionBar().setSubtitle(R.string.plugin_name); - - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - - ImageButton mSearchShortcutButton = findViewById(R.id.search_shortcut_button); - mSearchShortcutButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - startActivityForResult(ShortcutChooserActivity.newShortcutTypeChooserIntent(EditActivity.this), ShortcutChooserActivity.REQUEST_CHOOSE_SHORTCUT); - } - }); - - mSearchShortcutButton.setOnLongClickListener(new View.OnLongClickListener() { - @Override - public boolean onLongClick(View view) { - Logger.showToast(EditActivity.this, view.getContentDescription().toString()); - return true; - } - }); - } - - @Override - public void onPostCreateWithPreviousResult(@NonNull final Bundle previousBundle, - @NonNull final String previousBlurb) { - final String message = PluginBundleValues.getMessage(previousBundle); - ((EditText) findViewById(R.id.shortcut_uri_text)).setText(message); - } - - @Override - public boolean isBundleValid(@NonNull final Bundle bundle) { - //Logger.logDebug(this, "Bundle: \"" + bundle.toString() + "\""); - return PluginBundleValues.isBundleValid(bundle); - } - - @NonNull - @Override - public Intent getResultIntent() { - Intent resultIntent = new Intent(); - - // Configuration information for Tasker variables returned from the executed task - if (TaskerPlugin.hostSupportsRelevantVariables(getIntent().getExtras())) { - TaskerPlugin.addRelevantVariableList(resultIntent, new String[]{ - "%result_code\nResult Code\nThe result code for sending shortcut intent.\n" + - "0 for success, otherwise a failure.", - "%errmsg\nError Message\nThe err message of the action." - }); - } - - // Notify Tasker to wait for max 10 seconds for plugin to send result - if (TaskerPlugin.Setting.hostSupportsSynchronousExecution(getIntent().getExtras())) { - TaskerPlugin.Setting.requestTimeoutMS(resultIntent, 10000); - } - - return resultIntent; - } - - @Nullable - @Override - public Bundle getResultBundle() { - Bundle resultBundle = null; - - final String message = ((EditText) findViewById(R.id.shortcut_uri_text)).getText().toString(); - if (!TextUtils.isEmpty(message)) { - resultBundle = PluginBundleValues.generateBundle(getApplicationContext(), message); - - if (TaskerPlugin.Setting.hostSupportsOnFireVariableReplacement(this)) { - TaskerPlugin.Setting.setVariableReplaceKeys(resultBundle, new String[]{ - BUNDLE_EXTRA_STRING_SHORTCUT_INTENT_URI - }); - } - } - - return resultBundle; - } - - @NonNull - @Override - public String getResultBlurb(@NonNull final Bundle bundle) { - final String message = PluginBundleValues.getMessage(bundle); - - final int maxBlurbLength = getResources().getInteger( - R.integer.com_twofortyfouram_locale_sdk_client_maximum_blurb_length); - - if (message.length() > maxBlurbLength) { - return message.substring(0, maxBlurbLength); - } - - return message; - } - - @Override - public boolean onCreateOptionsMenu(final Menu menu) { - getMenuInflater().inflate(R.menu.activity_edit, menu); - - return true; - } - - @Override - public boolean onOptionsItemSelected(final MenuItem item) { - if (android.R.id.home == item.getItemId()) { - finish(); - } else if (R.id.menu_discard_changes == item.getItemId()) { - // Signal to AbstractAppCompatPluginActivity that the user canceled. - mIsCancelled = true; - finish(); - - return true; - } - - return super.onOptionsItemSelected(item); - } - - @Override - public void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - - if (resultCode != Activity.RESULT_OK) { - return; - } - - if (requestCode == ShortcutChooserActivity.REQUEST_CHOOSE_SHORTCUT) { - int returnValue = data.getIntExtra(ShortcutChooserActivity.CHOOSE_SHORTCUT_RETURN_STATE, ShortcutChooserActivity.CHOOSE_SHORTCUT_RETURN_STATE_FAILED); - if (returnValue == ShortcutChooserActivity.CHOOSE_SHORTCUT_RETURN_STATE_SUCCESS) { - String shortcutIntentUri = data.getStringExtra(ShortcutChooserActivity.ARG_SHORTCUT_INTENT_URI); - if (shortcutIntentUri != null) { - Logger.logDebug(this, "Chosen Shortcut: \"" + shortcutIntentUri + "\""); - ((EditText) findViewById(R.id.shortcut_uri_text)).setText(shortcutIntentUri); - return; - } - } - } - - // Signal to AbstractAppCompatPluginActivity that the user canceled. - mIsCancelled = true; - Logger.logDebugAndShowToast(this, "Choose Shortcut Cancelled"); - finish(); - } - -} - diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/BundleUtils.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/BundleUtils.java deleted file mode 100644 index b309290..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/BundleUtils.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.utils; - -import android.os.BaseBundle; -import android.os.Build; -import android.os.Bundle; -import android.os.PersistableBundle; - -import androidx.annotation.RequiresApi; - -public class BundleUtils { - /** - * Creates a new {@link Bundle} based on the specified {@link PersistableBundle}. - */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) - public static Bundle toBundle(PersistableBundle persistableBundle) { - if (persistableBundle == null) { - return null; - } - Bundle bundle = new Bundle(); - bundle.putAll(persistableBundle); - return bundle; - } - - /** - * Creates a new {@link PersistableBundle} from the specified {@link Bundle}. - * Will ignore all values that are not persistable, according - * to {@link #isPersistableBundleType(Object)}. - */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) - public static PersistableBundle toPersistableBundle(Bundle bundle) { - if (bundle == null) { - return null; - } - PersistableBundle persistableBundle = new PersistableBundle(); - for (String key : bundle.keySet()) { - Object value = bundle.get(key); - if (isPersistableBundleType(value)) { - putIntoBundle(persistableBundle, key, value); - } - } - return persistableBundle; - } - - /** - * Checks if the specified object can be put into a {@link PersistableBundle}. - * - * @see PersistableBundle Implementation - */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) - public static boolean isPersistableBundleType(Object value) { - return ((value instanceof PersistableBundle) || - (value instanceof Integer) || (value instanceof int[]) || - (value instanceof Long) || (value instanceof long[]) || - (value instanceof Double) || (value instanceof double[]) || - (value instanceof String) || (value instanceof String[]) || - (value instanceof Boolean) || (value instanceof boolean[]) - ); - } - - /** - * Attempts to insert the specified key value pair into the specified bundle. - * - * @throws IllegalArgumentException if the value type can not be put into the bundle. - */ - @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1) - public static void putIntoBundle(BaseBundle baseBundle, String key, Object value) throws IllegalArgumentException { - if (value == null) { - throw new IllegalArgumentException("Unable to determine type of null values"); - } else if (value instanceof Integer) { - baseBundle.putInt(key, (int) value); - } else if (value instanceof int[]) { - baseBundle.putIntArray(key, (int[]) value); - } else if (value instanceof Long) { - baseBundle.putLong(key, (long) value); - } else if (value instanceof long[]) { - baseBundle.putLongArray(key, (long[]) value); - } else if (value instanceof Double) { - baseBundle.putDouble(key, (double) value); - } else if (value instanceof double[]) { - baseBundle.putDoubleArray(key, (double[]) value); - } else if (value instanceof String) { - baseBundle.putString(key, (String) value); - } else if (value instanceof String[]) { - baseBundle.putStringArray(key, (String[]) value); - } else if (value instanceof Boolean) { - baseBundle.putBoolean(key, (boolean) value); - } else if (value instanceof boolean[]) { - baseBundle.putBooleanArray(key, (boolean[]) value); - } else if (value instanceof PersistableBundle) { - if (baseBundle instanceof PersistableBundle) - ((PersistableBundle) baseBundle).putPersistableBundle(key, (PersistableBundle)value); - else if (baseBundle instanceof Bundle) - ((Bundle) baseBundle).putBundle(key, toBundle((PersistableBundle) value)); - } else { - throw new IllegalArgumentException("Objects of type " + value.getClass().getSimpleName() - + " can not be put into a " + BaseBundle.class.getSimpleName()); - } - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/LauncherUtils.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/LauncherUtils.java deleted file mode 100644 index 264019e..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/LauncherUtils.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.utils; - -import android.annotation.SuppressLint; -import android.app.Activity; -import android.app.role.RoleManager; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.os.Build; - -import com.agnostic.apollo.taskerlaunchershortcut.FakeLauncherHome; - -import java.util.ArrayList; -import java.util.List; - -import static android.content.Context.ROLE_SERVICE; - -public class LauncherUtils { - - public static void changeDefaultLauncherInitiate(Activity context) { - if (context == null) - return; - - PackageManager packageManager = context.getPackageManager(); - ComponentName componentName = new ComponentName(context.getApplicationContext(), FakeLauncherHome.class); - packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP); - - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_HOME); - context.startActivity(intent); - - packageManager.setComponentEnabledSetting(componentName, PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); - } - - public static boolean isMyAppLauncherDefault(Context context) { - - if (context == null) - return false; - - final Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_HOME); - final ResolveInfo resolveInfo = context.getPackageManager().resolveActivity(intent, 0); - if (resolveInfo!=null && resolveInfo.activityInfo != null && context.getPackageName() - .equals(resolveInfo.activityInfo.packageName)) { - return true; - } - return false; - } - - public static void startLauncherHome(Activity context) { - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.addCategory(Intent.CATEGORY_HOME); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS | Intent.FLAG_ACTIVITY_NO_HISTORY); - context.startActivity(intent); - } -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/Logger.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/Logger.java deleted file mode 100644 index a574ad7..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/Logger.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.utils; - - -import android.content.Context; -import android.os.Handler; -import android.os.Looper; -import android.util.Log; -import android.widget.Toast; - -import java.io.IOException; -import java.io.PrintWriter; -import java.io.StringWriter; - -public class Logger { - - static String tag = "custom_taskerlaunchershortcut_log"; - //static String tag = TAG; - static public void logDebug(Context context, String message) - { - if(context!=null && QueryPreferences.getLoggingState(context)) - Log.d(tag,message); - } - - static public void logError(Context context, String message) - { - if(context!=null && QueryPreferences.getLoggingState(context)) - Log.e(tag,message); - } - - static public void logStackTrace(Context context, Exception e) - { - if(context!=null && QueryPreferences.getLoggingState(context)) - { - try { - StringWriter errors = new StringWriter(); - PrintWriter pw = new PrintWriter(errors); - e.printStackTrace(pw); - pw.close(); - Log.e(tag,errors.toString()); - errors.close(); - } catch (IOException e1) { - e1.printStackTrace(); - } - } - - } - - static public void showToast(final Context context, final String toastText){ - new Handler(Looper.getMainLooper()).post(new Runnable() { - - @Override - public void run() { - Toast.makeText(context, toastText, Toast.LENGTH_LONG).show(); - } - }); - } - - static public void logDebugAndShowToast(Context context, String message) { - logDebug(context,message); - showToast(context,message); - } - - static public void logErrorAndShowToast(Context context, String message) { - logError(context,message); - showToast(context,message); - } - -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/PermissionsUtils.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/PermissionsUtils.java deleted file mode 100644 index deca3c6..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/PermissionsUtils.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.utils; - -import android.Manifest; -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.content.pm.PackageManager; -import android.net.Uri; -import android.os.Build; -import android.provider.Settings; - -import androidx.core.content.ContextCompat; - -public class PermissionsUtils { - - public static final int ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE = 0; - - public static String[] mPermissions = new String[]{ - Manifest.permission.READ_EXTERNAL_STORAGE - }; - - public static boolean checkPermissions(Context context, String[] permissions) { - int result; - - for (String p:permissions) { - result = ContextCompat.checkSelfPermission(context,p); - if (result != PackageManager.PERMISSION_GRANTED) { - return false; - } - } - return true; - } - - public static void askPermissions(Activity context, String[] permissions) { - - int result; - Logger.showToast(context, "Please grant permissions on next screen"); - try {Thread.sleep(1000);} catch (InterruptedException e) {e.printStackTrace();} - - for (String p:permissions) { - result = ContextCompat.checkSelfPermission(context,p); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && result != PackageManager.PERMISSION_GRANTED) { - Logger.logDebug(context, "Requesting Permissions"); - context.requestPermissions(new String[]{p}, 0); - } - } - } - - public static boolean checkSystemAlertWindowPermission(Context context) { - boolean result; - - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) - return true; - - result = Settings.canDrawOverlays(context); - if (!result) { - Logger.logDebug(context, "App does not have SYSTEM_ALERT_WINDOW permission"); - return false; - } else { - Logger.logDebug(context, "App has SYSTEM_ALERT_WINDOW permission"); - return true; - } - } - - public static void askSystemAlertWindowPermission(Activity context) { - - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, - Uri.parse("package:" + context.getPackageName())); - context.startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE); - } - } - -} diff --git a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/QueryPreferences.java b/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/QueryPreferences.java deleted file mode 100644 index 71ad692..0000000 --- a/app/src/main/java/com/agnostic/apollo/taskerlaunchershortcut/utils/QueryPreferences.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut.utils; - - -import android.content.Context; -import android.preference.PreferenceManager; - -public class QueryPreferences { - - private static final String LOGGING_STATE = "logging_state"; - private static final String PINNED_SHORTCUT_INTENT_URI = "pinned_shortcut_intent_uri"; - - public static final Boolean DEFAULT_LOGGING_STATE = true; - public static final String DEFAULT_PINNED_SHORTCUT_INTENT_URI = ""; - - public static boolean getLoggingState(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getBoolean(LOGGING_STATE, DEFAULT_LOGGING_STATE); - } - - public static void setLoggingState(Context context, Boolean loggingState) { - PreferenceManager.getDefaultSharedPreferences(context) - .edit() - .putBoolean(LOGGING_STATE, loggingState) - .apply(); - } - - public static String getPinnedShortcutIntentUri(Context context) { - return PreferenceManager.getDefaultSharedPreferences(context) - .getString(PINNED_SHORTCUT_INTENT_URI, DEFAULT_PINNED_SHORTCUT_INTENT_URI); - } - - public static void setPinnedShortcutIntentUri(Context context, String pinnedShortcutIntentUri) { - PreferenceManager.getDefaultSharedPreferences(context) - .edit() - .putString(PINNED_SHORTCUT_INTENT_URI, pinnedShortcutIntentUri) - .apply(); - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable-anydpi/ic_search.xml b/app/src/main/res/drawable-anydpi/ic_search.xml deleted file mode 100644 index afb0429..0000000 --- a/app/src/main/res/drawable-anydpi/ic_search.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable-hdpi/ic_search.png b/app/src/main/res/drawable-hdpi/ic_search.png deleted file mode 100644 index f9c0afe199efef694bef280480db7a2c69a71753..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 453 zcmV;$0XqJPP)WA81b!=8#S!-{5KqPXN6# z&yyq&zpB20udWq-L+WWySJq!O1^M6SIU9yBX z7XEeK0wjRiEa8KNzsCG;5 zU6=X3p)Dz(O?Ce)x$4061t-(hMolC=%R(BI`39<4-cz61C5U~hnXv{lQCII`z&2@6 zrUshud8XQcG*pceF9K0Db3vZeDHLteP_qeop+cWgZ6(ktFW@;J;0DUDTYD&5sKi4R vKqVSfT=q{UhZ>Z6LK;;3FJOH5SXKN1JrkgsceM#{00000NkvXXu0mjfsuaW$ diff --git a/app/src/main/res/drawable-mdpi/ic_search.png b/app/src/main/res/drawable-mdpi/ic_search.png deleted file mode 100644 index 6fd5a13ce225707d27a5f9450e4cb04332ffe0b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 229 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjYdl>XLn>}1CrGe9Y5M>F|7ylU zF#&&;M@Ivsj)X71lAxy0*Dlq?-TY+ciLDH2Kb#c$7?M~Oo;6$&3@F^7`h<=9OaZS< zmdOO2K;^4VIxCJ9Fugjo@YN=dtqDRQi*u~%Bx-wMEw@GRZ+tl~Yn_ODNS{G{A>Ih1fO>5X-uvSY$aF(Rq b9!7?n4Eq9(b;Sq*-Ob?X>gTe~DWM4fAc9oz diff --git a/app/src/main/res/drawable-xhdpi/ic_search.png b/app/src/main/res/drawable-xhdpi/ic_search.png deleted file mode 100644 index aad212cca9399d4f5787296510f09ab9bf3ca928..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 401 zcmV;C0dD?@P)YxPBo1fh&%6niAgy zY`+jrVK}-?%zT;n3^2laa1lPXWiL!PHVq_<2vexx8)HN4OUEZR3zp{m4&Z&j;o%rs z6M+o_88h?V7d#%b5?S5i`^?gZKk$VNU%yTR6Y{ck1)OWbIkA~O;|e&(*3t;b_f;=9 zla~8B4dmoyZUvk!;mp-Q!zpysB5wFII+gxMHjuoPNTqM)hLX3_vE&2I1<;dvq`Z*d zD@lj?*vvfhENc6;O8Q)|C4KCgcyY0H2Ar^M#(n2a+LV}BO1jmH{@KJrl8NO%o0v;7 vu}~8&F))(yr85H*8ww00000NkvXXu0mjfm!hl; diff --git a/app/src/main/res/drawable-xxhdpi/ic_search.png b/app/src/main/res/drawable-xxhdpi/ic_search.png deleted file mode 100644 index 64b54caf778b178420efc3516ebe66eb1e58e9b7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmV;F0&D$=P)Bb5QYx}6kJ148#*ymQq%AgsIW2?P-?+PC5aTq1}inuSeO{azz@aQWJnBgXHUFa zXW@O5HzXHs=kCew-0VjbK@bE%5ClPxPc4_r61hq4lCQ~+BH8ruq{PQLvm6q`*u^=$!DAos}gl;Es9=XMJr!>N#`DT7(JX}=O8oGSS_ zV>m0DIMvX4P7*k8j%!%GlG{o12e;Yg`&`4VpdC=p z@e-y-#2dC9^Zio$J?)?Jx$xELq!g#)h*Q@JNUC!>DaYzab&}Q!SsGTkl;hyqW z&`3zgaYiv?A#sm1!HI>rRXgL@ZDH;fYXQ_0>YQT6v5P{T)YJl~Yk9zdr}zU){H_*2 z6Uzg(JjHKW;!m^yda^v=k*D}amiSLv0NHXt*;D+oEeC1=WUFfPp5o^%@juan2g&O}HLNJwV~rz?QnV&r zi?m9?uEuGkS^vB*c0=BawCkUCR*f%$0K_lpb8r49n*&&fA@roIPj{GMbtynP2q7nB zbw23S3@P>^SV-SWfV57SU6GI1+Ft|@>08CU$r(j6w;I~km>9x#K;jpYPPv-oe#h6( z$S1Cnz$D~^koKcpmFXdX1V~;XRRBqb^swuY_5lfy0LkaP@WBD;9*_X(&yaQ-kOLCn utU - - - - - - diff --git a/app/src/main/res/layout/activity_fragment.xml b/app/src/main/res/layout/activity_fragment.xml deleted file mode 100644 index 63b1be9..0000000 --- a/app/src/main/res/layout/activity_fragment.xml +++ /dev/null @@ -1,6 +0,0 @@ - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_launcher_home.xml b/app/src/main/res/layout/fragment_launcher_home.xml deleted file mode 100644 index e403036..0000000 --- a/app/src/main/res/layout/fragment_launcher_home.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_shortcut_type_chooser.xml b/app/src/main/res/layout/fragment_shortcut_type_chooser.xml deleted file mode 100644 index b3efdea..0000000 --- a/app/src/main/res/layout/fragment_shortcut_type_chooser.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - diff --git a/app/src/main/res/layout/fragment_static_and_dynamic_shortcut_chooser.xml b/app/src/main/res/layout/fragment_static_and_dynamic_shortcut_chooser.xml deleted file mode 100644 index a0504d2..0000000 --- a/app/src/main/res/layout/fragment_static_and_dynamic_shortcut_chooser.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/list_item_app.xml b/app/src/main/res/layout/list_item_app.xml deleted file mode 100644 index ee98aa6..0000000 --- a/app/src/main/res/layout/list_item_app.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/list_item_shortcut.xml b/app/src/main/res/layout/list_item_shortcut.xml deleted file mode 100644 index 2755fcb..0000000 --- a/app/src/main/res/layout/list_item_shortcut.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/activity_edit.xml b/app/src/main/res/menu/activity_edit.xml deleted file mode 100644 index b5444b4..0000000 --- a/app/src/main/res/menu/activity_edit.xml +++ /dev/null @@ -1,11 +0,0 @@ - -

- - - - diff --git a/app/src/main/res/menu/fragment_launcher_home.xml b/app/src/main/res/menu/fragment_launcher_home.xml deleted file mode 100644 index 5bbbe48..0000000 --- a/app/src/main/res/menu/fragment_launcher_home.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/fragment_static_and_dynamic_shortcut_chooser.xml b/app/src/main/res/menu/fragment_static_and_dynamic_shortcut_chooser.xml deleted file mode 100644 index e65b30e..0000000 --- a/app/src/main/res/menu/fragment_static_and_dynamic_shortcut_chooser.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.png b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.png deleted file mode 100644 index 28796a3ec19eb49ba2c878c12055fdeb887f5f01..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1674 zcmb7FX;4#F6h1F`!AAfIR;|T_XG8^AL=kZzBnY^()Tp3HUQ|RyEQ?$0Fy#4Eger;> zz$ha)E(jtjs6|l%bs-HZj#y<6g+{0rBC%2*hNO>9|FkphjCaoc?z!K&=gizW=iHkX z8obDcYtID$n+B>{dbWlcS;5y6g&c${Yg>v!D{rHf(@ zJ$dK#wp-Bmaf?fA&cSycHmx60FU<+lgt&&i7L4!|kD5C!(0=nZ4vWNq52=8Eo+8Q# znvhbK4M6@wJT|pywZ{(KKWjtEUdp18c0J$6*LT9zl9HpU+p?)sOJb~o7X1_r)u(f={E)_XGLh2%~%mv0E!5C;u1Ixa3w67MXMdL z*B1FkIKR+iD(Hsc0_rw631KqtF(RT7r~T3x(AbKcQ86nt88j15a!CU_bVT(?P&kmK zm^+7YRV<9RWL)!os2y?%jWnQ?SMqAw8^tBHkpoX2INKH9%XXLNuF484JjB&GXuF63 z{CiS*MR3_5@QZ=It!-V?Z{uphbd1Q}WWJlIUT3;m`SU?sPG3&i=o95;F8tMo_oDIi ztKADrWO}*MA42s>K-!F;E73ElnthWxf76)UuZVpR$q_i*$ zU!yT6EcHa2llzy83lCZAj;;AH{_rzeS=JJAZ5~;E<-9>iUroz5ls!_`?R5z$B=!}l ze!po!z0u{poqeWMj-`m`X0w+Qs?pj50~7uQqCKd_wrUD5>W;I7wqjj6iq9uYbkjNc zGpWZgFGn?wEW%1z-4fFYn8sIQBHD_5DFq)3IxUb(v6)Dy$p*PZ;Z_WRlU!^jFa%qD zlqnsJ7DUnLHdd%PjuQDLEtuU^GBDfE0oM z+mNr$-W%SttNS7(@z{P5;G1?J-whld`ac^@UU%Z%;7C12quY@&=@?^7>0H3jeccS* zPFZ73toXnYjIrF&mbwM&GP%qVcTGyZ8~H}3Iv<{8A};gCD1>{?;#;^Pdg2zV|AhAV zIZkphn$X{a+*PR@n31Jw^sG_VG=3V@O`x{6wi@j(jh)4w3gJ%<)JFeay*^9ciFF() zQwUp${gwCbjo0_~D&*&|j@Zs4gI?X1=%+ym?VW-@ofScgS*dp`D&wdw#=BZpG5*6C# zVUCgC;r&Jabj0Aqk0IJIb%L72^!YzL4a^uED*^X__?V^#V+hSmC_v*K0dln*1RBVRN#RaLEzKK^t@h3|bqH8C+& z(7o3568L!qE9!P7_-7w36;4vmy6_b_%I-n&z}z^uA9sq4sd#NtGMvCqzQ1*1Iq>_6 znI=g*oooH~8{Du7m<#_UhzJEc2msz^Dp7q#&f+@XHus&Hi_9MbO9F!fN)|||KLOzv Bw2c4& diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_plugin.png b/app/src/main/res/mipmap-anydpi-v26/ic_plugin.png deleted file mode 100644 index 28796a3ec19eb49ba2c878c12055fdeb887f5f01..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1674 zcmb7FX;4#F6h1F`!AAfIR;|T_XG8^AL=kZzBnY^()Tp3HUQ|RyEQ?$0Fy#4Eger;> zz$ha)E(jtjs6|l%bs-HZj#y<6g+{0rBC%2*hNO>9|FkphjCaoc?z!K&=gizW=iHkX z8obDcYtID$n+B>{dbWlcS;5y6g&c${Yg>v!D{rHf(@ zJ$dK#wp-Bmaf?fA&cSycHmx60FU<+lgt&&i7L4!|kD5C!(0=nZ4vWNq52=8Eo+8Q# znvhbK4M6@wJT|pywZ{(KKWjtEUdp18c0J$6*LT9zl9HpU+p?)sOJb~o7X1_r)u(f={E)_XGLh2%~%mv0E!5C;u1Ixa3w67MXMdL z*B1FkIKR+iD(Hsc0_rw631KqtF(RT7r~T3x(AbKcQ86nt88j15a!CU_bVT(?P&kmK zm^+7YRV<9RWL)!os2y?%jWnQ?SMqAw8^tBHkpoX2INKH9%XXLNuF484JjB&GXuF63 z{CiS*MR3_5@QZ=It!-V?Z{uphbd1Q}WWJlIUT3;m`SU?sPG3&i=o95;F8tMo_oDIi ztKADrWO}*MA42s>K-!F;E73ElnthWxf76)UuZVpR$q_i*$ zU!yT6EcHa2llzy83lCZAj;;AH{_rzeS=JJAZ5~;E<-9>iUroz5ls!_`?R5z$B=!}l ze!po!z0u{poqeWMj-`m`X0w+Qs?pj50~7uQqCKd_wrUD5>W;I7wqjj6iq9uYbkjNc zGpWZgFGn?wEW%1z-4fFYn8sIQBHD_5DFq)3IxUb(v6)Dy$p*PZ;Z_WRlU!^jFa%qD zlqnsJ7DUnLHdd%PjuQDLEtuU^GBDfE0oM z+mNr$-W%SttNS7(@z{P5;G1?J-whld`ac^@UU%Z%;7C12quY@&=@?^7>0H3jeccS* zPFZ73toXnYjIrF&mbwM&GP%qVcTGyZ8~H}3Iv<{8A};gCD1>{?;#;^Pdg2zV|AhAV zIZkphn$X{a+*PR@n31Jw^sG_VG=3V@O`x{6wi@j(jh)4w3gJ%<)JFeay*^9ciFF() zQwUp${gwCbjo0_~D&*&|j@Zs4gI?X1=%+ym?VW-@ofScgS*dp`D&wdw#=BZpG5*6C# zVUCgC;r&Jabj0Aqk0IJIb%L72^!YzL4a^uED*^X__?V^#V+hSmC_v*K0dln*1RBVRN#RaLEzKK^t@h3|bqH8C+& z(7o3568L!qE9!P7_-7w36;4vmy6_b_%I-n&z}z^uA9sq4sd#NtGMvCqzQ1*1Iq>_6 znI=g*oooH~8{Du7m<#_UhzJEc2msz^Dp7q#&f+@XHus&Hi_9MbO9F!fN)|||KLOzv Bw2c4& diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index ba56e170c16fc6fd1a06fb6dc7bc66d546aeace7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 677 zcmV;W0$TlvP)&5DDScTdgGsu`?5oleO|j@+E+0^5v27 z_@{ETs8vKjKmIpPkQVcRU_H8mkiL z^j$2V*X!jTkB8fCx9)U0MImVcp)d4_zTpGDiUU;FwcG7>zc;&Dt=#2u2}05ULLcZ0 zed2rY0bj)c!qdFp?{2f%eB3Z@D5NAQAg>$`$2a(b&m2lJ2h=o;+wb>ZHyl%v1W;Ew z-3FiVUBqAPcDuRtdL4w+RnickkaB#3FZe9#9dx~3qmbT}6azG*9Qc5*BGbH7Ng+UU zDrd5BkVHv`!{O^QT$@ul$$*eCq%XxGCG|lFUDqlHF{Wg<(SVRvkvXJ+#+0OK8s#81 z#E4iY1B9o6fterYXai1xq*2cM13|2ad5n_OfH1W8BjnV;b1J9n12H4^tbkA)qW;No z138q_ZHQf4;Hm&wrd_F$tiZ=g9n-&<<-l!7Nmjszie>XGHieSrR!(x7w^UNfjAAb3 zn2e;Ylr$DlPUV=D8Wu_#11Pt0Olz@JC20Xop&avKHAP7pKvOA41*mV`s;{8}4*~L! z`hFM6V$$!v140avSf%T3)z~akdXr{J0wN#+nja8f(oFLlD6-V}kEI5SRZe$s!i-a{ zQ%<>Z(w@scTsY*?^W00%-ne-|pd@a8F|fsMpt4N6i`;_8O`L`Uwnc3N=0b5 zf$=blKuJ6fB`k1xpf1rCeI!$2Jk(pT5fA|p5CIVo0TB=ZE!BPiX#)52lIm^~00000 LNkvXXu0mjfND(Q* diff --git a/app/src/main/res/mipmap-hdpi/ic_plugin.png b/app/src/main/res/mipmap-hdpi/ic_plugin.png deleted file mode 100644 index ba56e170c16fc6fd1a06fb6dc7bc66d546aeace7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 677 zcmV;W0$TlvP)&5DDScTdgGsu`?5oleO|j@+E+0^5v27 z_@{ETs8vKjKmIpPkQVcRU_H8mkiL z^j$2V*X!jTkB8fCx9)U0MImVcp)d4_zTpGDiUU;FwcG7>zc;&Dt=#2u2}05ULLcZ0 zed2rY0bj)c!qdFp?{2f%eB3Z@D5NAQAg>$`$2a(b&m2lJ2h=o;+wb>ZHyl%v1W;Ew z-3FiVUBqAPcDuRtdL4w+RnickkaB#3FZe9#9dx~3qmbT}6azG*9Qc5*BGbH7Ng+UU zDrd5BkVHv`!{O^QT$@ul$$*eCq%XxGCG|lFUDqlHF{Wg<(SVRvkvXJ+#+0OK8s#81 z#E4iY1B9o6fterYXai1xq*2cM13|2ad5n_OfH1W8BjnV;b1J9n12H4^tbkA)qW;No z138q_ZHQf4;Hm&wrd_F$tiZ=g9n-&<<-l!7Nmjszie>XGHieSrR!(x7w^UNfjAAb3 zn2e;Ylr$DlPUV=D8Wu_#11Pt0Olz@JC20Xop&avKHAP7pKvOA41*mV`s;{8}4*~L! z`hFM6V$$!v140avSf%T3)z~akdXr{J0wN#+nja8f(oFLlD6-V}kEI5SRZe$s!i-a{ zQ%<>Z(w@scTsY*?^W00%-ne-|pd@a8F|fsMpt4N6i`;_8O`L`Uwnc3N=0b5 zf$=blKuJ6fB`k1xpf1rCeI!$2Jk(pT5fA|p5CIVo0TB=ZE!BPiX#)52lIm^~00000 LNkvXXu0mjfND(Q* diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 2328dd5ab069c149a8866bdea9a9423e76f54cd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 427 zcmV;c0aX5pP)TzM0Z;>}!n1NSt)NeO8I84&GING74>G5?n^!$TpN7f}ET zKmjNK# z1%SR7gEq_&0}%``j-wK2g0KPT;@^h3ZUEQ@>G9A>JDRL56i|b7+EanM*wWhcDm27L;sr=GX_qcMjj|bP9l69U>q`{M+C= z8h{#nHVEn%)7}ys10fJ~U8}yRrw~udLR1K!vrw#favG&ToB>=RK4>5Cg>V5}CEf{u zGdvudOy8vRb*}fRs!Fw?uD9v&p>K9Jf3Ew46#y3z-;F7?LCgOEuwO##gE+f1%6cPX zeUxB-m}7sOW`Ch!f2GXgQlI6s3j2pG_D_rKA9vY5uV?XrBkNC0ca;KA015!}@&fvf V^c>8?5?cTO002ovPDHLkV1mEAvxooy diff --git a/app/src/main/res/mipmap-mdpi/ic_plugin.png b/app/src/main/res/mipmap-mdpi/ic_plugin.png deleted file mode 100644 index 2328dd5ab069c149a8866bdea9a9423e76f54cd4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 427 zcmV;c0aX5pP)TzM0Z;>}!n1NSt)NeO8I84&GING74>G5?n^!$TpN7f}ET zKmjNK# z1%SR7gEq_&0}%``j-wK2g0KPT;@^h3ZUEQ@>G9A>JDRL56i|b7+EanM*wWhcDm27L;sr=GX_qcMjj|bP9l69U>q`{M+C= z8h{#nHVEn%)7}ys10fJ~U8}yRrw~udLR1K!vrw#favG&ToB>=RK4>5Cg>V5}CEf{u zGdvudOy8vRb*}fRs!Fw?uD9v&p>K9Jf3Ew46#y3z-;F7?LCgOEuwO##gE+f1%6cPX zeUxB-m}7sOW`Ch!f2GXgQlI6s3j2pG_D_rKA9vY5uV?XrBkNC0ca;KA015!}@&fvf V^c>8?5?cTO002ovPDHLkV1mEAvxooy diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index 6f38928d0a63aafa7f56bc14832ca7580ec3e1d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 762 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7Ro>U^?jO;uunK>+Rgr6Au~iv^n!S zh>JLCmN12DJ#g{e!}Y0;@8-=^gCB}Fxqg~F4pxi!w|}O~G#NvdHLH0&pymNh0~rgU z8p3bC|DGt(Hr;t0BT$gRq0LsVzrb$(Y~~4;sqZ40ciexUxHqo-Xp*4c@?c{Iqv>Zf zi@W(ZvlQ&Udnjw`FHwC_C*6j?KOf~jI@Zh-ZFv3lm;WCb4pWACNB?s>*34pUIQ>*; z+UeAgBmM$jj7N^hxBpPtS8Lnw_@jiVBC8W;ga4y`=bG6^m0uKCh&Z2MouIYvhso;c z1)41~4EK({mus8m;K6FZ`Y|@=NRi?ah8bNy@`3~{1?(7SO!~2|$Z@5B*=*l0yJBWf z`k}_4GEI;7d62@DzMzk(zGA;wLK!yAmNAc9%DuHE;PvD+zSYOqusyKc{+PFEn*Obw z%AyRD0&Aw;{>bEbn>})MnAldSh9_54*WM0lmyGA%& zu$y)%xaM-q1W^`WhP_A4{f|XDTwr?O_($z#KrV+A!=8@&IAT-vlut%&GIP)MHLt{V^N6nEkLlG0-HSVA84E178#DAR zx2|CM*x1%Q-C(|kC5Q7*kMjrJdd`Q;1v)~B-|osg4ZF2mR^9Vw^(>BTf4FXPnW^m2 z^ST*W%3hbcQW!OFnQcDqIaTWNo)>%R-a)%W7?{AI3c9mjSsf0fU^?jO;uunK>+Rgr6Au~iv^n!S zh>JLCmN12DJ#g{e!}Y0;@8-=^gCB}Fxqg~F4pxi!w|}O~G#NvdHLH0&pymNh0~rgU z8p3bC|DGt(Hr;t0BT$gRq0LsVzrb$(Y~~4;sqZ40ciexUxHqo-Xp*4c@?c{Iqv>Zf zi@W(ZvlQ&Udnjw`FHwC_C*6j?KOf~jI@Zh-ZFv3lm;WCb4pWACNB?s>*34pUIQ>*; z+UeAgBmM$jj7N^hxBpPtS8Lnw_@jiVBC8W;ga4y`=bG6^m0uKCh&Z2MouIYvhso;c z1)41~4EK({mus8m;K6FZ`Y|@=NRi?ah8bNy@`3~{1?(7SO!~2|$Z@5B*=*l0yJBWf z`k}_4GEI;7d62@DzMzk(zGA;wLK!yAmNAc9%DuHE;PvD+zSYOqusyKc{+PFEn*Obw z%AyRD0&Aw;{>bEbn>})MnAldSh9_54*WM0lmyGA%& zu$y)%xaM-q1W^`WhP_A4{f|XDTwr?O_($z#KrV+A!=8@&IAT-vlut%&GIP)MHLt{V^N6nEkLlG0-HSVA84E178#DAR zx2|CM*x1%Q-C(|kC5Q7*kMjrJdd`Q;1v)~B-|osg4ZF2mR^9Vw^(>BTf4FXPnW^m2 z^ST*W%3hbcQW!OFnQcDqIaTWNo)>%R-a)%W7?{AI3c9mjSsf0fiOS<>DbcE<&~R1<5CW);R4}3( zQACDfOy#u7A(sTiIC8~6NT3?7pg=ga6p7+7iZnFS`ONOleE;0t`CP&ddXR`zA^?Eo z<%#-fX4X;>^fZ0aeY73`{Ja;sJAgefGt_;+d<(g4j^uzLc>>pcNE+gcF$tNlA8{l0 zgrC~%C+0ObzVGZ)EpGZ0WvKZ57XBXV?=Xu(nn5N9aJ7&DMGKCmWe-5L5I6)*`1r!Y z*+(Lgj2g{=^FrnUeXOGAU6BFaPCE<XU9zP9W)j9U zdY)LxFzd-L_<*~oFX*^>Ma;FCms|7ME0v@ZjS29a+w_Fu|eZ5*ErBs)l1OPq>{%%9_-@ zd!7w6q>_KFfWqT2bnTR#a5< zyB;mq&Dg z>gXf&n+B6so>ux3mv!}bnvI>0*=&+<$K{6H<4EzTsq(J;)E%+gQ%;CpcSV(+5c$V7 z4o$Y0tL`HkWEj6F@NkDyM*9giJir|@PAr~&^qn{CowwGTY8qj#?!xm$C!>n=?LQ<6 z>xv${2I0fk7kkoL6gi<_jO$TVTxf{i)cI4`S6^q57>gRPB_KT`6zAh4;86|?-_Z#T z&}6S5Dy19GZ{WD^eMX`sgxvD?si~`}j$^%IqFX&?$1hcip7h}Ex&Kt@9`V)>eW72l z_Y3805Yg{$>EXNEcdg~IyxLAJwjH(JXFcsHR~{bOjvi?}wpZl&@P~DcbvNCT;xi(+ zumpqN8E#(ZI{V&oI;Bdp$5lLKV+aIu&UuC#TSXOC53IK|tBP!biOS<>DbcE<&~R1<5CW);R4}3( zQACDfOy#u7A(sTiIC8~6NT3?7pg=ga6p7+7iZnFS`ONOleE;0t`CP&ddXR`zA^?Eo z<%#-fX4X;>^fZ0aeY73`{Ja;sJAgefGt_;+d<(g4j^uzLc>>pcNE+gcF$tNlA8{l0 zgrC~%C+0ObzVGZ)EpGZ0WvKZ57XBXV?=Xu(nn5N9aJ7&DMGKCmWe-5L5I6)*`1r!Y z*+(Lgj2g{=^FrnUeXOGAU6BFaPCE<XU9zP9W)j9U zdY)LxFzd-L_<*~oFX*^>Ma;FCms|7ME0v@ZjS29a+w_Fu|eZ5*ErBs)l1OPq>{%%9_-@ zd!7w6q>_KFfWqT2bnTR#a5< zyB;mq&Dg z>gXf&n+B6so>ux3mv!}bnvI>0*=&+<$K{6H<4EzTsq(J;)E%+gQ%;CpcSV(+5c$V7 z4o$Y0tL`HkWEj6F@NkDyM*9giJir|@PAr~&^qn{CowwGTY8qj#?!xm$C!>n=?LQ<6 z>xv${2I0fk7kkoL6gi<_jO$TVTxf{i)cI4`S6^q57>gRPB_KT`6zAh4;86|?-_Z#T z&}6S5Dy19GZ{WD^eMX`sgxvD?si~`}j$^%IqFX&?$1hcip7h}Ex&Kt@9`V)>eW72l z_Y3805Yg{$>EXNEcdg~IyxLAJwjH(JXFcsHR~{bOjvi?}wpZl&@P~DcbvNCT;xi(+ zumpqN8E#(ZI{V&oI;Bdp$5lLKV+aIu&UuC#TSXOC53IK|tBP!b zz$ha)E(jtjs6|l%bs-HZj#y<6g+{0rBC%2*hNO>9|FkphjCaoc?z!K&=gizW=iHkX z8obDcYtID$n+B>{dbWlcS;5y6g&c${Yg>v!D{rHf(@ zJ$dK#wp-Bmaf?fA&cSycHmx60FU<+lgt&&i7L4!|kD5C!(0=nZ4vWNq52=8Eo+8Q# znvhbK4M6@wJT|pywZ{(KKWjtEUdp18c0J$6*LT9zl9HpU+p?)sOJb~o7X1_r)u(f={E)_XGLh2%~%mv0E!5C;u1Ixa3w67MXMdL z*B1FkIKR+iD(Hsc0_rw631KqtF(RT7r~T3x(AbKcQ86nt88j15a!CU_bVT(?P&kmK zm^+7YRV<9RWL)!os2y?%jWnQ?SMqAw8^tBHkpoX2INKH9%XXLNuF484JjB&GXuF63 z{CiS*MR3_5@QZ=It!-V?Z{uphbd1Q}WWJlIUT3;m`SU?sPG3&i=o95;F8tMo_oDIi ztKADrWO}*MA42s>K-!F;E73ElnthWxf76)UuZVpR$q_i*$ zU!yT6EcHa2llzy83lCZAj;;AH{_rzeS=JJAZ5~;E<-9>iUroz5ls!_`?R5z$B=!}l ze!po!z0u{poqeWMj-`m`X0w+Qs?pj50~7uQqCKd_wrUD5>W;I7wqjj6iq9uYbkjNc zGpWZgFGn?wEW%1z-4fFYn8sIQBHD_5DFq)3IxUb(v6)Dy$p*PZ;Z_WRlU!^jFa%qD zlqnsJ7DUnLHdd%PjuQDLEtuU^GBDfE0oM z+mNr$-W%SttNS7(@z{P5;G1?J-whld`ac^@UU%Z%;7C12quY@&=@?^7>0H3jeccS* zPFZ73toXnYjIrF&mbwM&GP%qVcTGyZ8~H}3Iv<{8A};gCD1>{?;#;^Pdg2zV|AhAV zIZkphn$X{a+*PR@n31Jw^sG_VG=3V@O`x{6wi@j(jh)4w3gJ%<)JFeay*^9ciFF() zQwUp${gwCbjo0_~D&*&|j@Zs4gI?X1=%+ym?VW-@ofScgS*dp`D&wdw#=BZpG5*6C# zVUCgC;r&Jabj0Aqk0IJIb%L72^!YzL4a^uED*^X__?V^#V+hSmC_v*K0dln*1RBVRN#RaLEzKK^t@h3|bqH8C+& z(7o3568L!qE9!P7_-7w36;4vmy6_b_%I-n&z}z^uA9sq4sd#NtGMvCqzQ1*1Iq>_6 znI=g*oooH~8{Du7m<#_UhzJEc2msz^Dp7q#&f+@XHus&Hi_9MbO9F!fN)|||KLOzv Bw2c4& diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_plugin.png b/app/src/main/res/mipmap-xxxhdpi/ic_plugin.png deleted file mode 100644 index 28796a3ec19eb49ba2c878c12055fdeb887f5f01..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1674 zcmb7FX;4#F6h1F`!AAfIR;|T_XG8^AL=kZzBnY^()Tp3HUQ|RyEQ?$0Fy#4Eger;> zz$ha)E(jtjs6|l%bs-HZj#y<6g+{0rBC%2*hNO>9|FkphjCaoc?z!K&=gizW=iHkX z8obDcYtID$n+B>{dbWlcS;5y6g&c${Yg>v!D{rHf(@ zJ$dK#wp-Bmaf?fA&cSycHmx60FU<+lgt&&i7L4!|kD5C!(0=nZ4vWNq52=8Eo+8Q# znvhbK4M6@wJT|pywZ{(KKWjtEUdp18c0J$6*LT9zl9HpU+p?)sOJb~o7X1_r)u(f={E)_XGLh2%~%mv0E!5C;u1Ixa3w67MXMdL z*B1FkIKR+iD(Hsc0_rw631KqtF(RT7r~T3x(AbKcQ86nt88j15a!CU_bVT(?P&kmK zm^+7YRV<9RWL)!os2y?%jWnQ?SMqAw8^tBHkpoX2INKH9%XXLNuF484JjB&GXuF63 z{CiS*MR3_5@QZ=It!-V?Z{uphbd1Q}WWJlIUT3;m`SU?sPG3&i=o95;F8tMo_oDIi ztKADrWO}*MA42s>K-!F;E73ElnthWxf76)UuZVpR$q_i*$ zU!yT6EcHa2llzy83lCZAj;;AH{_rzeS=JJAZ5~;E<-9>iUroz5ls!_`?R5z$B=!}l ze!po!z0u{poqeWMj-`m`X0w+Qs?pj50~7uQqCKd_wrUD5>W;I7wqjj6iq9uYbkjNc zGpWZgFGn?wEW%1z-4fFYn8sIQBHD_5DFq)3IxUb(v6)Dy$p*PZ;Z_WRlU!^jFa%qD zlqnsJ7DUnLHdd%PjuQDLEtuU^GBDfE0oM z+mNr$-W%SttNS7(@z{P5;G1?J-whld`ac^@UU%Z%;7C12quY@&=@?^7>0H3jeccS* zPFZ73toXnYjIrF&mbwM&GP%qVcTGyZ8~H}3Iv<{8A};gCD1>{?;#;^Pdg2zV|AhAV zIZkphn$X{a+*PR@n31Jw^sG_VG=3V@O`x{6wi@j(jh)4w3gJ%<)JFeay*^9ciFF() zQwUp${gwCbjo0_~D&*&|j@Zs4gI?X1=%+ym?VW-@ofScgS*dp`D&wdw#=BZpG5*6C# zVUCgC;r&Jabj0Aqk0IJIb%L72^!YzL4a^uED*^X__?V^#V+hSmC_v*K0dln*1RBVRN#RaLEzKK^t@h3|bqH8C+& z(7o3568L!qE9!P7_-7w36;4vmy6_b_%I-n&z}z^uA9sq4sd#NtGMvCqzQ1*1Iq>_6 znI=g*oooH~8{Du7m<#_UhzJEc2msz^Dp7q#&f+@XHus&Hi_9MbO9F!fN)|||KLOzv Bw2c4& diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml deleted file mode 100644 index 55344e5..0000000 --- a/app/src/main/res/values/arrays.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml deleted file mode 100644 index 88bc80f..0000000 --- a/app/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - #252424 - #000000 - #D81B60 - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml deleted file mode 100644 index 2425d72..0000000 --- a/app/src/main/res/values/strings.xml +++ /dev/null @@ -1,34 +0,0 @@ - - TaskerLauncherShortcut - - - TaskerLauncherShortcut - - - Shortcut Intent Uri - - - Discard changes - hello! - Change Launcher - - Search - Clear Search - There are no apps - App Icon - Search Shortcuts - No Shortcuts - Shortcut Chooser - Shortcut Icon - Shortcut Label - App Label - - - %1$s app - %1$s apps - - - %1$s shortcut - %1$s shortcuts - - diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml deleted file mode 100644 index 5885930..0000000 --- a/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/app/src/test/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleUnitTest.java b/app/src/test/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleUnitTest.java deleted file mode 100644 index 4bb158c..0000000 --- a/app/src/test/java/com/agnostic/apollo/taskerlaunchershortcut/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.agnostic.apollo.taskerlaunchershortcut; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file