mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-23 16:53:04 +02:00
added for graph and table fragment an option menu
This commit is contained in:
@@ -27,11 +27,14 @@ import android.support.design.widget.FloatingActionButton;
|
|||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.view.GestureDetector;
|
import android.view.GestureDetector;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.PopupMenu;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.health.openscale.R;
|
import com.health.openscale.R;
|
||||||
@@ -80,7 +83,8 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
private FloatingActionButton diagramWaist;
|
private FloatingActionButton diagramWaist;
|
||||||
private FloatingActionButton diagramHip;
|
private FloatingActionButton diagramHip;
|
||||||
private FloatingActionButton diagramBone;
|
private FloatingActionButton diagramBone;
|
||||||
private FloatingActionButton enableMonth;
|
private ImageView optionMenu;
|
||||||
|
private PopupMenu popup;
|
||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
|
|
||||||
private int textColor;
|
private int textColor;
|
||||||
@@ -140,7 +144,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
diagramWaist = (FloatingActionButton) graphView.findViewById(R.id.diagramWaist);
|
diagramWaist = (FloatingActionButton) graphView.findViewById(R.id.diagramWaist);
|
||||||
diagramHip = (FloatingActionButton) graphView.findViewById(R.id.diagramHip);
|
diagramHip = (FloatingActionButton) graphView.findViewById(R.id.diagramHip);
|
||||||
diagramBone = (FloatingActionButton) graphView.findViewById(R.id.diagramBone);
|
diagramBone = (FloatingActionButton) graphView.findViewById(R.id.diagramBone);
|
||||||
enableMonth = (FloatingActionButton) graphView.findViewById(R.id.enableMonth);
|
optionMenu = (ImageView) graphView.findViewById(R.id.optionMenu);
|
||||||
|
|
||||||
diagramWeight.setOnClickListener(new onClickListenerDiagramLines());
|
diagramWeight.setOnClickListener(new onClickListenerDiagramLines());
|
||||||
diagramFat.setOnClickListener(new onClickListenerDiagramLines());
|
diagramFat.setOnClickListener(new onClickListenerDiagramLines());
|
||||||
@@ -151,7 +155,12 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
diagramHip.setOnClickListener(new onClickListenerDiagramLines());
|
diagramHip.setOnClickListener(new onClickListenerDiagramLines());
|
||||||
diagramBone.setOnClickListener(new onClickListenerDiagramLines());
|
diagramBone.setOnClickListener(new onClickListenerDiagramLines());
|
||||||
|
|
||||||
enableMonth.setOnClickListener(new onClickListenerDiagramLines());
|
optionMenu.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
popup.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
prefs = PreferenceManager.getDefaultSharedPreferences(graphView.getContext());
|
prefs = PreferenceManager.getDefaultSharedPreferences(graphView.getContext());
|
||||||
|
|
||||||
@@ -217,6 +226,34 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
popup = new PopupMenu(getContext(), optionMenu);
|
||||||
|
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
||||||
|
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.enableMonth:
|
||||||
|
if (item.isChecked()) {
|
||||||
|
item.setChecked(false);
|
||||||
|
prefs.edit().putBoolean("showMonth", false).commit();
|
||||||
|
} else {
|
||||||
|
item.setChecked(true);
|
||||||
|
prefs.edit().putBoolean("showMonth", true).commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
generateGraphs();
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popup.getMenuInflater().inflate(R.menu.graph_menu, popup.getMenu());
|
||||||
|
|
||||||
|
MenuItem enableMonth = popup.getMenu().findItem(R.id.enableMonth);
|
||||||
|
enableMonth.setChecked(prefs.getBoolean("showMonth", true));
|
||||||
|
|
||||||
openScale.registerFragment(this);
|
openScale.registerFragment(this);
|
||||||
|
|
||||||
return graphView;
|
return graphView;
|
||||||
@@ -417,12 +454,6 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
diagramBone.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
diagramBone.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefs.getBoolean(String.valueOf(enableMonth.getId()), true)) {
|
|
||||||
enableMonth.setBackgroundTintList(ColorStateList.valueOf(ChartUtils.COLOR_BLUE));
|
|
||||||
} else {
|
|
||||||
enableMonth.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#d3d3d3")));
|
|
||||||
}
|
|
||||||
|
|
||||||
LineChartData lineData = new LineChartData(lines);
|
LineChartData lineData = new LineChartData(lines);
|
||||||
lineData.setAxisXBottom(new Axis(axisValues).
|
lineData.setAxisXBottom(new Axis(axisValues).
|
||||||
setHasLines(true).
|
setHasLines(true).
|
||||||
@@ -548,7 +579,7 @@ public class GraphFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show monthly diagram
|
// show monthly diagram
|
||||||
if (prefs.getBoolean(String.valueOf(enableMonth.getId()), true)) {
|
if (prefs.getBoolean("showMonth", true)) {
|
||||||
chartTop.setVisibility(View.VISIBLE);
|
chartTop.setVisibility(View.VISIBLE);
|
||||||
chartBottom.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 0.7f));
|
chartBottom.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 0.7f));
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ import android.text.Spanned;
|
|||||||
import android.text.SpannedString;
|
import android.text.SpannedString;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -43,6 +44,7 @@ import android.widget.EditText;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.PopupMenu;
|
||||||
import android.widget.TableLayout;
|
import android.widget.TableLayout;
|
||||||
import android.widget.TableRow;
|
import android.widget.TableRow;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@@ -76,8 +78,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import lecho.lib.hellocharts.util.ChartUtils;
|
|
||||||
|
|
||||||
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
|
|
||||||
public class TableFragment extends Fragment implements FragmentUpdateListener {
|
public class TableFragment extends Fragment implements FragmentUpdateListener {
|
||||||
@@ -87,6 +87,9 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
private SharedPreferences prefs;
|
private SharedPreferences prefs;
|
||||||
private LinearLayout subpageView;
|
private LinearLayout subpageView;
|
||||||
|
|
||||||
|
private ImageView optionMenu;
|
||||||
|
private PopupMenu popup;
|
||||||
|
|
||||||
private ArrayList <MeasurementView> measurementsList;
|
private ArrayList <MeasurementView> measurementsList;
|
||||||
|
|
||||||
private int selectedSubpageNr;
|
private int selectedSubpageNr;
|
||||||
@@ -106,8 +109,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
tableDataView = (ListView) tableView.findViewById(R.id.tableDataView);
|
tableDataView = (ListView) tableView.findViewById(R.id.tableDataView);
|
||||||
tableHeaderView = (LinearLayout) tableView.findViewById(R.id.tableHeaderView);
|
tableHeaderView = (LinearLayout) tableView.findViewById(R.id.tableHeaderView);
|
||||||
|
|
||||||
tableView.findViewById(R.id.btnImportData).setOnClickListener(new onClickListenerImport());
|
optionMenu = (ImageView) tableView.findViewById(R.id.optionMenu);
|
||||||
tableView.findViewById(R.id.btnExportData).setOnClickListener(new onClickListenerExport());
|
|
||||||
|
|
||||||
measurementsList = new ArrayList<>();
|
measurementsList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -140,6 +142,42 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
selectedSubpageNr = savedInstanceState.getInt(SELECTED_SUBPAGE_NR_KEY);
|
selectedSubpageNr = savedInstanceState.getInt(SELECTED_SUBPAGE_NR_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
optionMenu.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
popup.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
popup = new PopupMenu(getContext(), optionMenu);
|
||||||
|
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
|
||||||
|
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.importData:
|
||||||
|
if (PermissionHelper.requestReadPermission(getActivity())) {
|
||||||
|
importTable();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case R.id.exportData:
|
||||||
|
if (PermissionHelper.requestWritePermission(getActivity())) {
|
||||||
|
exportTable();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case R.id.shareData:
|
||||||
|
if (PermissionHelper.requestWritePermission(getActivity())) {
|
||||||
|
shareTable();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
popup.getMenuInflater().inflate(R.menu.table_menu, popup.getMenu());
|
||||||
|
|
||||||
OpenScale.getInstance(getContext()).registerFragment(this);
|
OpenScale.getInstance(getContext()).registerFragment(this);
|
||||||
|
|
||||||
return tableView;
|
return tableView;
|
||||||
@@ -160,7 +198,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final int maxSize = 50;
|
final int maxSize = 25;
|
||||||
|
|
||||||
int subpageCount = (int)Math.ceil(scaleMeasurementList.size() / (double)maxSize);
|
int subpageCount = (int)Math.ceil(scaleMeasurementList.size() / (double)maxSize);
|
||||||
|
|
||||||
@@ -182,6 +220,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
TextView subpageNrView = new TextView(tableView.getContext());
|
TextView subpageNrView = new TextView(tableView.getContext());
|
||||||
subpageNrView.setOnClickListener(new onClickListenerSubpageSelect());
|
subpageNrView.setOnClickListener(new onClickListenerSubpageSelect());
|
||||||
subpageNrView.setText(Integer.toString(i+1));
|
subpageNrView.setText(Integer.toString(i+1));
|
||||||
|
subpageNrView.setTextColor(Color.GRAY);
|
||||||
subpageNrView.setPadding(10, 10, 20, 10);
|
subpageNrView.setPadding(10, 10, 20, 10);
|
||||||
|
|
||||||
subpageView.addView(subpageNrView);
|
subpageView.addView(subpageNrView);
|
||||||
@@ -190,7 +229,7 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
TextView selectedSubpageNrView = (TextView) subpageView.getChildAt(selectedSubpageNr + 1);
|
TextView selectedSubpageNrView = (TextView) subpageView.getChildAt(selectedSubpageNr + 1);
|
||||||
if (selectedSubpageNrView != null) {
|
if (selectedSubpageNrView != null) {
|
||||||
selectedSubpageNrView.setTypeface(null, Typeface.BOLD);
|
selectedSubpageNrView.setTypeface(null, Typeface.BOLD);
|
||||||
selectedSubpageNrView.setTextColor(ChartUtils.COLOR_BLUE);
|
selectedSubpageNrView.setTextColor(Color.WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,12 +245,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
moveSubpageRight.setEnabled(selectedSubpageNr + 1 < subpageCount);
|
moveSubpageRight.setEnabled(selectedSubpageNr + 1 < subpageCount);
|
||||||
subpageView.addView(moveSubpageRight);
|
subpageView.addView(moveSubpageRight);
|
||||||
|
|
||||||
if (subpageCount <= 1) {
|
|
||||||
subpageView.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
subpageView.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
tableHeaderView.removeAllViews();
|
tableHeaderView.removeAllViews();
|
||||||
|
|
||||||
for (MeasurementView measurement : measurementsList) {
|
for (MeasurementView measurement : measurementsList) {
|
||||||
@@ -288,15 +321,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
startActivityForResult(intent, 1); }
|
startActivityForResult(intent, 1); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private class onClickListenerImport implements View.OnClickListener {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (PermissionHelper.requestReadPermission(getActivity())) {
|
|
||||||
importTable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void importTable() {
|
private void importTable() {
|
||||||
int selectedUserId = OpenScale.getInstance(getContext()).getSelectedScaleUserId();
|
int selectedUserId = OpenScale.getInstance(getContext()).getSelectedScaleUserId();
|
||||||
|
|
||||||
@@ -343,15 +367,6 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class onClickListenerExport implements View.OnClickListener {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (PermissionHelper.requestWritePermission(getActivity())) {
|
|
||||||
exportTable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void exportTable() {
|
private void exportTable() {
|
||||||
AlertDialog.Builder filenameDialog = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder filenameDialog = new AlertDialog.Builder(getActivity());
|
||||||
|
|
||||||
@@ -377,9 +392,21 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
filenameDialog.setNeutralButton(getResources().getString(R.string.label_share), new DialogInterface.OnClickListener() {
|
filenameDialog.setNegativeButton(getResources().getString(R.string.label_cancel), new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
String fullPath = Environment.getExternalStorageDirectory().getPath() + "/tmp/" + txtFilename.getText().toString();
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
filenameDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void shareTable() {
|
||||||
|
final ScaleUser selectedScaleUser = OpenScale.getInstance(getContext()).getSelectedScaleUser();
|
||||||
|
String exportFilename = prefs.getString("exportFilename" + selectedScaleUser.getId(), "openScale_data_" + selectedScaleUser.getUserName() + ".csv");
|
||||||
|
|
||||||
|
String fullPath = Environment.getExternalStorageDirectory().getPath() + "/tmp/" + exportFilename;
|
||||||
|
|
||||||
if (!OpenScale.getInstance(getContext()).exportData(fullPath)) {
|
if (!OpenScale.getInstance(getContext()).exportData(fullPath)) {
|
||||||
return;
|
return;
|
||||||
@@ -393,16 +420,11 @@ public class TableFragment extends Fragment implements FragmentUpdateListener {
|
|||||||
intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+fullPath));
|
intentShareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+fullPath));
|
||||||
|
|
||||||
intentShareFile.putExtra(Intent.EXTRA_SUBJECT, "openScale export csv file");
|
intentShareFile.putExtra(Intent.EXTRA_SUBJECT, "openScale export csv file");
|
||||||
intentShareFile.putExtra(Intent.EXTRA_TEXT, txtFilename.getText().toString());
|
intentShareFile.putExtra(Intent.EXTRA_TEXT, exportFilename);
|
||||||
|
|
||||||
startActivity(Intent.createChooser(intentShareFile, getResources().getString(R.string.label_share)));
|
startActivity(Intent.createChooser(intentShareFile, getResources().getString(R.string.label_share)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
filenameDialog.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
|
||||||
|
BIN
android_app/app/src/main/res/drawable-hdpi/ic_options.png
Normal file
BIN
android_app/app/src/main/res/drawable-hdpi/ic_options.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 168 B |
BIN
android_app/app/src/main/res/drawable-ldpi/ic_options.png
Normal file
BIN
android_app/app/src/main/res/drawable-ldpi/ic_options.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 154 B |
BIN
android_app/app/src/main/res/drawable-mdpi/ic_options.png
Normal file
BIN
android_app/app/src/main/res/drawable-mdpi/ic_options.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 133 B |
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_options.png
Normal file
BIN
android_app/app/src/main/res/drawable-xhdpi/ic_options.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 158 B |
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_options.png
Normal file
BIN
android_app/app/src/main/res/drawable-xxhdpi/ic_options.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 B |
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_options.png
Normal file
BIN
android_app/app/src/main/res/drawable-xxxhdpi/ic_options.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 216 B |
@@ -1,10 +1,83 @@
|
|||||||
<android.support.design.widget.CoordinatorLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:padding="5dp">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:gravity="left"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnLeftYear"
|
||||||
|
style="?android:attr/buttonStyleSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:background="@drawable/flat_selector"
|
||||||
|
android:text="<"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/txtYear"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="30dp"
|
||||||
|
android:layout_marginRight="30dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="year"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@android:color/white"
|
||||||
|
android:textStyle="bold" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btnRightYear"
|
||||||
|
style="?android:attr/buttonStyleSmall"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="20dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:background="@drawable/flat_selector"
|
||||||
|
android:text=">"
|
||||||
|
android:textColor="@android:color/white" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/colorHack"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:gravity="right"
|
||||||
|
android:layout_weight="0.9"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/optionMenu"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:tint="@android:color/white"
|
||||||
|
app:srcCompat="@drawable/ic_options" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/linearLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
@@ -114,55 +187,6 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
android:gravity="center"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="5dp">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnLeftYear"
|
|
||||||
style="?android:attr/buttonStyleSmall"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:background="@drawable/flat_selector"
|
|
||||||
android:text="<"
|
|
||||||
android:textColor="@android:color/white" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/txtYear"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="30dp"
|
|
||||||
android:layout_marginRight="30dp"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="year"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:textColor="@android:color/white"
|
|
||||||
android:textStyle="bold" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnRightYear"
|
|
||||||
style="?android:attr/buttonStyleSmall"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="20dp"
|
|
||||||
android:layout_weight="0"
|
|
||||||
android:background="@drawable/flat_selector"
|
|
||||||
android:text=">"
|
|
||||||
android:textColor="@android:color/white" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/colorHack"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<lecho.lib.hellocharts.view.ColumnChartView
|
<lecho.lib.hellocharts.view.ColumnChartView
|
||||||
android:id="@+id/chart_top"
|
android:id="@+id/chart_top"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -178,16 +202,4 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<android.support.design.widget.FloatingActionButton
|
</LinearLayout>
|
||||||
android:id="@+id/enableMonth"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="16dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:src="@drawable/ic_lastmonth"
|
|
||||||
app:backgroundTint="#33B5E5"
|
|
||||||
app:layout_anchor="@id/chart_bottom"
|
|
||||||
app:layout_anchorGravity="bottom|right|end"
|
|
||||||
app:rippleColor="#33B5E5" />
|
|
||||||
|
|
||||||
</android.support.design.widget.CoordinatorLayout>
|
|
||||||
|
@@ -6,12 +6,48 @@
|
|||||||
android:weightSum="1">
|
android:weightSum="1">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/subpageView"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:padding="5dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:gravity="left"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/subpageView"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
android:gravity="right"
|
||||||
|
android:layout_weight="0.9"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/optionMenu"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:scaleType="centerInside"
|
||||||
|
android:tint="@android:color/white"
|
||||||
|
app:srcCompat="@drawable/ic_options" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
@@ -20,7 +56,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingBottom="5dp"
|
android:paddingBottom="5dp"
|
||||||
android:paddingTop="5dp"></LinearLayout>
|
android:paddingTop="5dp">
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -35,36 +72,4 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
</ListView>
|
</ListView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp"
|
|
||||||
android:layout_weight="0.1"
|
|
||||||
android:gravity="bottom"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:weightSum="1">
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnImportData"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginRight="5dp"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:background="@drawable/flat_selector"
|
|
||||||
android:text="@string/label_import"
|
|
||||||
android:textColor="@android:color/white" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/btnExportData"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="5dp"
|
|
||||||
android:layout_weight="0.5"
|
|
||||||
android:background="@drawable/flat_selector"
|
|
||||||
android:text="@string/label_export"
|
|
||||||
android:textColor="@android:color/white" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
9
android_app/app/src/main/res/menu/graph_menu.xml
Normal file
9
android_app/app/src/main/res/menu/graph_menu.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="com.example.openscale.MainActivity">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/enableMonth"
|
||||||
|
android:title="@string/label_month_view"
|
||||||
|
android:checkable="true"/>
|
||||||
|
</menu>
|
16
android_app/app/src/main/res/menu/table_menu.xml
Normal file
16
android_app/app/src/main/res/menu/table_menu.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
tools:context="com.example.openscale.MainActivity">
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/importData"
|
||||||
|
android:title="@string/label_import"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/exportData"
|
||||||
|
android:title="@string/label_export"/>
|
||||||
|
|
||||||
|
<item
|
||||||
|
android:id="@+id/shareData"
|
||||||
|
android:title="@string/label_share"/>
|
||||||
|
</menu>
|
@@ -216,6 +216,8 @@
|
|||||||
<string name="edit">Edit</string>
|
<string name="edit">Edit</string>
|
||||||
<string name="save">Save</string>
|
<string name="save">Save</string>
|
||||||
|
|
||||||
|
<string name="label_month_view">Month view</string>
|
||||||
|
|
||||||
<string name="permission_not_granted">Permission not granted</string>
|
<string name="permission_not_granted">Permission not granted</string>
|
||||||
<string name="permission_bluetooth_info">openScale requires permission to access the coarse location to search for Bluetooth devices</string>
|
<string name="permission_bluetooth_info">openScale requires permission to access the coarse location to search for Bluetooth devices</string>
|
||||||
<string name="permission_bluetooth_info_title">Information</string>
|
<string name="permission_bluetooth_info_title">Information</string>
|
||||||
|
Reference in New Issue
Block a user