From 63450dbcabb35518bcf976af63902239c3d6381f Mon Sep 17 00:00:00 2001 From: threethan Date: Sat, 29 Jul 2023 13:53:21 -0400 Subject: [PATCH] hotfix --- .../main/java/com/threethan/launcher/SettingsProvider.java | 7 ++++++- .../java/com/threethan/launcher/platforms/AppPlatform.java | 7 ++----- .../main/java/com/threethan/launcher/ui/AppsAdapter.java | 1 - 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Launcher/App/src/main/java/com/threethan/launcher/SettingsProvider.java b/Launcher/App/src/main/java/com/threethan/launcher/SettingsProvider.java index 7364a212..0f4a6149 100644 --- a/Launcher/App/src/main/java/com/threethan/launcher/SettingsProvider.java +++ b/Launcher/App/src/main/java/com/threethan/launcher/SettingsProvider.java @@ -39,6 +39,7 @@ public class SettingsProvider { private Set appGroupsSet = new HashSet<>(); private Set selectedGroupsSet = new HashSet<>(); private static Set appsToLaunchOut = new HashSet<>(); + private Set appsToLaunchOutNS = new HashSet<>(); private SettingsProvider(Context context) { sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); @@ -100,7 +101,6 @@ public ArrayList getInstalledApps(Context context, List if (!appListMap.containsKey(app.packageName)) { final boolean isVr = AbstractPlatform.isVirtualRealityApp(app); appListMap.put(app.packageName, isVr ? context.getString(R.string.default_apps_group) : context.getString(R.string.android_apps_group)); - if (isVr) appsToLaunchOut.add(app.packageName); } } } @@ -166,6 +166,7 @@ public ArrayList getInstalledApps(Context context, List return sortedApps; } + public boolean hasMetadata(ApplicationInfo app, String metadata) { if (app.metaData != null) { return app.metaData.keySet().contains(metadata); @@ -232,9 +233,13 @@ private synchronized void readValues() { appListMap.put(app, group); } } + + appsToLaunchOut = sharedPreferences.getStringSet(KEY_LAUNCH_OUT, defaultGroupsSet); + } catch (Exception e) { e.printStackTrace(); } + } private synchronized void storeValues() { diff --git a/Launcher/App/src/main/java/com/threethan/launcher/platforms/AppPlatform.java b/Launcher/App/src/main/java/com/threethan/launcher/platforms/AppPlatform.java index a5d83aa1..d13fe810 100644 --- a/Launcher/App/src/main/java/com/threethan/launcher/platforms/AppPlatform.java +++ b/Launcher/App/src/main/java/com/threethan/launcher/platforms/AppPlatform.java @@ -1,12 +1,9 @@ package com.threethan.launcher.platforms; import android.app.Activity; -import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; -import android.util.Log; - import com.threethan.launcher.SettingsProvider; import java.util.Timer; @@ -21,14 +18,14 @@ public boolean isSupported(Context context) { @Override public void runApp(Activity context, ApplicationInfo appInfo) { Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(appInfo.packageName); - if (SettingsProvider.getAppLaunchOut(appInfo.packageName)) { + if (SettingsProvider.getAppLaunchOut(appInfo.packageName) || AbstractPlatform.isVirtualRealityApp(appInfo)) { context.finish(); new Timer().schedule(new TimerTask() { @Override public void run() { context.startActivity(launchIntent); } - }, 650); + }, 615); } else { context.startActivity(launchIntent); } diff --git a/Launcher/App/src/main/java/com/threethan/launcher/ui/AppsAdapter.java b/Launcher/App/src/main/java/com/threethan/launcher/ui/AppsAdapter.java index d233aaf0..27148a0a 100644 --- a/Launcher/App/src/main/java/com/threethan/launcher/ui/AppsAdapter.java +++ b/Launcher/App/src/main/java/com/threethan/launcher/ui/AppsAdapter.java @@ -228,7 +228,6 @@ private void showAppDetails(ApplicationInfo currentApp) throws PackageManager.Na final boolean isVr = AbstractPlatform.isVirtualRealityApp(currentApp); if (isVr) { //VR apps MUST launch out, so just hide the option launchModeBtn.setVisibility(View.GONE); - if (!launchOut[0]) SettingsProvider.setAppLaunchOut(currentApp.packageName, true); //Failsafe } else { launchModeBtn.setVisibility(View.VISIBLE); launchModeBtn.setText(context.getString(launchOut[0] ? R.string.launch_out : R.string.launch_in));