mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-23 00:33:09 +02:00
some enhancement for small android devices.
This commit is contained in:
@@ -167,15 +167,13 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
||||
LineChartData lineData = new LineChartData(lines);
|
||||
lineData.setAxisXBottom(new Axis(axisValues).
|
||||
setHasLines(true).
|
||||
setTextColor(Color.BLACK).
|
||||
setName(getResources().getString(R.string.label_x_axis))
|
||||
setTextColor(Color.BLACK)
|
||||
);
|
||||
|
||||
lineData.setAxisYLeft(new Axis().
|
||||
setHasLines(true).
|
||||
setMaxLabelChars(3).
|
||||
setTextColor(Color.BLACK).
|
||||
setName(getResources().getString(R.string.label_y_axis))
|
||||
setTextColor(Color.BLACK)
|
||||
);
|
||||
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -87,9 +88,18 @@ public class OverviewFragment extends Fragment implements FragmentUpdateListener
|
||||
pieChartData.setFormatter(new SimpleValueFormatter(1, false, null, " %".toCharArray()));
|
||||
pieChartData.setHasCenterCircle(true);
|
||||
pieChartData.setCenterText1(Float.toString(lastEntry.weight) + " " + getResources().getString(R.string.weight_unit));
|
||||
pieChartData.setCenterText1FontSize(35);
|
||||
pieChartData.setCenterText2(new SimpleDateFormat("dd. MMM yyyy (EE)").format(lastEntry.date_time));
|
||||
pieChartData.setCenterText2FontSize(15);
|
||||
|
||||
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE ||
|
||||
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
|
||||
pieChartData.setCenterText1FontSize(33);
|
||||
pieChartData.setCenterText2FontSize(14);
|
||||
} else
|
||||
{
|
||||
pieChartData.setCenterText1FontSize(12);
|
||||
pieChartData.setCenterText2FontSize(8);
|
||||
pieChartData.setValueLabelTextSize(8);
|
||||
}
|
||||
|
||||
pieChart.setPieChartData(pieChartData);
|
||||
|
||||
|
@@ -15,19 +15,17 @@
|
||||
*/
|
||||
package com.health.openscale.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TableLayout;
|
||||
import android.widget.TableRow;
|
||||
@@ -39,6 +37,10 @@ import com.health.openscale.R;
|
||||
import com.health.openscale.core.OpenScale;
|
||||
import com.health.openscale.core.ScaleData;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
private View tableView;
|
||||
private TableLayout tableDataView;
|
||||
@@ -71,7 +73,26 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
openDeleteAllDialog();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE &&
|
||||
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE)
|
||||
{
|
||||
TextView txtDateTableHeader = (TextView)tableView.findViewById(R.id.txtDateTableHeader);
|
||||
txtDateTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
TextView txtTimeTableHeader = (TextView)tableView.findViewById(R.id.txtTimeTableHeader);
|
||||
txtTimeTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
TextView txtWeightTableHeader = (TextView)tableView.findViewById(R.id.txtWeightTableHeader);
|
||||
txtWeightTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
TextView txtFatTableHeader = (TextView)tableView.findViewById(R.id.txtFatTableHeader);
|
||||
txtFatTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
TextView txtWaterTableHeader = (TextView)tableView.findViewById(R.id.txtWaterTableHeader);
|
||||
txtWaterTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
TextView txtMuscleTableHeader = (TextView)tableView.findViewById(R.id.txtMuscleTableHeader);
|
||||
txtMuscleTableHeader.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
Button btnDeleteAll = (Button)tableView.findViewById(R.id.btnDeleteAll);
|
||||
btnDeleteAll.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
}
|
||||
|
||||
return tableView;
|
||||
}
|
||||
|
||||
@@ -88,35 +109,51 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||
dataRow.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||
|
||||
TextView dateTextView = new TextView(tableView.getContext());
|
||||
dateTextView.setText(new SimpleDateFormat("dd. MMM yyyy (EE)").format(scaleEntry.date_time));
|
||||
dateTextView.setPadding(5, 5, 5, 5);
|
||||
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE ||
|
||||
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_LARGE) {
|
||||
dateTextView.setText(new SimpleDateFormat("dd. MMM yyyy (EE)").format(scaleEntry.date_time));
|
||||
} else{
|
||||
dateTextView.setText(new SimpleDateFormat("dd/MM/yy").format(scaleEntry.date_time));
|
||||
}
|
||||
dateTextView.setPadding(0, 5, 5, 5);
|
||||
dataRow.addView(dateTextView);
|
||||
|
||||
TextView timeTextView = new TextView(tableView.getContext());
|
||||
timeTextView.setText(new SimpleDateFormat("HH:mm").format(scaleEntry.date_time));
|
||||
timeTextView.setPadding(5, 5, 5, 5);
|
||||
timeTextView.setPadding(0, 5, 5, 5);
|
||||
dataRow.addView(timeTextView);
|
||||
|
||||
TextView weightView = new TextView(tableView.getContext());
|
||||
weightView.setText(Float.toString(scaleEntry.weight));
|
||||
weightView.setPadding(5, 5, 5, 5);
|
||||
weightView.setPadding(0, 5, 5, 5);
|
||||
dataRow.addView(weightView);
|
||||
|
||||
TextView fatView = new TextView(tableView.getContext());
|
||||
fatView.setText(Float.toString(scaleEntry.fat));
|
||||
fatView.setPadding(5, 5, 5, 5);
|
||||
fatView.setPadding(0, 5, 5, 5);
|
||||
dataRow.addView(fatView);
|
||||
|
||||
TextView waterView = new TextView(tableView.getContext());
|
||||
waterView.setText(Float.toString(scaleEntry.water));
|
||||
waterView.setPadding(5, 5, 5, 5);
|
||||
waterView.setPadding(0, 5, 5, 5);
|
||||
dataRow.addView(waterView);
|
||||
|
||||
TextView muscleView = new TextView(tableView.getContext());
|
||||
muscleView.setText(Float.toString(scaleEntry.muscle));
|
||||
muscleView.setPadding(5, 5, 5, 5);
|
||||
muscleView.setPadding(0, 5, 5, 5);
|
||||
dataRow.addView(muscleView);
|
||||
|
||||
|
||||
if ((getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_XLARGE &&
|
||||
(getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) != Configuration.SCREENLAYOUT_SIZE_LARGE)
|
||||
{
|
||||
dateTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
timeTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
weightView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
fatView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
waterView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
muscleView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 11);
|
||||
}
|
||||
|
||||
tableDataView.addView(dataRow, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
}
|
||||
|
@@ -11,32 +11,33 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
android:orientation="vertical"
|
||||
android:weightSum="100">
|
||||
|
||||
<lecho.lib.hellocharts.view.PieChartView
|
||||
android:id="@+id/data_pie_chart"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="300dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_gravity="top|center"
|
||||
android:layout_weight="0" />
|
||||
android:layout_weight="50" />
|
||||
|
||||
<TableLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="150dp"
|
||||
android:layout_marginRight="150dp"
|
||||
android:padding="10dp" >
|
||||
android:padding="10dp"
|
||||
android:layout_weight="40">
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableRow1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp" >
|
||||
android:padding="10dp"
|
||||
android:weightSum="100">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:layout_weight="25"
|
||||
android:text="@string/label_weight_average"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -44,13 +45,13 @@
|
||||
android:id="@+id/txtAvgWeight"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:layout_weight="25"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:layout_weight="25"
|
||||
android:text="@string/label_fat_average"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -58,7 +59,7 @@
|
||||
android:id="@+id/txtAvgFat"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:layout_weight="25"
|
||||
android:text="0" />
|
||||
|
||||
</TableRow>
|
||||
@@ -67,12 +68,13 @@
|
||||
android:id="@+id/tableRow2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp" >
|
||||
android:padding="10dp"
|
||||
android:weightSum="100">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:layout_weight="25"
|
||||
android:text="@string/label_water_average"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -80,13 +82,13 @@
|
||||
android:id="@+id/txtAvgWater"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:layout_weight="25"
|
||||
android:text="0" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="3"
|
||||
android:layout_weight="25"
|
||||
android:text="@string/label_muscle"
|
||||
android:textStyle="bold" />
|
||||
|
||||
@@ -94,7 +96,7 @@
|
||||
android:id="@+id/txtAvgMuscle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="7"
|
||||
android:layout_weight="25"
|
||||
android:text="0" />
|
||||
|
||||
</TableRow>
|
||||
@@ -103,7 +105,7 @@
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="1"
|
||||
android:layout_weight="10"
|
||||
android:gravity="center|bottom"
|
||||
android:orientation="vertical" >
|
||||
|
||||
|
@@ -17,7 +17,8 @@
|
||||
android:id="@+id/tableDataView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:stretchColumns="*" >
|
||||
android:stretchColumns="*"
|
||||
android:shrinkColumns="*">
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/tableHeader"
|
||||
@@ -28,46 +29,51 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_date"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/txtDateTableHeader" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_time"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/txtTimeTableHeader" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_weight"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/txtWeightTableHeader" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_fat"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/txtFatTableHeader" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_water"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/txtWaterTableHeader" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/label_muscle"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:id="@+id/txtMuscleTableHeader" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDeleteAll"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/flat_selector"
|
||||
android:minHeight="0dp"
|
||||
android:minWidth="0dp"
|
||||
android:minHeight="20dp"
|
||||
android:minWidth="10dp"
|
||||
android:text="@string/label_delete_all"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="10sp" />
|
||||
|
@@ -32,9 +32,6 @@
|
||||
<string name="label_export">Export</string>
|
||||
<string name="label_delete_all">Delete all</string>
|
||||
|
||||
<string name="label_x_axis">Day</string>
|
||||
<string name="label_y_axis">Value</string>
|
||||
|
||||
<string name="error_weight_value_required">Weight value is required!</string>
|
||||
<string name="error_fat_value_required">Fat value is required!</string>
|
||||
<string name="error_water_value_required">Water value is required!</string>
|
||||
|
Reference in New Issue
Block a user