Skip to content

Fixes #4589 :- The empty screen while no images found in custom picture selector #4863

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import fr.free.nrw.commons.customselector.ui.adapter.FolderAdapter
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment
import fr.free.nrw.commons.media.MediaClient
import fr.free.nrw.commons.upload.FileProcessor
import kotlinx.android.synthetic.main.fragment_custom_selector.*
import kotlinx.android.synthetic.main.fragment_custom_selector.view.*
import javax.inject.Inject

Expand Down Expand Up @@ -111,6 +112,11 @@ class FolderFragment : CommonsDaggerSupportFragment() {
*/
private fun handleResult(result: Result) {
if(result.status is CallbackStatus.SUCCESS){
val images = result.images
if(images.isNullOrEmpty())
{
empty_text.visibility = View.VISIBLE
}
folders = ImageHelper.folderListFromImages(result.images)
folderAdapter.init(folders)
folderAdapter.notifyDataSetChanged()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import fr.free.nrw.commons.customselector.model.Result
import fr.free.nrw.commons.customselector.ui.adapter.ImageAdapter
import fr.free.nrw.commons.di.CommonsDaggerSupportFragment
import fr.free.nrw.commons.theme.BaseActivity
import kotlinx.android.synthetic.main.fragment_custom_selector.*
import kotlinx.android.synthetic.main.fragment_custom_selector.view.*
import java.io.File
import java.io.FileInputStream
Expand Down Expand Up @@ -141,6 +142,7 @@ class ImageFragment: CommonsDaggerSupportFragment() {
if(result.status is CallbackStatus.SUCCESS){
val images = result.images
if(images.isNotEmpty()) {
empty_text.visibility = View.GONE
filteredImages = ImageHelper.filterImages(images, bucketId)
imageAdapter.init(filteredImages)
selectorRV?.let {
Expand All @@ -152,6 +154,7 @@ class ImageFragment: CommonsDaggerSupportFragment() {
}
}
else{
empty_text.visibility = View.VISIBLE
selectorRV?.let{
it.visibility = View.GONE
}
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/res/layout/fragment_custom_selector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
android:id="@+id/empty_text"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:textSize="@dimen/normal_text"
android:textSize="20sp"
android:padding="@dimen/standard_gap"
android:text="@string/custom_selector_empty_text"
android:text="@string/no_images_found"
android:visibility="gone"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />


<ProgressBar
Expand Down