diff --git a/android_app/app/src/main/java/com/health/openscale/gui/GraphFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/GraphFragment.java index 020c5119..4d69f911 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/GraphFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/GraphFragment.java @@ -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) ); diff --git a/android_app/app/src/main/java/com/health/openscale/gui/OverviewFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/OverviewFragment.java index adf44172..49f9cab0 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/OverviewFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/OverviewFragment.java @@ -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); diff --git a/android_app/app/src/main/java/com/health/openscale/gui/TableFragment.java b/android_app/app/src/main/java/com/health/openscale/gui/TableFragment.java index 45281fb0..3892014c 100644 --- a/android_app/app/src/main/java/com/health/openscale/gui/TableFragment.java +++ b/android_app/app/src/main/java/com/health/openscale/gui/TableFragment.java @@ -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)); } } diff --git a/android_app/app/src/main/res/layout/fragment_overview.xml b/android_app/app/src/main/res/layout/fragment_overview.xml index bde56420..3dd27811 100644 --- a/android_app/app/src/main/res/layout/fragment_overview.xml +++ b/android_app/app/src/main/res/layout/fragment_overview.xml @@ -11,32 +11,33 @@ + android:orientation="vertical" + android:weightSum="100"> + android:layout_weight="50" /> + android:padding="10dp" + android:layout_weight="40"> + android:padding="10dp" + android:weightSum="100"> @@ -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" /> @@ -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" /> @@ -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"> @@ -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" /> @@ -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" /> @@ -103,7 +105,7 @@ diff --git a/android_app/app/src/main/res/layout/fragment_table.xml b/android_app/app/src/main/res/layout/fragment_table.xml index 9da701f8..4cda7066 100644 --- a/android_app/app/src/main/res/layout/fragment_table.xml +++ b/android_app/app/src/main/res/layout/fragment_table.xml @@ -17,7 +17,8 @@ android:id="@+id/tableDataView" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:stretchColumns="*" > + android:stretchColumns="*" + android:shrinkColumns="*"> + android:textStyle="bold" + android:id="@+id/txtDateTableHeader" /> + android:textStyle="bold" + android:id="@+id/txtTimeTableHeader" /> + android:textStyle="bold" + android:id="@+id/txtWeightTableHeader" /> + android:textStyle="bold" + android:id="@+id/txtFatTableHeader" /> + android:textStyle="bold" + android:id="@+id/txtWaterTableHeader" /> + android:textStyle="bold" + android:id="@+id/txtMuscleTableHeader" />