OSDN Git Service

Fix issues with auto showing/hiding Taskbar when set as home screen
authorBraden Farmer <farmerbb@gmail.com>
Sun, 15 Mar 2020 05:30:20 +0000 (23:30 -0600)
committerBraden Farmer <farmerbb@gmail.com>
Sun, 15 Mar 2020 05:30:20 +0000 (23:30 -0600)
app/src/main/java/com/farmerbb/taskbar/activity/HomeActivityDelegate.java
app/src/main/java/com/farmerbb/taskbar/util/U.java

index 4027d7b..dd9cadf 100644 (file)
@@ -404,7 +404,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
                     finish();
                 } catch (ActivityNotFoundException e) { /* Gracefully fail */ }
             }
-        } else if(U.shouldCollapse(this, false))
+        } else if(U.shouldCollapse(this, false, true))
             LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.SHOW_TASKBAR"));
     }
 
@@ -473,7 +473,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
             pref.edit().putBoolean("taskbar_active", false).apply();
 
         // Show the Taskbar temporarily, as nothing else will be visible on screen
-        if(U.shouldCollapse(this, false))
+        if(U.shouldCollapse(this, false, true))
             new Handler().postDelayed(() -> LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.SHOW_TASKBAR")), 100);
     }
 
@@ -492,7 +492,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
         if(!U.canBootToFreeform(this)) {
             setOnHomeScreen(false);
 
-            if(U.shouldCollapse(this, false))
+            if(U.shouldCollapse(this, false, true))
                 LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_TASKBAR"));
 
             if(this instanceof SecondaryHomeActivity) {
index e360680..274bb98 100644 (file)
@@ -1487,11 +1487,15 @@ public class U {
     }
 
     public static boolean shouldCollapse(Context context, boolean pendingAppLaunch) {
+        return shouldCollapse(context, pendingAppLaunch, false);
+    }
+
+    public static boolean shouldCollapse(Context context, boolean pendingAppLaunch, boolean isHomeActivity) {
         SharedPreferences pref = getSharedPreferences(context);
         if(pref.getBoolean("hide_taskbar", true)) {
             if(!pref.getBoolean("freeform_hack", false)
                     || isOverridingFreeformHack(context, false))
-                return !LauncherHelper.getInstance().isOnHomeScreen();
+                return !LauncherHelper.getInstance().isOnHomeScreen() || isHomeActivity;
             else {
                 FreeformHackHelper helper = FreeformHackHelper.getInstance();
                 if(pendingAppLaunch)