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

* no image found

* old removed

* new way

* minor changes

* reqeusted changes done
This commit is contained in:
RISHAV GUPTA 2022-03-07 15:04:03 +05:30 committed by GitHub
parent 824a82ad2a
commit c02d569468
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 4 deletions

View file

@ -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
@ -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()

View file

@ -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
@ -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 {
@ -152,6 +154,7 @@ class ImageFragment: CommonsDaggerSupportFragment() {
}
}
else{
empty_text.visibility = View.VISIBLE
selectorRV?.let{
it.visibility = View.GONE
}

View file

@ -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