diff --git a/CHANGELOG.md b/CHANGELOG.md index ac4dac4..ff87c33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v1.0.0-beta5 (--.--.--) + +* The 'Select All' feature added +* Notification behavior added +* UI improvement + ## v1.0.0-beta4 (29.02.2024) * Home screen menu arrangement diff --git a/app/src/main/java/com/sn/snfilemanager/core/extensions/FileJob.kt b/app/src/main/java/com/sn/snfilemanager/core/extensions/FileJob.kt index 3e508d4..43e879a 100644 --- a/app/src/main/java/com/sn/snfilemanager/core/extensions/FileJob.kt +++ b/app/src/main/java/com/sn/snfilemanager/core/extensions/FileJob.kt @@ -22,6 +22,7 @@ fun BaseJob.postNotification( .setOngoing(true) .setOnlyAlertOnce(true) .setCategory(CATEGORY_PROGRESS) + .setForegroundServiceBehavior(NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE) .setProgress(100, progress, false) .build() service.notificationManager.notify(id, notification) diff --git a/app/src/main/java/com/sn/snfilemanager/feature/files/adapter/FileItemAdapter.kt b/app/src/main/java/com/sn/snfilemanager/feature/files/adapter/FileItemAdapter.kt index 2fe8c2b..b265448 100644 --- a/app/src/main/java/com/sn/snfilemanager/feature/files/adapter/FileItemAdapter.kt +++ b/app/src/main/java/com/sn/snfilemanager/feature/files/adapter/FileItemAdapter.kt @@ -47,6 +47,17 @@ class FileItemAdapter( } } + fun selectAll() { + selectedItems.clear() + selectedItems.addAll(fileItems) + for (fileItem in fileItems) { + fileItem.isSelected = true + onSelected?.invoke(fileItem, true) + } + notifyItemRangeChanged(0, fileItems.size) + selectionCallback?.onUpdateSelection(selectedItems.size) + } + fun finishSelectionAndReset() { for (selectedItem in selectedItems) { val position = fileItems.indexOf(selectedItem) diff --git a/app/src/main/java/com/sn/snfilemanager/feature/files/presentation/FilesListFragment.kt b/app/src/main/java/com/sn/snfilemanager/feature/files/presentation/FilesListFragment.kt index b9600b6..5c619aa 100644 --- a/app/src/main/java/com/sn/snfilemanager/feature/files/presentation/FilesListFragment.kt +++ b/app/src/main/java/com/sn/snfilemanager/feature/files/presentation/FilesListFragment.kt @@ -129,6 +129,10 @@ class FilesListFragment : R.id.action_detail -> { actionDetail() } + + R.id.action_select_all -> { + adapter?.selectAll() + } } return true diff --git a/app/src/main/java/com/sn/snfilemanager/feature/media/adapter/MediaItemAdapter.kt b/app/src/main/java/com/sn/snfilemanager/feature/media/adapter/MediaItemAdapter.kt index a70cd7d..ebbb39c 100644 --- a/app/src/main/java/com/sn/snfilemanager/feature/media/adapter/MediaItemAdapter.kt +++ b/app/src/main/java/com/sn/snfilemanager/feature/media/adapter/MediaItemAdapter.kt @@ -101,6 +101,17 @@ class MediaItemAdapter( return mediaItems.size } + fun selectAll() { + selectedItems.clear() + selectedItems.addAll(mediaItems) + for (mediaItem in mediaItems) { + mediaItem.isSelected = true + onSelected?.invoke(mediaItem, true) + } + notifyItemRangeChanged(0, mediaItems.size) + selectionCallback?.onUpdateSelection(selectedItems.size) + } + private fun startSelection(mediaFile: Media) { selectionCallback?.onStartSelection() isSelectionModeActive = true diff --git a/app/src/main/java/com/sn/snfilemanager/feature/media/presentation/MediaFragment.kt b/app/src/main/java/com/sn/snfilemanager/feature/media/presentation/MediaFragment.kt index 38ceaaf..e1ab3bf 100644 --- a/app/src/main/java/com/sn/snfilemanager/feature/media/presentation/MediaFragment.kt +++ b/app/src/main/java/com/sn/snfilemanager/feature/media/presentation/MediaFragment.kt @@ -120,6 +120,10 @@ class MediaFragment : R.id.action_detail -> { actionDetail() } + + R.id.action_select_all -> { + adapter?.selectAll() + } } return true diff --git a/app/src/main/java/com/sn/snfilemanager/feature/pathpicker/presentation/PathPickerFragment.kt b/app/src/main/java/com/sn/snfilemanager/feature/pathpicker/presentation/PathPickerFragment.kt index b7ac4e6..39f3643 100644 --- a/app/src/main/java/com/sn/snfilemanager/feature/pathpicker/presentation/PathPickerFragment.kt +++ b/app/src/main/java/com/sn/snfilemanager/feature/pathpicker/presentation/PathPickerFragment.kt @@ -10,6 +10,8 @@ import androidx.fragment.app.DialogFragment import androidx.fragment.app.viewModels import com.sn.snfilemanager.R import com.sn.snfilemanager.core.extensions.click +import com.sn.snfilemanager.core.extensions.gone +import com.sn.snfilemanager.core.extensions.visible import com.sn.snfilemanager.core.util.RootPath import com.sn.snfilemanager.databinding.FragmentPathPickerBinding import com.sn.snfilemanager.feature.files.data.toFileModel @@ -70,7 +72,9 @@ class PathPickerFragment(private val pathCallback: ((String?) -> Unit)? = null) with(viewModel) { currentPath = directoryPath updateDirectoryList(directoryPath) - adapter?.setItems(getDirectoryList(directoryPath).map { it.toFileModel() }) + val item = getDirectoryList(directoryPath).map { it.toFileModel() } + if (item.isEmpty()) binding.tvEmpty.visible() else binding.tvEmpty.gone() + adapter?.setItems(item) } } diff --git a/app/src/main/res/layout/fragment_path_picker.xml b/app/src/main/res/layout/fragment_path_picker.xml index eb14bcc..5550978 100644 --- a/app/src/main/res/layout/fragment_path_picker.xml +++ b/app/src/main/res/layout/fragment_path_picker.xml @@ -87,4 +87,18 @@ app:layout_constraintStart_toEndOf="@+id/center_view" app:layout_constraintTop_toTopOf="@id/center_view" /> + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_action.xml b/app/src/main/res/menu/menu_action.xml index 452c28f..29ef6ce 100644 --- a/app/src/main/res/menu/menu_action.xml +++ b/app/src/main/res/menu/menu_action.xml @@ -34,5 +34,9 @@ android:title="@string/detail" app:showAsAction="never" /> + \ No newline at end of file diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index ce14d1a..741d4e8 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -27,7 +27,7 @@ Kullanılabilir bellek %s Harici bellek bulunamadı %d öğe seçildi - Hepsini seç + Tümünü seç İptal Resim adını girin Hiçbir şey bulunamadı @@ -54,7 +54,7 @@ Emin misiniz ? Seçilen dosyalar silinecek Yol seçilmedi - "Burada bir şey yok" + Burada bir şey yok Paylaşım yapabilecek uygulama bulunamadı Maksimum dosya sayısını aştınız Tamam @@ -103,4 +103,5 @@ Oluştur Klasör adı Bu ada sahip klasör zaten mevcut + Görüntülenecek bir klasör yok \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d8ffd53..9561236 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -58,7 +58,7 @@ Are you sure ? Selected files will be deleted Path not selected - "There is nothing here " + There is nothing here No application found that can share You have exceeded the maximum number of files OK @@ -68,7 +68,7 @@ Selected Item Count Total Size Number Of Children - Open With + Open with No application found to open the file Last Modified Added Date @@ -107,4 +107,5 @@ Create Folder name The folder with this name already exists + There is no folder to display \ No newline at end of file