Skip to content

Commit

Permalink
Improve stability Compare and check tasks (hopefully)
Browse files Browse the repository at this point in the history
Moved some task in background
  • Loading branch information
Kaiserdragon2 committed May 23, 2023
1 parent 09c61b6 commit d931c76
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions app/src/main/java/de/kaiserdragon/iconrequest/RequestActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,37 +208,42 @@ public void onCreate(Bundle savedInstanceState) {
}

public void IPackSelect(String packageName) {

switcherLoad.showNext();
ExecutorService executors = Executors.newSingleThreadExecutor();
executors.execute(() -> {
Looper.prepare();
ExecutorService executor = Executors.newCachedThreadPool();
executor.execute(() -> {
try {
parseXML(packageName);
if (DEBUG) Log.v(TAG, packageName);
//appListFilter = prepareData();
if (mode < 2 || mode > 5) adapter = new AppAdapter(prepareData(false));

if (mode < 2 || mode > 5) {
adapter = new AppAdapter(prepareData(false));
}
if (mode > 1 && (mode != 2 && mode != 3 || firstrun) ) {
adapter = new AppAdapter(compare());
recyclerView.setAdapter(adapter);
}
} catch (Exception e) {
e.printStackTrace();
}

new Handler(Looper.getMainLooper()).post(() -> {
runOnUiThread(() -> {
if (mode != 2 && mode != 3 || firstrun) {
if (DEBUG) Log.v(TAG,"Wahh");
if (!(mode <=1))adapter = new AppAdapter(compare());
if (DEBUG) Log.v(TAG, "Wahh");

findViewById(R.id.text_ipack_chooser).setVisibility(View.GONE);
IPackChoosen = true;
invalidateOptionsMenu();
}
firstrun = true;
recyclerView.setAdapter(adapter);
switcherLoad.showNext();

switcherLoad.showNext();
});
});
}




public boolean onCreateOptionsMenu(Menu menu) {
if ((OnlyNew || (mode >= 2 && mode <= 5)) && !IPackChoosen) {
getMenuInflater().inflate(R.menu.menu_iconpack_chooser, menu);
Expand Down

0 comments on commit d931c76

Please sign in to comment.