Skip to content

Commit

Permalink
[app] refresh nav ui after one key boost delayed
Browse files Browse the repository at this point in the history
  • Loading branch information
Tornaco committed Oct 24, 2021
1 parent 84ebcde commit f527652
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package github.tornaco.android.thanos.main;

import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
Expand Down Expand Up @@ -54,6 +57,14 @@ public class PrebuiltFeatureFragment extends NavFragment
private FragmentPrebuiltFeaturesBinding prebuiltFeaturesBinding;
private NavViewModel navViewModel;

private Handler uiHandler;

@Override
public void onAttach(Context context) {
super.onAttach(context);
this.uiHandler = new Handler(Looper.getMainLooper());
}

@Nullable
@Override
public View onCreateView(
Expand Down Expand Up @@ -98,6 +109,8 @@ public void onClick(@NonNull Tile tile) {
return;
}
navViewModel.cleanUpBackgroundTasks();
// Delay 1.5s to refresh
uiHandler.postDelayed(() -> navViewModel.start(), 1500);
break;
case R.id.id_background_start:
StartRestrictActivity.start(getActivity());
Expand Down

0 comments on commit f527652

Please sign in to comment.