-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #705 from grote/565-choose-files-restore
Allow choosing what files/folders will get restored
- Loading branch information
Showing
41 changed files
with
991 additions
and
53 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
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
45 changes: 45 additions & 0 deletions
45
app/src/main/java/com/stevesoltys/seedvault/restore/FilesSelectionFragment.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,45 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2024 The Calyx Institute | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.stevesoltys.seedvault.restore | ||
|
||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.view.ViewStub | ||
import android.widget.Button | ||
import com.stevesoltys.seedvault.R | ||
import org.calyxos.backup.storage.ui.restore.FileSelectionFragment | ||
import org.calyxos.backup.storage.ui.restore.FilesItem | ||
import org.koin.androidx.viewmodel.ext.android.sharedViewModel | ||
|
||
internal class FilesSelectionFragment : FileSelectionFragment() { | ||
|
||
override val viewModel: RestoreViewModel by sharedViewModel() | ||
private lateinit var button: Button | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle?, | ||
): View { | ||
val v = super.onCreateView(inflater, container, savedInstanceState) | ||
val topStub: ViewStub = v.requireViewById(R.id.topStub) | ||
topStub.layoutResource = R.layout.header_files_selection | ||
topStub.inflate() | ||
val bottomStub: ViewStub = v.requireViewById(R.id.bottomStub) | ||
bottomStub.layoutResource = R.layout.footer_files_selection | ||
button = bottomStub.inflate() as Button | ||
button.setOnClickListener { | ||
viewModel.startFilesRestore() | ||
} | ||
return v | ||
} | ||
|
||
override fun onFileItemsChanged(filesItems: List<FilesItem>) { | ||
slideUpInRootView(button) | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
app/src/main/java/com/stevesoltys/seedvault/restore/RestoreUiModule.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,31 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2020 The Calyx Institute | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.stevesoltys.seedvault.restore | ||
|
||
import com.stevesoltys.seedvault.ui.files.FileSelectionViewModel | ||
import org.calyxos.backup.storage.ui.restore.FileSelectionManager | ||
import org.koin.android.ext.koin.androidApplication | ||
import org.koin.androidx.viewmodel.dsl.viewModel | ||
import org.koin.dsl.module | ||
|
||
val restoreUiModule = module { | ||
single { FileSelectionManager() } | ||
viewModel { | ||
RestoreViewModel( | ||
app = androidApplication(), | ||
settingsManager = get(), | ||
keyManager = get(), | ||
backupManager = get(), | ||
restoreCoordinator = get(), | ||
apkRestore = get(), | ||
iconManager = get(), | ||
storageBackup = get(), | ||
pluginManager = get(), | ||
fileSelectionManager = get(), | ||
) | ||
} | ||
viewModel { FileSelectionViewModel(androidApplication(), get()) } | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
SPDX-FileCopyrightText: 2024 The Calyx Institute | ||
SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/button" | ||
style="@style/SudPrimaryButton" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="bottom|end" | ||
android:layout_marginEnd="16dp" | ||
android:drawableTint="?android:textColorPrimaryInverse" | ||
app:icon="@drawable/ic_cloud_restore" | ||
android:text="@string/select_files_button_restore" | ||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior" /> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?><!-- | ||
SPDX-FileCopyrightText: 2020 The Calyx Institute | ||
SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="@color/background" | ||
android:paddingBottom="16dp"> | ||
|
||
<ImageView | ||
android:id="@+id/imageView" | ||
style="@style/SudHeaderIcon" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:srcCompat="@drawable/ic_cloud_download" | ||
app:tint="?android:colorAccent" | ||
tools:ignore="ContentDescription" /> | ||
|
||
<TextView | ||
android:id="@+id/titleView" | ||
style="@style/SudHeaderTitle" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="@string/select_files_title" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/imageView" /> | ||
|
||
<TextView | ||
android:id="@+id/backupNameView" | ||
style="@style/SudDescription" | ||
android:layout_width="0dp" | ||
android:layout_height="wrap_content" | ||
android:text="@string/restore_storage_selection_description" | ||
android:textColor="?android:textColorSecondary" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.0" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/titleView" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |
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
Oops, something went wrong.