1 Commits
Author SHA1 Message Date
nino 91067833a4 v1.1.0: Add toggle to use folders as album or upload without album 2026-07-30 16:21:47 -06:00
5 changed files with 46 additions and 4 deletions
+2 -2
View File
@@ -11,8 +11,8 @@ android {
applicationId "com.folderredirect.app"
minSdk 26
targetSdk 34
versionCode 1
versionName "1.0.1"
versionCode 2
versionName "1.1.0"
}
buildTypes {
@@ -140,7 +140,7 @@ class FileMoveWorker(appContext: Context, params: WorkerParameters) : CoroutineW
}
val relativePath = file.absolutePath.substringAfter(sourceDir.absolutePath.trimEnd('/'), "").trimStart('/')
val albumName = getAlbumNameFromRelativePathImmich(relativePath)
val albumName = if (rule.useFolderAsAlbum) getAlbumNameFromRelativePathImmich(relativePath) else null
var retries = 3
var success = false
@@ -12,6 +12,7 @@ data class ImmichUploadRule(
var isEnabled: Boolean = true,
var fileTypeCategory: String = FileTypeCategory.IMAGES.name,
var namePattern: String? = null,
var useFolderAsAlbum: Boolean = true,
var progress: Int = 0
) : Serializable {
@@ -399,6 +399,7 @@ class MainActivity : AppCompatActivity() {
editApiKey = view.findViewById(R.id.editApiKey)
radioGroupFileType = view.findViewById(R.id.radioGroupFileType)
editNamePattern = view.findViewById(R.id.editNamePattern)
val switchUseFolderAsAlbum = view.findViewById<com.google.android.material.switchmaterial.SwitchMaterial>(R.id.switchUseFolderAsAlbum)
val btnSelectSource = view.findViewById<Button>(R.id.btnSelectSource)
editRuleName?.setText(rule?.name ?: "")
@@ -407,6 +408,7 @@ class MainActivity : AppCompatActivity() {
editImmichUrl?.setText(rule?.immichUrl ?: "")
editApiKey?.setText(rule?.apiKey ?: "")
editNamePattern?.setText(currentPattern)
switchUseFolderAsAlbum.isChecked = rule?.useFolderAsAlbum ?: true
when (currentCategory) {
FileTypeCategory.IMAGES -> view.findViewById<RadioButton>(R.id.radioImages).isChecked = true
@@ -460,6 +462,7 @@ class MainActivity : AppCompatActivity() {
immichUrl = immichUrl,
apiKey = apiKey
)
newRule.useFolderAsAlbum = switchUseFolderAsAlbum.isChecked
newRule.setCategory(fileTypeCategory)
if (namePattern.isNotEmpty()) {
newRule.setPattern(namePattern)
@@ -471,6 +474,7 @@ class MainActivity : AppCompatActivity() {
rule.sourcePath = sourcePath
rule.immichUrl = immichUrl
rule.apiKey = apiKey
rule.useFolderAsAlbum = switchUseFolderAsAlbum.isChecked
rule.setCategory(fileTypeCategory)
if (namePattern.isNotEmpty()) {
rule.setPattern(namePattern)
+38 -1
View File
@@ -175,6 +175,43 @@
android:textSize="11sp"
android:textColor="@android:color/darker_gray" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Usar carpetas como álbum"
android:textStyle="bold"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Al desactivar, todos los archivos se suben sin álbum"
android:textSize="11sp"
android:textColor="@android:color/darker_gray" />
</LinearLayout>
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/switchUseFolderAsAlbum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
</LinearLayout>
<com.google.android.material.card.MaterialCardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -199,7 +236,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:text="Las subcarpetas dentro de la carpeta monitoreada se usarán como nombres de álbum en Immich. Los archivos sin subcarpeta se subirán sin álbum."
android:text="Las subcarpetas dentro de la carpeta monitoreada se usarán como nombres de álbum en Immich. Puedes desactivar esta opción para subir todo sin álbum."
android:textSize="12sp"
android:textColor="?attr/colorOnPrimaryContainer" />