OSDN Git Service

[WIP] Allow Taskbar to be built as a lib for inclusion into other launchers
authorBraden Farmer <farmerbb@gmail.com>
Mon, 28 Oct 2019 03:57:59 +0000 (21:57 -0600)
committerBraden Farmer <farmerbb@gmail.com>
Mon, 28 Oct 2019 03:57:59 +0000 (21:57 -0600)
65 files changed:
.gitignore
Android.mk
app/build.gradle
app/src/lib/AndroidManifest.xml [new file with mode: 0644]
app/src/lib/java/com/farmerbb/taskbar/lib/Taskbar.java [new file with mode: 0644]
app/src/lib/java/com/farmerbb/taskbar/util/ShortcutUtils.java [new file with mode: 0644]
app/src/lib/res/drawable/ic_apps_black_24dp.xml [new file with mode: 0644]
app/src/lib/res/drawable/ic_brush_black_24dp.xml [new file with mode: 0644]
app/src/lib/res/drawable/ic_error_outline_black_24dp.xml [new file with mode: 0644]
app/src/lib/res/drawable/ic_settings_black_24dp.xml [new file with mode: 0644]
app/src/lib/res/drawable/ic_web_asset_black_24dp.xml [new file with mode: 0644]
app/src/lib/res/layout/main.xml [new file with mode: 0644]
app/src/lib/res/values/public.xml [new file with mode: 0644]
app/src/lib/res/xml/pref_about.xml [new file with mode: 0644]
app/src/main/java/com/farmerbb/taskbar/activity/ContextMenuActivity.java
app/src/main/java/com/farmerbb/taskbar/activity/IconPackActivity.java
app/src/main/java/com/farmerbb/taskbar/activity/KeyboardShortcutActivity.java
app/src/main/java/com/farmerbb/taskbar/activity/MainActivity.java
app/src/main/java/com/farmerbb/taskbar/activity/ShortcutActivity.java
app/src/main/java/com/farmerbb/taskbar/activity/StartTaskbarActivity.java
app/src/main/java/com/farmerbb/taskbar/fragment/AboutFragment.java
app/src/main/java/com/farmerbb/taskbar/fragment/AdvancedFragment.java
app/src/main/java/com/farmerbb/taskbar/fragment/AppearanceFragment.java
app/src/main/java/com/farmerbb/taskbar/fragment/GeneralFragment.java
app/src/main/java/com/farmerbb/taskbar/fragment/SettingsFragment.java
app/src/main/java/com/farmerbb/taskbar/service/NotificationService.java
app/src/main/java/com/farmerbb/taskbar/service/QuickSettingsTileService.java
app/src/main/java/com/farmerbb/taskbar/ui/TaskbarController.java
app/src/main/java/com/farmerbb/taskbar/util/IconCache.java
app/src/main/java/com/farmerbb/taskbar/util/U.java
app/src/main/res/drawable/dummy.xml [new file with mode: 0644]
app/src/main/res/values-de/strings.xml
app/src/main/res/values-ja/strings.xml
app/src/main/res/values-nl/strings.xml
app/src/main/res/values-ru/strings.xml
app/src/main/res/values-tr/strings.xml
app/src/main/res/values-zh-rCN/strings.xml
app/src/main/res/values/strings.xml
app/src/nonlib/java/com/farmerbb/taskbar/util/ShortcutUtils.java [new file with mode: 0644]
app/src/nonlib/res/drawable/ic_apps_black_24dp.xml [moved from app/src/main/res/drawable/ic_apps_black_24dp.xml with 100% similarity]
app/src/nonlib/res/drawable/ic_brush_black_24dp.xml [moved from app/src/main/res/drawable/ic_brush_black_24dp.xml with 100% similarity]
app/src/nonlib/res/drawable/ic_error_outline_black_24dp.xml [moved from app/src/main/res/drawable/ic_error_outline_black_24dp.xml with 100% similarity]
app/src/nonlib/res/drawable/ic_settings_black_24dp.xml [moved from app/src/main/res/drawable/ic_settings_black_24dp.xml with 100% similarity]
app/src/nonlib/res/drawable/ic_web_asset_black_24dp.xml [moved from app/src/main/res/drawable/ic_web_asset_black_24dp.xml with 100% similarity]
app/src/nonlib/res/layout/main.xml [moved from app/src/main/res/layout/main.xml with 100% similarity]
app/src/nonlib/res/mipmap-anydpi-v26/ic_freeform_mode.xml [moved from app/src/main/res/mipmap-anydpi-v26/ic_freeform_mode.xml with 100% similarity]
app/src/nonlib/res/mipmap-anydpi-v26/ic_launcher.xml [moved from app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml with 100% similarity]
app/src/nonlib/res/mipmap-hdpi/ic_freeform_mode.png [moved from app/src/main/res/mipmap-hdpi/ic_freeform_mode.png with 100% similarity]
app/src/nonlib/res/mipmap-hdpi/ic_launcher.png [moved from app/src/main/res/mipmap-hdpi/ic_launcher.png with 100% similarity]
app/src/nonlib/res/mipmap-mdpi/ic_freeform_mode.png [moved from app/src/main/res/mipmap-mdpi/ic_freeform_mode.png with 100% similarity]
app/src/nonlib/res/mipmap-mdpi/ic_launcher.png [moved from app/src/main/res/mipmap-mdpi/ic_launcher.png with 100% similarity]
app/src/nonlib/res/mipmap-xhdpi/ic_freeform_mode.png [moved from app/src/main/res/mipmap-xhdpi/ic_freeform_mode.png with 100% similarity]
app/src/nonlib/res/mipmap-xhdpi/ic_launcher.png [moved from app/src/main/res/mipmap-xhdpi/ic_launcher.png with 100% similarity]
app/src/nonlib/res/mipmap-xxhdpi/ic_freeform_mode.png [moved from app/src/main/res/mipmap-xxhdpi/ic_freeform_mode.png with 100% similarity]
app/src/nonlib/res/mipmap-xxhdpi/ic_launcher.png [moved from app/src/main/res/mipmap-xxhdpi/ic_launcher.png with 100% similarity]
app/src/nonlib/res/mipmap-xxxhdpi/ic_freeform_mode.png [moved from app/src/main/res/mipmap-xxxhdpi/ic_freeform_mode.png with 100% similarity]
app/src/nonlib/res/mipmap-xxxhdpi/ic_launcher.png [moved from app/src/main/res/mipmap-xxxhdpi/ic_launcher.png with 100% similarity]
app/src/nonlib/res/xml/accessibility_service.xml [moved from app/src/main/res/xml/accessibility_service.xml with 100% similarity]
app/src/nonlib/res/xml/pref_about.xml [moved from app/src/main/res/xml/pref_about.xml with 100% similarity]
app/src/nonplaystore/java/com/farmerbb/taskbar/util/DependencyUtils.java [moved from app/src/androidx86/java/com/farmerbb/taskbar/util/DependencyUtils.java with 100% similarity]
app/src/playstore/java/com/farmerbb/taskbar/receiver/ReceiveSettingsReceiver.java
app/src/playstore/java/com/farmerbb/taskbar/receiver/SendSettingsReceiver.java
app/src/playstore/java/com/farmerbb/taskbar/receiver/TaskerActionReceiver.java
lib/build.gradle [new file with mode: 0644]
settings.gradle

index 9a94f0a..07578cf 100644 (file)
@@ -7,4 +7,5 @@
 /build
 /captures
 /app/build
+/lib/build
 output.json
index 6cacb13..ceee794 100644 (file)
@@ -3,14 +3,17 @@ include $(CLEAR_VARS)
 
 appcompat_dir := frameworks/support/v7/appcompat
 res_dir := app/src/main/res
+nonlib_res_dir := app/src/nonlib/res
 
 LOCAL_MODULE_TAGS := optional
 
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/$(res_dir) $(appcompat_dir)/res
+LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/$(res_dir) $(LOCAL_PATH)/$(nonlib_res_dir) $(appcompat_dir)/res
 
 LOCAL_SRC_FILES := \
         $(call all-java-files-under, app/src/main/java) \
         $(call all-java-files-under, app/src/androidx86/java) \
