mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-19 00:19:25 +01:00
Improve dashboard layout and make today chart scalable
This commit is contained in:
parent
1d5ccde5b1
commit
c6967e9a24
@ -114,6 +114,12 @@ public class DashboardTodayWidget extends AbstractDashboardWidget {
|
||||
chart_12_24.setTransparentCircleRadius(91f);
|
||||
chart_12_24.setTransparentCircleColor(Color.TRANSPARENT);
|
||||
}
|
||||
ArrayList<PieEntry> emptyChartEntries = new ArrayList<>();
|
||||
PieDataSet emptyChartDataSet = new PieDataSet(emptyChartEntries, "");
|
||||
emptyChartDataSet.setDrawValues(false);
|
||||
emptyChartDataSet.setColor(Color.TRANSPARENT);
|
||||
PieData emptyChartData = new PieData(emptyChartDataSet);
|
||||
chart_12_24.setData(emptyChartData);
|
||||
|
||||
// Initialize inner chart
|
||||
chart_0_12 = todayView.findViewById(R.id.dashboard_piechart_today_0_12);
|
||||
@ -130,6 +136,7 @@ public class DashboardTodayWidget extends AbstractDashboardWidget {
|
||||
chart_0_12.setRotationEnabled(false);
|
||||
chart_0_12.setDrawEntryLabels(false);
|
||||
chart_0_12.setHighlightPerTapEnabled(false);
|
||||
chart_0_12.setData(emptyChartData);
|
||||
}
|
||||
|
||||
// Initialize legend
|
||||
|
@ -5,6 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical"
|
||||
tools:context=".activities.dashboard.DashboardGoalsWidget">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@ -14,7 +15,7 @@
|
||||
android:id="@+id/dashboard_goals_chart"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="25dp"
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintDimensionRatio="H,1:1"
|
||||
|
@ -1,46 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical"
|
||||
tools:context=".activities.dashboard.DashboardTodayWidget">
|
||||
|
||||
<RelativeLayout
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="230dp"
|
||||
android:layout_height="230dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/clock_face" />
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginVertical="5dp"
|
||||
android:gravity="center"
|
||||
app:layout_constraintDimensionRatio="H,1:1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dashboard_piechart_today_12_24"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:minWidth="300dp"
|
||||
android:minHeight="300dp" />
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="35dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:src="@drawable/clock_face" />
|
||||
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dashboard_piechart_today_0_12"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:minWidth="270dp"
|
||||
android:minHeight="270dp" />
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dashboard_piechart_today_12_24"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dashboard_piechart_scale"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="200dp"
|
||||
android:minHeight="200dp"
|
||||
android:layout_centerInParent="true" />
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dashboard_piechart_today_0_12"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_margin="15dp" />
|
||||
|
||||
</RelativeLayout>
|
||||
<com.github.mikephil.charting.charts.PieChart
|
||||
android:id="@+id/dashboard_piechart_scale"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_margin="50dp"
|
||||
android:layout_centerInParent="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dashboard_piechart_legend"
|
||||
|
Loading…
Reference in New Issue
Block a user