Use past year for statistics filter

This commit is contained in:
ByteHamster 2022-03-05 10:58:20 +01:00
parent f0aec13ea3
commit fc3807aaf5
3 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@
<string name="statistics_to">To</string>
<string name="statistics_today">Today</string>
<string name="statistics_filter_all_time">All time</string>
<string name="statistics_filter_last_year">Last year</string>
<string name="statistics_filter_past_year">Past year</string>
<string name="statistics_reset_data">Reset statistics data</string>
<string name="statistics_reset_data_msg">This will erase the history of duration played for all episodes. Are you sure you want to proceed?</string>
<string name="statistics_counting_range">Played between %1$s and %2$s</string>

View File

@ -46,7 +46,7 @@ public class StatisticsFilterDialog {
dialogBinding.includeMarkedCheckbox.setOnCheckedChangeListener((compoundButton, checked) -> {
dialogBinding.timeToSpinner.setEnabled(!checked);
dialogBinding.timeFromSpinner.setEnabled(!checked);
dialogBinding.lastYearButton.setEnabled(!checked);
dialogBinding.pastYearButton.setEnabled(!checked);
dialogBinding.allTimeButton.setEnabled(!checked);
dialogBinding.dateSelectionContainer.setAlpha(checked ? 0.5f : 1f);
});
@ -79,8 +79,8 @@ public class StatisticsFilterDialog {
dialogBinding.timeFromSpinner.setSelection(0);
dialogBinding.timeToSpinner.setSelection(filterDatesTo.first.length - 1);
});
dialogBinding.lastYearButton.setOnClickListener(v -> {
dialogBinding.timeFromSpinner.setSelection(Math.max(0, filterDatesFrom.first.length - 14));
dialogBinding.pastYearButton.setOnClickListener(v -> {
dialogBinding.timeFromSpinner.setSelection(Math.max(0, filterDatesFrom.first.length - 13));
dialogBinding.timeToSpinner.setSelection(filterDatesTo.first.length - 2);
});

View File

@ -65,10 +65,10 @@
android:orientation="horizontal">
<Button
android:id="@+id/lastYearButton"
android:id="@+id/past_year_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@string/statistics_filter_last_year"
android:text="@string/statistics_filter_past_year"
android:layout_weight="1"
android:layout_marginEnd="4dp"
style="@style/Widget.MaterialComponents.Button.OutlinedButton" />