1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 03:37:03 +01:00

Update PAI charts to match new charts design

This commit is contained in:
José Rebelo 2024-09-27 23:26:45 +01:00
parent 8348c5349e
commit ae3615a388
2 changed files with 90 additions and 177 deletions

View File

@ -367,12 +367,12 @@ public class PaiChartFragment extends AbstractChartFragment<PaiChartFragment.Pai
final int maxPai = Math.max(100, total);
final String todayLabel = today != 0 ? requireContext().getString(R.string.pai_plus_num, today) : "";
entries.add(new PieEntry(today, todayLabel));
entries.add(new PieEntry(total - today, ""));
entries.add(new PieEntry(today, todayLabel));
entries.add(new PieEntry(maxPai - total, ""));
final PieDataSet pieDataSet = new PieDataSet(entries, "");
pieDataSet.setColors(PAI_DAY_COLOR, PAI_TOTAL_COLOR, 0x0);
pieDataSet.setColors(PAI_TOTAL_COLOR, PAI_DAY_COLOR, 0x0);
data.setDataSet(pieDataSet);
data.setDrawValues(false);

View File

@ -15,6 +15,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="10dp"
android:gravity="center"
android:textSize="20sp" />
@ -26,242 +27,154 @@
android:layout_marginBottom="0dp"
android:layout_weight="1" />
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="5dp"
android:layout_marginBottom="30dp"
android:layout_weight="3"
android:shrinkColumns="*"
android:stretchColumns="*">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="fill_parent"
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="2">
android:background="@color/gauge_line_color"
android:columnCount="2">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:paddingLeft="20dip"
android:paddingTop="20dip"
android:paddingRight="20dip">
style="@style/GridTile"
android:layout_marginBottom="0dp">
<View
android:layout_width="fill_parent"
android:layout_height="5dp"
android:layout_marginBottom="10dp"
android:background="@color/chart_activity_dark" />
<TextView
android:id="@+id/pai_line_today"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginTop="20dip"
android:text="@string/stats_empty_value"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="@string/activity_summary_today"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="20dip"
android:paddingTop="20dip"
android:paddingRight="20dip">
style="@style/GridTile"
android:layout_marginBottom="0dp">
<View
android:layout_width="fill_parent"
android:layout_height="5dp"
android:layout_marginBottom="10dp"
android:background="@color/chart_deep_sleep_light" />
<TextView
android:id="@+id/pai_line_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginTop="20dip"
android:text="@string/stats_empty_value"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:text="@string/step_streak_total"
android:textSize="12sp" />
</LinearLayout>
</TableRow>
</TableLayout>
</GridLayout>
<GridLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="15dp"
android:background="@color/gauge_line_color"
android:columnCount="3"
android:rowCount="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:baselineAligned="false"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_weight="1"
android:gravity="center|top"
android:orientation="vertical">
style="@style/GridTile"
android:layout_marginTop="2dp"
android:layout_marginEnd="1dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:maxLines="2"
android:scrollHorizontally="false"
android:text="@string/sony_speak_to_chat_sensitivity_low"
android:textAllCaps="true"
android:textColor="@color/accent"
android:textStyle="bold" />
android:textSize="12sp" />
<TextView
android:id="@+id/pai_line_low_inc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-black"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="5"
android:textSize="24sp" />
android:text="@string/stats_empty_value"
android:textSize="20sp" />
<TextView
android:id="@+id/pai_line_low_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="10 min"
android:textSize="16sp" />
android:text="@string/stats_empty_value"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
style="@style/GridTile"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_weight="1"
android:gravity="center|top"
android:orientation="vertical">
android:layout_marginTop="2dp"
android:layout_marginEnd="1dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:maxLines="2"
android:scrollHorizontally="false"
android:text="@string/stress_moderate"
android:textAllCaps="true"
android:textColor="@color/accent"
android:textStyle="bold" />
android:textSize="12sp" />
<TextView
android:id="@+id/pai_line_moderate_inc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-black"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="5"
android:textSize="24sp" />
android:text="@string/stats_empty_value"
android:textSize="20sp" />
<TextView
android:id="@+id/pai_line_moderate_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="10 min"
android:textSize="16sp" />
android:text="@string/stats_empty_value"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center|top"
android:id="@+id/sleep_chart_legend_movement_intensity_wrapper"
style="@style/GridTile"
android:layout_marginStart="1dp"
android:layout_marginEnd="1dp"
android:layout_weight="1"
android:gravity="center|top"
android:orientation="vertical">
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:maxLines="2"
android:scrollHorizontally="false"
android:text="@string/stress_high"
android:textAllCaps="true"
android:textColor="@color/accent"
android:textStyle="bold" />
android:textSize="12sp" />
<TextView
android:id="@+id/pai_line_high_inc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif-black"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="5"
android:textSize="24sp" />
android:text="@string/stats_empty_value"
android:textSize="20sp" />
<TextView
android:id="@+id/pai_line_high_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="sans-serif"
android:gravity="center"
android:maxLines="1"
android:scrollHorizontally="false"
android:text="10 min"
android:textSize="16sp" />
</LinearLayout>
android:text="@string/stats_empty_value"
android:textSize="12sp" />
</LinearLayout>
</GridLayout>
<com.github.mikephil.charting.charts.BarChart
android:id="@+id/pai_chart_week"