Skip to content

Commit

Permalink
Merge pull request #47 from emreesen27/develop
Browse files Browse the repository at this point in the history
v1.0.0-beta5 is completed
  • Loading branch information
emreesen27 authored Apr 8, 2024
2 parents d8da390 + f1fd2c7 commit 58dfb5b
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v1.0.0-beta5 (08.04.2024)

* The 'Select All' feature added
* Notification behavior added
* UI improvement

## v1.0.0-beta4 (29.02.2024)

* Home screen menu arrangement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ class FilesListFragment :
R.id.action_detail -> {
actionDetail()
}

R.id.action_select_all -> {
adapter?.selectAll()
}
}

return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class MediaFragment :
R.id.action_detail -> {
actionDetail()
}

R.id.action_select_all -> {
adapter?.selectAll()
}
}

return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/dialog_create_directory.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="@color/bg_color">

<com.google.android.material.textview.MaterialTextView
android:id="@+id/tv_title"
Expand Down Expand Up @@ -35,6 +36,7 @@
android:fontFamily="@font/adamina"
android:hint="@string/folder_name"
android:padding="@dimen/_8sdp"
android:textColor="@color/first_text_color"
android:textColorHint="@color/first_text_color" />

</com.google.android.material.textfield.TextInputLayout>
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/res/layout/fragment_path_picker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,18 @@
app:layout_constraintStart_toEndOf="@+id/center_view"
app:layout_constraintTop_toTopOf="@id/center_view" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/tv_empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="@font/adamina"
android:text="@string/no_folder"
android:textAlignment="center"
android:textColor="@color/first_text_color"
android:textSize="@dimen/_13ssp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
4 changes: 4 additions & 0 deletions app/src/main/res/menu/menu_action.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@
android:title="@string/detail"
app:showAsAction="never" />

<item
android:id="@+id/action_select_all"
android:title="@string/select_all"
app:showAsAction="never" />

</menu>
5 changes: 3 additions & 2 deletions app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<string name="available_storage">Kullanılabilir bellek %s</string>
<string name="no_external_storage">Harici bellek bulunamadı</string>
<string name="selected_count">%d öğe seçildi</string>
<string name="select_all">Hepsini seç</string>
<string name="select_all">Tümünü seç</string>
<string name="cancel">İptal</string>
<string name="search_image_hint">Resim adını girin</string>
<string name="nothing_found">Hiçbir şey bulunamadı</string>
Expand All @@ -54,7 +54,7 @@
<string name="are_you_sure">Emin misiniz ?</string>
<string name="delete_warning">Seçilen dosyalar silinecek</string>
<string name="path_not_selected">Yol seçilmedi</string>
<string name="no_item">"Burada bir şey yok"</string>
<string name="no_item">Burada bir şey yok</string>
<string name="no_app_share">Paylaşım yapabilecek uygulama bulunamadı</string>
<string name="max_share_file">Maksimum dosya sayısını aştınız</string>
<string name="ok">Tamam</string>
Expand Down Expand Up @@ -103,4 +103,5 @@
<string name="create">Oluştur</string>
<string name="folder_name">Klasör adı</string>
<string name="folder_exists_warning">Bu ada sahip klasör zaten mevcut</string>
<string name="no_folder">Görüntülenecek bir klasör yok</string>
</resources>
5 changes: 3 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<string name="are_you_sure">Are you sure ?</string>
<string name="delete_warning">Selected files will be deleted</string>
<string name="path_not_selected">Path not selected</string>
<string name="no_item">"There is nothing here "</string>
<string name="no_item">There is nothing here</string>
<string name="no_app_share">No application found that can share</string>
<string name="max_share_file">You have exceeded the maximum number of files</string>
<string name="ok">OK</string>
Expand All @@ -68,7 +68,7 @@
<string name="selected_item_count">Selected Item Count</string>
<string name="total_size">Total Size</string>
<string name="number_of_children">Number Of Children</string>
<string name="open_with">Open With</string>
<string name="open_with">Open with</string>
<string name="no_app_open_with">No application found to open the file</string>
<string name="last_modified">Last Modified</string>
<string name="added_date">Added Date</string>
Expand Down Expand Up @@ -107,4 +107,5 @@
<string name="create">Create</string>
<string name="folder_name">Folder name</string>
<string name="folder_exists_warning">The folder with this name already exists</string>
<string name="no_folder">There is no folder to display</string>
</resources>

0 comments on commit 58dfb5b

Please sign in to comment.