mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Code Enhancement (Explore Map) (#6293)
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
Some checks are pending
Android CI / Run tests and generate APK (push) Waiting to run
* Exclude past locations (P585) from Nearby query * "Send" button text should be white * Custom picker: logic * Revert back changes * Enhancement :- Explore Map information * Enhancement :- Explore Map information * Style --------- Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
This commit is contained in:
parent
ed42d85f67
commit
7479d96675
2 changed files with 18 additions and 6 deletions
|
|
@ -348,12 +348,12 @@ class ImageAdapter(
|
||||||
scope.launch(ioDispatcher) {
|
scope.launch(ioDispatcher) {
|
||||||
val imageSHA1 = imageLoader.getSHA1(image, defaultDispatcher)
|
val imageSHA1 = imageLoader.getSHA1(image, defaultDispatcher)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
if (holder.isItemUploaded()) {
|
if (holder.isItemUploaded()) {
|
||||||
Toast.makeText(context, R.string.custom_selector_already_uploaded_image_text, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.custom_selector_already_uploaded_image_text, Toast.LENGTH_SHORT).show()
|
||||||
return@withContext
|
return@withContext
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imageSHA1.isNotEmpty() && imageLoader.getFromUploaded(imageSHA1) != null) {
|
if (imageSHA1.isNotEmpty() && imageLoader.getFromUploaded(imageSHA1) != null) {
|
||||||
holder.itemUploaded()
|
holder.itemUploaded()
|
||||||
Toast.makeText(context, R.string.custom_selector_already_uploaded_image_text, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.custom_selector_already_uploaded_image_text, Toast.LENGTH_SHORT).show()
|
||||||
return@withContext
|
return@withContext
|
||||||
|
|
@ -369,7 +369,7 @@ class ImageAdapter(
|
||||||
selectedImages.add(image)
|
selectedImages.add(image)
|
||||||
notifyItemChanged(position, ImageSelectedOrUpdated())
|
notifyItemChanged(position, ImageSelectedOrUpdated())
|
||||||
|
|
||||||
imageSelectListener.onSelectedImagesChanged(selectedImages, numberOfSelectedImagesMarkedAsNotForUpload)
|
imageSelectListener.onSelectedImagesChanged(selectedImages, numberOfSelectedImagesMarkedAsNotForUpload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -717,8 +717,20 @@ public class ExploreMapFragment extends CommonsDaggerSupportFragment
|
||||||
authorUser = Html.fromHtml(authorUser, Html.FROM_HTML_MODE_LEGACY).toString();
|
authorUser = Html.fromHtml(authorUser, Html.FROM_HTML_MODE_LEGACY).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
OverlayItem item = new OverlayItem(nearbyBaseMarker.getPlace().name,
|
String title = nearbyBaseMarker.getPlace().name;
|
||||||
authorUser, point);
|
// Remove "File:" if present at start
|
||||||
|
if (title.startsWith("File:")) {
|
||||||
|
title = title.substring(5);
|
||||||
|
}
|
||||||
|
// Remove extensions like .jpg, .jpeg, .png, .svg (case insensitive)
|
||||||
|
title = title.replaceAll("(?i)\\.(jpg|jpeg|png|svg)$", "");
|
||||||
|
title = title.replace("_", " ");
|
||||||
|
//Truncate if too long because it doesn't fit the screen
|
||||||
|
if (title.length() > 43) {
|
||||||
|
title = title.substring(0, 40) + "…";
|
||||||
|
}
|
||||||
|
|
||||||
|
OverlayItem item = new OverlayItem(title, authorUser, point);
|
||||||
item.setMarker(d);
|
item.setMarker(d);
|
||||||
items.add(item);
|
items.add(item);
|
||||||
ItemizedOverlayWithFocus overlay = new ItemizedOverlayWithFocus(items,
|
ItemizedOverlayWithFocus overlay = new ItemizedOverlayWithFocus(items,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue