OSDN Git Service

Fixes and customizations for Android-x86
authorBraden Farmer <farmerbb@gmail.com>
Sun, 18 Jun 2017 02:32:30 +0000 (20:32 -0600)
committerBraden Farmer <farmerbb@gmail.com>
Mon, 19 Jun 2017 16:39:39 +0000 (10:39 -0600)
app/src/main/java/com/farmerbb/taskbar/MainActivity.java
app/src/main/java/com/farmerbb/taskbar/fragment/AdvancedFragment.java
app/src/main/java/com/farmerbb/taskbar/util/U.java

index 8280cdd..3d2fc53 100644 (file)
@@ -92,9 +92,11 @@ public class MainActivity extends AppCompatActivity {
             editor.putBoolean("taskbar_active", false);
 
         // Ensure that components that should be enabled are enabled properly
-        boolean launcherEnabled = (pref.getBoolean("launcher", false) && U.canDrawOverlays(this)) || U.hasSupportLibrary(this);
-        editor.putBoolean("launcher", launcherEnabled);
+        boolean launcherEnabled = (pref.getBoolean("launcher", false) && U.canDrawOverlays(this))
+                || U.hasSupportLibrary(this)
+                || BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID);
 
+        editor.putBoolean("launcher", launcherEnabled);
         editor.apply();
 
         ComponentName component = new ComponentName(this, HomeActivity.class);
@@ -120,17 +122,15 @@ public class MainActivity extends AppCompatActivity {
         if(!launcherEnabled)
             LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent("com.farmerbb.taskbar.KILL_HOME_ACTIVITY"));
 
-        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.BASE_APPLICATION_ID))
-            proceedWithAppLaunch(savedInstanceState);
-        else {
+        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.PAID_APPLICATION_ID)) {
             File file = new File(getFilesDir() + File.separator + "imported_successfully");
             if(freeVersionInstalled() && !file.exists()) {
                 startActivity(new Intent(this, ImportSettingsActivity.class));
                 finish();
-            } else {
+            } else
                 proceedWithAppLaunch(savedInstanceState);
-            }
-        }
+        } else
+            proceedWithAppLaunch(savedInstanceState);
     }
 
     private boolean freeVersionInstalled() {
index 8d60f67..6f1593d 100644 (file)
@@ -69,7 +69,9 @@ public class AdvancedFragment extends SettingsFragment implements Preference.OnP
             bindPreferenceSummaryToValue(findPreference("dashboard"));
 
             SharedPreferences pref = U.getSharedPreferences(getActivity());
-            boolean lockHomeToggle = U.hasSupportLibrary(getActivity()) && pref.getBoolean("launcher", false);
+            boolean lockHomeToggle = pref.getBoolean("launcher", false)
+                    && (U.hasSupportLibrary(getActivity())
+                    || BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID));
 
             findPreference("launcher").setEnabled(!lockHomeToggle);
         }
index 7a37fde..0f33074 100644 (file)
@@ -1031,6 +1031,7 @@ public class U {
             pref.edit().putString("start_menu_layout", "grid").apply();
         }
 
+        // Enable freeform hack automatically on supported devices
         if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
             if(!pref.getBoolean("freeform_hack_override", false)) {
                 pref.edit()
@@ -1044,5 +1045,19 @@ public class U {
                 LocalBroadcastManager.getInstance(context).sendBroadcast(new Intent("com.farmerbb.taskbar.FINISH_FREEFORM_ACTIVITY"));
             }
         }
+
+        // Customizations for Android-x86 devices (non-Bliss)
+        if(BuildConfig.APPLICATION_ID.equals(BuildConfig.ANDROIDX86_APPLICATION_ID)
+                && isSystemApp(context)
+                && !pref.getBoolean("android_x86_prefs", false)) {
+            pref.edit()
+                    .putString("recents_amount", "running_apps_only")
+                    .putString("refresh_frequency", "0")
+                    .putString("max_num_of_recents", "2147483647")
+                    .putBoolean("full_length", true)
+                    .putBoolean("dashboard", true)
+                    .putBoolean("android_x86_prefs", true)
+                    .apply();
+        }
     }
 }