From 67de1a62cba98c4acb664252f39b3bcac0de792a Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:01:32 +0530 Subject: [PATCH 01/15] issue_656: change layout for "Privacy analysis" --- .../main/res/drawable/ic_arrow_forward.xml | 4 +- .../layout/fragment_application_privacy.xml | 42 +++++-------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/app/src/main/res/drawable/ic_arrow_forward.xml b/app/src/main/res/drawable/ic_arrow_forward.xml index 9ca871051..0a075dffb 100644 --- a/app/src/main/res/drawable/ic_arrow_forward.xml +++ b/app/src/main/res/drawable/ic_arrow_forward.xml @@ -17,8 +17,8 @@ --> - - - - - + android:textSize="15sp" + android:drawableEnd="@drawable/ic_arrow_forward" /> + android:textSize="15sp" + android:drawableEnd="@drawable/ic_arrow_forward" /> - - -- GitLab From 4cdf95a96a36ccd18dd1606bbc9f6a19fdcaf5cd Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:14:44 +0530 Subject: [PATCH 02/15] issue_656: add loading progress bar for "Privacy analysis" --- .../res/layout/fragment_application_privacy.xml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_application_privacy.xml b/app/src/main/res/layout/fragment_application_privacy.xml index 0a81559cf..62c4f402b 100644 --- a/app/src/main/res/layout/fragment_application_privacy.xml +++ b/app/src/main/res/layout/fragment_application_privacy.xml @@ -52,7 +52,8 @@ android:text="@string/permissions" android:textColor="?android:textColorPrimary" android:textSize="15sp" - android:drawableEnd="@drawable/ic_arrow_forward" /> + android:drawableEnd="@drawable/ic_arrow_forward" + android:visibility="invisible" /> + android:drawableEnd="@drawable/ic_arrow_forward" + android:visibility="invisible" /> + + -- GitLab From 0533a44381a0bab65f482a586c894ae5017a3b66 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:32:29 +0530 Subject: [PATCH 03/15] issue_656: change privacy score layout to add loading progress bar --- .../layout/fragment_application_ratings.xml | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/fragment_application_ratings.xml b/app/src/main/res/layout/fragment_application_ratings.xml index 4c255c3c9..0562ddb64 100644 --- a/app/src/main/res/layout/fragment_application_ratings.xml +++ b/app/src/main/res/layout/fragment_application_ratings.xml @@ -69,7 +69,7 @@ app:drawableStartCompat="@drawable/ic_star" /> - + + + android:textSize="25sp" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@+id/materialTextView2" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/loadingBar" + app:layout_constraintTop_toTopOf="parent" /> - + app:drawableStartCompat="@drawable/ic_lock" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> + -- GitLab From 7d802e16594116894f3ce134167d551e3497b02c Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:38:52 +0530 Subject: [PATCH 04/15] issue_656: function togglePrivacyInfo(Boolean) for all privacy info layouts --- .../e/apps/application/ApplicationFragment.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index 9dac14ef5..51aa2d266 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -749,6 +749,29 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { } } + /** + * It takes fair amount of time to load trackers information after loading app details. + * Till trackers are loaded, we should show loading icon for privacy info. + * + * Issue: https://gitlab.e.foundation/e/os/backlog/-/issues/656 + * + * @param visible Boolean to toggle visibility of loading progress bar or the + * layout contents. + */ + private fun togglePrivacyInfo(visible: Boolean) { + binding.privacyInclude.run { + (if (visible) View.VISIBLE else View.INVISIBLE).run { + appPermissions.visibility = this + appTrackers.visibility = this + } + loadingBar.isVisible = !visible + } + binding.ratingsInclude.appPrivacyScoreLayout.run { + findViewById(R.id.loadingBar).isVisible = !visible + findViewById(R.id.appPrivacyScore).isVisible = visible + } + } + override fun onDestroyView() { super.onDestroyView() _binding?.recyclerView?.adapter = null -- GitLab From 3e28b53abd5baacb3bb2166351d88018fa1fd0d2 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:41:06 +0530 Subject: [PATCH 05/15] issue_656: fix waiting for trackers to load to show app details. --- .../foundation/e/apps/application/ApplicationFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index 51aa2d266..babf1386d 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -30,6 +30,7 @@ import android.widget.RelativeLayout import androidx.core.content.ContextCompat import androidx.core.graphics.BlendModeColorFilterCompat import androidx.core.graphics.BlendModeCompat +import androidx.core.view.isVisible import androidx.fragment.app.activityViewModels import androidx.fragment.app.viewModels import androidx.lifecycle.lifecycleScope @@ -176,6 +177,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { val it = resultPair.first dismissTimeoutDialog() + togglePrivacyInfo(false) isDetailsLoaded = true if (applicationViewModel.appStatus.value == null) { @@ -207,6 +209,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { mainActivityViewModel.downloadList.observe(viewLifecycleOwner) { list -> applicationViewModel.updateApplicationStatus(list) } + stopLoadingUI() } private fun updateAppDescriptionText(it: FusedApp) { @@ -718,7 +721,6 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { private fun fetchAppTracker(fusedApp: FusedApp) { privacyInfoViewModel.getAppPrivacyInfoLiveData(fusedApp).observe(viewLifecycleOwner) { updatePrivacyScore() - stopLoadingUI() } } @@ -747,6 +749,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { ) appPrivacyScore.compoundDrawablePadding = 15 } + togglePrivacyInfo(true) } /** -- GitLab From 506491f3d606a54757aa6588d3641ece18679293 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:01:32 +0530 Subject: [PATCH 06/15] issue_656: change layout for "Privacy analysis" --- .../main/res/drawable/ic_arrow_forward.xml | 4 +- .../layout/fragment_application_privacy.xml | 42 +++++-------------- 2 files changed, 13 insertions(+), 33 deletions(-) diff --git a/app/src/main/res/drawable/ic_arrow_forward.xml b/app/src/main/res/drawable/ic_arrow_forward.xml index 9ca871051..0a075dffb 100644 --- a/app/src/main/res/drawable/ic_arrow_forward.xml +++ b/app/src/main/res/drawable/ic_arrow_forward.xml @@ -17,8 +17,8 @@ --> - - - - - + android:textSize="15sp" + android:drawableEnd="@drawable/ic_arrow_forward" /> + android:textSize="15sp" + android:drawableEnd="@drawable/ic_arrow_forward" /> - - -- GitLab From e3965e1d07a4173eb3ae381cee7c81b3c8077e38 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:14:44 +0530 Subject: [PATCH 07/15] issue_656: add loading progress bar for "Privacy analysis" --- .../res/layout/fragment_application_privacy.xml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/fragment_application_privacy.xml b/app/src/main/res/layout/fragment_application_privacy.xml index 0a81559cf..62c4f402b 100644 --- a/app/src/main/res/layout/fragment_application_privacy.xml +++ b/app/src/main/res/layout/fragment_application_privacy.xml @@ -52,7 +52,8 @@ android:text="@string/permissions" android:textColor="?android:textColorPrimary" android:textSize="15sp" - android:drawableEnd="@drawable/ic_arrow_forward" /> + android:drawableEnd="@drawable/ic_arrow_forward" + android:visibility="invisible" /> + android:drawableEnd="@drawable/ic_arrow_forward" + android:visibility="invisible" /> + + -- GitLab From fd4f3f0ab6b9221bafabb702b011671f22fb45c8 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:32:29 +0530 Subject: [PATCH 08/15] issue_656: change privacy score layout to add loading progress bar --- .../layout/fragment_application_ratings.xml | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/layout/fragment_application_ratings.xml b/app/src/main/res/layout/fragment_application_ratings.xml index 4c255c3c9..0562ddb64 100644 --- a/app/src/main/res/layout/fragment_application_ratings.xml +++ b/app/src/main/res/layout/fragment_application_ratings.xml @@ -69,7 +69,7 @@ app:drawableStartCompat="@drawable/ic_star" /> - + + + android:textSize="25sp" + android:visibility="gone" + app:layout_constraintBottom_toTopOf="@+id/materialTextView2" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toEndOf="@+id/loadingBar" + app:layout_constraintTop_toTopOf="parent" /> - + app:drawableStartCompat="@drawable/ic_lock" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" /> + -- GitLab From 1269b8a07430280122797785ae87dfbb0a42cf8a Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:38:52 +0530 Subject: [PATCH 09/15] issue_656: function togglePrivacyInfo(Boolean) for all privacy info layouts --- .../e/apps/application/ApplicationFragment.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index 61ca82e17..754baa83f 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -763,6 +763,29 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { } } + /** + * It takes fair amount of time to load trackers information after loading app details. + * Till trackers are loaded, we should show loading icon for privacy info. + * + * Issue: https://gitlab.e.foundation/e/os/backlog/-/issues/656 + * + * @param visible Boolean to toggle visibility of loading progress bar or the + * layout contents. + */ + private fun togglePrivacyInfo(visible: Boolean) { + binding.privacyInclude.run { + (if (visible) View.VISIBLE else View.INVISIBLE).run { + appPermissions.visibility = this + appTrackers.visibility = this + } + loadingBar.isVisible = !visible + } + binding.ratingsInclude.appPrivacyScoreLayout.run { + findViewById(R.id.loadingBar).isVisible = !visible + findViewById(R.id.appPrivacyScore).isVisible = visible + } + } + override fun onDestroyView() { super.onDestroyView() _binding?.recyclerView?.adapter = null -- GitLab From 95eb5269a766cefae309efb010de207e143cb674 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 27 Sep 2022 22:41:06 +0530 Subject: [PATCH 10/15] issue_656: fix waiting for trackers to load to show app details. --- .../foundation/e/apps/application/ApplicationFragment.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index 754baa83f..32384af0b 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -177,6 +177,8 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { */ val it = resultPair.first + togglePrivacyInfo(false) + isDetailsLoaded = true if (applicationViewModel.appStatus.value == null) { applicationViewModel.appStatus.value = it.status @@ -211,6 +213,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { mainActivityViewModel.downloadList.observe(viewLifecycleOwner) { list -> applicationViewModel.updateApplicationStatus(list) } + stopLoadingUI() } private fun updateAppDescriptionText(it: FusedApp) { @@ -732,7 +735,6 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { private fun fetchAppTracker(fusedApp: FusedApp) { privacyInfoViewModel.getAppPrivacyInfoLiveData(fusedApp).observe(viewLifecycleOwner) { updatePrivacyScore() - stopLoadingUI() } } @@ -761,6 +763,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { ) appPrivacyScore.compoundDrawablePadding = 15 } + togglePrivacyInfo(true) } /** -- GitLab From fc5ec512dafc014868ea46973a94ef652274e8e5 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 2 Nov 2022 17:26:55 +0530 Subject: [PATCH 11/15] Issue 656: changed handling some visibility from "gone" to "invisible" --- .../foundation/e/apps/application/ApplicationFragment.kt | 9 ++++----- app/src/main/res/layout/fragment_application_ratings.xml | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index 32384af0b..cdb73320f 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -776,16 +776,15 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { * layout contents. */ private fun togglePrivacyInfo(visible: Boolean) { + val visibility = if (visible) View.VISIBLE else View.INVISIBLE binding.privacyInclude.run { - (if (visible) View.VISIBLE else View.INVISIBLE).run { - appPermissions.visibility = this - appTrackers.visibility = this - } + appPermissions.visibility = visibility + appTrackers.visibility = visibility loadingBar.isVisible = !visible } binding.ratingsInclude.appPrivacyScoreLayout.run { findViewById(R.id.loadingBar).isVisible = !visible - findViewById(R.id.appPrivacyScore).isVisible = visible + findViewById(R.id.appPrivacyScore).visibility = visibility } } diff --git a/app/src/main/res/layout/fragment_application_ratings.xml b/app/src/main/res/layout/fragment_application_ratings.xml index 0562ddb64..c372c970e 100644 --- a/app/src/main/res/layout/fragment_application_ratings.xml +++ b/app/src/main/res/layout/fragment_application_ratings.xml @@ -98,7 +98,7 @@ android:text="@string/not_available" android:textColor="?android:textColorPrimary" android:textSize="25sp" - android:visibility="gone" + android:visibility="invisible" app:layout_constraintBottom_toTopOf="@+id/materialTextView2" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toEndOf="@+id/loadingBar" -- GitLab From d389f0b15ce9910bc8e34b91aebfbafcba5fefa9 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 2 Nov 2022 17:36:26 +0530 Subject: [PATCH 12/15] Issue 656: fix off-centered loading icon --- app/src/main/res/layout/fragment_application_ratings.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/fragment_application_ratings.xml b/app/src/main/res/layout/fragment_application_ratings.xml index c372c970e..f77206a15 100644 --- a/app/src/main/res/layout/fragment_application_ratings.xml +++ b/app/src/main/res/layout/fragment_application_ratings.xml @@ -86,8 +86,7 @@ android:layout_height="25dp" android:visibility="visible" app:layout_constraintBottom_toBottomOf="@+id/appPrivacyScore" - app:layout_constraintEnd_toStartOf="@+id/appPrivacyScore" - app:layout_constraintHorizontal_chainStyle="packed" + app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@+id/appPrivacyScore" /> @@ -101,7 +100,7 @@ android:visibility="invisible" app:layout_constraintBottom_toTopOf="@+id/materialTextView2" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintStart_toEndOf="@+id/loadingBar" + app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> Date: Wed, 2 Nov 2022 19:14:38 +0600 Subject: [PATCH 13/15] removed usage of findviewbyid --- .../e/apps/application/ApplicationFragment.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index cdb73320f..24b298c35 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -386,7 +386,13 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { /* Remove trailing slash (if present) that can become part of the packageName */ val packageName = args.packageName.run { if (endsWith('/')) dropLast(1) else this } - applicationViewModel.loadData(args.id, packageName, origin, isFdroidDeepLink, authObjectList) { + applicationViewModel.loadData( + args.id, + packageName, + origin, + isFdroidDeepLink, + authObjectList + ) { clearAndRestartGPlayLogin() true } @@ -707,7 +713,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { return } val downloadedSize = "${ - Formatter.formatFileSize(requireContext(), progressResult.second).substringBefore(" MB") + Formatter.formatFileSize(requireContext(), progressResult.second).substringBefore(" MB") }/${Formatter.formatFileSize(requireContext(), progressResult.first)}" val progressPercentage = ((progressResult.second / progressResult.first.toDouble()) * 100f).toInt() @@ -782,10 +788,8 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { appTrackers.visibility = visibility loadingBar.isVisible = !visible } - binding.ratingsInclude.appPrivacyScoreLayout.run { - findViewById(R.id.loadingBar).isVisible = !visible - findViewById(R.id.appPrivacyScore).visibility = visibility - } + binding.ratingsInclude.loadingBar.isVisible = !visible + binding.ratingsInclude.appPrivacyScore.visibility = visibility } override fun onDestroyView() { -- GitLab From a183ff0e3cefaa9a484a7e568fa54bd55415210b Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 2 Nov 2022 19:23:12 +0530 Subject: [PATCH 14/15] Issue 656: Rename togglePrivacyInfo to togglePrivacyInfoVisibility --- .../foundation/e/apps/application/ApplicationFragment.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index 24b298c35..560f66590 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -177,7 +177,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { */ val it = resultPair.first - togglePrivacyInfo(false) + togglePrivacyInfoVisibility(false) isDetailsLoaded = true if (applicationViewModel.appStatus.value == null) { @@ -769,7 +769,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { ) appPrivacyScore.compoundDrawablePadding = 15 } - togglePrivacyInfo(true) + togglePrivacyInfoVisibility(true) } /** @@ -781,7 +781,7 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { * @param visible Boolean to toggle visibility of loading progress bar or the * layout contents. */ - private fun togglePrivacyInfo(visible: Boolean) { + private fun togglePrivacyInfoVisibility(visible: Boolean) { val visibility = if (visible) View.VISIBLE else View.INVISIBLE binding.privacyInclude.run { appPermissions.visibility = visibility -- GitLab From d03e5443053787015705a23a8976f326c50387cc Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 2 Nov 2022 20:14:02 +0530 Subject: [PATCH 15/15] Issue 656: Remove comments --- .../foundation/e/apps/application/ApplicationFragment.kt | 9 --------- 1 file changed, 9 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt index 560f66590..c575c1464 100644 --- a/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/application/ApplicationFragment.kt @@ -772,15 +772,6 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { togglePrivacyInfoVisibility(true) } - /** - * It takes fair amount of time to load trackers information after loading app details. - * Till trackers are loaded, we should show loading icon for privacy info. - * - * Issue: https://gitlab.e.foundation/e/os/backlog/-/issues/656 - * - * @param visible Boolean to toggle visibility of loading progress bar or the - * layout contents. - */ private fun togglePrivacyInfoVisibility(visible: Boolean) { val visibility = if (visible) View.VISIBLE else View.INVISIBLE binding.privacyInclude.run { -- GitLab