OSDN Git Service

Various odds & ends
authorBraden Farmer <farmerbb@gmail.com>
Fri, 16 Aug 2019 03:16:36 +0000 (21:16 -0600)
committerBraden Farmer <farmerbb@gmail.com>
Fri, 16 Aug 2019 03:34:47 +0000 (21:34 -0600)
app/src/main/java/com/farmerbb/taskbar/activity/ContextMenuActivity.java
app/src/main/java/com/farmerbb/taskbar/activity/DesktopIconSelectAppActivity.java
app/src/main/java/com/farmerbb/taskbar/activity/HomeActivityDelegate.java
app/src/main/java/com/farmerbb/taskbar/activity/SelectAppActivity.java
app/src/main/java/com/farmerbb/taskbar/util/U.java

index 4fc41a7..f374e5e 100644 (file)
@@ -423,7 +423,7 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
                                 ComponentName.unflattenFromString(entry.getComponentName()),
                                 userManager.getUserForSerialNumber(entry.getUserId(this)),
                                 null,
-                                U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, null)));
+                                U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, getListView().getChildAt(p.getOrder()))));
 
                 showStartMenu = false;
                 shouldHideTaskbar = true;
@@ -457,7 +457,8 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
                     intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
 
                     try {
-                        startActivity(intent2, U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, null));
+                        startActivity(intent2,
+                                U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, getListView().getChildAt(p.getOrder())));
                     } catch (IllegalArgumentException e) { /* Gracefully fail */ }
                 });
 
@@ -533,7 +534,13 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
                     SavedWindowSizes.getInstance(this).setWindowSize(this, entry.getPackageName(), windowSize);
                 }
 
-                U.launchApp(getApplicationContext(), entry, windowSize, false, true, null);
+                U.launchApp(
+                        getApplicationContext(),
+                        entry,
+                        windowSize,
+                        false,
+                        true,
+                        getListView().getChildAt(p.getOrder()));
 
                 if(U.hasBrokenSetLaunchBoundsApi())
                     U.cancelToast();
@@ -553,7 +560,11 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
             case "shortcut_3":
             case "shortcut_4":
             case "shortcut_5":
-                U.startShortcut(getApplicationContext(), entry, shortcuts.get(Integer.parseInt(p.getKey().replace("shortcut_", "")) - 1));
+                U.startShortcut(
+                        getApplicationContext(),
+                        entry,
+                        shortcuts.get(Integer.parseInt(p.getKey().replace("shortcut_", "")) - 1),
+                        getListView().getChildAt(p.getOrder()));
 
                 showStartMenu = false;
                 shouldHideTaskbar = true;
@@ -615,7 +626,8 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
                     fileManagerIntent.setData(Uri.parse("content://com.android.externalstorage.documents/root/primary"));
 
                     try {
-                        startActivity(fileManagerIntent, U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, null));
+                        startActivity(fileManagerIntent,
+                                U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, getListView().getChildAt(p.getOrder())));
                     } catch (ActivityNotFoundException e) {
                         U.showToast(this, R.string.lock_device_not_supported);
                     } catch (IllegalArgumentException e) { /* Gracefully fail */ }
@@ -631,7 +643,8 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
                     settingsIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 
                     try {
-                        startActivity(settingsIntent, U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, null));
+                        startActivity(settingsIntent,
+                                U.getActivityOptionsBundle(this, ApplicationType.APPLICATION, getListView().getChildAt(p.getOrder())));
                     } catch (ActivityNotFoundException e) {
                         U.showToast(this, R.string.lock_device_not_supported);
                     } catch (IllegalArgumentException e) { /* Gracefully fail */ }
@@ -688,6 +701,9 @@ public class ContextMenuActivity extends PreferenceActivity implements Preferenc
                 LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.SORT_DESKTOP_ICONS"));
                 break;
             case "change_wallpaper":
+                if(LauncherHelper.getInstance().isOnHomeScreen())
+                    LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));
+
                 Intent intent3 = Intent.createChooser(new Intent(Intent.ACTION_SET_WALLPAPER), getString(R.string.set_wallpaper));
                 intent3.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                 U.startActivityMaximized(getApplicationContext(), intent3);
index 551bd10..8c9a3f3 100644 (file)
@@ -76,6 +76,8 @@ public class DesktopIconSelectAppActivity extends AppCompatActivity {
                 getWindow().setElevation(0);
         }
 
+        LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));
+
         progressBar = findViewById(R.id.progress_bar);
         appList = findViewById(R.id.list);
 
@@ -88,6 +90,9 @@ public class DesktopIconSelectAppActivity extends AppCompatActivity {
         if(appListGenerator != null && appListGenerator.getStatus() == AsyncTask.Status.RUNNING)
             appListGenerator.cancel(true);
 
+        if(!U.shouldCollapse(this, false))
+            LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_SHOW_TASKBAR"));
+
         super.finish();
     }
 
