forked from upstream-mirrors/OpenTracks
Import+Export activity: removed "require twice back navigation".
onBackPressed() is not support anymore as of Android gradle plugin 8.11.0
This commit is contained in:
@@ -21,7 +21,6 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -95,8 +94,6 @@ public class ExportActivity extends AppCompatActivity implements ExportService.E
|
||||
private int trackExportSkippedCount;
|
||||
private int trackExportTotalCount;
|
||||
|
||||
boolean doubleBackToCancel = false;
|
||||
|
||||
private ExportActivityBinding viewBinding;
|
||||
|
||||
private ArrayList<String> trackErrors = new ArrayList<>();
|
||||
@@ -214,19 +211,6 @@ public class ExportActivity extends AppCompatActivity implements ExportService.E
|
||||
exportTasks.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (doubleBackToCancel || getTotalDone() == trackExportTotalCount) {
|
||||
super.onBackPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
this.doubleBackToCancel = true;
|
||||
Toast.makeText(this, getString(R.string.generic_click_twice_cancel), Toast.LENGTH_SHORT).show();
|
||||
|
||||
new Handler().postDelayed(() -> doubleBackToCancel = false, 2000);
|
||||
}
|
||||
|
||||
private void createExportTasks(boolean allInOneFile) {
|
||||
List<Track> tracks = contentProviderUtils.getTracks();
|
||||
exportTasks = new ArrayList<>();
|
||||
|
||||
@@ -20,9 +20,7 @@ import android.content.ClipData;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
@@ -56,8 +54,6 @@ public class ImportActivity extends FragmentActivity {
|
||||
|
||||
private ImportActivityBinding viewBinding;
|
||||
|
||||
boolean doubleBackToCancel = false;
|
||||
|
||||
private ArrayList<Uri> documentUris = new ArrayList<>();
|
||||
private boolean isDirectory;
|
||||
|
||||
@@ -122,21 +118,6 @@ public class ImportActivity extends FragmentActivity {
|
||||
outState.putBoolean(BUNDLE_IS_DIRECTORY, isDirectory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (doubleBackToCancel || (summary != null && getTotalDone() == summary.getTotalCount())) {
|
||||
super.onBackPressed();
|
||||
viewModel.cancel();
|
||||
getViewModelStore().clear();
|
||||
return;
|
||||
}
|
||||
|
||||
this.doubleBackToCancel = true;
|
||||
Toast.makeText(this, getString(R.string.generic_click_twice_cancel), Toast.LENGTH_SHORT).show();
|
||||
|
||||
new Handler().postDelayed(() -> doubleBackToCancel=false, 2000);
|
||||
}
|
||||
|
||||
private void initViews() {
|
||||
viewBinding.importProgressDone.setText("0");
|
||||
viewBinding.importProgressTotal.setText("0");
|
||||
|
||||
Reference in New Issue
Block a user