+        $(call all-java-files-under, app/src/nonlib/java) \
+        $(call all-java-files-under, app/src/nonplaystore/java) \
         $(call all-java-files-under, app/src/compat-$(PLATFORM_SDK_VERSION)/java)
 
 LOCAL_MANIFEST_FILE := app/src/androidx86/AndroidManifest.xml
index 8705553..21866a7 100644 (file)
@@ -78,8 +78,8 @@ android {
 
     sourceSets {
         main {
-            java { srcDirs('src/main/java', 'src/playstore/java', "src/compat-${SDK_VERSION}/java") }
-            res { srcDirs('src/main/res', 'src/playstore/res') }
+            java { srcDirs('src/main/java', 'src/playstore/java', 'src/nonlib/java', "src/compat-${SDK_VERSION}/java") }
+            res { srcDirs('src/main/res', 'src/playstore/res', 'src/nonlib/res') }
             manifest.srcFile 'src/playstore/AndroidManifest.xml'
         }
     }
diff --git a/app/src/lib/AndroidManifest.xml b/app/src/lib/AndroidManifest.xml
new file mode 100644 (file)
index 0000000..c05838f
--- /dev/null
@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Manifest used for library builds of Taskbar, with the following changes:
+
+     * Certain permissions have been removed
+     * Certain activities have either had their intent filters removed, or their
+       entries removed entirely, as they're not needed
+     * All services and receivers are removed as they are never run
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    package="com.farmerbb.taskbar">
+
+    <uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" tools:ignore="ProtectedPermissions" />
+    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
+    <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
+    <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.BLUETOOTH" />
+
+    <application>
+
+        <activity
+            android:name=".activity.MainActivity"
+            android:label="@string/app_name"
+            android:launchMode="singleTask"/>
+        <activity
+            android:name=".activity.InvisibleActivity"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:launchMode="singleTask"
+            android:theme="@style/AppTheme.InvisibleActivity"/>
+        <activity
+            android:name=".activity.InvisibleActivityAlt"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:launchMode="singleTask"
+            android:theme="@style/AppTheme.Incognito"/>
+        <activity
+            android:name=".activity.dark.InvisibleActivityAltDark"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:launchMode="singleTask"
+            android:theme="@style/AppTheme.Incognito.Dark"/>
+        <activity
+            android:name=".activity.InvisibleActivityFreeform"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:launchMode="singleInstance"
+            android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
+            android:theme="@style/AppTheme.InvisibleActivity"/>
+        <activity
+            android:name=".activity.SecondaryHomeActivity"
+            android:label="@string/app_name"
+            android:enabled="true"
+            android:theme="@style/AppTheme.HomeActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+
+                <category android:name="android.intent.category.DEFAULT"/>
+                <category android:name="android.intent.category.SECONDARY_HOME"/>
+            </intent-filter>
+        </activity>
+        <activity
+            android:name=".activity.ContextMenuActivity"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:theme="@style/AppTheme.Dialog"/>
+        <activity
+            android:name=".activity.dark.ContextMenuActivityDark"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:theme="@style/AppTheme.Dialog.Dark"/>
+        <activity
+            android:name=".activity.SelectAppActivity"
+            android:theme="@style/AppTheme.Dialog.Blacklist"/>
+        <activity
+            android:name=".activity.dark.SelectAppActivityDark"
+            android:theme="@style/AppTheme.Dialog.Blacklist.Dark"/>
+        <activity
+            android:name=".activity.DesktopIconSelectAppActivity"
+            android:theme="@style/AppTheme.Dialog.Blacklist"/>
+        <activity
+            android:name=".activity.dark.DesktopIconSelectAppActivityDark"
+            android:theme="@style/AppTheme.Dialog.Blacklist.Dark"/>
+        <activity
+            android:name=".activity.DummyActivity"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:theme="@style/AppTheme.Incognito"/>
+        <activity
+            android:name=".activity.IconPackActivity"
+            android:theme="@style/AppTheme.Dialog.Blacklist"/>
+        <activity
+            android:name=".activity.dark.IconPackActivityDark"
+            android:theme="@style/AppTheme.Dialog.Blacklist.Dark"/>
+        <activity
+            android:name=".activity.ClearDataActivity"
+            android:theme="@style/AppTheme.Dialog.Blacklist"/>
+        <activity
+            android:name=".activity.dark.ClearDataActivityDark"
+            android:theme="@style/AppTheme.Dialog.Blacklist.Dark"/>
+        <activity
+            android:name=".activity.DashboardActivity"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:launchMode="singleTask"
+            android:theme="@style/AppTheme.Incognito"/>
+        <activity
+            android:name=".activity.dark.DashboardActivityDark"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:launchMode="singleTask"
+            android:theme="@style/AppTheme.Incognito.Dark"/>
+        <activity
+            android:name=".activity.TouchAbsorberActivity"
+            android:documentLaunchMode="always"
+            android:excludeFromRecents="true"
+            android:launchMode="singleTask"
+            android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize|layoutDirection"
+            android:theme="@style/AppTheme.Incognito"/>
+    </application>
+
+</manifest>
diff --git a/app/src/lib/java/com/farmerbb/taskbar/lib/Taskbar.java b/app/src/lib/java/com/farmerbb/taskbar/lib/Taskbar.java
new file mode 100644 (file)
index 0000000..8fac3ff
--- /dev/null
@@ -0,0 +1,41 @@
+/* Copyright 2019 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.farmerbb.taskbar.lib;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+
+import com.farmerbb.taskbar.activity.MainActivity;
+
+public class Taskbar {
+
+    private Taskbar() {}
+
+    public static void openSettings(Context context) {
+        openSettings(context, null);
+    }
+
+    public static void openSettings(Context context, String title) {
+        Intent intent = new Intent(context, MainActivity.class);
+        intent.putExtra("title", title);
+
+        if(!(context instanceof Activity))
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+        context.startActivity(intent);
+    }
+}
\ No newline at end of file
diff --git a/app/src/lib/java/com/farmerbb/taskbar/util/ShortcutUtils.java b/app/src/lib/java/com/farmerbb/taskbar/util/ShortcutUtils.java
new file mode 100644 (file)
index 0000000..0d4a0f6
--- /dev/null
@@ -0,0 +1,32 @@
+/* Copyright 2019 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.farmerbb.taskbar.util;
+
+import android.content.Context;
+import android.content.Intent;
+
+public class ShortcutUtils {
+
+    private ShortcutUtils() {}
+
+    public static Intent getShortcutIntent(Context context) {
+        return null;
+    }
+
+    public static Intent getStartStopIntent(Context context) {
+        return null;
+    }
+}
diff --git a/app/src/lib/res/drawable/ic_apps_black_24dp.xml b/app/src/lib/res/drawable/ic_apps_black_24dp.xml
new file mode 100644 (file)
index 0000000..ad01d8a
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="?attr/colorControlNormal"
+        android:pathData="M4,8h4L8,4L4,4v4zM10,20h4v-4h-4v4zM4,20h4v-4L4,16v4zM4,14h4v-4L4,10v4zM10,14h4v-4h-4v4zM16,4v4h4L20,4h-4zM10,8h4L14,4h-4v4zM16,14h4v-4h-4v4zM16,20h4v-4h-4v4z"/>
+</vector>
diff --git a/app/src/lib/res/drawable/ic_brush_black_24dp.xml b/app/src/lib/res/drawable/ic_brush_black_24dp.xml
new file mode 100644 (file)
index 0000000..394c624
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="?attr/colorControlNormal"
+        android:pathData="M7,14c-1.66,0 -3,1.34 -3,3 0,1.31 -1.16,2 -2,2 0.92,1.22 2.49,2 4,2 2.21,0 4,-1.79 4,-4 0,-1.66 -1.34,-3 -3,-3zM20.71,4.63l-1.34,-1.34c-0.39,-0.39 -1.02,-0.39 -1.41,0L9,12.25 11.75,15l8.96,-8.96c0.39,-0.39 0.39,-1.02 0,-1.41z"/>
+</vector>
diff --git a/app/src/lib/res/drawable/ic_error_outline_black_24dp.xml b/app/src/lib/res/drawable/ic_error_outline_black_24dp.xml
new file mode 100644 (file)
index 0000000..545cc5a
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="?attr/colorControlNormal"
+        android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
+</vector>
diff --git a/app/src/lib/res/drawable/ic_settings_black_24dp.xml b/app/src/lib/res/drawable/ic_settings_black_24dp.xml
new file mode 100644 (file)
index 0000000..2e85225
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:fillColor="?attr/colorControlNormal"
+        android:pathData="M19.43,12.98c0.04,-0.32 0.07,-0.64 0.07,-0.98s-0.03,-0.66 -0.07,-0.98l2.11,-1.65c0.19,-0.15 0.24,-0.42 0.12,-0.64l-2,-3.46c-0.12,-0.22 -0.39,-0.3 -0.61,-0.22l-2.49,1c-0.52,-0.4 -1.08,-0.73 -1.69,-0.98l-0.38,-2.65C14.46,2.18 14.25,2 14,2h-4c-0.25,0 -0.46,0.18 -0.49,0.42l-0.38,2.65c-0.61,0.25 -1.17,0.59 -1.69,0.98l-2.49,-1c-0.23,-0.09 -0.49,0 -0.61,0.22l-2,3.46c-0.13,0.22 -0.07,0.49 0.12,0.64l2.11,1.65c-0.04,0.32 -0.07,0.65 -0.07,0.98s0.03,0.66 0.07,0.98l-2.11,1.65c-0.19,0.15 -0.24,0.42 -0.12,0.64l2,3.46c0.12,0.22 0.39,0.3 0.61,0.22l2.49,-1c0.52,0.4 1.08,0.73 1.69,0.98l0.38,2.65c0.03,0.24 0.24,0.42 0.49,0.42h4c0.25,0 0.46,-0.18 0.49,-0.42l0.38,-2.65c0.61,-0.25 1.17,-0.59 1.69,-0.98l2.49,1c0.23,0.09 0.49,0 0.61,-0.22l2,-3.46c0.12,-0.22 0.07,-0.49 -0.12,-0.64l-2.11,-1.65zM12,15.5c-1.93,0 -3.5,-1.57 -3.5,-3.5s1.57,-3.5 3.5,-3.5 3.5,1.57 3.5,3.5 -1.57,3.5 -3.5,3.5z"/>
+</vector>
diff --git a/app/src/lib/res/drawable/ic_web_asset_black_24dp.xml b/app/src/lib/res/drawable/ic_web_asset_black_24dp.xml
new file mode 100644 (file)
index 0000000..3b9cb2e
--- /dev/null
@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+        android:width="24dp"
+        android:height="24dp"
+        android:viewportWidth="24.0"
+        android:viewportHeight="24.0">
+    <path
+        android:pathData="M19,4L5,4c-1.11,0 -2,0.9 -2,2v12c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2L21,6c0,-1.1 -0.89,-2 -2,-2zM19,18L5,18L5,8h14v10z"
+        android:fillColor="?attr/colorControlNormal"/>
+</vector>
diff --git a/app/src/lib/res/layout/main.xml b/app/src/lib/res/layout/main.xml
new file mode 100644 (file)
index 0000000..1069b51
--- /dev/null
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:id="@+id/main_activity_layout"
+              android:layout_width="fill_parent"
+              android:layout_height="fill_parent"
+              android:clipToPadding="true"
+              android:fitsSystemWindows="true"
+              android:orientation="vertical">
+
+    <LinearLayout
+        android:id="@+id/fragmentContainer"
+        android:orientation="vertical"
+        android:layout_width="@dimen/max_width"
+        android:layout_height="match_parent"
+        android:layout_gravity="center_horizontal"/>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/app/src/lib/res/values/public.xml b/app/src/lib/res/values/public.xml
new file mode 100644 (file)
index 0000000..24fb5b3
--- /dev/null
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<resources>
+    <public />
+</resources>
\ No newline at end of file
diff --git a/app/src/lib/res/xml/pref_about.xml b/app/src/lib/res/xml/pref_about.xml
new file mode 100644 (file)
index 0000000..9c75666
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <Preference android:enabled="false" android:summary="@string/powered_by_taskbar" />
+
+    <PreferenceCategory android:key="dummy" android:title="\n\n" />
+
+</PreferenceScreen>
index 8baa9ea..f66f8c3 100644 (file)
@@ -474,7 +474,7 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
                 break;
             case "quit_taskbar":
                 Intent quitIntent = new Intent("com.farmerbb.taskbar.QUIT");
-                quitIntent.setPackage(BuildConfig.APPLICATION_ID);
+                quitIntent.setPackage(getPackageName());
                 sendBroadcast(quitIntent);
 
                 showStartMenu = false;
index 0fa8572..51a31bf 100644 (file)
@@ -104,7 +104,7 @@ public class IconPackActivity extends AppCompatActivity {
             PackageManager pm = getPackageManager();
             ImageView imageView = convertView.findViewById(R.id.icon);
 
-            if(entry.getPackageName().equals(BuildConfig.APPLICATION_ID)) {
+            if(entry.getPackageName().equals(getPackageName())) {
                 imageView.setImageDrawable(null);
             } else {
                 try {
@@ -148,7 +148,7 @@ public class IconPackActivity extends AppCompatActivity {
             else {
                 List<IconPack> finalList = new ArrayList<>();
                 IconPack dummyIconPack = new IconPack();
-                dummyIconPack.setPackageName(BuildConfig.APPLICATION_ID);
+                dummyIconPack.setPackageName(getPackageName());
                 dummyIconPack.setName(getString(R.string.icon_pack_none));
 
                 Collections.sort(list, (ip1, ip2) -> Collator.getInstance().compare(ip1.getName(), ip2.getName()));
index 0cc8b4a..024e37f 100644 (file)
@@ -59,7 +59,7 @@ public class KeyboardShortcutActivity extends Activity {
                     else
                         startStopIntent = new Intent("com.farmerbb.taskbar.START");
 
-                    startStopIntent.setPackage(BuildConfig.APPLICATION_ID);
+                    startStopIntent.setPackage(getPackageName());
                     sendBroadcast(startStopIntent);
                 }
 
index 9bfed04..6650714 100644 (file)
@@ -79,13 +79,15 @@ public class MainActivity extends AppCompatActivity {
         final SharedPreferences pref = U.getSharedPreferences(this);
         SharedPreferences.Editor editor = pref.edit();
 
-        switch(pref.getString("theme", "light")) {
-            case "light":
-                setTheme(R.style.AppTheme);
-                break;
-            case "dark":
-                setTheme(R.style.AppTheme_Dark);
-                break;
+        if(!U.isLibrary(this)) {
+            switch(pref.getString("theme", "light")) {
+                case "light":
+                    setTheme(R.style.AppTheme);
+                    break;
+                case "dark":
+                    setTheme(R.style.AppTheme_Dark);
+                    break;
+            }
         }
 
         if(pref.getBoolean("taskbar_active", false) && !U.isServiceRunning(this, NotificationService.class))
@@ -98,38 +100,40 @@ public class MainActivity extends AppCompatActivity {
         editor.putBoolean("launcher", launcherEnabled);
         editor.apply();
 
-        ComponentName component = new ComponentName(this, HomeActivity.class);
-        getPackageManager().setComponentEnabledSetting(component,
-                launcherEnabled && !U.isDelegatingHomeActivity(this)
-                        ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
-                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
-                PackageManager.DONT_KILL_APP);
-
-        ComponentName component2 = new ComponentName(this, KeyboardShortcutActivity.class);
-        getPackageManager().setComponentEnabledSetting(component2,
-                pref.getBoolean("keyboard_shortcut", false)
-                        ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
-                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
-                PackageManager.DONT_KILL_APP);
-
-        ComponentName component3 = new ComponentName(this, ShortcutActivity.class);
-        getPackageManager().setComponentEnabledSetting(component3,
-                U.enableFreeformModeShortcut(this)
-                        ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
-                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
-                PackageManager.DONT_KILL_APP);
-
-        ComponentName component4 = new ComponentName(this, StartTaskbarActivity.class);
-        getPackageManager().setComponentEnabledSetting(component4,
-                PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
-                PackageManager.DONT_KILL_APP);
-
-        ComponentName component5 = new ComponentName(this, SecondaryHomeActivity.class);
-        getPackageManager().setComponentEnabledSetting(component5,
-                launcherEnabled && !U.isDelegatingHomeActivity(this) && FeatureFlags.SECONDARY_HOME
-                        ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
-                        : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
-                PackageManager.DONT_KILL_APP);
+        if(!U.isLibrary(this)) {
+            ComponentName component = new ComponentName(this, HomeActivity.class);
+            getPackageManager().setComponentEnabledSetting(component,
+                    launcherEnabled && !U.isDelegatingHomeActivity(this)
+                            ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+                            : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+                    PackageManager.DONT_KILL_APP);
+
+            ComponentName component2 = new ComponentName(this, KeyboardShortcutActivity.class);
+            getPackageManager().setComponentEnabledSetting(component2,
+                    pref.getBoolean("keyboard_shortcut", false)
+                            ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+                            : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+                    PackageManager.DONT_KILL_APP);
+
+            ComponentName component3 = new ComponentName(this, ShortcutActivity.class);
+            getPackageManager().setComponentEnabledSetting(component3,
+                    U.enableFreeformModeShortcut(this)
+                            ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+                            : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+                    PackageManager.DONT_KILL_APP);
+
+            ComponentName component4 = new ComponentName(this, StartTaskbarActivity.class);
+            getPackageManager().setComponentEnabledSetting(component4,
+                    PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
+                    PackageManager.DONT_KILL_APP);
+
+            ComponentName component5 = new ComponentName(this, SecondaryHomeActivity.class);
+            getPackageManager().setComponentEnabledSetting(component5,
+                    launcherEnabled && !U.isDelegatingHomeActivity(this) && FeatureFlags.SECONDARY_HOME
+                            ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+                            : PackageManager.COMPONENT_ENABLED_STATE_DISABLED,
+                    PackageManager.DONT_KILL_APP);
+        }
 
         if(!launcherEnabled)
             LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.KILL_HOME_ACTIVITY"));
@@ -141,7 +145,7 @@ public class MainActivity extends AppCompatActivity {
             new Handler().postDelayed(() -> pref.edit().putBoolean("has_caption", hasCaption).apply(), 500);
         }
 
-        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.PAID_APPLICATION_ID)) {
+        if(getPackageName().equals(BuildConfig.PAID_APPLICATION_ID)) {
             File file = new File(getFilesDir() + File.separator + "imported_successfully");
             if(freeVersionInstalled() && !file.exists()) {
                 startActivity(new Intent(this, ImportSettingsActivity.class));
@@ -157,7 +161,7 @@ public class MainActivity extends AppCompatActivity {
         try {
             PackageInfo pInfo = pm.getPackageInfo(BuildConfig.BASE_APPLICATION_ID, 0);
             return pInfo.versionCode >= 68
-                    && pm.checkSignatures(BuildConfig.BASE_APPLICATION_ID, BuildConfig.APPLICATION_ID)
+                    && pm.checkSignatures(BuildConfig.BASE_APPLICATION_ID, getPackageName())
                     == PackageManager.SIGNATURE_MATCH;
         } catch (PackageManager.NameNotFoundException e) {
             return false;
@@ -168,7 +172,7 @@ public class MainActivity extends AppCompatActivity {
         setContentView(R.layout.main);
 
         ActionBar actionBar = getSupportActionBar();
-        if(actionBar != null) {
+        if(actionBar != null && !U.isLibrary(this)) {
             actionBar.setCustomView(R.layout.switch_layout);
             actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_CUSTOM);
         }
@@ -205,7 +209,7 @@ public class MainActivity extends AppCompatActivity {
         }
 
         SharedPreferences pref = U.getSharedPreferences(this);
-        if(!BuildConfig.APPLICATION_ID.equals(BuildConfig.BASE_APPLICATION_ID) && freeVersionInstalled()) {
+        if(!getPackageName().equals(BuildConfig.BASE_APPLICATION_ID) && freeVersionInstalled()) {
             if(!pref.getBoolean("dont_show_uninstall_dialog", false)) {
                 AlertDialog.Builder builder = new AlertDialog.Builder(this);
                 builder.setTitle(R.string.settings_imported_successfully)
@@ -233,7 +237,7 @@ public class MainActivity extends AppCompatActivity {
 
                 String iconPack = pref.getString("icon_pack", BuildConfig.BASE_APPLICATION_ID);
                 if(iconPack.contains(BuildConfig.BASE_APPLICATION_ID)) {
-                    editor.putString("icon_pack", BuildConfig.APPLICATION_ID);
+                    editor.putString("icon_pack", getPackageName());
                 } else {
                     U.refreshPinnedIcons(this);
                 }
@@ -355,4 +359,12 @@ public class MainActivity extends AppCompatActivity {
                     .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_CLOSE)
                     .commit();
     }
+
+    public String getAboutFragmentTitle() {
+        if(!U.isLibrary(this))
+            return getString(R.string.app_name);
+
+        String title = getIntent().getStringExtra("title");
+        return title != null ? title : getString(R.string.settings);
+    }
 }
\ No newline at end of file
index 7e67311..ced73b6 100644 (file)
@@ -22,8 +22,8 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.support.v4.content.LocalBroadcastManager;
 
-import com.farmerbb.taskbar.BuildConfig;
 import com.farmerbb.taskbar.R;
+import com.farmerbb.taskbar.util.ShortcutUtils;
 import com.farmerbb.taskbar.util.U;
 
 public class ShortcutActivity extends Activity {
@@ -44,14 +44,14 @@ public class ShortcutActivity extends Activity {
                 }
 
                 Intent intent = new Intent("com.farmerbb.taskbar.START");
-                intent.setPackage(BuildConfig.APPLICATION_ID);
+                intent.setPackage(getPackageName());
                 sendBroadcast(intent);
 
                 new Handler().postDelayed(() -> U.startFreeformHack(this, true), 100);
             } else
                 U.showToastLong(this, R.string.no_freeform_support);
         } else
-            setResult(RESULT_OK, U.getShortcutIntent(this));
+            setResult(RESULT_OK, ShortcutUtils.getShortcutIntent(this));
 
         finish();
     }
index 889e24f..eebcd27 100644 (file)
@@ -19,8 +19,8 @@ import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 
-import com.farmerbb.taskbar.BuildConfig;
 import com.farmerbb.taskbar.service.NotificationService;
+import com.farmerbb.taskbar.util.ShortcutUtils;
 import com.farmerbb.taskbar.util.U;
 
 public class StartTaskbarActivity extends Activity {
@@ -33,10 +33,10 @@ public class StartTaskbarActivity extends Activity {
             Intent intent = new Intent("com.farmerbb.taskbar."
                     + (U.isServiceRunning(this, NotificationService.class) ? "QUIT" : "START"));
 
-            intent.setPackage(BuildConfig.APPLICATION_ID);
+            intent.setPackage(getPackageName());
             sendBroadcast(intent);
         } else
-            setResult(RESULT_OK, U.getStartStopIntent(this));
+            setResult(RESULT_OK, ShortcutUtils.getStartStopIntent(this));
 
         finish();
     }
index 076329d..c383670 100644 (file)
@@ -28,6 +28,7 @@ import android.support.v7.app.AppCompatActivity;
 
 import com.farmerbb.taskbar.BuildConfig;
 import com.farmerbb.taskbar.R;
+import com.farmerbb.taskbar.activity.MainActivity;
 import com.farmerbb.taskbar.util.U;
 
 import java.text.NumberFormat;
@@ -46,18 +47,20 @@ public class AboutFragment extends SettingsFragment implements Preference.OnPref
 
         // Add preferences
         addPreferencesFromResource(R.xml.pref_base);
-
-        SharedPreferences pref = U.getSharedPreferences(getActivity());
         addPreferencesFromResource(R.xml.pref_about);
 
-        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.BASE_APPLICATION_ID)
-                && U.isPlayStoreInstalled(getActivity())
-                && U.isPlayStoreRelease(getActivity())
-                && !U.isSystemApp(getActivity())
-                && !pref.getBoolean("hide_donate", false)) {
-            findPreference("donate").setOnPreferenceClickListener(this);
-        } else
-            getPreferenceScreen().removePreference(findPreference("donate_category"));
+        boolean isLibrary = U.isLibrary(getActivity());
+        if(!isLibrary) {
+            SharedPreferences pref = U.getSharedPreferences(getActivity());
+            if(getActivity().getPackageName().equals(BuildConfig.BASE_APPLICATION_ID)
+                    && U.isPlayStoreInstalled(getActivity())
+                    && U.isPlayStoreRelease(getActivity())
+                    && !U.isSystemApp(getActivity())
+                    && !pref.getBoolean("hide_donate", false)) {
+                findPreference("donate").setOnPreferenceClickListener(this);
+            } else
+                getPreferenceScreen().removePreference(findPreference("donate_category"));
+        }
 
         // Set OnClickListeners for certain preferences
         if(U.canEnableFreeform())
@@ -70,11 +73,13 @@ public class AboutFragment extends SettingsFragment implements Preference.OnPref
         findPreference("pref_screen_recent_apps").setOnPreferenceClickListener(this);
         findPreference("pref_screen_advanced").setOnPreferenceClickListener(this);
 
-        if(BuildConfig.DEBUG || BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID))
-            findPreference("about").setSummary(R.string.pref_about_description_alt);
-        else {
-            findPreference("about").setSummary(getString(R.string.pref_about_description, new String(Character.toChars(0x1F601))));
-            findPreference("about").setOnPreferenceClickListener(this);
+        if(!isLibrary) {
+            if(BuildConfig.DEBUG || getActivity().getPackageName().equals(BuildConfig.ANDROIDX86_APPLICATION_ID))
+                findPreference("about").setSummary(R.string.pref_about_description_alt);
+            else {
+                findPreference("about").setSummary(getString(R.string.pref_about_description, new String(Character.toChars(0x1F601))));
+                findPreference("about").setOnPreferenceClickListener(this);
+            }
         }
 
         finishedLoadingPrefs = true;
@@ -85,10 +90,10 @@ public class AboutFragment extends SettingsFragment implements Preference.OnPref
         super.onActivityCreated(savedInstanceState);
 
         AppCompatActivity activity = (AppCompatActivity) getActivity();
-        activity.setTitle(R.string.app_name);
+        activity.setTitle(((MainActivity) getActivity()).getAboutFragmentTitle());
         ActionBar actionBar = activity.getSupportActionBar();
         if(actionBar != null)
-            actionBar.setDisplayHomeAsUpEnabled(false);
+            actionBar.setDisplayHomeAsUpEnabled(U.isLibrary(getActivity()));
     }
 
     @Override
index 456607f..61f94ea 100644 (file)
@@ -77,21 +77,29 @@ public class AdvancedFragment extends SettingsFragment implements Preference.OnP
 
         // Set OnClickListeners for certain preferences
         findPreference("clear_pinned_apps").setOnPreferenceClickListener(this);
-        findPreference("launcher").setOnPreferenceClickListener(this);
-        findPreference("keyboard_shortcut").setOnPreferenceClickListener(this);
         findPreference("dashboard_grid_size").setOnPreferenceClickListener(this);
-        findPreference("navigation_bar_buttons").setOnPreferenceClickListener(this);
         findPreference("keyboard_shortcut").setSummary(DependencyUtils.getKeyboardShortcutSummary(getActivity()));
 
-        boolean isAndroidx86 = BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID);
+        boolean isLibrary = U.isLibrary(getActivity());
+        boolean isAndroidx86 = getActivity().getPackageName().equals(BuildConfig.ANDROIDX86_APPLICATION_ID);
+
+        if(isLibrary) {
+            getPreferenceScreen().removePreference(findPreference("launcher"));
+            getPreferenceScreen().removePreference(findPreference("keyboard_shortcut"));
+            getPreferenceScreen().removePreference(findPreference("navigation_bar_buttons"));
+        } else {
+            findPreference("launcher").setOnPreferenceClickListener(this);
+            findPreference("keyboard_shortcut").setOnPreferenceClickListener(this);
+            findPreference("navigation_bar_buttons").setOnPreferenceClickListener(this);
+        }
 
-        if(!isAndroidx86 && U.isPlayStoreInstalled(getActivity()) && U.isPlayStoreRelease(getActivity())) {
+        if(!isAndroidx86 && !isLibrary && U.isPlayStoreInstalled(getActivity()) && U.isPlayStoreRelease(getActivity())) {
             findPreference("secondscreen").setOnPreferenceClickListener(this);
             secondScreenPrefEnabled = true;
         } else
             getPreferenceScreen().removePreference(findPreference("secondscreen"));
 
-        if(isAndroidx86)
+        if(isAndroidx86 || isLibrary)
             getPreferenceScreen().removePreference(findPreference("tasker_enabled"));
 
         bindPreferenceSummaryToValue(findPreference("dashboard"));
@@ -100,7 +108,8 @@ public class AdvancedFragment extends SettingsFragment implements Preference.OnP
         boolean lockHomeToggle = pref.getBoolean("launcher", false)
                 && U.isLauncherPermanentlyEnabled(getActivity());
 
-        findPreference("launcher").setEnabled(!lockHomeToggle);
+        if(!isLibrary)
+            findPreference("launcher").setEnabled(!lockHomeToggle);
 
         finishedLoadingPrefs = true;
     }
index 71d15b5..6ef0d96 100644 (file)
@@ -98,7 +98,7 @@ public class AppearanceFragment extends SettingsFragment implements Preference.O
         Preference iconPackListPref = findPreference("icon_pack_list");
         if(iconPackListPref != null) {
             SharedPreferences pref = U.getSharedPreferences(getActivity());
-            String iconPackPackage = pref.getString("icon_pack", BuildConfig.APPLICATION_ID);
+            String iconPackPackage = pref.getString("icon_pack", getActivity().getPackageName());
             PackageManager pm = getActivity().getPackageManager();
 
             boolean iconPackValid = true;
@@ -108,7 +108,7 @@ public class AppearanceFragment extends SettingsFragment implements Preference.O
                 iconPackValid = false;
             }
 
-            if(!iconPackValid || iconPackPackage.equals(BuildConfig.APPLICATION_ID)) {
+            if(!iconPackValid || iconPackPackage.equals(getActivity().getPackageName())) {
                 iconPackListPref.setSummary(getString(R.string.icon_pack_none));
             } else {
                 try {
index 2c02e8f..b9b3160 100644 (file)
@@ -47,7 +47,13 @@ public class GeneralFragment extends SettingsFragment implements Preference.OnPr
 
         // Set OnClickListeners for certain preferences
         findPreference("blacklist").setOnPreferenceClickListener(this);
-        findPreference("notification_settings").setOnPreferenceClickListener(this);
+
+        if(!U.isLibrary(getActivity()))
+            findPreference("notification_settings").setOnPreferenceClickListener(this);
+        else {
+            getPreferenceScreen().removePreference(findPreference("start_on_boot"));
+            getPreferenceScreen().removePreference(findPreference("notification_settings"));
+        }
 
         if(U.canEnableFreeform()
                 && !U.isChromeOs(getActivity())
@@ -122,9 +128,9 @@ public class GeneralFragment extends SettingsFragment implements Preference.OnPr
                 intent2.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
 
                 if(Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1)
-                    intent2.putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID);
+                    intent2.putExtra(Settings.EXTRA_APP_PACKAGE, getActivity().getPackageName());
                 else {
-                    intent2.putExtra("app_package", BuildConfig.APPLICATION_ID);
+                    intent2.putExtra("app_package", getActivity().getPackageName());
                     intent2.putExtra("app_uid", getActivity().getApplicationInfo().uid);
                 }
 
index b5c0127..7d28779 100644 (file)
@@ -82,6 +82,8 @@ public abstract class SettingsFragment extends PreferenceFragment {
             if(finishedLoadingPrefs) {
                 switch(preference.getKey()) {
                     case "theme":
+                        if(U.isLibrary(getActivity())) break;
+
                         // Restart MainActivity
                         Intent intent = new Intent(getActivity(), MainActivity.class);
                         intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
index 746aafb..b581355 100644 (file)
@@ -95,10 +95,10 @@ public class NotificationService extends Service {
                 intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
 
                 Intent receiverIntent = new Intent("com.farmerbb.taskbar.SHOW_HIDE_TASKBAR");
-                receiverIntent.setPackage(BuildConfig.APPLICATION_ID);
+                receiverIntent.setPackage(getPackageName());
 
                 Intent receiverIntent2 = new Intent("com.farmerbb.taskbar.QUIT");
-                receiverIntent2.setPackage(BuildConfig.APPLICATION_ID);
+                receiverIntent2.setPackage(getPackageName());
 
                 PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
                 PendingIntent receiverPendingIntent = PendingIntent.getBroadcast(this, 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT);
@@ -132,7 +132,7 @@ public class NotificationService extends Service {
                     String freeformLabel = getString(pref.getBoolean("freeform_hack", false) ? R.string.freeform_off : R.string.freeform_on);
 
                     Intent freeformIntent = new Intent("com.farmerbb.taskbar.TOGGLE_FREEFORM_MODE");
-                    freeformIntent.setPackage(BuildConfig.APPLICATION_ID);
+                    freeformIntent.setPackage(getPackageName());
 
                     PendingIntent freeformPendingIntent = PendingIntent.getBroadcast(this, 0, freeformIntent, PendingIntent.FLAG_UPDATE_CURRENT);
 
@@ -150,7 +150,7 @@ public class NotificationService extends Service {
                 LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.UPDATE_SWITCH"));
 
                 if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
-                    TileService.requestListeningState(this, new ComponentName(BuildConfig.APPLICATION_ID, QuickSettingsTileService.class.getName()));
+                    TileService.requestListeningState(this, new ComponentName(getPackageName(), QuickSettingsTileService.class.getName()));
 
                 DependencyUtils.requestTaskerQuery(this);
 
@@ -175,7 +175,7 @@ public class NotificationService extends Service {
             LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.UPDATE_SWITCH"));
 
             if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
-                TileService.requestListeningState(this, new ComponentName(BuildConfig.APPLICATION_ID, QuickSettingsTileService.class.getName()));
+                TileService.requestListeningState(this, new ComponentName(getPackageName(), QuickSettingsTileService.class.getName()));
 
             DependencyUtils.requestTaskerQuery(this);
 
index 9191621..2d82a5b 100644 (file)
@@ -43,7 +43,7 @@ public class QuickSettingsTileService extends TileService {
         Intent intent = new Intent("com.farmerbb.taskbar."
                 + (U.isServiceRunning(this, NotificationService.class) ? "QUIT" : "START"));
 
-        intent.setPackage(BuildConfig.APPLICATION_ID);
+        intent.setPackage(getPackageName());
         sendBroadcast(intent);
 
         new Handler().postDelayed(this::updateState, 100);
index 67f0ba4..e4f2c9b 100644 (file)
@@ -48,6 +48,7 @@ import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.PowerManager;
+import android.os.Process;
 import android.os.SystemClock;
 import android.os.UserHandle;
 import android.os.UserManager;
@@ -321,8 +322,11 @@ public class TaskbarController implements UIController {
                 if(U.isBlissOs(context)) {
                     drawable = ContextCompat.getDrawable(context, R.drawable.bliss);
                     drawable.setTint(accentColor);
-                } else
-                    drawable = ContextCompat.getDrawable(context, R.mipmap.ic_launcher);
+                } else {
+                    LauncherApps launcherApps = (LauncherApps) context.getSystemService(Context.LAUNCHER_APPS_SERVICE);
+                    LauncherActivityInfo info = launcherApps.getActivityList(context.getPackageName(), Process.myUserHandle()).get(0);
+                    drawable = IconCache.getInstance(context).getIcon(context, context.getPackageManager(), info);
+                }
 
                 startButton.setImageDrawable(drawable);
                 padding = context.getResources().getDimensionPixelSize(R.dimen.app_drawer_icon_padding_alt);
@@ -1664,7 +1668,7 @@ public class TaskbarController implements UIController {
     }
 
     private int getResourceIdFor(String name) {
-        String packageName = context.getResources().getResourcePackageName(R.mipmap.ic_launcher);
+        String packageName = context.getResources().getResourcePackageName(R.drawable.dummy);
         return context.getResources().getIdentifier(name, "drawable", packageName);
     }
 }
index f9d47b9..c36c9e1 100644 (file)
@@ -94,19 +94,19 @@ public class IconCache {
 
     private Drawable loadIcon(Context context, PackageManager pm, LauncherActivityInfo appInfo) {
         SharedPreferences pref = U.getSharedPreferences(context);
-        String iconPackPackage = pref.getString("icon_pack", BuildConfig.APPLICATION_ID);
+        String iconPackPackage = pref.getString("icon_pack", context.getPackageName());
         boolean useMask = pref.getBoolean("icon_pack_use_mask", false);
         IconPackManager iconPackManager = IconPackManager.getInstance();
 
         try {
             pm.getPackageInfo(iconPackPackage, 0);
         } catch (PackageManager.NameNotFoundException e) {
-            iconPackPackage = BuildConfig.APPLICATION_ID;
+            iconPackPackage = context.getPackageName();
             pref.edit().putString("icon_pack", iconPackPackage).apply();
             U.refreshPinnedIcons(context);
         }
 
-        if(iconPackPackage.equals(BuildConfig.APPLICATION_ID))
+        if(iconPackPackage.equals(context.getPackageName()))
             return getIcon(pm, appInfo);
         else {
             IconPack iconPack = iconPackManager.getIconPack(iconPackPackage);
index 594538e..9d1f94c 100644 (file)
@@ -63,8 +63,6 @@ import com.farmerbb.taskbar.R;
 import com.farmerbb.taskbar.activity.ContextMenuActivity;
 import com.farmerbb.taskbar.activity.DummyActivity;
 import com.farmerbb.taskbar.activity.InvisibleActivityFreeform;
-import com.farmerbb.taskbar.activity.ShortcutActivity;
-import com.farmerbb.taskbar.activity.StartTaskbarActivity;
 import com.farmerbb.taskbar.activity.TouchAbsorberActivity;
 import com.farmerbb.taskbar.activity.dark.ContextMenuActivityDark;
 import com.farmerbb.taskbar.service.DashboardService;
@@ -104,6 +102,7 @@ public class U {
     private static final int WINDOWING_MODE_FULLSCREEN = 1;
     private static final int WINDOWING_MODE_FREEFORM = 5;
 
+    @SuppressWarnings("deprecation")
     public static SharedPreferences getSharedPreferences(Context context) {
         return context.getSharedPreferences(BuildConfig.APPLICATION_ID + "_preferences", Context.MODE_PRIVATE);
     }
@@ -128,7 +127,7 @@ public class U {
                 .setPositiveButton(R.string.action_grant_permission, (dialog, which) -> {
                     try {
                         context.startActivity(new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
-                                Uri.parse("package:" + BuildConfig.APPLICATION_ID)));
+                                Uri.parse("package:" + context.getPackageName())));
 
                         finalOnFinish.run();
                     } catch (ActivityNotFoundException e) {
@@ -154,7 +153,7 @@ public class U {
 
         AlertDialog.Builder builder = new AlertDialog.Builder(context);
         builder.setTitle(R.string.error_dialog_title)
-                .setMessage(context.getString(R.string.error_dialog_message, BuildConfig.APPLICATION_ID, appopCmd))
+                .setMessage(context.getString(R.string.error_dialog_message, context.getPackageName(), appopCmd))
                 .setPositiveButton(R.string.action_ok, (dialog, which) -> finalOnFinish.run());
 
         AlertDialog dialog = builder.create();
@@ -622,13 +621,13 @@ public class U {
     public static void checkForUpdates(Context context) {
         String url;
         if(isPlayStoreRelease(context)) {
-            if(BuildConfig.APPLICATION_ID.equals(BuildConfig.BASE_APPLICATION_ID)
+            if(context.getPackageName().equals(BuildConfig.BASE_APPLICATION_ID)
                     && !isPlayStoreInstalled(context))
                 url = "https://github.com/farmerbb/Taskbar/releases";
             else
-                url = "https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID;
+                url = "https://play.google.com/store/apps/details?id=" + context.getPackageName();
         } else
-            url = "https://f-droid.org/repository/browse/?fdid=" + BuildConfig.APPLICATION_ID;
+            url = "https://f-droid.org/repository/browse/?fdid=" + context.getPackageName();
 
         Intent intent = new Intent(Intent.ACTION_VIEW);
         intent.setData(Uri.parse(url));
@@ -644,7 +643,7 @@ public class U {
         homeIntent.addCategory(Intent.CATEGORY_HOME);
         ResolveInfo defaultLauncher = context.getPackageManager().resolveActivity(homeIntent, PackageManager.MATCH_DEFAULT_ONLY);
 
-        return defaultLauncher.activityInfo.packageName.equals(BuildConfig.APPLICATION_ID);
+        return defaultLauncher.activityInfo.packageName.equals(context.getPackageName());
     }
 
     public static void setCachedRotation(int cachedRotation) {
@@ -867,32 +866,6 @@ public class U {
         }
     }
 
-    public static Intent getShortcutIntent(Context context) {
-        Intent shortcutIntent = new Intent(context, ShortcutActivity.class);
-        shortcutIntent.setAction(Intent.ACTION_MAIN);
-        shortcutIntent.putExtra("is_launching_shortcut", true);
-
-        Intent intent = new Intent();
-        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
-        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.mipmap.ic_freeform_mode));
-        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.pref_header_freeform));
-
-        return intent;
-    }
-
-    public static Intent getStartStopIntent(Context context) {
-        Intent shortcutIntent = new Intent(context, StartTaskbarActivity.class);
-        shortcutIntent.setAction(Intent.ACTION_MAIN);
-        shortcutIntent.putExtra("is_launching_shortcut", true);
-
-        Intent intent = new Intent();
-        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
-        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.mipmap.ic_launcher));
-        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.start_taskbar));
-
-        return intent;
-    }
-
     public static boolean canEnableFreeform() {
         return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N;
     }
@@ -1088,7 +1061,7 @@ public class U {
 
     public static boolean isSystemApp(Context context) {
         try {
-            ApplicationInfo info = context.getPackageManager().getApplicationInfo(BuildConfig.APPLICATION_ID, 0);
+            ApplicationInfo info = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0);
             int mask = ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
             return (info.flags & mask) != 0;
         } catch (PackageManager.NameNotFoundException e) {
@@ -1112,19 +1085,19 @@ public class U {
             validBlissOsBuildProp = true;
 
         return validBlissOsBuildProp
-                && BuildConfig.APPLICATION_ID.equals(BuildConfig.BASE_APPLICATION_ID)
+                && context.getPackageName().equals(BuildConfig.BASE_APPLICATION_ID)
                 && isSystemApp(context);
     }
 
     public static boolean isLauncherPermanentlyEnabled(Context context) {
-        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID))
+        if(context.getPackageName().equals(BuildConfig.ANDROIDX86_APPLICATION_ID))
             return true;
 
         PackageManager pm = context.getPackageManager();
         try {
             pm.getPackageInfo(BuildConfig.SUPPORT_APPLICATION_ID, 0);
-            return pm.checkSignatures(BuildConfig.SUPPORT_APPLICATION_ID, BuildConfig.APPLICATION_ID) == PackageManager.SIGNATURE_MATCH
-                    && BuildConfig.APPLICATION_ID.equals(BuildConfig.BASE_APPLICATION_ID)
+            return pm.checkSignatures(BuildConfig.SUPPORT_APPLICATION_ID, context.getPackageName()) == PackageManager.SIGNATURE_MATCH
+                    && context.getPackageName().equals(BuildConfig.BASE_APPLICATION_ID)
                     && isSystemApp(context);
         } catch (PackageManager.NameNotFoundException e) {
             return false;
@@ -1274,7 +1247,7 @@ public class U {
         }
 
         // Customizations for Android-x86 devices (non-Bliss)
-        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID)
+        if(context.getPackageName().equals(BuildConfig.ANDROIDX86_APPLICATION_ID)
                 && isSystemApp(context)
                 && !pref.getBoolean("android_x86_prefs", false)) {
             pref.edit()
@@ -1348,7 +1321,7 @@ public class U {
             } else
                 showToastLong(context, R.string.pin_shortcut_not_supported);
         } else {
-            Intent intent = getShortcutIntent(context);
+            Intent intent = ShortcutUtils.getShortcutIntent(context);
             intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
             intent.putExtra("duplicate", false);
 
@@ -1455,7 +1428,7 @@ public class U {
         if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && !isSystemApp(context)) {
             ApplicationInfo applicationInfo = null;
             try {
-                applicationInfo = context.getPackageManager().getApplicationInfo(BuildConfig.APPLICATION_ID, 0);
+                applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0);
             } catch (PackageManager.NameNotFoundException e) { /* Gracefully fail */ }
 
             if(applicationInfo != null) {
@@ -1508,7 +1481,7 @@ public class U {
     }
 
     public static boolean isPlayStoreRelease(Context context) {
-        return isPlayStoreRelease(context, BuildConfig.APPLICATION_ID);
+        return isPlayStoreRelease(context, context.getPackageName());
     }
 
     @SuppressLint("PackageManagerGetSignatures")
@@ -1627,4 +1600,9 @@ public class U {
                 && pref.getBoolean("full_length", context.getResources().getBoolean(R.bool.def_full_length))
                 && !getTaskbarPosition(context).contains("vertical");
     }
+
+    @SuppressWarnings("deprecation")
+    public static boolean isLibrary(Context context) {
+        return !context.getPackageName().equals(BuildConfig.APPLICATION_ID);
+    }
 }
diff --git a/app/src/main/res/drawable/dummy.xml b/app/src/main/res/drawable/dummy.xml
new file mode 100644 (file)
index 0000000..e6b5531
--- /dev/null
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector />
\ No newline at end of file
index 9ec6e82..893adb5 100644 (file)
     <string name="pref_title_sys_tray">Show status icons and clock</string>
     <string name="pref_description_sys_tray">Only visible when Taskbar is horizontal</string>
 
+    <string name="settings">Settings</string>
+    <string name="powered_by_taskbar">Powered by Taskbar</string>
+
 </resources>
index 226154b..51c03bc 100644 (file)
     <string name="pref_title_sys_tray">Show status icons and clock</string>
     <string name="pref_description_sys_tray">Only visible when Taskbar is horizontal</string>
 
+    <string name="settings">Settings</string>
+    <string name="powered_by_taskbar">Powered by Taskbar</string>
+
 </resources>
\ No newline at end of file
index 7a0de61..1a4cd6e 100644 (file)
     <string name="pref_title_sys_tray">Show status icons and clock</string>
     <string name="pref_description_sys_tray">Only visible when Taskbar is horizontal</string>
 
+    <string name="settings">Settings</string>
+    <string name="powered_by_taskbar">Powered by Taskbar</string>
+
 </resources>
