Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66188937 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

Merge branch 'update_ui_4963' into 'main'

Update main screen UI, #4963

See merge request e/privacy-central/privacycentralapp!27
parents a8a5374b fd4b8f04
Loading
Loading
Loading
Loading
Loading
+15 −19
Original line number Diff line number Diff line
@@ -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)
+15 −0
Original line number Diff line number Diff line
<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>
+17 −0
Original line number Diff line number Diff line
<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>
+41 −51
Original line number Diff line number Diff line
@@ -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"
                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_subtitle"
                android:layout_width="match_parent"
                    android:id="@+id/state_label"
                    android:layout_width="0dp"
                    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_weight="1"
                    android:text="@string/dashboard_state_title_off"
                    android:textSize="14sp"
                    android:textColor="@color/grey_text"
                    />

            <ImageView
                <Switch
                    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"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:layout_margin="16dp"
                    />
            </LinearLayout>
            <View
                android:layout_width="match_parent"
                android:layout_height="1dp"
                android:background="@color/grey_divider"
                />


            <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"
                    />

+1 −1
Original line number Diff line number Diff line
@@ -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>

Loading