From eef23f0c245a1cc5154a34f243769d7ebde719b6 Mon Sep 17 00:00:00 2001 From: Neel Doshi Date: Mon, 2 Dec 2024 01:07:41 +0530 Subject: [PATCH] Fixed the badge issue & made the badge clickable --- app/build.gradle | 2 +- .../commons/profile/achievements/AchievementsFragment.kt | 9 ++++----- app/src/main/res/layout/fragment_achievements.xml | 8 ++++---- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 468255d38c..b83f2b01ba 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,7 +47,7 @@ dependencies { implementation 'com.jakewharton.timber:timber:4.7.1' implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0' - implementation "com.google.android.material:material:1.9.0" + implementation "com.google.android.material:material:1.12.0" implementation 'com.karumi:dexter:5.0.0' implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' diff --git a/app/src/main/java/fr/free/nrw/commons/profile/achievements/AchievementsFragment.kt b/app/src/main/java/fr/free/nrw/commons/profile/achievements/AchievementsFragment.kt index 8194bd96b9..7f417b0a8f 100644 --- a/app/src/main/java/fr/free/nrw/commons/profile/achievements/AchievementsFragment.kt +++ b/app/src/main/java/fr/free/nrw/commons/profile/achievements/AchievementsFragment.kt @@ -68,9 +68,9 @@ class AchievementsFragment : CommonsDaggerSupportFragment(){ binding.imagesUploadInfoIcon.setOnClickListener { showUploadInfo() } binding.imagesRevertedInfoIcon.setOnClickListener { showRevertedInfo() } binding.imagesUsedByWikiInfoIcon.setOnClickListener { showUsedByWikiInfo() } - //binding.imagesNearbyInfoIcon.setOnClickListener { showImagesViaNearbyInfo() } - //binding.imagesFeaturedInfoIcon.setOnClickListener { showFeaturedImagesInfo() } - //binding.thanksReceivedInfoIcon.setOnClickListener { showThanksReceivedInfo() } + binding.wikidataEditsIcon.setOnClickListener { showImagesViaNearbyInfo() } + binding.featuredImageIcon.setOnClickListener { showFeaturedImagesInfo() } + binding.thanksImageIcon.setOnClickListener { showThanksReceivedInfo() } binding.qualityImageIcon.setOnClickListener { showQualityImagesInfo() } // DisplayMetrics used to fetch the size of the screen @@ -345,7 +345,6 @@ class AchievementsFragment : CommonsDaggerSupportFragment(){ * and assign badge and level. Also stores the achievements level of the user in BasicKvStore to display in menu * @param achievements */ -// @OptIn(ExperimentalBadgeUtils::class) private fun inflateAchievements(achievements: Achievements) { // Thanks Received Badge @@ -412,7 +411,7 @@ class AchievementsFragment : CommonsDaggerSupportFragment(){ badgeDrawable.badgeGravity = badgeGravity badgeDrawable.badgeTextColor = badgeTextColor badgeDrawable.backgroundColor = backgroundColor - BadgeUtils.attachBadgeDrawable(badgeDrawable, binding.wikidataEditsIcon) + BadgeUtils.attachBadgeDrawable(badgeDrawable, view) view.getViewTreeObserver().removeOnGlobalLayoutListener(this) } }) diff --git a/app/src/main/res/layout/fragment_achievements.xml b/app/src/main/res/layout/fragment_achievements.xml index aceff85d10..ab8afe6a15 100644 --- a/app/src/main/res/layout/fragment_achievements.xml +++ b/app/src/main/res/layout/fragment_achievements.xml @@ -396,7 +396,7 @@ android:id="@+id/wikidata_edits_icon" android:layout_width="@dimen/dimen_40" android:layout_height="@dimen/dimen_40" - android:layout_marginEnd="@dimen/medium_width" + android:layout_marginEnd="@dimen/large_gap" app:srcCompat="@drawable/ic_custom_map_marker" /> @@ -404,7 +404,7 @@ android:id="@+id/featured_image_icon" android:layout_width="@dimen/dimen_40" android:layout_height="@dimen/dimen_40" - android:layout_marginEnd="@dimen/medium_width" + android:layout_marginEnd="@dimen/large_gap" app:srcCompat="@drawable/featured" /> @@ -412,7 +412,7 @@ android:id="@+id/quality_image_icon" android:layout_width="@dimen/dimen_40" android:layout_height="@dimen/dimen_40" - android:layout_marginEnd="@dimen/medium_width" + android:layout_marginEnd="@dimen/large_gap" app:srcCompat="@drawable/ic_quality_images_logo" /> @@ -421,7 +421,7 @@ android:layout_width="@dimen/dimen_40" android:layout_height="@dimen/dimen_40" - android:layout_marginEnd="@dimen/medium_width" + android:layout_marginEnd="@dimen/large_gap" app:srcCompat="@drawable/ic_thanks" />