diff options
-rw-r--r-- | app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt | 34 | ||||
-rw-r--r-- | app/src/main/res/drawable/ic_shield_off.xml | 15 | ||||
-rw-r--r-- | app/src/main/res/drawable/ic_shield_on.xml | 17 | ||||
-rw-r--r-- | app/src/main/res/layout/fragment_dashboard.xml | 92 | ||||
-rw-r--r-- | app/src/main/res/values/colors.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/values/strings.xml | 10 |
6 files changed, 93 insertions, 77 deletions
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 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24"> + <path + android:pathData="M4,11V5.6499L12,2.0943L20,5.6499V11C20,16.0434 16.556,20.7257 12,21.9673C7.444,20.7257 4,16.0434 4,11Z" + android:strokeWidth="2" + android:fillColor="#00000000" + android:strokeColor="#F8432E"/> + <path + android:pathData="M15.1213,10.1213L15.8284,9.4142L14.4142,8L13.7071,8.7071L11.9142,10.5L10.1213,8.7071L9.4142,8L8,9.4142L8.7071,10.1213L10.5,11.9142L8.7071,13.7071L8,14.4142L9.4142,15.8284L10.1213,15.1213L11.9142,13.3284L13.7071,15.1213L14.4142,15.8284L15.8284,14.4142L15.1213,13.7071L13.3284,11.9142L15.1213,10.1213Z" + android:fillColor="#F8432E" + android:fillType="evenOdd"/> +</vector> 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 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="25dp" + android:viewportWidth="24" + android:viewportHeight="25"> + <path + android:pathData="M4,11.5V6.1499L12,2.5943L20,6.1499V11.5C20,16.5434 16.556,21.2257 12,22.4673C7.444,21.2257 4,16.5434 4,11.5Z" + android:strokeWidth="2" + android:fillColor="#00000000" + android:strokeColor="#2CC766"/> + <path + android:pathData="M9,12.9234L10.6951,14.5L15,10.5" + android:strokeWidth="2" + android:fillColor="#00000000" + android:strokeColor="#2CC766" + android:strokeLineCap="square"/> +</vector> 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" > - - <TextView - android:id="@+id/state_label" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="24dp" - android:layout_marginBottom="4dp" - android:text="@string/dashboard_state_subtitle_off" - android:textColor="@color/orange_off" - android:gravity="center" - /> - <TextView - android:id="@+id/state_subtitle" + android:orientation="horizontal" + android:gravity="center_vertical"> + <ImageView + android:id="@+id/state_icon" + android:layout_height="25dp" + android:layout_width="24dp" + android:layout_margin="16dp" + android:src="@drawable/ic_shield_off" + android:scaleType="fitCenter" + /> + <TextView + android:id="@+id/state_label" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/dashboard_state_title_off" + android:textSize="14sp" + android:textColor="@color/grey_text" + /> + <Switch + android:id="@+id/toggle_privacy_central" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:layout_margin="16dp" + /> + </LinearLayout> + <View android:layout_width="match_parent" - android:layout_height="wrap_content" - android:text="@string/dashboard_state_title_on" - android:gravity="center" - android:textSize="12sp" - android:textColor="@color/grey_text_2" + android:layout_height="1dp" + android:background="@color/grey_divider" /> - <ImageView - android:id="@+id/toggle_privacy_central" - android:layout_height="120dp" - android:layout_margin="32dp" - android:layout_width="120dp" - android:src="@drawable/ic_quick_privacy_off" - android:scaleType="fitCenter" - android:background="?attr/selectableItemBackgroundBorderless" - /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="16dp" - android:layout_marginBottom="32dp"> + + android:layout_marginTop="8dp" + android:layout_marginBottom="16dp"> <LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" - android:gravity="center"> + android:paddingStart="8dp" + > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -87,7 +95,8 @@ android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" - android:gravity="center"> + android:paddingStart="8dp" + > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -111,7 +120,8 @@ android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" - android:gravity="center"> + android:paddingStart="8dp" + > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -147,6 +157,7 @@ android:text="@string/dashboard_state_ipaddress_off" android:paddingBottom="16dp" > <TextView + android:id="@+id/graph_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/dashboard_graph_label" @@ -155,32 +166,11 @@ android:text="@string/dashboard_state_ipaddress_off" app:layout_constraintTop_toTopOf="parent" /> - <TextView - android:id="@+id/graph_period" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:text="@string/dashboard_graph_period" - android:textSize="14sp" - android:textColor="@color/grey_text_2" - app:layout_constraintRight_toRightOf="parent" - app:layout_constraintTop_toTopOf="parent" - android:layout_marginRight="16dp" - /> - -<!-- <TextView--> -<!-- android:id="@+id/graph_total"--> -<!-- android:layout_width="wrap_content"--> -<!-- android:layout_height="wrap_content"--> -<!-- android:text="200 hits"--> -<!-- app:layout_constraintRight_toRightOf="parent"--> -<!-- app:layout_constraintTop_toBottomOf="@+id/graph_period"--> -<!-- />--> - <com.github.mikephil.charting.charts.BarChart android:id="@+id/graph" android:layout_height="144dp" android:layout_width="match_parent" - app:layout_constraintTop_toBottomOf="@+id/graph_period" + app:layout_constraintTop_toBottomOf="@+id/graph_title" android:layout_marginTop="16dp" /> 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 @@ <color name="grey_divider">#14212121</color> <color name="grey_overlay">#66FFFFFF</color> - <color name="orange_off">#FC7222</color> + <color name="red_off">@lineageos.platform:color/color_default_red1</color> <color name="green_on">#169659</color> <color name="green_valid">#2CC766</color> 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 @@ <!-- Dashboard --> <string name="dashboard_title">Quick Privacy</string> - <string name="dashboard_state_subtitle_off">You are not protected against tracking and surveillance</string> - <string name="dashboard_state_subtitle_on">You are protected against tracking and surveillance</string> - <string name="dashboard_state_title_on">Tap to disable your privacy preferences</string> - <string name="dashboard_state_title_off">Tap to enable your privacy preferences</string> + <string name="dashboard_state_title_on">Your online privacy is protected</string> + <string name="dashboard_state_title_off">Your online privacy is unprotected</string> <string name="dashboard_state_trackers_label">Trackers:</string> <string name="dashboard_state_trackers_off">Vulnerable</string> <string name="dashboard_state_trackers_on">Denied</string> @@ -16,9 +14,9 @@ <string name="dashboard_state_ipaddress_label">Real IP address:</string> <string name="dashboard_state_ipaddress_off">Exposed</string> <string name="dashboard_state_ipaddress_on">Hidden</string> - <string name="dashboard_graph_label">Trackers\' activity</string> + <string name="dashboard_graph_label">Personal data leakage</string> <string name="dashboard_graph_period">Today</string> - <string name="dashboard_graph_trackers_legend">%s Trackers</string> + <string name="dashboard_graph_trackers_legend">%s trackers have profiled you in the last 24 hours</string> <string name="dashboard_am_i_tracked_title">Manage apps\' trackers</string> <string name="dashboard_am_i_tracked_subtitle">%1$d app trackers, %2$d active trackers</string> |