mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-21 16:02: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.setProgressBar(overviewView.findViewById(R.id.progressBar));
|
||||||
chartView.setIsInGraphKey(false);
|
chartView.setIsInGraphKey(false);
|
||||||
chartView.getLegend().setEnabled(false);
|
chartView.getLegend().setEnabled(false);
|
||||||
chartView.getAxisRight().setDrawLabels(false);
|
|
||||||
chartView.getAxisRight().setDrawGridLines(false);
|
setYAxisVisibility(prefs.getBoolean("enableYAxis", false));
|
||||||
chartView.getAxisRight().setDrawAxisLine(false);
|
|
||||||
chartView.getAxisLeft().setDrawGridLines(false);
|
|
||||||
chartView.getAxisLeft().setDrawLabels(false);
|
|
||||||
chartView.getAxisLeft().setDrawAxisLine(false);
|
|
||||||
chartView.getXAxis().setDrawGridLines(false);
|
|
||||||
|
|
||||||
chartActionBarView = overviewView.findViewById(R.id.chartActionBar);
|
chartActionBarView = overviewView.findViewById(R.id.chartActionBar);
|
||||||
chartActionBarView.setIsInGraphKey(false);
|
chartActionBarView.setIsInGraphKey(false);
|
||||||
@@ -149,6 +144,13 @@ public class OverviewFragment extends Fragment {
|
|||||||
chartActionBarView.setVisibility(View.VISIBLE);
|
chartActionBarView.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
return true;
|
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:
|
case R.id.menu_range_day:
|
||||||
prefs.edit().putInt("selectRangeMode", ChartMeasurementView.ViewMode.DAY_OF_ALL.ordinal()).commit();
|
prefs.edit().putInt("selectRangeMode", ChartMeasurementView.ViewMode.DAY_OF_ALL.ordinal()).commit();
|
||||||
break;
|
break;
|
||||||
@@ -196,6 +198,9 @@ public class OverviewFragment extends Fragment {
|
|||||||
chartActionBarView.setVisibility(View.GONE);
|
chartActionBarView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MenuItem enableYAxis = rangePopupMenu.getMenu().findItem(R.id.enableYAxis);
|
||||||
|
enableYAxis.setChecked(prefs.getBoolean("enableYAxis", false));
|
||||||
|
|
||||||
recyclerView = overviewView.findViewById(R.id.recyclerView);
|
recyclerView = overviewView.findViewById(R.id.recyclerView);
|
||||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
|
LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
|
||||||
layoutManager.setInitialPrefetchItemCount(5);
|
layoutManager.setInitialPrefetchItemCount(5);
|
||||||
@@ -235,6 +240,18 @@ public class OverviewFragment extends Fragment {
|
|||||||
return overviewView;
|
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) {
|
public void updateOnView(List<ScaleMeasurement> scaleMeasurementList) {
|
||||||
this.scaleMeasurementList = scaleMeasurementList;
|
this.scaleMeasurementList = scaleMeasurementList;
|
||||||
|
|
||||||
|
@@ -7,6 +7,11 @@
|
|||||||
android:title="@string/label_measurement_bar"
|
android:title="@string/label_measurement_bar"
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
android:checked="false"/>
|
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"
|
<group android:id="@+id/rangeGroup"
|
||||||
android:checkableBehavior="single">
|
android:checkableBehavior="single">
|
||||||
|
@@ -287,4 +287,5 @@
|
|||||||
<string name="app_intro_back_button">Back</string>
|
<string name="app_intro_back_button">Back</string>
|
||||||
<string name="app_intro_done_button">Done</string>
|
<string name="app_intro_done_button">Done</string>
|
||||||
<string name="info_create_new_user_on_scale">Create new user on scale.</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