Renamed type to mode

This commit is contained in:
ByteHamster 2017-04-15 15:34:31 +02:00
parent 416117515c
commit 769ed8b15e
4 changed files with 23 additions and 23 deletions

View File

@ -65,7 +65,7 @@ public class StatisticsActivity extends AppCompatActivity
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
refreshStats(); refreshStatistics();
} }
@Override @Override
@ -81,44 +81,44 @@ public class StatisticsActivity extends AppCompatActivity
if (item.getItemId() == android.R.id.home) { if (item.getItemId() == android.R.id.home) {
finish(); finish();
return true; return true;
} else if (item.getItemId() == R.id.calculation_type) { } else if (item.getItemId() == R.id.statistics_mode) {
selectCalculationType(); selectStatisticsMode();
return true; return true;
} else { } else {
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
} }
private void selectCalculationType() { private void selectStatisticsMode() {
View contentView = View.inflate(this, R.layout.calculation_type, null); View contentView = View.inflate(this, R.layout.statistics_mode_select_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(contentView); builder.setView(contentView);
builder.setTitle(R.string.calculation_type); builder.setTitle(R.string.statistics_mode);
if (countAll) { if (countAll) {
((RadioButton) contentView.findViewById(R.id.calculation_type_count_all)).setChecked(true); ((RadioButton) contentView.findViewById(R.id.statistics_mode_count_all)).setChecked(true);
} else { } else {
((RadioButton) contentView.findViewById(R.id.calculation_type_normal)).setChecked(true); ((RadioButton) contentView.findViewById(R.id.statistics_mode_normal)).setChecked(true);
} }
builder.setPositiveButton(android.R.string.ok, (dialog, which) -> { builder.setPositiveButton(android.R.string.ok, (dialog, which) -> {
countAll = ((RadioButton) contentView.findViewById(R.id.calculation_type_count_all)).isChecked(); countAll = ((RadioButton) contentView.findViewById(R.id.statistics_mode_count_all)).isChecked();
listAdapter.setCountAll(countAll); listAdapter.setCountAll(countAll);
prefs.edit().putBoolean(PREF_COUNT_ALL, countAll).commit(); prefs.edit().putBoolean(PREF_COUNT_ALL, countAll).apply();
refreshStats(); refreshStatistics();
}); });
builder.show(); builder.show();
} }
private void refreshStats() { private void refreshStatistics() {
progressBar.setVisibility(View.VISIBLE); progressBar.setVisibility(View.VISIBLE);
totalTimeTextView.setVisibility(View.GONE); totalTimeTextView.setVisibility(View.GONE);
feedStatisticsList.setVisibility(View.GONE); feedStatisticsList.setVisibility(View.GONE);
loadStats(); loadStatistics();
} }
private void loadStats() { private void loadStatistics() {
if (subscription != null) { if (subscription != null) {
subscription.unsubscribe(); subscription.unsubscribe();
} }

View File

@ -6,14 +6,14 @@
android:padding="16dp"> android:padding="16dp">
<RadioButton <RadioButton
android:id="@+id/calculation_type_normal" android:id="@+id/statistics_mode_normal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/calculation_type_normal" /> android:text="@string/statistics_mode_normal" />
<RadioButton <RadioButton
android:id="@+id/calculation_type_count_all" android:id="@+id/statistics_mode_count_all"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/calculation_type_count_all" /> android:text="@string/statistics_mode_count_all" />
</RadioGroup> </RadioGroup>

View File

@ -3,9 +3,9 @@
xmlns:custom="http://schemas.android.com/apk/res-auto"> xmlns:custom="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/calculation_type" android:id="@+id/statistics_mode"
android:icon="?attr/ic_filter" android:icon="?attr/ic_filter"
android:title="@string/calculation_type" android:title="@string/statistics_mode"
custom:showAsAction="never"> custom:showAsAction="never">
</item> </item>

View File

@ -31,9 +31,9 @@
<!-- Statistics fragment --> <!-- Statistics fragment -->
<string name="total_time_listened_to_podcasts">Total time of podcasts played:</string> <string name="total_time_listened_to_podcasts">Total time of podcasts played:</string>
<string name="statistics_details_dialog">%1$d out of %2$d episodes started.\n\nPlayed %3$s out of %4$s.</string> <string name="statistics_details_dialog">%1$d out of %2$d episodes started.\n\nPlayed %3$s out of %4$s.</string>
<string name="calculation_type">Calculation type</string> <string name="statistics_mode">Statistics mode</string>
<string name="calculation_type_normal">The time you actually played podcasts, respecting playback speed</string> <string name="statistics_mode_normal">The time you actually played podcasts, respecting playback speed</string>
<string name="calculation_type_count_all">Sum up all played podcast durations, including those just marked as played</string> <string name="statistics_mode_count_all">Sum up all played podcast durations, including those just marked as played</string>
<!-- Main activity --> <!-- Main activity -->
<string name="drawer_open">Open menu</string> <string name="drawer_open">Open menu</string>