Skip to content

Commit

Permalink
hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
threethan committed Jul 29, 2023
1 parent cd9a00f commit 63450db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class SettingsProvider {
private Set<String> appGroupsSet = new HashSet<>();
private Set<String> selectedGroupsSet = new HashSet<>();
private static Set<String> appsToLaunchOut = new HashSet<>();
private Set<String> appsToLaunchOutNS = new HashSet<>();

private SettingsProvider(Context context) {
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
Expand Down Expand Up @@ -100,7 +101,6 @@ public ArrayList<ApplicationInfo> getInstalledApps(Context context, List<String>
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);
}
}
}
Expand Down Expand Up @@ -166,6 +166,7 @@ public ArrayList<ApplicationInfo> getInstalledApps(Context context, List<String>

return sortedApps;
}

public boolean hasMetadata(ApplicationInfo app, String metadata) {
if (app.metaData != null) {
return app.metaData.keySet().contains(metadata);
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 63450db

Please sign in to comment.