Skip to content

Commit

Permalink
Update CandyBarSplashActivity.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Donnnno committed Jan 2, 2025
1 parent 9f2bee7 commit 35a3d69
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.os.Bundle;
import android.util.Log;

import androidx.activity.OnBackPressedCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
Expand Down Expand Up @@ -61,15 +62,17 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
.executeOnThreadPool();

mWallpaperThumbPreloader = new WallpaperThumbPreloader(this).execute();
}

@Override
public void onBackPressed() {
if (mWallpaperThumbPreloader != null) {
mWallpaperThumbPreloader.cancel(true);
}
Database.get(this.getApplicationContext()).closeDatabase();
super.onBackPressed();
getOnBackPressedDispatcher().addCallback(this, new OnBackPressedCallback(true) {
@Override
public void handleOnBackPressed() {
if (mWallpaperThumbPreloader != null) {
mWallpaperThumbPreloader.cancel(true);
}
Database.get(getApplicationContext()).closeDatabase();
finish();
}
});
}

@Override
Expand Down

0 comments on commit 35a3d69

Please sign in to comment.