Skip to content

Commit

Permalink
hotfix: default group PSP not created on first launch
Browse files Browse the repository at this point in the history
  • Loading branch information
Veticia committed Apr 23, 2023
1 parent 5c22d47 commit b119ca1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Latest version: [piLauncherNext_101.apk](https://github.com/Veticia/binaries/raw/main/releases/piLauncherNext_101.apk)
# Latest version: [piLauncherNext_102.apk](https://github.com/Veticia/binaries/raw/main/releases/piLauncherNext_102.apk)

## Changelog
### 1.0.2
- hotfix: default group PSP not created on first launch

### 1.0.1
- hotfix: nullPointerException crash on first run

Expand Down
4 changes: 2 additions & 2 deletions Launcher/App/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ android {
minSdkVersion 23
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 23
versionCode 101
versionName "1.0.1"
versionCode 102
versionName "1.0.2"
signingConfig signingConfigs.release
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ public static synchronized SettingsProvider getInstance (Context context)
}
return SettingsProvider.instance;
}
private boolean isPSPSupported = false;

//storage
private final SharedPreferences mPreferences;
private Map<String, String> mAppList = new HashMap<>();
private Set<String> mAppGroups = new HashSet<>();
private Set<String> mSelectedGroups = new HashSet<>();
private Map<String, Long> mRecents = new HashMap<>();
Set<String> def = new HashSet<>();

private SettingsProvider(Context context) {
mPreferences = PreferenceManager.getDefaultSharedPreferences(context);
Expand Down Expand Up @@ -102,9 +102,6 @@ public ArrayList<ApplicationInfo> getInstalledApps(Context context, List<String>
if (isPlatformEnabled(KEY_PLATFORM_VR)) {
List<ApplicationInfo> vrApps = new VRPlatform().getInstalledApps(context);
for (ApplicationInfo app : vrApps) {
if (app.packageName.startsWith(MainActivity.EMULATOR_PACKAGE)) {
isPSPSupported = true;
}
if (!mAppList.containsKey(app.packageName) && mAppGroups.contains(context.getString(R.string.default_apps_group))) {
mAppList.put(app.packageName, context.getString(R.string.default_apps_group));
}
Expand All @@ -123,18 +120,14 @@ public ArrayList<ApplicationInfo> getInstalledApps(Context context, List<String>
}

if (isPlatformEnabled(KEY_PLATFORM_PSP)) {
if(isPSPSupported) {
// only add PSP apps if the platform is supported
List<ApplicationInfo> pspApps = new PSPPlatform().getInstalledApps(context);
for (ApplicationInfo app : pspApps) {
if (!mAppList.containsKey(app.packageName) && mAppGroups.contains("PSP")) {
mAppList.put(app.packageName, "PSP");
}
// only add PSP apps if the platform is supported
List<ApplicationInfo> pspApps = new PSPPlatform().getInstalledApps(context);
for (ApplicationInfo app : pspApps) {
if (!mAppList.containsKey(app.packageName) && mAppGroups.contains("PSP")) {
mAppList.put(app.packageName, "PSP");
}
installedApplications.addAll(pspApps);
}
}else{
isPSPSupported = false;
installedApplications.addAll(pspApps);
}

// Save changes to app list
Expand Down Expand Up @@ -259,14 +252,22 @@ private synchronized void readValues()
{
try
{
Set<String> def = new HashSet<>();
def.add(context.getString(R.string.default_apps_group));
String defAppsGroup = context.getString(R.string.default_apps_group);
if (!def.contains(defAppsGroup)) {
def.add(defAppsGroup);
}
Set<String> defClone = new HashSet<>();
defClone.add(context.getString(R.string.default_apps_group));
defClone.add(defAppsGroup);
mSelectedGroups = mPreferences.getStringSet(KEY_SELECTED_GROUPS, defClone);
def.add(context.getString(R.string.default_tools_group));
if (isPSPSupported) {
def.add("PSP");
String defToolsGroup = context.getString(R.string.default_tools_group);
if (!def.contains(defToolsGroup)) {
def.add(defToolsGroup);
}
String defPSPgroup = "PSP";
if (!def.contains(defPSPgroup)) {
if (new PSPPlatform().isSupported(context)) {
def.add(defPSPgroup);
}
}
mAppGroups = mPreferences.getStringSet(KEY_APP_GROUPS, def);

Expand Down

0 comments on commit b119ca1

Please sign in to comment.