@@ -159,6 +164,7 @@ public class DesktopIconSelectAppActivity extends AppCompatActivity {
         protected void onPostExecute(DesktopIconAppListAdapter adapter) {
             progressBar.setVisibility(View.GONE);
             appList.setAdapter(adapter);
+            setFinishOnTouchOutside(true);
         }
     }
 }
\ No newline at end of file
index 2160801..e4be7d9 100644 (file)
@@ -28,6 +28,7 @@ import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.SharedPreferences;
 import android.content.pm.LauncherApps;
+import android.content.res.ColorStateList;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
@@ -36,6 +37,7 @@ import android.os.UserManager;
 import android.support.design.widget.FloatingActionButton;
 import android.support.v4.content.ContextCompat;
 import android.support.v4.content.LocalBroadcastManager;
+import android.support.v4.graphics.ColorUtils;
 import android.support.v7.app.AppCompatActivity;
 import android.util.SparseArray;
 import android.view.DragEvent;
@@ -219,7 +221,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
             }
         };
 
-        if(U.isDesktopIconsEnabled(HomeActivityDelegate.this)) {
+        if(U.isDesktopIconsEnabled(this)) {
             layout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
                 @Override
                 public void onGlobalLayout() {
@@ -231,9 +233,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
                     initDesktopIcons();
                 }
             });
-        }
-
-        if(!U.isDesktopIconsEnabled(this)) {
+        } else {
             layout.setOnClickListener(view1 -> LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU")));
 
             layout.setOnLongClickListener(view2 -> {
@@ -291,10 +291,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
     }
 
     private void setWallpaper() {
-        if(U.shouldCollapse(this, true))
-            LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));
-        else
-            LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU"));
+        LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));
 
         try {
             startActivity(Intent.createChooser(new Intent(Intent.ACTION_SET_WALLPAPER), getString(R.string.set_wallpaper)));
@@ -407,11 +404,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
         SharedPreferences pref = U.getSharedPreferences(this);
         if(!U.canBootToFreeform(this)) {
             LauncherHelper.getInstance().setOnHomeScreen(false);
-
-            if(U.shouldCollapse(this, true))
-                LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));
-            else
-                LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.HIDE_START_MENU"));
+            LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));
 
             if(FeatureFlags.homeActivityUIHost()) {
                 if(taskbarController != null) taskbarController.onDestroyHost(this);
@@ -554,7 +547,9 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
         refreshDesktopIcons();
 
         fab.setImageResource(R.drawable.ic_done_black_24dp);
-        fab.setBackgroundColor(U.getAccentColor(this));
+        fab.setBackgroundTintList(
+                ColorStateList.valueOf(ColorUtils.setAlphaComponent(U.getAccentColor(this), 255)));
+
         fab.setOnClickListener(v -> {
             iconArrangeMode = false;
             fab.hide();
@@ -829,7 +824,7 @@ public class HomeActivityDelegate extends AppCompatActivity implements UIHost {
         TextView textView = icon.findViewById(R.id.name);
         textView.setText(entry.getLabel());
         textView.setTextColor(ContextCompat.getColor(this, R.color.desktop_icon_text));
-        textView.setShadowLayer(50, 0, 0, R.color.desktop_icon_shadow);
+        textView.setShadowLayer(10, 0, 0, R.color.desktop_icon_shadow);
 
         ImageView imageView = icon.findViewById(R.id.icon);
         imageView.setImageDrawable(entry.getIcon(this));
index ba55b21..f7e4ceb 100644 (file)
@@ -30,6 +30,7 @@ import android.support.design.widget.TabLayout;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentPagerAdapter;
+import android.support.v4.content.LocalBroadcastManager;
 import android.support.v4.view.ViewPager;
 import android.support.v7.app.AppCompatActivity;
 import android.view.View;
@@ -106,6 +107,8 @@ public class SelectAppActivity extends AppCompatActivity {
                     getWindow().setElevation(0);
             }
 
+            LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_HIDE_TASKBAR"));
+
             progressBar = findViewById(R.id.progress_bar);
             appListGenerator = new AppListGenerator();
             appListGenerator.execute();
@@ -137,6 +140,9 @@ public class SelectAppActivity extends AppCompatActivity {
         if(appListGenerator != null && appListGenerator.getStatus() == AsyncTask.Status.RUNNING)
             appListGenerator.cancel(true);
 
+        if(!U.shouldCollapse(this, false))
+            LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.TEMP_SHOW_TASKBAR"));
+
         super.finish();
     }
 
index de885ec..6937451 100644 (file)
@@ -262,14 +262,14 @@ public class U {
         if(toast != null) toast.cancel();
     }
 
-    public static void startShortcut(Context context, AppEntry entry, ShortcutInfo shortcut) {
+    public static void startShortcut(Context context, AppEntry entry, ShortcutInfo shortcut, View view) {
         launchApp(context,
                 entry,
                 null,
                 false,
                 false,
                 shortcut,
-                null);
+                view);
     }
 
     public static void launchApp(final Context context,