mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-27 02:55:50 +01:00
Fix body energy page scroll
This commit is contained in:
parent
b8bf1200c1
commit
84c91021d1
@ -4,6 +4,7 @@ import android.graphics.Bitmap;
|
|||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -63,6 +64,12 @@ public class BodyEnergyFragment extends AbstractChartFragment<BodyEnergyFragment
|
|||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View rootView = inflater.inflate(R.layout.fragment_body_energy, container, false);
|
View rootView = inflater.inflate(R.layout.fragment_body_energy, container, false);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
|
rootView.setOnScrollChangeListener((v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
|
||||||
|
getChartsHost().enableSwipeRefresh(scrollY == 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mDateView = rootView.findViewById(R.id.body_energy_date_view);
|
mDateView = rootView.findViewById(R.id.body_energy_date_view);
|
||||||
bodyEnergyGauge = rootView.findViewById(R.id.body_energy_gauge);
|
bodyEnergyGauge = rootView.findViewById(R.id.body_energy_gauge);
|
||||||
bodyEnergyGained = rootView.findViewById(R.id.body_energy_gained);
|
bodyEnergyGained = rootView.findViewById(R.id.body_energy_gained);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
@ -14,51 +14,52 @@
|
|||||||
android:id="@+id/body_energy_date_view"
|
android:id="@+id/body_energy_date_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
|
||||||
android:textSize="20sp"
|
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginBottom="20dp"
|
android:layout_marginBottom="20dp"
|
||||||
/>
|
android:gravity="center"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/body_energy_gauge"
|
||||||
android:layout_width="180dp"
|
android:layout_width="180dp"
|
||||||
android:layout_height="180dp"
|
android:layout_height="180dp"
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:scaleType="fitStart"
|
android:layout_gravity="center"
|
||||||
android:id="@+id/body_energy_gauge" />
|
android:scaleType="fitStart" />
|
||||||
|
|
||||||
|
|
||||||
<GridLayout
|
<GridLayout
|
||||||
android:background="@color/gauge_line_color"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:columnCount="2"
|
|
||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_marginBottom="15dp"
|
android:layout_marginBottom="15dp"
|
||||||
>
|
android:background="@color/gauge_line_color"
|
||||||
|
android:columnCount="2">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:layout_marginEnd="1dp"
|
|
||||||
style="@style/GridTile"
|
style="@style/GridTile"
|
||||||
>
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginEnd="1dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/body_energy_gained"
|
android:id="@+id/body_energy_gained"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="+ 0"
|
android:text="+ 0"
|
||||||
android:textSize="20sp" />
|
android:textSize="20sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/body_energy_gained"
|
android:text="@string/body_energy_gained"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="2dp"
|
|
||||||
android:layout_marginEnd="1dp"
|
|
||||||
style="@style/GridTile"
|
style="@style/GridTile"
|
||||||
>
|
android:layout_marginTop="2dp"
|
||||||
|
android:layout_marginEnd="1dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/body_energy_lost"
|
android:id="@+id/body_energy_lost"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -77,8 +78,8 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="250sp"
|
android:layout_height="250sp">
|
||||||
>
|
|
||||||
<com.github.mikephil.charting.charts.LineChart
|
<com.github.mikephil.charting.charts.LineChart
|
||||||
android:id="@+id/body_energy_chart"
|
android:id="@+id/body_energy_chart"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@ -88,4 +89,4 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</ScrollView>
|
||||||
|
Loading…
Reference in New Issue
Block a user