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 ++++++++++------------ 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'app/src/main/java/foundation') 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) -- cgit v1.2.1