mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-20 15:32:04 +02:00
Settings for overview Y-axes visibility (#971)
* Settings for overview Y-axes visibility * Removed the settings entry and moved option to the dropdown * Removed unused xml declaration * Update strings.xml * Update overview_menu.xml * Added autohiding right y-axis in overview if only one measurement view is selected * Added autohiding of the appropriate axis * Removed autohiding of y-axes on the overview * Removed unused imports and unnecessary changes * Removed changed space --------- Co-authored-by: OliE <olie.xdev@googlemail.com>
This commit is contained in:
@@ -104,13 +104,8 @@ public class OverviewFragment extends Fragment {
|
||||
chartView.setProgressBar(overviewView.findViewById(R.id.progressBar));
|
||||
chartView.setIsInGraphKey(false);
|
||||
chartView.getLegend().setEnabled(false);
|
||||
chartView.getAxisRight().setDrawLabels(false);
|
||||
chartView.getAxisRight().setDrawGridLines(false);
|
||||
chartView.getAxisRight().setDrawAxisLine(false);
|
||||
chartView.getAxisLeft().setDrawGridLines(false);
|
||||
chartView.getAxisLeft().setDrawLabels(false);
|
||||
chartView.getAxisLeft().setDrawAxisLine(false);
|
||||
chartView.getXAxis().setDrawGridLines(false);
|
||||
|
||||
setYAxisVisibility(prefs.getBoolean("enableYAxis", false));
|
||||
|
||||
chartActionBarView = overviewView.findViewById(R.id.chartActionBar);
|
||||
chartActionBarView.setIsInGraphKey(false);
|
||||
@@ -149,6 +144,13 @@ public class OverviewFragment extends Fragment {
|
||||
chartActionBarView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
return true;
|
||||
case R.id.enableYAxis:
|
||||
boolean checked = item.isChecked();
|
||||
item.setChecked(!checked);
|
||||
prefs.edit().putBoolean("enableYAxis", !checked).apply();
|
||||
setYAxisVisibility(!checked);
|
||||
updateChartView();
|
||||
return true;
|
||||
case R.id.menu_range_day:
|
||||
prefs.edit().putInt("selectRangeMode", ChartMeasurementView.ViewMode.DAY_OF_ALL.ordinal()).commit();
|
||||
break;
|
||||
@@ -196,6 +198,9 @@ public class OverviewFragment extends Fragment {
|
||||
chartActionBarView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
MenuItem enableYAxis = rangePopupMenu.getMenu().findItem(R.id.enableYAxis);
|
||||
enableYAxis.setChecked(prefs.getBoolean("enableYAxis", false));
|
||||
|
||||
recyclerView = overviewView.findViewById(R.id.recyclerView);
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
|
||||
layoutManager.setInitialPrefetchItemCount(5);
|
||||
@@ -235,6 +240,18 @@ public class OverviewFragment extends Fragment {
|
||||
return overviewView;
|
||||
}
|
||||
|
||||
protected void setYAxisVisibility(boolean visible) {
|
||||
chartView.getAxisRight().setDrawLabels(visible);
|
||||
chartView.getAxisRight().setDrawGridLines(visible);
|
||||
chartView.getAxisRight().setDrawAxisLine(visible);
|
||||
|
||||
chartView.getAxisLeft().setDrawGridLines(visible);
|
||||
chartView.getAxisLeft().setDrawLabels(visible);
|
||||
chartView.getAxisLeft().setDrawAxisLine(visible);
|
||||
|
||||
chartView.getXAxis().setDrawGridLines(visible);
|
||||
}
|
||||
|
||||
public void updateOnView(List<ScaleMeasurement> scaleMeasurementList) {
|
||||
this.scaleMeasurementList = scaleMeasurementList;
|
||||
|
||||
|
@@ -7,6 +7,11 @@
|
||||
android:title="@string/label_measurement_bar"
|
||||
android:checkable="true"
|
||||
android:checked="false"/>
|
||||
<item
|
||||
android:id="@+id/enableYAxis"
|
||||
android:title="@string/label_y_axis"
|
||||
android:checkable="true"
|
||||
android:checked="false"/>
|
||||
|
||||
<group android:id="@+id/rangeGroup"
|
||||
android:checkableBehavior="single">
|
||||
|
@@ -287,4 +287,5 @@
|
||||
<string name="app_intro_back_button">Back</string>
|
||||
<string name="app_intro_done_button">Done</string>
|
||||
<string name="info_create_new_user_on_scale">Create new user on scale.</string>
|
||||
</resources>
|
||||
<string name="label_y_axis">Y-axis</string>
|
||||
</resources>
|
||||
|
Reference in New Issue
Block a user