From a8e38f43292e87c44dc3e179183d894fef454d34 Mon Sep 17 00:00:00 2001 From: Sujal Date: Sun, 23 Feb 2025 19:06:07 +0530 Subject: [PATCH 1/3] Updated Icon & Added Animation for Nearby (#6201) * Applied better animation in nearby * Refactor: Reduce Duration of Rotate Animation Decreased the duration of the rotate animation from 1000ms to 500ms in `rotate.xml`, resulting in a faster rotation speed. --- .../nearby/fragments/NearbyParentFragment.kt | 44 ++++++++++++++++- app/src/main/res/anim/rotate.xml | 10 ++++ app/src/main/res/drawable/loading_icon.xml | 49 +++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 app/src/main/res/anim/rotate.xml create mode 100644 app/src/main/res/drawable/loading_icon.xml diff --git a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt index 12ab600b2..c25efa2da 100644 --- a/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt +++ b/app/src/main/java/fr/free/nrw/commons/nearby/fragments/NearbyParentFragment.kt @@ -46,6 +46,9 @@ import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.LinearLayoutManager import com.bumptech.glide.Glide +import com.bumptech.glide.load.engine.GlideException +import com.bumptech.glide.request.RequestListener +import com.bumptech.glide.request.target.Target import com.google.android.material.bottomsheet.BottomSheetBehavior import com.google.android.material.bottomsheet.BottomSheetBehavior.BottomSheetCallback import com.google.android.material.snackbar.Snackbar @@ -134,6 +137,7 @@ import java.util.UUID import java.util.concurrent.TimeUnit import javax.inject.Inject import javax.inject.Named +import javax.sql.DataSource import kotlin.concurrent.Volatile @@ -2353,12 +2357,50 @@ class NearbyParentFragment : CommonsDaggerSupportFragment(), selectedPlace?.pic?.substringAfterLast("/")?.takeIf { it.isNotEmpty() }?.let { imageName -> Glide.with(binding!!.bottomSheetDetails.icon.context) .clear(binding!!.bottomSheetDetails.icon) + + val loadingDrawable = ContextCompat.getDrawable( + binding!!.bottomSheetDetails.icon.context, + R.drawable.loading_icon + ) + val animation = AnimationUtils.loadAnimation( + binding!!.bottomSheetDetails.icon.context, + R.anim.rotate + ) + Glide.with(binding!!.bottomSheetDetails.icon.context) .load("https://commons.wikimedia.org/wiki/Special:Redirect/file/$imageName?width=25") - .placeholder(fr.free.nrw.commons.R.drawable.ic_refresh_24dp_nearby) + .placeholder(loadingDrawable) .error(selectedPlace!!.label.icon) + .listener(object : RequestListener { + override fun onLoadFailed( + e: GlideException?, + model: Any?, + target: Target, + isFirstResource: Boolean + ): Boolean { + binding!!.bottomSheetDetails.icon.clearAnimation() + return false + } + + override fun onResourceReady( + resource: Drawable, + model: Any, + target: Target?, + dataSource: com.bumptech.glide.load.DataSource, + isFirstResource: Boolean + ): Boolean { + binding!!.bottomSheetDetails.icon.clearAnimation() + return false + } + }) .into(binding!!.bottomSheetDetails.icon) + if (binding!!.bottomSheetDetails.icon.drawable != null && binding!!.bottomSheetDetails.icon.drawable.constantState == loadingDrawable?.constantState) { + binding!!.bottomSheetDetails.icon.startAnimation(animation) + } else { + binding!!.bottomSheetDetails.icon.clearAnimation() + } + binding!!.bottomSheetDetails.icon.setOnClickListener { handleMediaClick(imageName) } diff --git a/app/src/main/res/anim/rotate.xml b/app/src/main/res/anim/rotate.xml new file mode 100644 index 000000000..8c42dc3e5 --- /dev/null +++ b/app/src/main/res/anim/rotate.xml @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/app/src/main/res/drawable/loading_icon.xml b/app/src/main/res/drawable/loading_icon.xml new file mode 100644 index 000000000..babc0da6f --- /dev/null +++ b/app/src/main/res/drawable/loading_icon.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 50eb13a85057b1885cc6b78daacc7825283b3801 Mon Sep 17 00:00:00 2001 From: Parneet Singh <111801812+parneet-guraya@users.noreply.github.com> Date: Sun, 23 Feb 2025 19:06:52 +0530 Subject: [PATCH 2/3] delete file (#6205) Signed-off-by: parneet-guraya --- app/.attach_pid781771 | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/.attach_pid781771 diff --git a/app/.attach_pid781771 b/app/.attach_pid781771 deleted file mode 100644 index e69de29bb..000000000 From 71d3d12020f943f9736f9844520eff6ebbf50f88 Mon Sep 17 00:00:00 2001 From: Nicolas Raoul Date: Mon, 24 Feb 2025 10:56:41 +0900 Subject: [PATCH 3/3] limit to the best issues for newcomers --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cefb267aa..d7e9d334b 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ This software is open source, licensed under the [Apache License 2.0][10]. [1]: https://play.google.com/store/apps/details?id=fr.free.nrw.commons [2]: https://commons-app.github.io/ -[3]: https://github.com/commons-app/apps-android-commons/issues +[3]: https://github.com/commons-app/apps-android-commons/issues?q=is%3Aopen+is%3Aissue+no%3Aassignee+-label%3Adebated+label%3Abug+-label%3A%22low+priority%22+-label%3Aupstream [4]: https://github.com/commons-app/commons-app-documentation/blob/master/android/README.md#-android-documentation [5]: https://github.com/commons-app/commons-app-documentation/blob/master/android/README.md#-user-documentation