index 19dc179..f78805c 100644 (file)
     <string name="pref_title_sys_tray">Show status icons and clock</string>
     <string name="pref_description_sys_tray">Only visible when Taskbar is horizontal</string>
 
+    <string name="settings">Settings</string>
+    <string name="powered_by_taskbar">Powered by Taskbar</string>
+
 </resources>
\ No newline at end of file
index 1a8bbd2..a6f9157 100644 (file)
@@ -375,4 +375,7 @@ Bu durumda, bu cihazdaki serbest biçimli modu kullanmak için Ã¶zel bir ROM fla
     <string name="pref_title_sys_tray">Show status icons and clock</string>
     <string name="pref_description_sys_tray">Only visible when Taskbar is horizontal</string>
 
+    <string name="settings">Settings</string>
+    <string name="powered_by_taskbar">Powered by Taskbar</string>
+
 </resources>
\ No newline at end of file
index d545332..c009db6 100644 (file)
     <string name="pref_title_sys_tray">Show status icons and clock</string>
     <string name="pref_description_sys_tray">Only visible when Taskbar is horizontal</string>
 
+    <string name="settings">Settings</string>
+    <string name="powered_by_taskbar">Powered by Taskbar</string>
+
 </resources>
\ No newline at end of file
index 44ec295..8b7b0a5 100644 (file)
     <string name="pref_title_sys_tray">Show status icons and clock</string>
     <string name="pref_description_sys_tray">Only visible when Taskbar is horizontal</string>
 
