-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae9c813
commit c2aa90a
Showing
26 changed files
with
273 additions
and
229 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
15 changes: 10 additions & 5 deletions
15
app/src/main/java/com/aliernfrog/pftool/data/PermissionData.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 |
---|---|---|
@@ -1,17 +1,22 @@ | ||
package com.aliernfrog.pftool.data | ||
|
||
import android.net.Uri | ||
import android.os.Environment | ||
import androidx.annotation.StringRes | ||
import androidx.compose.runtime.Composable | ||
import com.aliernfrog.pftool.util.manager.base.BasePreferenceManager | ||
|
||
data class PermissionData( | ||
@StringRes val title: Int, | ||
val recommendedPath: String?, | ||
val pref: BasePreferenceManager.Preference<String>, | ||
val recommendedPath: String? = pref.defaultValue, | ||
@StringRes val recommendedPathDescription: Int?, | ||
@StringRes val recommendedPathWarning: Int? = null, | ||
@StringRes val useUnrecommendedAnywayDescription: Int? = null, | ||
val forceRecommendedPath: Boolean = true, | ||
val getUri: () -> String, | ||
val onUriUpdate: (Uri) -> Unit, | ||
val content: @Composable () -> Unit | ||
) | ||
) | ||
|
||
val PermissionData.requiresAndroidData: Boolean | ||
get() = forceRecommendedPath && recommendedPath?.startsWith( | ||
"${Environment.getExternalStorageDirectory()}/Android/data" | ||
) == true |
11 changes: 5 additions & 6 deletions
11
app/src/main/java/com/aliernfrog/pftool/data/PrefEditItem.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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
package com.aliernfrog.pftool.data | ||
|
||
import com.aliernfrog.pftool.util.manager.PreferenceManager | ||
import com.aliernfrog.pftool.util.manager.base.BasePreferenceManager | ||
|
||
data class PrefEditItem( | ||
val labelResourceId: Int, | ||
val getValue: (prefs: PreferenceManager) -> String, | ||
val setValue: (newValue: String, prefs: PreferenceManager) -> Unit, | ||
val default: String = "" | ||
) | ||
data class PrefEditItem<T>( | ||
val preference: (PreferenceManager) -> BasePreferenceManager.Preference<T>, | ||
val label: (PreferenceManager) -> Any = { preference(it).key } | ||
) |
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
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
Oops, something went wrong.