Skip to content
This repository was archived by the owner on Aug 24, 2025. It is now read-only.

Commit 420d538

Browse files
committed
Preferences: Import all/Export all has now transparent background and back button works as desired.
1 parent 36672d6 commit 420d538

5 files changed

Lines changed: 57 additions & 8 deletions

File tree

src/main/AndroidManifest.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ limitations under the License.
8383
android:name=".AggregatedStatsActivity"
8484
android:label="@string/menu_aggregated_statistics" />
8585
<activity android:name=".DeleteActivity" />
86-
<activity android:name=".io.file.importer.ImportActivity">
86+
<activity
87+
android:name=".io.file.importer.ImportActivity"
88+
android:theme="@style/ThemeCustomTransparent">
8789
<intent-filter>
8890
<action android:name="android.intent.action.ATTACH_DATA" />
8991
<action android:name="android.intent.action.VIEW" />
@@ -128,7 +130,9 @@ limitations under the License.
128130
android:name="android.app.default_searchable"
129131
android:value=".SearchListActivity" />
130132
</activity>
131-
<activity android:name=".io.file.exporter.ExportActivity" />
133+
<activity
134+
android:name=".io.file.exporter.ExportActivity"
135+
android:theme="@style/ThemeCustomTransparent" />
132136
<activity android:name=".settings.RecordingSettingsActivity" />
133137
<activity android:name=".settings.SettingsActivity" />
134138
<activity android:name=".settings.StatsSettingsActivity" />

src/main/java/de/dennisguse/opentracks/fragments/FileTypeDialogFragment.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,35 @@ protected Dialog createDialog() {
7070
choices[i] = getString(optionId, trackFileFormat.name(),
7171
FileUtils.getPathDisplayName(trackFileFormat.getExtension()));
7272
}
73-
return new AlertDialog.Builder(getActivity()).setNegativeButton(R.string.generic_cancel, null)
73+
return new AlertDialog.Builder(getActivity())
74+
.setCancelable(true)
75+
.setNegativeButton(R.string.generic_cancel, new OnClickListener() {
76+
@Override
77+
public void onClick(DialogInterface dialog, int which) {
78+
onDismissed();
79+
}
80+
})
7481
.setPositiveButton(R.string.generic_ok, new OnClickListener() {
7582
@Override
7683
public void onClick(DialogInterface dialog, int which) {
7784
int position = ((AlertDialog) dialog).getListView().getCheckedItemPosition();
7885
caller.onFileTypeDone(TrackFileFormat.values()[position]);
7986
}
80-
}).setSingleChoiceItems(choices, 0, null).setTitle(titleId).create();
87+
})
88+
.setSingleChoiceItems(choices, 0, null)
89+
.setTitle(titleId)
90+
.setOnCancelListener(new DialogInterface.OnCancelListener() {
91+
@Override
92+
public void onCancel(DialogInterface dialog) {
93+
onDismissed();
94+
}
95+
})
96+
.create();
97+
}
98+
99+
protected void onDismissed() {
100+
dismiss();
101+
caller.onDismissed();
81102
}
82103

83104
/**
@@ -91,5 +112,7 @@ public interface FileTypeCaller {
91112
* Called when file type selection is done.
92113
*/
93114
void onFileTypeDone(TrackFileFormat trackFileFormat);
115+
116+
void onDismissed();
94117
}
95118
}

src/main/java/de/dennisguse/opentracks/io/file/exporter/ExportActivity.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ public void onFileTypeDone(TrackFileFormat trackFileFormat) {
9292
// }
9393
}
9494

95+
@Override
96+
public void onDismissed() {
97+
finish();
98+
}
99+
95100
@Override
96101
protected Dialog onCreateDialog(int id) {
97102
switch (id) {
@@ -103,6 +108,7 @@ protected Dialog onCreateDialog(int id) {
103108
public void onCancel(DialogInterface dialog) {
104109
saveAsyncTask.cancel(true);
105110
dialog.dismiss();
111+
onDismissed();
106112
}
107113
}, directoryDisplayName);
108114
return progressDialog;
@@ -129,13 +135,13 @@ public void onCancel(DialogInterface dialog) {
129135
@Override
130136
public void onCancel(DialogInterface dialog) {
131137
dialog.dismiss();
132-
finish();
138+
onDismissed();
133139
}
134140
}).setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
135141
@Override
136142
public void onClick(DialogInterface dialog, int arg1) {
137143
dialog.dismiss();
138-
finish();
144+
onDismissed();
139145
}
140146
}).setTitle(titleId);
141147
final Dialog dialog = builder.create();

src/main/java/de/dennisguse/opentracks/io/file/importer/ImportActivity.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ this, getString(R.string.import_no_directory, directoryDisplayName), Toast.LENGT
102102
// }
103103
}
104104

105+
@Override
106+
public void onDismissed() {
107+
finish();
108+
}
109+
105110
@Override
106111
protected Dialog onCreateDialog(int id) {
107112
switch (id) {
@@ -112,6 +117,7 @@ protected Dialog onCreateDialog(int id) {
112117
public void onCancel(DialogInterface dialog) {
113118
importAsyncTask.cancel(true);
114119
dialog.dismiss();
120+
onDismissed();
115121
}
116122
}, directoryDisplayName);
117123
return progressDialog;
@@ -142,13 +148,13 @@ public void onCancel(DialogInterface dialog) {
142148
@Override
143149
public void onCancel(DialogInterface dialogInterface) {
144150
dialogInterface.dismiss();
145-
finish();
151+
onDismissed();
146152
}
147153
}).setPositiveButton(R.string.generic_ok, new DialogInterface.OnClickListener() {
148154
@Override
149155
public void onClick(DialogInterface dialogInterface, int which) {
150156
dialogInterface.dismiss();
151-
finish();
157+
onDismissed();
152158
}
153159
}).setTitle(titleId).create();
154160
dialog.setOnShowListener(new DialogInterface.OnShowListener() {

src/main/res/values/themes_custom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ limitations under the License.
3232
<item name="android:alertDialogTheme">@style/CustomAlertDialogTheme</item>
3333
</style>
3434

35+
<style name="ThemeCustomTransparent" parent="ThemeCustom">
36+
<!-- TODO Remove when moving to settings to fragments. -->
37+
<item name="android:windowIsTranslucent">true</item>
38+
<item name="android:windowBackground">@android:color/transparent</item>
39+
<item name="android:windowContentOverlay">@null</item>
40+
<item name="android:windowNoTitle">true</item>
41+
<item name="android:windowIsFloating">true</item>
42+
<item name="android:backgroundDimEnabled">false</item>
43+
</style>
44+
3545
<style name="CustomAlertDialogTheme" parent="@android:style/Theme.Holo.Dialog">
3646
<!-- From auto generated -->
3747
<item name="android:activatedBackgroundIndicator">@drawable/activated_background_holo_dark

0 commit comments

Comments
 (0)