+    <string name="settings">Settings</string>
+    <string name="powered_by_taskbar">Powered by Taskbar</string>
+
 </resources>
diff --git a/app/src/nonlib/java/com/farmerbb/taskbar/util/ShortcutUtils.java b/app/src/nonlib/java/com/farmerbb/taskbar/util/ShortcutUtils.java
new file mode 100644 (file)
index 0000000..b68a103
--- /dev/null
@@ -0,0 +1,54 @@
+/* Copyright 2019 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.farmerbb.taskbar.util;
+
+import android.content.Context;
+import android.content.Intent;
+
+import com.farmerbb.taskbar.R;
+import com.farmerbb.taskbar.activity.ShortcutActivity;
+import com.farmerbb.taskbar.activity.StartTaskbarActivity;
+
+public class ShortcutUtils {
+
+    private ShortcutUtils() {}
+
+    public static Intent getShortcutIntent(Context context) {
+        Intent shortcutIntent = new Intent(context, ShortcutActivity.class);
+        shortcutIntent.setAction(Intent.ACTION_MAIN);
+        shortcutIntent.putExtra("is_launching_shortcut", true);
+
+        Intent intent = new Intent();
+        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
+        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.mipmap.ic_freeform_mode));
+        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.pref_header_freeform));
+
+        return intent;
+    }
+
+    public static Intent getStartStopIntent(Context context) {
+        Intent shortcutIntent = new Intent(context, StartTaskbarActivity.class);
+        shortcutIntent.setAction(Intent.ACTION_MAIN);
+        shortcutIntent.putExtra("is_launching_shortcut", true);
+
+        Intent intent = new Intent();
+        intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
+        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.mipmap.ic_launcher));
+        intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, context.getString(R.string.start_taskbar));
+
+        return intent;
+    }
+}
index 35b42a2..02847bc 100644 (file)
@@ -44,7 +44,7 @@ public class ReceiveSettingsReceiver extends BroadcastReceiver {
     @Override
     public void onReceive(Context context, Intent intent) {
         // Ignore this broadcast if this is the free version
-        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.PAID_APPLICATION_ID)) {
+        if(context.getPackageName().equals(BuildConfig.PAID_APPLICATION_ID)) {
             // Get pinned and blocked apps
             PinnedBlockedApps pba = PinnedBlockedApps.getInstance(context);
             pba.clear(context);
@@ -148,7 +148,7 @@ public class ReceiveSettingsReceiver extends BroadcastReceiver {
             String contents = intent.getStringExtra("preferences");
             if(contents.length() > 0)
                 try {
-                    File file = new File(context.getFilesDir().getParent() + "/shared_prefs/" + BuildConfig.APPLICATION_ID + "_preferences.xml");
+                    File file = new File(context.getFilesDir().getParent() + "/shared_prefs/" + context.getPackageName() + "_preferences.xml");
                     FileOutputStream output = new FileOutputStream(file);
                     output.write(contents.getBytes());
                     output.close();
index 2d98baa..2afe252 100644 (file)
@@ -42,7 +42,7 @@ public class SendSettingsReceiver extends BroadcastReceiver {
     @Override
     public void onReceive(Context context, Intent intent) {
         // Ignore this broadcast if this is the paid version
-        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.BASE_APPLICATION_ID)) {
+        if(context.getPackageName().equals(BuildConfig.BASE_APPLICATION_ID)) {
             Intent sendSettingsIntent = new Intent("com.farmerbb.taskbar.SEND_SETTINGS");
             sendSettingsIntent.setPackage(BuildConfig.PAID_APPLICATION_ID);
 
@@ -139,7 +139,7 @@ public class SendSettingsReceiver extends BroadcastReceiver {
             StringBuilder preferences = new StringBuilder();
 
             try {
-                File file = new File(context.getFilesDir().getParent() + "/shared_prefs/" + BuildConfig.APPLICATION_ID + "_preferences.xml");
+                File file = new File(context.getFilesDir().getParent() + "/shared_prefs/" + context.getPackageName() + "_preferences.xml");
                 FileInputStream input = new FileInputStream(file);
                 InputStreamReader reader = new InputStreamReader(input);
                 BufferedReader buffer = new BufferedReader(reader);
@@ -160,7 +160,7 @@ public class SendSettingsReceiver extends BroadcastReceiver {
             // Get custom start button image
             File file = new File(context.getFilesDir() + "/images", "custom_image");
             if(file.exists() && U.isPlayStoreRelease(context, BuildConfig.PAID_APPLICATION_ID)) {
-                Uri uri = FileProvider.getUriForFile(context, BuildConfig.APPLICATION_ID + ".fileprovider", file);
+                Uri uri = FileProvider.getUriForFile(context, context.getPackageName() + ".fileprovider", file);
                 context.grantUriPermission(BuildConfig.PAID_APPLICATION_ID, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION);
                 sendSettingsIntent.putExtra("custom_image", uri);
             }
index f856cc5..d603673 100644 (file)
@@ -44,7 +44,7 @@ public final class TaskerActionReceiver extends BroadcastReceiver {
             if(actionIntent != null) switch(action) {
                 case "tasker_on":
                 case "tasker_off":
-                    actionIntent.setPackage(BuildConfig.APPLICATION_ID);
+                    actionIntent.setPackage(context.getPackageName());
                     context.sendBroadcast(actionIntent);
                     break;
                 default:
diff --git a/lib/build.gradle b/lib/build.gradle
new file mode 100644 (file)
index 0000000..326973f
--- /dev/null
@@ -0,0 +1,81 @@
+ext {
+    SUPPORT_LIBRARY_VERSION = "28.0.0"
+    SDK_VERSION = 29
+}
+
+apply plugin: 'com.android.library'
+
+repositories {
+    google()
+}
+
+android {
+    compileSdkVersion SDK_VERSION
+    buildToolsVersion "28.0.3"
+
+    defaultConfig {
+        minSdkVersion 21
+        targetSdkVersion SDK_VERSION
+
+        // TODO keep versionName and versionCode in sync with Android-x86 manifest
+        versionCode 195
+        versionName "4.0.3"
+
+        resConfigs "en", "ja", "ru", "de", "zh-rCN", "tr", "nl"
+        vectorDrawables.generatedDensities = []
+
+        buildConfigField "String", "BASE_APPLICATION_ID", "\"com.farmerbb.taskbar\""
+        buildConfigField "String", "PAID_APPLICATION_ID", "\"com.farmerbb.taskbar.paid\""
+        buildConfigField "String", "SUPPORT_APPLICATION_ID", "\"com.farmerbb.taskbar.support\""
+        buildConfigField "String", "ANDROIDX86_APPLICATION_ID", "\"com.farmerbb.taskbar.androidx86\""
+    }
+
+    compileOptions {
+        sourceCompatibility JavaVersion.VERSION_1_8
+        targetCompatibility JavaVersion.VERSION_1_8
+    }
+
+    signingConfigs {
+        release {
+            if(System.getenv("KSTOREFILE") != null)
+                storeFile file(System.getenv("KSTOREFILE"))
+
+            storePassword System.getenv("KSTOREPWD")
+            keyAlias System.getenv("KEYALIAS")
+            keyPassword System.getenv("KEYPWD")
+        }
+    }
+
+    buildTypes {
+        debug {
+            manifestPlaceholders = [appName: "@string/app_name_debug"]
+        }
+
+        release {
+            minifyEnabled true
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+            signingConfig signingConfigs.release
+            manifestPlaceholders = [appName: "@string/app_name"]
+        }
+    }
+
+    sourceSets {
+        main {
+            java { srcDirs('../app/src/main/java', '../app/src/lib/java', '../app/src/nonplaystore/java', "../app/src/compat-${SDK_VERSION}/java") }
+            res { srcDirs('../app/src/main/res', '../app/src/lib/res') }
+            manifest.srcFile '../app/src/lib/AndroidManifest.xml'
+        }
+    }
+
+    lintOptions {
+        abortOnError false
+    }
+}
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    implementation "com.android.support:support-v4:${SUPPORT_LIBRARY_VERSION}"
+    implementation "com.android.support:appcompat-v7:${SUPPORT_LIBRARY_VERSION}"
+    implementation "com.android.support:design:${SUPPORT_LIBRARY_VERSION}"
+}
+
index e7b4def..3cbe249 100644 (file)
@@ -1 +1 @@
-include ':app'
+include ':app', ':lib'