forked from upstream-mirrors/OpenTracks
@@ -38,7 +38,7 @@ limitations under the License.
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".TrackDeleteActivity"
|
android:name=".TrackDeleteActivity"
|
||||||
android:theme="@style/ThemeCustomTransparent" />
|
android:theme="@style/TrackDeleteActivity" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".HelpActivity"
|
android:name=".HelpActivity"
|
||||||
@@ -46,7 +46,7 @@ limitations under the License.
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".io.file.importer.ImportActivity"
|
android:name=".io.file.importer.ImportActivity"
|
||||||
android:theme="@style/ThemeCustomTransparent">
|
android:theme="@style/ThemeCustomTransparentActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.ATTACH_DATA" />
|
<action android:name="android.intent.action.ATTACH_DATA" />
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
@@ -105,7 +105,7 @@ limitations under the License.
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".io.file.exporter.ExportActivity"
|
android:name=".io.file.exporter.ExportActivity"
|
||||||
android:theme="@style/ThemeCustomTransparent" />
|
android:theme="@style/ThemeCustomTransparentActivity" />
|
||||||
|
|
||||||
<activity android:name=".settings.SettingsActivity" />
|
<activity android:name=".settings.SettingsActivity" />
|
||||||
|
|
||||||
|
|||||||
@@ -60,13 +60,6 @@ class DeleteAsyncTask extends AsyncTask<Void, Integer, Boolean> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onPreExecute() {
|
|
||||||
if (deleteActivity != null) {
|
|
||||||
deleteActivity.showProgressDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(Void... params) {
|
protected Boolean doInBackground(Void... params) {
|
||||||
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context);
|
ContentProviderUtils contentProviderUtils = new ContentProviderUtils(context);
|
||||||
|
|||||||
@@ -17,15 +17,11 @@
|
|||||||
package de.dennisguse.opentracks;
|
package de.dennisguse.opentracks;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
import de.dennisguse.opentracks.util.DialogUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An activity for delete tracks.
|
* An activity for deleting tracks.
|
||||||
*
|
*
|
||||||
* @author Jimmy Shih
|
* @author Jimmy Shih
|
||||||
*/
|
*/
|
||||||
@@ -33,14 +29,14 @@ public class TrackDeleteActivity extends Activity {
|
|||||||
|
|
||||||
public static final String EXTRA_TRACK_IDS = "track_ids";
|
public static final String EXTRA_TRACK_IDS = "track_ids";
|
||||||
|
|
||||||
private static final int DIALOG_PROGRESS_ID = 0;
|
|
||||||
|
|
||||||
private DeleteAsyncTask deleteAsyncTask;
|
private DeleteAsyncTask deleteAsyncTask;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
setContentView(R.layout.track_delete);
|
||||||
|
|
||||||
setResult(RESULT_CANCELED);
|
setResult(RESULT_CANCELED);
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
@@ -56,41 +52,20 @@ public class TrackDeleteActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onStop() {
|
||||||
|
super.onStop();
|
||||||
|
deleteAsyncTask.cancel(true);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object onRetainNonConfigurationInstance() {
|
public Object onRetainNonConfigurationInstance() {
|
||||||
deleteAsyncTask.setActivity(null);
|
deleteAsyncTask.setActivity(null);
|
||||||
return deleteAsyncTask;
|
return deleteAsyncTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Dialog onCreateDialog(int id) {
|
|
||||||
if (id != DIALOG_PROGRESS_ID) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return DialogUtils.createSpinnerProgressDialog(
|
|
||||||
this, R.string.track_delete_progress_message, new DialogInterface.OnCancelListener() {
|
|
||||||
@Override
|
|
||||||
public void onCancel(DialogInterface dialog) {
|
|
||||||
deleteAsyncTask.cancel(true);
|
|
||||||
dialog.dismiss();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invokes when the associated AsyncTask completes.
|
|
||||||
*/
|
|
||||||
public void onAsyncTaskCompleted() {
|
public void onAsyncTaskCompleted() {
|
||||||
removeDialog(DIALOG_PROGRESS_ID);
|
|
||||||
setResult(RESULT_OK);
|
setResult(RESULT_OK);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows the progress dialog.
|
|
||||||
*/
|
|
||||||
public void showProgressDialog() {
|
|
||||||
showDialog(DIALOG_PROGRESS_ID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,17 +52,6 @@ public class DialogUtils {
|
|||||||
.setTitle(titleId).create();
|
.setTitle(titleId).create();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a spinner progress dialog.
|
|
||||||
*
|
|
||||||
* @param context the context
|
|
||||||
* @param messageId the progress message id
|
|
||||||
* @param onCancelListener the cancel listener
|
|
||||||
*/
|
|
||||||
public static ProgressDialog createSpinnerProgressDialog(Context context, int messageId, DialogInterface.OnCancelListener onCancelListener) {
|
|
||||||
return createProgressDialog(true, context, messageId, onCancelListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a horizontal progress dialog.
|
* Creates a horizontal progress dialog.
|
||||||
*
|
*
|
||||||
@@ -72,27 +61,26 @@ public class DialogUtils {
|
|||||||
* @param formatArgs the format arguments for the messageId
|
* @param formatArgs the format arguments for the messageId
|
||||||
*/
|
*/
|
||||||
public static ProgressDialog createHorizontalProgressDialog(Context context, int messageId, DialogInterface.OnCancelListener onCancelListener, Object... formatArgs) {
|
public static ProgressDialog createHorizontalProgressDialog(Context context, int messageId, DialogInterface.OnCancelListener onCancelListener, Object... formatArgs) {
|
||||||
return createProgressDialog(false, context, messageId, onCancelListener, formatArgs);
|
return createProgressDialog(context, messageId, onCancelListener, formatArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a progress dialog.
|
* Creates a progress dialog.
|
||||||
*
|
*
|
||||||
* @param spinner true to use the spinner style
|
|
||||||
* @param context the context
|
* @param context the context
|
||||||
* @param messageId the progress message id
|
* @param messageId the progress message id
|
||||||
* @param onCancelListener the cancel listener
|
* @param onCancelListener the cancel listener
|
||||||
* @param formatArgs the format arguments for the message id
|
* @param formatArgs the format arguments for the message id
|
||||||
*/
|
*/
|
||||||
private static ProgressDialog createProgressDialog(boolean spinner, final Context context, int messageId, DialogInterface.OnCancelListener onCancelListener, Object... formatArgs) {
|
private static ProgressDialog createProgressDialog(final Context context, int messageId, DialogInterface.OnCancelListener onCancelListener, Object... formatArgs) {
|
||||||
final ProgressDialog progressDialog = new ProgressDialog(context, R.style.ThemeCustomNotTransparent);
|
final ProgressDialog progressDialog = new ProgressDialog(context, R.style.ThemeCustomNotTransparentDialog);
|
||||||
progressDialog.setCancelable(true);
|
progressDialog.setCancelable(true);
|
||||||
progressDialog.setCanceledOnTouchOutside(false);
|
progressDialog.setCanceledOnTouchOutside(false);
|
||||||
progressDialog.setIcon(R.drawable.ic_dialog_info_24dp);
|
progressDialog.setIcon(R.drawable.ic_dialog_info_24dp);
|
||||||
progressDialog.setIndeterminate(true);
|
progressDialog.setIndeterminate(true);
|
||||||
progressDialog.setMessage(context.getString(messageId, formatArgs));
|
progressDialog.setMessage(context.getString(messageId, formatArgs));
|
||||||
progressDialog.setOnCancelListener(onCancelListener);
|
progressDialog.setOnCancelListener(onCancelListener);
|
||||||
progressDialog.setProgressStyle(spinner ? ProgressDialog.STYLE_SPINNER : ProgressDialog.STYLE_HORIZONTAL);
|
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
|
||||||
progressDialog.setTitle(R.string.generic_progress_title);
|
progressDialog.setTitle(R.string.generic_progress_title);
|
||||||
return progressDialog;
|
return progressDialog;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:minHeight="100dp"
|
||||||
|
android:minWidth="100dp" />
|
||||||
|
</LinearLayout>
|
||||||
@@ -36,7 +36,7 @@ limitations under the License.
|
|||||||
<item name="windowActionModeOverlay">true</item>
|
<item name="windowActionModeOverlay">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ThemeCustomNotTransparent" parent="ThemeCustom">
|
<style name="ThemeCustomNotTransparentDialog" parent="ThemeCustom">
|
||||||
<!-- TODO Remove when moving to settings to fragments. -->
|
<!-- TODO Remove when moving to settings to fragments. -->
|
||||||
<item name="android:windowContentOverlay">@null</item>
|
<item name="android:windowContentOverlay">@null</item>
|
||||||
<item name="android:windowNoTitle">true</item>
|
<item name="android:windowNoTitle">true</item>
|
||||||
@@ -44,7 +44,7 @@ limitations under the License.
|
|||||||
<item name="android:backgroundDimEnabled">true</item>
|
<item name="android:backgroundDimEnabled">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ThemeCustomTransparent" parent="ThemeCustom">
|
<style name="ThemeCustomTransparentActivity" parent="ThemeCustom">
|
||||||
<!-- TODO Remove when moving to settings to fragments. -->
|
<!-- TODO Remove when moving to settings to fragments. -->
|
||||||
<item name="android:windowIsTranslucent">true</item>
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
<item name="android:windowBackground">@android:color/transparent</item>
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
@@ -53,4 +53,11 @@ limitations under the License.
|
|||||||
<item name="android:windowIsFloating">true</item>
|
<item name="android:windowIsFloating">true</item>
|
||||||
<item name="android:backgroundDimEnabled">false</item>
|
<item name="android:backgroundDimEnabled">false</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="TrackDeleteActivity" parent="ThemeCustom">
|
||||||
|
<!-- TODO Remove when moving to TrackDeleteActivity to fragments. -->
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowIsFloating">true</item>
|
||||||
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user