Fixed list not loaded

NOTE: every module directory must have permission 777, and module.prop file 744 (or at least must be only readable for all users)
This commit is contained in:
dvdandroid 2016-08-18 11:27:26 +02:00 committed by topjohnwu
parent 4692ed4b4a
commit bc2c63bf1f

View File

@ -53,19 +53,25 @@ public class ModulesActivity extends Activity {
if (magisk != null) { if (magisk != null) {
for (File mod : magisk) { for (File mod : magisk) {
listModules.add(new Module(mod)); Module m = new Module(mod);
if (m.isValid()) {
listModules.add(m);
}
} }
} }
if (magiskCache != null) { if (magiskCache != null) {
for (File mod : magiskCache) { for (File mod : magiskCache) {
listModules.add(new Module(mod)); Module m = new Module(mod);
if (m.isValid()) {
listModules.add(m);
}
} }
} }
//noinspection Convert2streamapi //noinspection Convert2streamapi
for (Module module : listModules) { for (Module module : listModules) {
if (module.isValid()) try { try {
module.parse(); module.parse();
} catch (Exception ignored) { } catch (Exception ignored) {
} }
@ -75,19 +81,19 @@ public class ModulesActivity extends Activity {
} }
@Override @Override
protected void onPostExecute(Boolean aBoolean) { protected void onPostExecute(Boolean result) {
super.onPostExecute(aBoolean); super.onPostExecute(result);
progress.dismiss(); progress.dismiss();
mListView.setAdapter(new ModulesAdapter(ModulesActivity.this, R.layout.row)); mListView.setAdapter(new ModulesAdapter(ModulesActivity.this, R.layout.row, listModules));
} }
} }
private class ModulesAdapter extends ArrayAdapter<Module> { private class ModulesAdapter extends ArrayAdapter<Module> {
public ModulesAdapter(Context context, int resource) { public ModulesAdapter(Context context, int resource, List<Module> modules) {
super(context, resource); super(context, resource, modules);
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")