From fd4b8f04aaf98da778838854c873ec108586451f Mon Sep 17 00:00:00 2001 From: jacquarg Date: Mon, 14 Mar 2022 18:36:50 +0100 Subject: Update main screen UI, #4963 --- .../features/dashboard/DashboardFragment.kt | 34 ++++---- app/src/main/res/drawable/ic_shield_off.xml | 15 ++++ app/src/main/res/drawable/ic_shield_on.xml | 17 ++++ app/src/main/res/layout/fragment_dashboard.xml | 92 ++++++++++------------ app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/strings.xml | 10 +-- 6 files changed, 93 insertions(+), 77 deletions(-) create mode 100644 app/src/main/res/drawable/ic_shield_off.xml create mode 100644 app/src/main/res/drawable/ic_shield_on.xml (limited to 'app/src/main') diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt index db9dcce..41f6509 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt @@ -19,6 +19,8 @@ package foundation.e.privacycentralapp.features.dashboard import android.content.Intent import android.os.Bundle +import android.text.Html +import android.text.Html.FROM_HTML_MODE_LEGACY import android.view.View import androidx.core.content.ContextCompat.getColor import androidx.fragment.app.activityViewModels @@ -143,21 +145,9 @@ class DashboardFragment : else R.string.dashboard_state_title_off ) - binding.stateSubtitle.text = getString( - if (state.isQuickPrivacyEnabled) R.string.dashboard_state_subtitle_on - else R.string.dashboard_state_subtitle_off - ) - - binding.togglePrivacyCentral.setImageResource( - if (state.isQuickPrivacyEnabled) R.drawable.ic_quick_privacy_on - else R.drawable.ic_quick_privacy_off - ) - binding.stateLabel.setTextColor( - getColor( - requireContext(), - if (state.isQuickPrivacyEnabled) R.color.green_on - else R.color.orange_off - ) + binding.stateIcon.setImageResource( + if (state.isQuickPrivacyEnabled) R.drawable.ic_shield_on + else R.drawable.ic_shield_off ) val trackersEnabled = state.isQuickPrivacyEnabled && state.isAllTrackersBlocked @@ -169,7 +159,7 @@ class DashboardFragment : getColor( requireContext(), if (trackersEnabled) R.color.green_on - else R.color.black_text + else R.color.red_off ) ) @@ -182,7 +172,7 @@ class DashboardFragment : getColor( requireContext(), if (geolocEnabled) R.color.green_on - else R.color.black_text + else R.color.red_off ) ) @@ -203,14 +193,20 @@ class DashboardFragment : getColor( requireContext(), if (ipAddressEnabled) R.color.green_on - else R.color.black_text + else R.color.red_off ) ) state.dayStatistics?.let { graphHolder.data = it } state.dayLabels?.let { graphHolder.labels = it } - binding.graphLegend.text = getString(R.string.dashboard_graph_trackers_legend, state.activeTrackersCount?.toString() ?: "No") + binding.graphLegend.text = Html.fromHtml( + getString( + R.string.dashboard_graph_trackers_legend, + state.activeTrackersCount?.toString() ?: "No" + ), + FROM_HTML_MODE_LEGACY + ) if (state.activeTrackersCount != null && state.trackersCount != null) { binding.amITracked.subTitle = getString(R.string.dashboard_am_i_tracked_subtitle, state.trackersCount, state.activeTrackersCount) diff --git a/app/src/main/res/drawable/ic_shield_off.xml b/app/src/main/res/drawable/ic_shield_off.xml new file mode 100644 index 0000000..f3565d5 --- /dev/null +++ b/app/src/main/res/drawable/ic_shield_off.xml @@ -0,0 +1,15 @@ + + + + diff --git a/app/src/main/res/drawable/ic_shield_on.xml b/app/src/main/res/drawable/ic_shield_on.xml new file mode 100644 index 0000000..39416ed --- /dev/null +++ b/app/src/main/res/drawable/ic_shield_on.xml @@ -0,0 +1,17 @@ + + + + diff --git a/app/src/main/res/layout/fragment_dashboard.xml b/app/src/main/res/layout/fragment_dashboard.xml index 93c1d36..97751a1 100644 --- a/app/src/main/res/layout/fragment_dashboard.xml +++ b/app/src/main/res/layout/fragment_dashboard.xml @@ -21,49 +21,57 @@ android:layout_width="match_parent" android:orientation="vertical" > - - - + + + + + - + + android:layout_marginTop="8dp" + android:layout_marginBottom="16dp"> + android:paddingStart="8dp" + > + android:paddingStart="8dp" + > + android:paddingStart="8dp" + > - - - - - - - - - - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index befe02b..d867b74 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -18,7 +18,7 @@ #14212121 #66FFFFFF - #FC7222 + @lineageos.platform:color/color_default_red1 #169659 #2CC766 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8457c00..f774249 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -3,10 +3,8 @@ Quick Privacy - You are not protected against tracking and surveillance - You are protected against tracking and surveillance - Tap to disable your privacy preferences - Tap to enable your privacy preferences + Your online privacy is protected + Your online privacy is unprotected Trackers: Vulnerable Denied @@ -16,9 +14,9 @@ Real IP address: Exposed Hidden - Trackers\' activity + Personal data leakage Today - %s Trackers + %s trackers have profiled you in the last 24 hours Manage apps\' trackers %1$d app trackers, %2$d active trackers -- cgit v1.2.1