/build
/captures
/app/build
+/lib/build
output.json
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
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'
}
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- 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>
--- /dev/null
+/* Copyright 2019 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.farmerbb.taskbar.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
--- /dev/null
+/* Copyright 2019 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.farmerbb.taskbar.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;
+ }
+}
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<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>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<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
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<resources>
+ <public />
+</resources>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 Braden Farmer
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<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>
break;
case "quit_taskbar":
Intent quitIntent = new Intent("com.farmerbb.taskbar.QUIT");
- quitIntent.setPackage(BuildConfig.APPLICATION_ID);
+ quitIntent.setPackage(getPackageName());
sendBroadcast(quitIntent);
showStartMenu = false;
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 {
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()));
else
startStopIntent = new Intent("com.farmerbb.taskbar.START");
- startStopIntent.setPackage(BuildConfig.APPLICATION_ID);
+ startStopIntent.setPackage(getPackageName());
sendBroadcast(startStopIntent);
}
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))
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"));
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));
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;
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);
}
}
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)
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);
}
.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
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 {
}
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();
}
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 {
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();
}
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;
// 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())
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;
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
// 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"));
boolean lockHomeToggle = pref.getBoolean("launcher", false)
&& U.isLauncherPermanentlyEnabled(getActivity());
- findPreference("launcher").setEnabled(!lockHomeToggle);
+ if(!isLibrary)
+ findPreference("launcher").setEnabled(!lockHomeToggle);
finishedLoadingPrefs = true;
}
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;
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 {
// 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())
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);
}
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);
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);
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);
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);
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);
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);
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;
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);
}
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);
}
}
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);
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;
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);
}
.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) {
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();
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));
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) {
}
}
- 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;
}
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) {
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;
}
// 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()
} 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);
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) {
}
public static boolean isPlayStoreRelease(Context context) {
- return isPlayStoreRelease(context, BuildConfig.APPLICATION_ID);
+ return isPlayStoreRelease(context, context.getPackageName());
}
@SuppressLint("PackageManagerGetSignatures")
&& 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);
+ }
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<selector />
\ No newline at end of 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>
<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
<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>
<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
<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
<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
<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>
--- /dev/null
+/* Copyright 2019 Braden Farmer
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.farmerbb.taskbar.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;
+ }
+}
@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);
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();
@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);
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);
// 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);
}
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:
--- /dev/null
+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}"
+}
+
-include ':app'
+include ':app', ':lib'