-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fixes #4589 :- The empty screen while no images found in custom picture selector #4858
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
Fixes #4589 :- The empty screen while no images found in custom picture selector #4858
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4858 +/- ##
============================================
- Coverage 50.66% 50.54% -0.12%
+ Complexity 2231 2223 -8
============================================
Files 338 338
Lines 15531 15552 +21
Branches 1358 1361 +3
============================================
- Hits 7869 7861 -8
- Misses 7079 7104 +25
- Partials 583 587 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tested it and it works.
But I don't think this is the best way to handle such exceptions. It would be better if the logic is added in folder and image fragments. There is a handleResult
function in both fragments which could be all you need.
Let me know if you think otherwise.
val lastOpenFolderId: Long = prefs.getLong(FOLDER_ID, 0L) | ||
val lastOpenFolderName: String? = prefs.getString(FOLDER_NAME, null) | ||
val lastItemId: Long = prefs.getLong(ITEM_ID, 0) | ||
lastOpenFolderName?.let { onFolderClick(lastOpenFolderId, it, lastItemId) } | ||
} | ||
|
||
if(isImageGalleryEmpty()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment for this if statement, similar to the one above.
Indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
/** | ||
* Checks for no image in gallery. | ||
*/ | ||
private fun isImageGalleryEmpty(): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be only 4 spaces before private
(same number as before /**
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay got it
app:layout_constraintHorizontal_bias="0.66" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="@+id/fragment_container" | ||
app:layout_constraintVertical_bias="0.481"></LinearLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use /> when element is empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
{ | ||
val linearLayout: LinearLayout = findViewById<View>(R.id.linear_layout_noimage) as LinearLayout | ||
val textView = TextView(this) | ||
textView.text = "No Image Found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use string localization for the text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can I translate this string to all possible languages, translation is done by other capable contributors, creating other issues in the repo , and moreover not all the strings have been localized yet , its still in progress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check how localization is done in other parts of the app. It is the standard Android way, so if you are not familiar with it I recommend doing a tutorial to get the idea. If you find strings in the app UI that are not localized, please create an issue to flag them, thanks a lot! :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-raoul I have seen youtube tutorial which says that I have to manually translate the text in all the different languages by searching in google translator , but there is no automatic translation feature so it will be a very hectic task to manually translate in all languages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@4D17Y4 @nicolas-raoul done
{ | ||
val linearLayout: LinearLayout = findViewById<View>(R.id.linear_layout_noimage) as LinearLayout | ||
val textView = TextView(this) | ||
textView.text = "No Image Found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check how localization is done in other parts of the app. It is the standard Android way, so if you are not familiar with it I recommend doing a tutorial to get the idea. If you find strings in the app UI that are not localized, please create an issue to flag them, thanks a lot! :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
val linearLayout: LinearLayout = findViewById<View>(R.id.linear_layout_noimage) as LinearLayout | ||
val textView = TextView(this) | ||
textView.text = "No Image Found" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-raoul I have seen youtube tutorial which says that I have to manually translate the text in all the different languages by searching in google translator , but there is no automatic translation feature so it will be a very hectic task to manually translate in all languages
/** | ||
* Checks for no image in gallery. | ||
*/ | ||
private fun isImageGalleryEmpty(): Boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay got it
|
@4D17Y4 @nicolas-raoul done in a simpler way as you have said me to do, also the localization issue is also solved.🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on Image fragment.
Image fragment is the one you see when you tap on a specific folder in custom selector. We can do this same thing in folder fragment in case there are no folders.
|
||
<LinearLayout | ||
android:id="@+id/linear_layout_noimage" | ||
android:layout_width="204dp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not hardcode the values. As android screens have varied dimensions it might not look perfect on some screen sizes. Instead you can use match_parent
or wrap_content
that way the layout adjusts depending on the screen size.
|
||
<TextView | ||
android:id="@+id/no_images_found" | ||
android:layout_width="172dp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No hardcoded values.
a problem occured in this brach so I am closing this pull request and creating a fresh one , Sorry for the Inconvenience |
The empty screen while no images found in custom picture selector #4589 is fixed now