Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement local storage migration by removing them with a hint #251
- Loading branch information
Showing
8 changed files
with
144 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 24 additions & 5 deletions
29
data/src/main/java/org/cryptomator/data/db/Upgrade9To10.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...rc/main/java/org/cryptomator/presentation/ui/dialog/VaultsRemovedDuringMigrationDialog.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.cryptomator.presentation.ui.dialog | ||
|
||
import android.app.Activity | ||
import android.content.DialogInterface | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AlertDialog | ||
import androidx.fragment.app.DialogFragment | ||
import org.cryptomator.generator.Dialog | ||
import org.cryptomator.presentation.R | ||
import kotlinx.android.synthetic.main.dialog_vaults_removed_during_migration.tv_message | ||
|
||
@Dialog(R.layout.dialog_vaults_removed_during_migration) | ||
class VaultsRemovedDuringMigrationDialog : BaseDialog<Activity>() { | ||
|
||
public override fun setupDialog(builder: AlertDialog.Builder): android.app.Dialog { | ||
val vaultsRemovedDuringMigration = requireArguments().getSerializable(VAULTS_REMOVED_ARG) as Pair<String, ArrayList<String>> | ||
|
||
return builder // | ||
.setTitle(String.format(getString(R.string.dialog_vaults_removed_during_migration_title), vaultsRemovedDuringMigration.first)) // | ||
.setNeutralButton(R.string.dialog_vaults_removed_during_migration_neutral_button) { dialog: DialogInterface, _: Int -> dialog.dismiss() } | ||
.create() | ||
} | ||
|
||
public override fun setupView() { | ||
val vaultsRemovedDuringMigration = requireArguments().getSerializable(VAULTS_REMOVED_ARG) as Pair<String, ArrayList<String>> | ||
|
||
val vaultsRemovedDuringMigrationString = vaultsRemovedDuringMigration | ||
.second | ||
.map { path -> "* $path" } | ||
.reduce { acc, s -> "$acc\n$s" } | ||
|
||
tv_message.text = String.format(getString(R.string.dialog_vaults_removed_during_migration_hint), vaultsRemovedDuringMigrationString) | ||
} | ||
|
||
companion object { | ||
|
||
private const val VAULTS_REMOVED_ARG = "vaultsRemovedArg" | ||
|
||
fun newInstance(vaultsRemovedDuringMigration: Pair<String, List<String>>): DialogFragment { | ||
val args = Bundle() | ||
args.putSerializable(VAULTS_REMOVED_ARG, vaultsRemovedDuringMigration) | ||
val fragment = VaultsRemovedDuringMigrationDialog() | ||
fragment.arguments = args | ||
return fragment | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
presentation/src/main/res/layout/dialog_vaults_removed_during_migration.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<RelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:padding="@dimen/activity_vertical_margin"> | ||
|
||
<TextView | ||
android:id="@+id/tv_message" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_marginBottom="5dp" | ||
android:text="@string/dialog_vaults_removed_during_migration_hint" /> | ||
|
||
</RelativeLayout> | ||
</androidx.core.widget.NestedScrollView> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters