diff --git a/.idea/copyright/AGPL.xml b/.idea/copyright/AGPL.xml
new file mode 100644
index 0000000..c031c2c
--- /dev/null
+++ b/.idea/copyright/AGPL.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
index 0228ed2..6c9dbcf 100644
--- a/.idea/copyright/profiles_settings.xml
+++ b/.idea/copyright/profiles_settings.xml
@@ -1,7 +1,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index c224ad5..bb44937 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/Gemfile.lock b/Gemfile.lock
index ba16dbb..8258900 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -10,16 +10,16 @@ GEM
artifactory (3.0.17)
atomos (0.1.3)
aws-eventstream (1.3.0)
- aws-partitions (1.995.0)
- aws-sdk-core (3.211.0)
+ aws-partitions (1.1014.0)
+ aws-sdk-core (3.214.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
jmespath (~> 1, >= 1.6.1)
- aws-sdk-kms (1.95.0)
+ aws-sdk-kms (1.96.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
- aws-sdk-s3 (1.169.0)
+ aws-sdk-s3 (1.174.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
@@ -154,17 +154,17 @@ GEM
domain_name (~> 0.5)
httpclient (2.8.3)
jmespath (1.6.2)
- json (2.7.4)
+ json (2.8.2)
jwt (2.9.3)
base64
mini_magick (4.13.2)
mini_mime (1.1.5)
multi_json (1.15.0)
multipart-post (2.4.1)
- nanaimo (0.3.0)
+ nanaimo (0.4.0)
naturally (2.2.1)
nkf (0.2.0)
- optparse (0.5.0)
+ optparse (0.6.0)
os (1.1.4)
plist (3.7.1)
public_suffix (6.0.1)
@@ -199,12 +199,12 @@ GEM
uber (0.1.0)
unicode-display_width (2.6.0)
word_wrap (1.0.0)
- xcodeproj (1.25.1)
+ xcodeproj (1.27.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
- nanaimo (~> 0.3.0)
+ nanaimo (~> 0.4.0)
rexml (>= 3.3.6, < 4.0)
xcpretty (0.3.0)
rouge (~> 2.0.7)
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index d84fe4b..e7ff67d 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -25,8 +25,8 @@ android {
minSdk = 26
//noinspection OldTargetApi
targetSdk = 34
- versionCode = 25
- versionName = "1.4.0"
+ versionCode = 26
+ versionName = "1.4.1"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt
index ab80d3d..c6847a6 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/DetailsActivity.kt
@@ -31,28 +31,31 @@ import androidx.activity.enableEdgeToEdge
import androidx.activity.result.ActivityResultLauncher
import androidx.compose.material3.windowsizeclass.ExperimentalMaterial3WindowSizeClassApi
import androidx.compose.material3.windowsizeclass.calculateWindowSizeClass
+import androidx.compose.runtime.LaunchedEffect
+import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceManager
import com.mateusrodcosta.apps.share2storage.model.UriData
import com.mateusrodcosta.apps.share2storage.screens.DetailsScreen
+import com.mateusrodcosta.apps.share2storage.screens.DetailsScreenSkipped
import com.mateusrodcosta.apps.share2storage.utils.CreateDocumentWithInitialUri
import com.mateusrodcosta.apps.share2storage.utils.SharedPreferenceKeys
+import com.mateusrodcosta.apps.share2storage.utils.SharedPreferencesDefaultValues
import com.mateusrodcosta.apps.share2storage.utils.getUriData
import com.mateusrodcosta.apps.share2storage.utils.saveFile
import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
-import kotlin.time.DurationUnit
-import kotlin.time.toDuration
class DetailsActivity : ComponentActivity() {
private lateinit var createFile: ActivityResultLauncher
- private var uriData: UriData? = null
+ private lateinit var fileUri: Uri
+ private lateinit var uriData: UriData
- private var skipFileDetails: Boolean = false
private var defaultSaveLocation: Uri? = null
- private var showFilePreview: Boolean = true
+ private var shouldSkipFilePicker: Boolean = false
+ private var skipFileDetails: Boolean = false
+ private var shouldShowFilePreview: Boolean = true
@OptIn(ExperimentalMaterial3WindowSizeClassApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
@@ -62,63 +65,95 @@ class DetailsActivity : ComponentActivity() {
getPreferences()
handleIntent(intent)
val launchFilePicker = {
- createFile.launch(uriData?.displayName ?: "")
+ if (shouldSkipFilePicker) {
+ lifecycleScope.launch {
+ val dir = DocumentFile.fromTreeUri(applicationContext, defaultSaveLocation!!)
+ val file = dir!!.createFile(uriData.type, uriData.displayName)
+
+ if (file?.uri != null) handleFileSave(file.uri, fileUri)
+ }
+ } else {
+ createFile.launch(uriData.displayName)
+ }
+ Unit
}
setContent {
val windowSizeClass = calculateWindowSizeClass(this)
- DetailsScreen(
- uriData = uriData,
- windowSizeClass = windowSizeClass,
- launchFilePicker = launchFilePicker,
- )
+ if (skipFileDetails) {
+ LaunchedEffect(key1 = Unit) {
+ launchFilePicker()
+ }
+ DetailsScreenSkipped()
+ } else {
+ DetailsScreen(
+ uriData = uriData,
+ windowSizeClass = windowSizeClass,
+ launchFilePicker = launchFilePicker,
+ )
+ }
}
-
- if (skipFileDetails) launchFilePicker()
}
private fun getPreferences() {
val sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this)
- skipFileDetails =
- sharedPreferences.getBoolean(SharedPreferenceKeys.SKIP_FILE_DETAILS_KEY, false)
- Log.d("details] skipFileDetails", skipFileDetails.toString())
-
val defaultSaveLocationRaw =
sharedPreferences.getString(SharedPreferenceKeys.DEFAULT_SAVE_LOCATION_KEY, null)
Log.d("details] defaultSaveLocationRaw", defaultSaveLocationRaw.toString())
- defaultSaveLocation = if (defaultSaveLocationRaw != null) Uri.parse(defaultSaveLocationRaw)
- else null
+ val defaultSaveLocation =
+ if (defaultSaveLocationRaw != null) Uri.parse(defaultSaveLocationRaw)
+ else null
Log.d("details] defaultSaveLocation", defaultSaveLocation.toString())
+ this.defaultSaveLocation = defaultSaveLocation
+
+ val skipFilePicker = sharedPreferences.getBoolean(
+ SharedPreferenceKeys.SKIP_FILE_PICKER_KEY,
+ SharedPreferencesDefaultValues.SKIP_FILE_PICKER_DEFAULT
+ )
+ Log.d("details] skipFilePicker", skipFilePicker.toString())
+ // Only skip file picker if both a default folder is set and "Skip File Picker is selected"
+ this.shouldSkipFilePicker = defaultSaveLocation != null && skipFilePicker
- showFilePreview =
- sharedPreferences.getBoolean(SharedPreferenceKeys.SHOW_FILE_PREVIEW_KEY, true)
+
+ val skipFileDetails = sharedPreferences.getBoolean(
+ SharedPreferenceKeys.SKIP_FILE_DETAILS_KEY,
+ SharedPreferencesDefaultValues.SKIP_FILE_DETAILS_DEFAULT
+ )
+ Log.d("details] skipFileDetails", skipFileDetails.toString())
+ this.skipFileDetails = skipFileDetails
+
+ val showFilePreview = sharedPreferences.getBoolean(
+ SharedPreferenceKeys.SHOW_FILE_PREVIEW_KEY,
+ SharedPreferencesDefaultValues.SHOW_FILE_PREVIEW_DEFAULT
+ )
Log.d("details] showFilePreview", showFilePreview.toString())
+ this.shouldShowFilePreview = !skipFileDetails && showFilePreview
}
private fun handleIntent(intent: Intent?) {
- var fileUri: Uri? = null
- if (intent?.action == Intent.ACTION_SEND) {
- fileUri =
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) intent.getParcelableExtra(
- Intent.EXTRA_STREAM, Uri::class.java
- )
- else @Suppress("DEPRECATION") intent.getParcelableExtra(Intent.EXTRA_STREAM)
- Log.d("fileUri ACTION_SEND", fileUri.toString())
- }
- // ACTION_VIEW intents interceptor
- if (intent?.action == Intent.ACTION_VIEW) {
- fileUri = intent.data
- Log.d("fileUri ACTION_VIEW", fileUri.toString())
- }
-
- if (fileUri != null) uriData =
- getUriData(contentResolver, fileUri, getPreview = showFilePreview)
- if (uriData != null) {
- createFile = registerForActivityResult(
- CreateDocumentWithInitialUri(uriData?.type ?: "*/*", defaultSaveLocation)
- ) { uri ->
+ val fileUri: Uri? = if (intent?.action == Intent.ACTION_SEND) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) intent.getParcelableExtra(
+ Intent.EXTRA_STREAM, Uri::class.java
+ )
+ else @Suppress("DEPRECATION") intent.getParcelableExtra(Intent.EXTRA_STREAM)
+ } else if (intent?.action == Intent.ACTION_VIEW) intent.data
+ else null
+ Log.d("fileUri", "Action: ${intent?.action}, uri: $fileUri")
+
+ if (fileUri == null) return
+ this.fileUri = fileUri
+ val uriData = getUriData(contentResolver, fileUri, getPreview = shouldShowFilePreview)
+ if (uriData == null) return
+ this.uriData = uriData
+
+ createFile = registerForActivityResult(
+ CreateDocumentWithInitialUri(uriData.type, defaultSaveLocation)
+ ) { uri ->
+ if (uri == null) {
+ if (skipFileDetails) finish()
+ } else {
lifecycleScope.launch {
handleFileSave(uri, fileUri)
}
@@ -126,8 +161,7 @@ class DetailsActivity : ComponentActivity() {
}
}
- private suspend fun handleFileSave(uri: Uri?, fileUri: Uri?) {
- if (uri == null || fileUri == null) return
+ private suspend fun handleFileSave(uri: Uri, fileUri: Uri) {
return withContext(Dispatchers.IO) {
val isSuccess = saveFile(baseContext, uri, fileUri)
@@ -141,11 +175,9 @@ class DetailsActivity : ComponentActivity() {
).show()
}
- if (skipFileDetails) {
- delay(1.toDuration(DurationUnit.SECONDS))
+ if (skipFileDetails || shouldSkipFilePicker) {
finish()
}
}
-
}
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt
index 8e2ceac..983c227 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/MainActivity.kt
@@ -65,7 +65,6 @@ class MainActivity : ComponentActivity() {
LaunchedEffect(key1 = Unit) {
if (isAppPreference) navController.navigate("settings")
}
-
AppNavigation(navController, settingsViewModel, windowSizeClass)
}
}
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/SampleUriDataProvider.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/SampleUriDataProvider.kt
index ba578b1..595fd6b 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/SampleUriDataProvider.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/SampleUriDataProvider.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 - 2023 Mateus Rodrigues Costa
+ * Copyright (C) 2022 - 2024 Mateus Rodrigues Costa
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -25,7 +25,6 @@ class SampleUriDataProvider : PreviewParameterProvider {
"21. Setting Sail, Coming Home (End Theme).flac", "audio/flac", 35280673, null
),
UriData("03. Lonely Rolling Star (Missing You).flac", "audio/flac", 41123343, null),
- UriData(null, null, null, null),
null,
)
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/UriData.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/UriData.kt
index 95a0592..a3b824a 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/UriData.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/model/UriData.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 - 2023 Mateus Rodrigues Costa
+ * Copyright (C) 2022 - 2024 Mateus Rodrigues Costa
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -20,8 +20,8 @@ package com.mateusrodcosta.apps.share2storage.model
import android.graphics.Bitmap
data class UriData(
- val displayName: String?,
- val type: String?,
- val size: Long?,
+ val displayName: String,
+ val type: String,
+ val size: Long,
val previewImage: Bitmap?
)
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt
index 38e9064..441c13b 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/DetailsScreen.kt
@@ -197,17 +197,15 @@ fun FileInfo(uriData: UriData) {
) {
FileInfoLine(
label = stringResource(R.string.file_name),
- content = uriData.displayName ?: stringResource(R.string.unknown)
+ content = uriData.displayName
)
FileInfoLine(
label = stringResource(R.string.file_type),
- content = uriData.type ?: stringResource(R.string.unknown)
+ content = uriData.type
)
FileInfoLine(
label = stringResource(R.string.file_size),
- content = if (uriData.size != null) Formatter.formatFileSize(
- LocalContext.current, uriData.size
- ) else stringResource(R.string.unknown)
+ content = Formatter.formatFileSize(LocalContext.current, uriData.size)
)
}
}
@@ -223,7 +221,7 @@ fun FileInfoLine(label: String, content: String) {
@Composable
fun FilePreview(uriData: UriData) {
- val mimeType = uriData.type ?: "*/*"
+ val mimeType = uriData.type
val fallbackFileIcon = if (mimeType.startsWith("image/")) Icons.Outlined.Image
else if (mimeType.startsWith("audio/")) Icons.Outlined.AudioFile
else if (mimeType.startsWith("video/")) Icons.Outlined.VideoFile
@@ -249,4 +247,45 @@ fun FilePreview(uriData: UriData) {
tint = MaterialTheme.colorScheme.tertiary
)
}
+}
+
+@Preview(apiLevel = 34, showSystemUi = true, showBackground = true)
+@Composable
+fun DetailsScreenSkippedPreview() {
+ DetailsScreenSkippedContent()
+}
+
+@Preview(apiLevel = 34, showSystemUi = true, showBackground = true, locale = "pt-rBR")
+@Composable
+fun DetailsScreenSkippedPreviewPtBr() {
+ DetailsScreenSkippedContent()
+}
+
+@Composable
+fun DetailsScreenSkipped() {
+ DetailsScreenSkippedContent()
+}
+
+@OptIn(ExperimentalMaterial3Api::class)
+@Composable
+fun DetailsScreenSkippedContent() {
+ AppTheme {
+ Scaffold(topBar = {
+ TopAppBar(
+ title = { Text(stringResource(R.string.file_details)) },
+ )
+ }) { paddingValues ->
+ Box(
+ contentAlignment = Alignment.Center,
+ modifier = Modifier
+ .fillMaxSize()
+ .padding(paddingValues)
+ ) {
+ Text(
+ stringResource(R.string.saving_file),
+ style = MaterialTheme.typography.headlineMedium
+ )
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt
index 031764a..6b8b3cc 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/MainScreen.kt
@@ -58,6 +58,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import com.mateusrodcosta.apps.share2storage.R
+import com.mateusrodcosta.apps.share2storage.screens.dialogs.AboutDialog
import com.mateusrodcosta.apps.share2storage.screens.shared.AppListHeader
import com.mateusrodcosta.apps.share2storage.screens.shared.ListItemWithURL
import com.mateusrodcosta.apps.share2storage.screens.shared.shouldShowLandscape
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt
index 8fcbf84..b90fd69 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsScreen.kt
@@ -27,7 +27,6 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
-import androidx.compose.material.icons.rounded.Clear
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@@ -39,15 +38,21 @@ import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.alpha
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.navigation.NavController
import com.mateusrodcosta.apps.share2storage.R
+import com.mateusrodcosta.apps.share2storage.screens.dialogs.DefaultFolderDialog
import com.mateusrodcosta.apps.share2storage.screens.shared.AppBasicDivider
import com.mateusrodcosta.apps.share2storage.screens.shared.AppListHeader
import com.mateusrodcosta.apps.share2storage.ui.theme.AppTheme
+import com.mateusrodcosta.apps.share2storage.utils.SharedPreferencesDefaultValues
+import com.mateusrodcosta.apps.share2storage.utils.Utils
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@@ -55,15 +60,21 @@ import kotlinx.coroutines.flow.StateFlow
@Composable
fun SettingsScreenPreview() {
val mockDefaultSaveLocation = MutableStateFlow(null)
- val mockSkipFileDetails = MutableStateFlow(false)
- val mockInterceptActionViewIntents = MutableStateFlow(false)
- val mockShowFilePreview = MutableStateFlow(true)
+ val mockSkipFilePicker =
+ MutableStateFlow(SharedPreferencesDefaultValues.SKIP_FILE_PICKER_DEFAULT)
+ val mockSkipFileDetails =
+ MutableStateFlow(SharedPreferencesDefaultValues.SKIP_FILE_DETAILS_DEFAULT)
+ val mockShowFilePreview =
+ MutableStateFlow(SharedPreferencesDefaultValues.SHOW_FILE_PREVIEW_DEFAULT)
+ val mockInterceptActionViewIntents =
+ MutableStateFlow(SharedPreferencesDefaultValues.INTERCEPT_ACTION_VIEW_INTENTS_DEFAULT)
SettingsScreenContent(
spDefaultSaveLocation = mockDefaultSaveLocation,
+ spSkipFilePicker = mockSkipFilePicker,
spSkipFileDetails = mockSkipFileDetails,
- spInterceptActionViewIntents = mockInterceptActionViewIntents,
spShowFilePreview = mockShowFilePreview,
+ spInterceptActionViewIntents = mockInterceptActionViewIntents,
)
}
@@ -72,15 +83,21 @@ fun SettingsScreenPreview() {
@Composable
fun SettingsScreenPreviewPtBr() {
val mockDefaultSaveLocation = MutableStateFlow(null)
- val mockSkipFileDetails = MutableStateFlow(false)
- val mockInterceptActionViewIntents = MutableStateFlow(false)
- val mockShowFilePreview = MutableStateFlow(true)
+ val mockSkipFilePicker =
+ MutableStateFlow(SharedPreferencesDefaultValues.SKIP_FILE_PICKER_DEFAULT)
+ val mockSkipFileDetails =
+ MutableStateFlow(SharedPreferencesDefaultValues.SKIP_FILE_DETAILS_DEFAULT)
+ val mockShowFilePreview =
+ MutableStateFlow(SharedPreferencesDefaultValues.SHOW_FILE_PREVIEW_DEFAULT)
+ val mockInterceptActionViewIntents =
+ MutableStateFlow(SharedPreferencesDefaultValues.INTERCEPT_ACTION_VIEW_INTENTS_DEFAULT)
SettingsScreenContent(
spDefaultSaveLocation = mockDefaultSaveLocation,
+ spSkipFilePicker = mockSkipFilePicker,
spSkipFileDetails = mockSkipFileDetails,
- spInterceptActionViewIntents = mockInterceptActionViewIntents,
spShowFilePreview = mockShowFilePreview,
+ spInterceptActionViewIntents = mockInterceptActionViewIntents,
)
}
@@ -89,11 +106,15 @@ fun SettingsScreen(navController: NavController, settingsViewModel: SettingsView
SettingsScreenContent(
navController = navController,
spDefaultSaveLocation = settingsViewModel.defaultSaveLocation,
+ spSkipFilePicker = settingsViewModel.skipFilePicker,
spSkipFileDetails = settingsViewModel.skipFileDetails,
- spInterceptActionViewIntents = settingsViewModel.interceptActionViewIntents,
spShowFilePreview = settingsViewModel.showFilePreview,
+ spInterceptActionViewIntents = settingsViewModel.interceptActionViewIntents,
launchFilePicker = { settingsViewModel.getSaveLocationDirIntent().launch(null) },
- clearSaveDirectory = { settingsViewModel.clearSaveDirectory() },
+ clearDefaultSaveLocation = { settingsViewModel.clearDefaultSaveLocation() },
+ updateSkipFilePicker = { value: Boolean ->
+ settingsViewModel.updateSkipFilePicker(value)
+ },
updateSkipFileDetails = { value: Boolean ->
settingsViewModel.updateSkipFileDetails(value)
},
@@ -111,11 +132,13 @@ fun SettingsScreen(navController: NavController, settingsViewModel: SettingsView
fun SettingsScreenContent(
navController: NavController? = null,
spDefaultSaveLocation: StateFlow,
+ spSkipFilePicker: StateFlow,
spSkipFileDetails: StateFlow,
- spInterceptActionViewIntents: StateFlow,
spShowFilePreview: StateFlow,
+ spInterceptActionViewIntents: StateFlow,
launchFilePicker: () -> Unit = {},
- clearSaveDirectory: () -> Unit = {},
+ clearDefaultSaveLocation: () -> Unit = {},
+ updateSkipFilePicker: (Boolean) -> Unit = {},
updateSkipFileDetails: (Boolean) -> Unit = {},
updateInterceptActionViewIntents: (Boolean) -> Unit = {},
updateShowFilePreview: (Boolean) -> Unit = {},
@@ -142,8 +165,13 @@ fun SettingsScreenContent(
AppListHeader(title = stringResource(R.string.settings_category_file_picker))
DefaultSaveLocationSetting(
launchFilePicker = launchFilePicker,
- clearSaveDirectory = clearSaveDirectory,
+ clearDefaultSaveLocation = clearDefaultSaveLocation,
+ spDefaultSaveLocation = spDefaultSaveLocation,
+ )
+ SkipFilePickerSetting(
spDefaultSaveLocation = spDefaultSaveLocation,
+ updateSkipFilePicker = updateSkipFilePicker,
+ spSkipFilePicker = spSkipFilePicker,
)
AppBasicDivider()
AppListHeader(stringResource(R.string.settings_category_file_details))
@@ -154,6 +182,7 @@ fun SettingsScreenContent(
ShowFilePreviewSetting(
updateShowFilePreview = updateShowFilePreview,
spShowFilePreview = spShowFilePreview,
+ spSkipFileDetails = spSkipFileDetails,
)
AppBasicDivider()
AppListHeader(title = stringResource(R.string.settings_category_intents))
@@ -171,22 +200,61 @@ fun SettingsScreenContent(
@Composable
fun DefaultSaveLocationSetting(
launchFilePicker: () -> Unit,
- clearSaveDirectory: () -> Unit,
+ clearDefaultSaveLocation: () -> Unit,
spDefaultSaveLocation: StateFlow,
) {
val defaultSaveLocation by spDefaultSaveLocation.collectAsState()
+ val openDefaultFolderDialog = remember { mutableStateOf(false) }
- ListItem(modifier = Modifier.clickable { launchFilePicker() }, headlineContent = {
- Text(stringResource(R.string.settings_default_save_location))
- }, supportingContent = {
- Text(
- defaultSaveLocation?.path
- ?: stringResource(R.string.settings_default_save_location_last_used)
+ if (openDefaultFolderDialog.value) {
+ DefaultFolderDialog(
+ onDismissRequest = {
+ openDefaultFolderDialog.value = false
+ },
+ clearDefaultSaveLocation = clearDefaultSaveLocation,
+ launchFilePicker = launchFilePicker,
+ )
+ }
+
+ ListItem(
+ modifier = Modifier.clickable { openDefaultFolderDialog.value = true },
+ headlineContent = {
+ Text(stringResource(R.string.settings_default_save_location))
+ },
+ supportingContent = {
+ Text(
+ defaultSaveLocation?.path
+ ?: stringResource(R.string.settings_default_save_location_last_used)
+ )
+ },
+ )
+}
+
+@Composable
+fun SkipFilePickerSetting(
+ spDefaultSaveLocation: StateFlow,
+ updateSkipFilePicker: (Boolean) -> Unit,
+ spSkipFilePicker: StateFlow,
+) {
+ val skipFilePicker by spSkipFilePicker.collectAsState()
+ val defaultSaveLocation by spDefaultSaveLocation.collectAsState()
+
+ ListItem(modifier = if (defaultSaveLocation != null) Modifier.clickable {
+ updateSkipFilePicker(
+ !skipFilePicker
)
+ } else Modifier.alpha(Utils.CONTENT_ALPHA_DISABLED), headlineContent = {
+ Text(stringResource(R.string.settings_skip_file_picker))
+ }, supportingContent = {
+ Text(stringResource(R.string.settings_skip_file_picker_info))
}, trailingContent = {
- IconButton(onClick = { clearSaveDirectory() }) {
- Icon(Icons.Rounded.Clear, stringResource(R.string.clear_button))
- }
+ Switch(
+ enabled = defaultSaveLocation != null,
+ checked = skipFilePicker,
+ onCheckedChange = { value ->
+ updateSkipFilePicker(value)
+ },
+ )
})
}
@@ -211,26 +279,28 @@ fun SkipFileDetailsSetting(
})
}
-
@Composable
fun ShowFilePreviewSetting(
+ spSkipFileDetails: StateFlow,
updateShowFilePreview: (Boolean) -> Unit,
spShowFilePreview: StateFlow,
) {
+ val skipFileDetails by spSkipFileDetails.collectAsState()
val showFilePreview by spShowFilePreview.collectAsState()
- ListItem(modifier = Modifier.clickable { updateShowFilePreview(!showFilePreview) },
- headlineContent = {
- Text(stringResource(R.string.settings_show_file_preview))
- },
- supportingContent = {
- Text(stringResource(R.string.settings_show_file_preview_info))
- },
- trailingContent = {
- Switch(checked = showFilePreview, onCheckedChange = { value ->
- updateShowFilePreview(value)
- })
+ ListItem(modifier = if (skipFileDetails) Modifier.alpha(Utils.CONTENT_ALPHA_DISABLED) else Modifier.clickable {
+ updateShowFilePreview(
+ !showFilePreview
+ )
+ }, headlineContent = {
+ Text(stringResource(R.string.settings_show_file_preview))
+ }, supportingContent = {
+ Text(stringResource(R.string.settings_show_file_preview_info))
+ }, trailingContent = {
+ Switch(enabled = !skipFileDetails, checked = showFilePreview, onCheckedChange = { value ->
+ updateShowFilePreview(value)
})
+ })
}
@Composable
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsViewModel.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsViewModel.kt
index 198d688..3992820 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsViewModel.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/SettingsViewModel.kt
@@ -33,6 +33,7 @@ import androidx.core.content.edit
import androidx.lifecycle.ViewModel
import androidx.preference.PreferenceManager
import com.mateusrodcosta.apps.share2storage.utils.SharedPreferenceKeys
+import com.mateusrodcosta.apps.share2storage.utils.SharedPreferencesDefaultValues
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
@@ -56,6 +57,9 @@ class SettingsViewModel : ViewModel() {
private val _interceptActionViewIntents = MutableStateFlow(false)
val interceptActionViewIntents: StateFlow = _interceptActionViewIntents
+ private val _skipFilePicker = MutableStateFlow(false)
+ val skipFilePicker: StateFlow = _skipFilePicker
+
fun assignSaveLocationDirIntent(intent: ActivityResultLauncher) {
getSaveLocationDirIntent = intent
}
@@ -86,29 +90,41 @@ class SettingsViewModel : ViewModel() {
}
else null
- val spSkipFileDetails =
- sharedPreferences.getBoolean(SharedPreferenceKeys.SKIP_FILE_DETAILS_KEY, false)
+ val spSkipFilePicker = sharedPreferences.getBoolean(
+ SharedPreferenceKeys.SKIP_FILE_PICKER_KEY,
+ SharedPreferencesDefaultValues.SKIP_FILE_PICKER_DEFAULT
+ )
+ Log.d("settings] initSharedPreferences] skipFilePicker", spSkipFilePicker.toString())
+
+
+ val spSkipFileDetails = sharedPreferences.getBoolean(
+ SharedPreferenceKeys.SKIP_FILE_DETAILS_KEY,
+ SharedPreferencesDefaultValues.SKIP_FILE_DETAILS_DEFAULT
+ )
Log.d("settings] initSharedPreferences] skipFileDetails", spSkipFileDetails.toString())
- val spInterceptActionViewIntents = sharedPreferences.getBoolean(
- SharedPreferenceKeys.INTERCEPT_ACTION_VIEW_INTENTS_KEY, false
+ val spShowFilePreview = sharedPreferences.getBoolean(
+ SharedPreferenceKeys.SHOW_FILE_PREVIEW_KEY,
+ SharedPreferencesDefaultValues.SHOW_FILE_PREVIEW_DEFAULT
)
Log.d(
- "settings] initSharedPreferences] interceptActionViewIntents",
- spInterceptActionViewIntents.toString()
+ "settings] initSharedPreferences] showFilePreview", spShowFilePreview.toString()
)
- val spShowFilePreview = sharedPreferences.getBoolean(
- SharedPreferenceKeys.SHOW_FILE_PREVIEW_KEY, true
+ val spInterceptActionViewIntents = sharedPreferences.getBoolean(
+ SharedPreferenceKeys.INTERCEPT_ACTION_VIEW_INTENTS_KEY,
+ SharedPreferencesDefaultValues.INTERCEPT_ACTION_VIEW_INTENTS_DEFAULT
)
Log.d(
- "settings] initSharedPreferences] showFilePreview", spShowFilePreview.toString()
+ "settings] initSharedPreferences] interceptActionViewIntents",
+ spInterceptActionViewIntents.toString()
)
_defaultSaveLocation.value = spDefaultSaveLocation
+ _skipFilePicker.value = spSkipFilePicker
_skipFileDetails.value = spSkipFileDetails
- _interceptActionViewIntents.value = spInterceptActionViewIntents
_showFilePreview.value = spShowFilePreview
+ _interceptActionViewIntents.value = spInterceptActionViewIntents
}
fun updateDefaultSaveLocation(value: Uri?) {
@@ -152,7 +168,7 @@ class SettingsViewModel : ViewModel() {
_defaultSaveLocation.value = value
}
- fun clearSaveDirectory() {
+ fun clearDefaultSaveLocation() {
updateDefaultSaveLocation(null)
}
@@ -194,4 +210,12 @@ class SettingsViewModel : ViewModel() {
_showFilePreview.value = value
}
}
+
+ fun updateSkipFilePicker(value: Boolean) {
+ sharedPreferences.edit(commit = true) {
+ putBoolean(SharedPreferenceKeys.SKIP_FILE_PICKER_KEY, value)
+ Log.e("settings] updateSkipFilePicker", value.toString())
+ _skipFilePicker.value = value
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AboutDialog.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/dialogs/AboutDialog.kt
similarity index 87%
rename from app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AboutDialog.kt
rename to app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/dialogs/AboutDialog.kt
index 080be8f..665c2ea 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/AboutDialog.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/dialogs/AboutDialog.kt
@@ -1,21 +1,21 @@
/*
- * Copyright (C) 2024 mateusrc
+ * Copyright (C) 2024 Mateus Rodrigues Costa
*
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
*/
-package com.mateusrodcosta.apps.share2storage.screens
+package com.mateusrodcosta.apps.share2storage.screens.dialogs
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/dialogs/DefaultFolderDialog.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/dialogs/DefaultFolderDialog.kt
new file mode 100644
index 0000000..852584e
--- /dev/null
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/dialogs/DefaultFolderDialog.kt
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2024 Mateus Rodrigues Costa
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package com.mateusrodcosta.apps.share2storage.screens.dialogs
+
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Column
+import androidx.compose.material3.Card
+import androidx.compose.material3.ListItem
+import androidx.compose.material3.Text
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.tooling.preview.Preview
+import androidx.compose.ui.window.Dialog
+import com.mateusrodcosta.apps.share2storage.R
+import com.mateusrodcosta.apps.share2storage.ui.theme.AppTheme
+
+
+@Preview(apiLevel = 34)
+@Composable
+fun DefaultFolderDialogContentPreview() {
+ DefaultFolderDialogContent()
+}
+
+@Preview(apiLevel = 34, locale = "pt-rBR")
+@Composable
+fun DefaultFolderDialogContentPreviewPtBr() {
+ DefaultFolderDialogContent()
+}
+
+@Composable
+fun DefaultFolderDialog(
+ onDismissRequest: () -> Unit,
+ clearDefaultSaveLocation: () -> Unit = {},
+ launchFilePicker: () -> Unit = {}
+) {
+ Dialog(onDismissRequest = onDismissRequest) {
+ DefaultFolderDialogContent(
+ onDismissRequest = onDismissRequest,
+ clearDefaultSaveLocation = clearDefaultSaveLocation,
+ launchFilePicker = launchFilePicker
+ )
+ }
+}
+
+@Composable
+fun DefaultFolderDialogContent(
+ onDismissRequest: () -> Unit = {},
+ clearDefaultSaveLocation: () -> Unit = {},
+ launchFilePicker: () -> Unit = {},
+) {
+ AppTheme {
+ Card {
+ Column {
+ ListItem(modifier = Modifier.clickable(onClick = {
+ clearDefaultSaveLocation()
+ onDismissRequest()
+ }),
+ headlineContent = { Text(stringResource(R.string.settings_default_save_location_last_used)) })
+ ListItem(modifier = Modifier.clickable(onClick = {
+ launchFilePicker()
+ onDismissRequest()
+ }),
+ headlineContent = { Text(stringResource(R.string.settings_default_save_location_select_folder)) })
+ }
+ }
+ }
+}
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt
index f09356e..3a8eacc 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/screens/shared/SharedComposables.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 - 2023 Mateus Rodrigues Costa
+ * Copyright (C) 2022 - 2024 Mateus Rodrigues Costa
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -26,7 +26,6 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
-import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
@@ -64,7 +63,8 @@ fun ListItemWithURL(
append(stringPieces[0])
withStyle(
style = SpanStyle(
- color = MaterialTheme.colorScheme.tertiary, textDecoration = TextDecoration.Underline
+ color = MaterialTheme.colorScheme.tertiary,
+ textDecoration = TextDecoration.Underline
)
) {
if (replaceWithUrl) append(url) else append(linkPlacement)
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt
index 02c0e37..7ddd4ff 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Color.kt
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2022 - 2024 Mateus Rodrigues Costa
+ * Copyright (C) 2024 Mateus Rodrigues Costa
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Type.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Type.kt
index 1e7fca7..3ecdb5a 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Type.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/ui/theme/Type.kt
@@ -1,3 +1,20 @@
+/*
+ * Copyright (C) 2024 Mateus Rodrigues Costa
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
package com.mateusrodcosta.apps.share2storage.ui.theme
import androidx.compose.material3.Typography
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/SharedPreferenceKeys.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/SharedPreferenceUtils.kt
similarity index 77%
rename from app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/SharedPreferenceKeys.kt
rename to app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/SharedPreferenceUtils.kt
index 938ad2c..5ed08d1 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/SharedPreferenceKeys.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/SharedPreferenceUtils.kt
@@ -18,8 +18,16 @@
package com.mateusrodcosta.apps.share2storage.utils
object SharedPreferenceKeys {
- const val SKIP_FILE_DETAILS_KEY: String = "skip_file_details"
const val DEFAULT_SAVE_LOCATION_KEY: String = "default_save_location"
- const val INTERCEPT_ACTION_VIEW_INTENTS_KEY: String = "intercept_action_view_intents"
+ const val SKIP_FILE_PICKER_KEY: String = "skip_file_picker"
+ const val SKIP_FILE_DETAILS_KEY: String = "skip_file_details"
const val SHOW_FILE_PREVIEW_KEY: String = "show_file_preview"
+ const val INTERCEPT_ACTION_VIEW_INTENTS_KEY: String = "intercept_action_view_intents"
+}
+
+object SharedPreferencesDefaultValues {
+ const val SKIP_FILE_PICKER_DEFAULT: Boolean = false
+ const val SKIP_FILE_DETAILS_DEFAULT: Boolean = true
+ const val SHOW_FILE_PREVIEW_DEFAULT: Boolean = false
+ const val INTERCEPT_ACTION_VIEW_INTENTS_DEFAULT: Boolean = false
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/Utils.kt b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/Utils.kt
index b8b2906..29bc78b 100644
--- a/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/Utils.kt
+++ b/app/src/main/kotlin/com/mateusrodcosta/apps/share2storage/utils/Utils.kt
@@ -31,27 +31,29 @@ import java.io.*
object Utils {
const val BUFFER_SIZE: Int = 1024
+ const val CONTENT_ALPHA_DISABLED = 0.38f
}
-fun getUriData(contentResolver: ContentResolver, uri: Uri?, getPreview: Boolean): UriData? {
- if (uri == null) return null
- val type = contentResolver.getType(uri)
- var displayName: String? = null
- var size: Long? = null
+fun getUriData(contentResolver: ContentResolver, uri: Uri, getPreview: Boolean): UriData? {
+ val type = contentResolver.getType(uri) ?: "*/*"
+ val displayName: String?
+ val size: Long?
+
val cursor = contentResolver.query(uri, null, null, null, null)
- if (cursor != null) {/*
- * Get the column indexes of the data in the Cursor,
- * move to the first row in the Cursor, get the data,
- * and display it.
- */
- val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
- val sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE)
- cursor.moveToFirst()
- displayName = cursor.getString(nameIndex)
- size = cursor.getLong(sizeIndex)
-
- cursor.close()
- }
+ if (cursor == null) return null
+
+ /*
+ * Get the column indexes of the data in the Cursor,
+ * move to the first row in the Cursor, get the data,
+ * and display it.
+ */
+ val nameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
+ val sizeIndex = cursor.getColumnIndex(OpenableColumns.SIZE)
+ cursor.moveToFirst()
+ displayName = cursor.getString(nameIndex)
+ size = cursor.getLong(sizeIndex)
+
+ cursor.close()
var bitmap: Bitmap? = null
if (getPreview) {
@@ -138,7 +140,7 @@ fun saveFile(
bos.flush()
bos.close()
}
- } catch (ignored: Exception) {
+ } catch (_: Exception) {
}
}
return !hasError
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 0fa5076..537f8c0 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -22,6 +22,9 @@
Seletor de Arquivos
Local de salvamento padrão
Última pasta usada
+ Selecionar pasta…
+ Pular seletor de arquivos
+ Pular seletor de arquivos e salvar imediatamente (apenas disponível quando uma pasta padrão for configurada)
Detalhes do arquivo
Pular página de Detalhes do arquivo
@@ -34,6 +37,7 @@
Permite registrar como uma opção quando aplicativos tentam automaticamente abrir um visualizador de arquivos
Nenhum arquivo
+ Salvando arquivo…
Detalhes do arquivo
Nome do arquivo
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8d56bb5..cfa7f8c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -22,6 +22,9 @@
File Picker
Default save location
Last used folder
+ Select folder…
+ Skip File Picker
+ Skip File Picker and immediately save files (only available when a default folder is set)
File Details
Skip File Details page
@@ -34,6 +37,7 @@
Allow registering as an option when apps try to automatically open a file viewer
No file found
+ Saving file…
File Details
File name
diff --git a/fastlane/README.md b/fastlane/README.md
index 5649d3a..54d23d9 100644
--- a/fastlane/README.md
+++ b/fastlane/README.md
@@ -31,6 +31,14 @@ Runs all the tests
Deploy a new version to the Google Play
+### android deployInternal
+
+```sh
+[bundle exec] fastlane android deployInternal
+```
+
+Deploy Google Play internal
+
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
diff --git a/fastlane/metadata/android/en-US/changelogs/26.txt b/fastlane/metadata/android/en-US/changelogs/26.txt
new file mode 100644
index 0000000..7ecf4ce
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/26.txt
@@ -0,0 +1,5 @@
+IMPORTANT: A future version might drop Android O support, see https://github.com/MateusRodCosta/Share2Storage/issues/38 for more info.
+
+• Updated dependencies
+• New "Skip File Picker" option when a Default folder is set
+• Improved UX and default setting values for decreasing friction (requested by some users)
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png
index 1426a92..b02880e 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png
index 8b21010..8d4ce02 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png
index 53e51f5..b509442 100644
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png and b/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png
deleted file mode 100644
index b509442..0000000
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png b/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png
deleted file mode 100644
index 77f58c5..0000000
Binary files a/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1.png
index b4c15ee..4047d81 100644
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1.png and b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/1.png differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2.png
index 6dc8cd0..bb47353 100644
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2.png and b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/2.png differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3.png
index a9aae4f..1b6ed47 100644
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3.png and b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/3.png differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4.png
deleted file mode 100644
index 58cb8ac..0000000
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/5.png b/fastlane/metadata/android/en-US/images/sevenInchScreenshots/5.png
deleted file mode 100644
index e11f2f4..0000000
Binary files a/fastlane/metadata/android/en-US/images/sevenInchScreenshots/5.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/2.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/2.png
index 6d6f4cb..4042bf8 100644
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/2.png and b/fastlane/metadata/android/en-US/images/tenInchScreenshots/2.png differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/3.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/3.png
index 61c2437..59ffa28 100644
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/3.png and b/fastlane/metadata/android/en-US/images/tenInchScreenshots/3.png differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/4.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/4.png
deleted file mode 100644
index 59ffa28..0000000
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/en-US/images/tenInchScreenshots/5.png b/fastlane/metadata/android/en-US/images/tenInchScreenshots/5.png
deleted file mode 100644
index 2683d25..0000000
Binary files a/fastlane/metadata/android/en-US/images/tenInchScreenshots/5.png and /dev/null differ
diff --git a/fastlane/metadata/android/pt-BR/changelogs/26.txt b/fastlane/metadata/android/pt-BR/changelogs/26.txt
new file mode 100644
index 0000000..5f1be4e
--- /dev/null
+++ b/fastlane/metadata/android/pt-BR/changelogs/26.txt
@@ -0,0 +1,5 @@
+IMPORTANTE: Uma versão futura poderá deixar de suportar o Android O, veja https://github.com/MateusRodCosta/Share2Storage/issues/38 para mais informações.
+
+• Dependências atualizadas
+• Nova opção "Pular seletor de arquivos" quando uma pasta padrão é configurada
+• Melhorias de UX e novos valores padrões de configurações com foco em redução de fricção (devido a demandas de usuários)
\ No newline at end of file
diff --git a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/2.png b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/2.png
index 5da7a0f..03255ac 100644
Binary files a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/2.png and b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/2.png differ
diff --git a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/3.png b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/3.png
index 213c260..5a8c3a3 100644
Binary files a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/3.png and b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/3.png differ
diff --git a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/4.png b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/4.png
deleted file mode 100644
index 5a8c3a3..0000000
Binary files a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/5.png b/fastlane/metadata/android/pt-BR/images/phoneScreenshots/5.png
deleted file mode 100644
index e630931..0000000
Binary files a/fastlane/metadata/android/pt-BR/images/phoneScreenshots/5.png and /dev/null differ
diff --git a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/1.png b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/1.png
index 8921074..599c7de 100644
Binary files a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/1.png and b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/1.png differ
diff --git a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/2.png b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/2.png
index e29c045..633818a 100644
Binary files a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/2.png and b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/2.png differ
diff --git a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/3.png b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/3.png
index eb45916..577bc2f 100644
Binary files a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/3.png and b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/3.png differ
diff --git a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/4.png b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/4.png
deleted file mode 100644
index 3e8e58b..0000000
Binary files a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/5.png b/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/5.png
deleted file mode 100644
index 4bbd6bc..0000000
Binary files a/fastlane/metadata/android/pt-BR/images/sevenInchScreenshots/5.png and /dev/null differ
diff --git a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/2.png b/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/2.png
index 2756713..71f200e 100644
Binary files a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/2.png and b/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/2.png differ
diff --git a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/3.png b/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/3.png
index 04edaa0..996b38c 100644
Binary files a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/3.png and b/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/3.png differ
diff --git a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/4.png b/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/4.png
deleted file mode 100644
index 996b38c..0000000
Binary files a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/4.png and /dev/null differ
diff --git a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/5.png b/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/5.png
deleted file mode 100644
index 904032f..0000000
Binary files a/fastlane/metadata/android/pt-BR/images/tenInchScreenshots/5.png and /dev/null differ
diff --git a/gradle.properties b/gradle.properties
index ea81cd7..619fd1f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-org.gradle.jvmargs=-Xmx4096M -Dfile.encoding=UTF-8 -XX:+UseParallelGC -Dkotlin.daemon.jvm.options="-Xmx4096M"
+org.gradle.jvmargs=-Xmx4G -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -Dkotlin.daemon.jvm.options="-Xmx4G"
android.useAndroidX=true
android.enableBuildConfigAsBytecode=true
org.gradle.caching=true
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 77a2c6e..e4d5420 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -1,13 +1,13 @@
[versions]
-agp = "8.7.1"
-kotlin = "2.0.21"
-ktx = "1.13.1"
+agp = "8.7.2"
+kotlin = "2.1.0"
+ktx = "1.15.0"
preference-ktx = "1.2.1"
-lifecycle-runtime-ktx = "2.8.6"
+lifecycle-runtime-ktx = "2.8.7"
splashscreen = "1.0.1"
-composeBom = "2024.10.00"
+composeBom = "2024.11.00"
activityCompose = "1.9.3"
-navigationCompose = "2.8.3"
+navigationCompose = "2.8.4"
junit = "4.13.2"
androidxTestRunner = "1.6.2"
androidxTestRules = "1.6.1"
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index fb602ee..eb1a55b 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionSha256Sum=31c55713e40233a8303827ceb42ca48a47267a0ad4bab9177123121e71524c26
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
+distributionSha256Sum=f397b287023acdba1e9f6fc5ea72d22dd63669d59ed4a289a29b1a76eee151c6
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME