3 Commits
6 changed files with 56 additions and 5 deletions
+10 -2
View File
@@ -11,8 +11,8 @@ android {
applicationId "com.folderredirect.app" applicationId "com.folderredirect.app"
minSdk 26 minSdk 26
targetSdk 34 targetSdk 34
versionCode 1 versionCode 2
versionName "1.0" versionName "1.1.0"
} }
buildTypes { buildTypes {
@@ -31,6 +31,14 @@ android {
buildFeatures { buildFeatures {
viewBinding true viewBinding true
} }
applicationVariants.all { variant ->
variant.outputs.all { output ->
def version = variant.versionName
def name = variant.buildType.name
outputFileName = "FolderRedirect-app-v${version}-${name}.apk"
}
}
} }
dependencies { dependencies {
+2 -1
View File
@@ -22,7 +22,8 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.FolderRedirectApp" android:theme="@style/Theme.FolderRedirectApp"
android:requestLegacyExternalStorage="true"> android:requestLegacyExternalStorage="true"
android:usesCleartextTraffic="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
@@ -140,7 +140,7 @@ class FileMoveWorker(appContext: Context, params: WorkerParameters) : CoroutineW
} }
val relativePath = file.absolutePath.substringAfter(sourceDir.absolutePath.trimEnd('/'), "").trimStart('/') 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 retries = 3
var success = false var success = false
@@ -12,6 +12,7 @@ data class ImmichUploadRule(
var isEnabled: Boolean = true, var isEnabled: Boolean = true,
var fileTypeCategory: String = FileTypeCategory.IMAGES.name, var fileTypeCategory: String = FileTypeCategory.IMAGES.name,
var namePattern: String? = null, var namePattern: String? = null,
var useFolderAsAlbum: Boolean = true,
var progress: Int = 0 var progress: Int = 0
) : Serializable { ) : Serializable {
@@ -399,6 +399,7 @@ class MainActivity : AppCompatActivity() {
editApiKey = view.findViewById(R.id.editApiKey) editApiKey = view.findViewById(R.id.editApiKey)
radioGroupFileType = view.findViewById(R.id.radioGroupFileType) radioGroupFileType = view.findViewById(R.id.radioGroupFileType)
editNamePattern = view.findViewById(R.id.editNamePattern) 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) val btnSelectSource = view.findViewById<Button>(R.id.btnSelectSource)
editRuleName?.setText(rule?.name ?: "") editRuleName?.setText(rule?.name ?: "")
@@ -407,6 +408,7 @@ class MainActivity : AppCompatActivity() {
editImmichUrl?.setText(rule?.immichUrl ?: "") editImmichUrl?.setText(rule?.immichUrl ?: "")
editApiKey?.setText(rule?.apiKey ?: "") editApiKey?.setText(rule?.apiKey ?: "")
editNamePattern?.setText(currentPattern) editNamePattern?.setText(currentPattern)
switchUseFolderAsAlbum.isChecked = rule?.useFolderAsAlbum ?: true
when (currentCategory) { when (currentCategory) {
FileTypeCategory.IMAGES -> view.findViewById<RadioButton>(R.id.radioImages).isChecked = true FileTypeCategory.IMAGES -> view.findViewById<RadioButton>(R.id.radioImages).isChecked = true
@@ -460,6 +462,7 @@ class MainActivity : AppCompatActivity() {
immichUrl = immichUrl, immichUrl = immichUrl,
apiKey = apiKey apiKey = apiKey
) )
newRule.useFolderAsAlbum = switchUseFolderAsAlbum.isChecked
newRule.setCategory(fileTypeCategory) newRule.setCategory(fileTypeCategory)
if (namePattern.isNotEmpty()) { if (namePattern.isNotEmpty()) {
newRule.setPattern(namePattern) newRule.setPattern(namePattern)
@@ -471,6 +474,7 @@ class MainActivity : AppCompatActivity() {
rule.sourcePath = sourcePath rule.sourcePath = sourcePath
rule.immichUrl = immichUrl rule.immichUrl = immichUrl
rule.apiKey = apiKey rule.apiKey = apiKey
rule.useFolderAsAlbum = switchUseFolderAsAlbum.isChecked
rule.setCategory(fileTypeCategory) rule.setCategory(fileTypeCategory)
if (namePattern.isNotEmpty()) { if (namePattern.isNotEmpty()) {
rule.setPattern(namePattern) rule.setPattern(namePattern)
+38 -1
View File
@@ -175,6 +175,43 @@
android:textSize="11sp" android:textSize="11sp"
android:textColor="@android:color/darker_gray" /> 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 <com.google.android.material.card.MaterialCardView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -199,7 +236,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="4dp" 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:textSize="12sp"
android:textColor="?attr/colorOnPrimaryContainer" /> android:textColor="?attr/colorOnPrimaryContainer" />