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\""
+ buildConfigField "String", "SS_SUPPORT_APPLICATION_ID", "\"com.farmerbb.secondscreen.support\""
}
compileOptions {
public static final String ANDROIDX86_APPLICATION_ID = "com.farmerbb.taskbar.androidx86";
public static final String BASE_APPLICATION_ID = "com.farmerbb.taskbar";
public static final String PAID_APPLICATION_ID = "com.farmerbb.taskbar.paid";
+ public static final String SS_SUPPORT_APPLICATION_ID = "com.farmerbb.secondscreen.support";
public static final String SUPPORT_APPLICATION_ID = "com.farmerbb.taskbar.support";
}
findPreference("button_home").setOnPreferenceClickListener(this);
findPreference("button_recents").setOnPreferenceClickListener(this);
- if(U.isBlissOs(this))
+ if(U.isBlissOs(this) || U.hasSecondScreenSupportLibrary(this))
findPreference("auto_hide_navbar").setOnPreferenceClickListener(this);
else
getPreferenceScreen().removePreference(findPreference("auto_hide_navbar_category"));
}
if(!shouldRedrawTaskbar && runningAppsOnly) {
- for(int i = 0; i < finalApplicationIds.size(); i++) {
+ for(int i = 0; i < currentRunningAppIds.size(); i++) {
if(!currentRunningAppIds.get(i).equals(prevRunningAppIds.get(i))) {
shouldRedrawTaskbar = true;
break;
--- /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.BuildConfig;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CommandDispatcher {
+
+ private List<String> commands = new ArrayList<>();
+
+ private static CommandDispatcher theInstance;
+
+ private CommandDispatcher() {}
+
+ public static CommandDispatcher getInstance() {
+ if(theInstance == null) theInstance = new CommandDispatcher();
+
+ return theInstance;
+ }
+
+ boolean addCommand(Context context, String command) {
+ if(U.hasSecondScreenSupportLibrary(context) && !command.isEmpty()) {
+ commands.add(command);
+ return true;
+ }
+
+ return false;
+ }
+
+ void dispatch(Context context) {
+ if(U.hasSecondScreenSupportLibrary(context)) {
+ Intent intent = new Intent(BuildConfig.SS_SUPPORT_APPLICATION_ID + ".DISPATCH_COMMANDS");
+ intent.setPackage(BuildConfig.SS_SUPPORT_APPLICATION_ID);
+
+ if(!commands.isEmpty())
+ intent.putExtra("commands", commands.toArray(new String[commands.size()]));
+
+ context.sendBroadcast(intent);
+ }
+
+ theInstance = null;
+ }
+}
\ No newline at end of file
}
public static void showHideNavigationBar(Context context, boolean show) {
+ if(hasSecondScreenSupportLibrary(context)) {
+ CommandDispatcher dispatcher = CommandDispatcher.getInstance();
+ int value = show ? 0 : getNavbarHeight(context) * -1;
+ String command = "wm overscan 0,0,0," + value + " -d " + getDisplayID();
+
+ if(dispatcher.addCommand(context, command)) {
+ dispatcher.dispatch(context);
+ return;
+ }
+ }
+
// Show or hide the system navigation bar on Bliss-x86
try {
if(getCurrentApiVersion() >= 28.0f)
editor.putBoolean("button_back", true);
editor.putBoolean("button_home", true);
editor.putBoolean("button_recents", true);
- // editor.putBoolean("auto_hide_navbar", true);
- // editor.putBoolean("shortcut_icon", false);
+ editor.putBoolean("auto_hide_navbar", true);
+ editor.putBoolean("shortcut_icon", false);
editor.putBoolean("bliss_os_prefs", true);
editor.apply();
}
public static DisplayInfo getDisplayInfo(Context context, boolean fromTaskbar) {
context = context.getApplicationContext();
-
- LauncherHelper helper = LauncherHelper.getInstance();
- int displayID;
-
- if(helper.isOnSecondaryHomeScreen())
- displayID = helper.getSecondaryDisplayId();
- else
- displayID = Display.DEFAULT_DISPLAY;
+ int displayID = getDisplayID();
DisplayManager dm = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
Display currentDisplay = null;
return info;
}
+ private static int getDisplayID() {
+ LauncherHelper helper = LauncherHelper.getInstance();
+
+ if(helper.isOnSecondaryHomeScreen())
+ return helper.getSecondaryDisplayId();
+ else
+ return Display.DEFAULT_DISPLAY;
+ }
+
public static void pinAppShortcut(Context context) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
ShortcutManager mShortcutManager = context.getSystemService(ShortcutManager.class);
return false;
}
+
+ public static boolean hasSecondScreenSupportLibrary(Context context) {
+ PackageManager pm = context.getPackageManager();
+ try {
+ pm.getPackageInfo(BuildConfig.SS_SUPPORT_APPLICATION_ID, 0);
+ return pm.checkSignatures(BuildConfig.SS_SUPPORT_APPLICATION_ID, context.getPackageName())
+ == PackageManager.SIGNATURE_MATCH;
+ } catch (PackageManager.NameNotFoundException e) {
+ return false;
+ }
+ }
}
-->
<resources>
- <integer name="tb_translucent_gray">0x60000000</integer>
+ <integer name="tb_translucent_gray">0x66000000</integer>
<integer name="tb_translucent_white">0xFFF0F0F0</integer>
<integer name="tb_dashboard_width">2</integer>
<integer name="tb_dashboard_height">2</integer>
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\""
+ buildConfigField "String", "SS_SUPPORT_APPLICATION_ID", "\"com.farmerbb.secondscreen.support\""
}
compileOptions {