Export All: ask to the user when conflicts (track already exported in the selected directory) and show a summary. Fixes #451.

This commit is contained in:
Román
2020-10-17 11:37:57 +02:00
committed by Román Martínez
parent 5a60f40308
commit 70c1379778
11 changed files with 730 additions and 343 deletions
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M1,21h22L12,2 1,21zM13,18h-2v-2h2v2zM13,14h-2v-4h2v4z"/>
</vector>
@@ -0,0 +1,151 @@
<?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"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">
<include layout="@layout/toolbar" />
<androidx.core.widget.NestedScrollView
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/export_progress_done"
style="@style/TextMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="48dp"
app:layout_constraintEnd_toStartOf="@id/export_progress_slash"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="1" />
<TextView
android:id="@+id/export_progress_slash"
style="@style/TextMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/generic_separator_done_total"
app:layout_constraintBottom_toBottomOf="@id/export_progress_done"
app:layout_constraintEnd_toStartOf="@id/export_progress_total"
app:layout_constraintStart_toEndOf="@id/export_progress_done"
app:layout_constraintTop_toTopOf="@id/export_progress_done" />
<TextView
android:id="@+id/export_progress_total"
style="@style/TextMedium"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
app:layout_constraintBottom_toBottomOf="@id/export_progress_slash"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/export_progress_slash"
app:layout_constraintTop_toTopOf="@id/export_progress_slash"
tools:text="10" />
<ProgressBar
android:id="@+id/export_progress_bar"
style="@style/ProgressBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginTop="8dp"
android:layout_marginRight="24dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/export_progress_done"
tools:progress="25" />
<TextView
android:id="@+id/export_progress_summary"
style="@style/TextMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="24dp"
android:text="@string/export_progress_review"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/export_progress_bar" />
<ImageView
android:id="@+id/export_progress_alert_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="8dp"
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintBottom_toBottomOf="@id/export_progress_alert_msg"
app:layout_constraintEnd_toStartOf="@id/export_progress_alert_msg"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/export_progress_alert_msg"
app:srcCompat="@drawable/ic_report_problem_24" />
<TextView
android:id="@+id/export_progress_alert_msg"
style="@style/TextMedium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginEnd="24dp"
android:layout_marginBottom="24dp"
app:layout_constraintBottom_toTopOf="@id/export_progress_toggle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/export_progress_alert_icon"
app:layout_constraintTop_toBottomOf="@id/export_progress_summary"
app:layout_constraintVertical_chainStyle="packed"
tools:text="The track already exists" />
<CheckBox
android:id="@+id/export_progress_toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="24dp"
android:layout_marginRight="24dp"
android:layout_marginBottom="24dp"
android:checked="false"
android:text="@string/export_all_do_it_for_all"
android:visibility="gone"
tools:visibility="visible"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/export_progress_alert_msg" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
<View style="@style/BottomButtonDivider" />
<LinearLayout style="@style/BottomButtonBar">
<Button
android:id="@+id/export_progress_left_button"
style="@style/BottomButton"
android:layout_gravity="center"
android:text="@string/generic_skip"
android:visibility="gone"
tools:visibility="visible" />
<Button
android:id="@+id/export_progress_right_button"
style="@style/BottomButton"
android:layout_gravity="right"
android:text="@string/generic_overwrite"
android:visibility="gone"
tools:visibility="visible"/>
</LinearLayout>
</LinearLayout>
+20
View File
@@ -216,6 +216,23 @@ limitations under the License.
<string name="export_progress_message">Exporting to %1$s&#8230;</string>
<string name="export_success">Exported %1$s to %2$s</string>
<string name="export_title">Export to&#8230;</string>
<string name="export_track_already_exists_msg">The track %1$s already exists at the destination directory.</string>
<plurals name="export_all_end_with_errors">
<item quantity="one">Completed with one error</item>
<item quantity="other">Completed with %1$d errors</item>
</plurals>
<string name="export_all_end">Completed</string>
<string name="export_all_do_it_for_all">do it for all conflicts</string>
<string name="export_click_twice_cancel">Click back again to cancel</string>
<string name="export_show_errors">Show Errors</string>
<string name="export_track_errors">Tracks not exported</string>
<string name="export_progress_review">
Total exported tracks: %1$d\n
- New tracks exported: %2$d\n
- Tracks overwritten: %3$d\n
- Tracks skipped: %4$d\n
- Errors: %5$d
</string>
<!-- External Storage -->
<!-- Files -->
<string name="files_few">%1$d files</string>
@@ -243,6 +260,9 @@ limitations under the License.
<string name="generic_success_title">Success</string>
<string name="generic_tracks">Tracks</string>
<string name="generic_yes">Yes</string>
<string name="generic_overwrite">Overwrite</string>
<string name="generic_skip">Skip</string>
<string name="generic_separator_done_total">/</string>
<!-- Gps -->
<string name="gps_location_access">&#8216;Location access&#8217;</string>
<string name="gps_disabled">GPS not enabled. Tap here to go to %1$s. Press the back button to return.</string>
+2
View File
@@ -224,4 +224,6 @@ limitations under the License.
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">wrap_content</item>
</style>
<style name="ProgressBar" parent="@style/Widget.AppCompat.ProgressBar.Horizontal" />
</resources>