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
public void onResume() {
super.onResume();
refreshStats();
refreshStatistics();
}
@Override
@ -81,44 +81,44 @@ public class StatisticsActivity extends AppCompatActivity
if (item.getItemId() == android.R.id.home) {
finish();
return true;
} else if (item.getItemId() == R.id.calculation_type) {
selectCalculationType();
} else if (item.getItemId() == R.id.statistics_mode) {
selectStatisticsMode();
return true;
} else {
return super.onOptionsItemSelected(item);
}
}
private void selectCalculationType() {
View contentView = View.inflate(this, R.layout.calculation_type, null);
private void selectStatisticsMode() {
View contentView = View.inflate(this, R.layout.statistics_mode_select_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setView(contentView);
builder.setTitle(R.string.calculation_type);
builder.setTitle(R.string.statistics_mode);
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 {
((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) -> {
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);
prefs.edit().putBoolean(PREF_COUNT_ALL, countAll).commit();
refreshStats();
prefs.edit().putBoolean(PREF_COUNT_ALL, countAll).apply();
refreshStatistics();
});
builder.show();
}
private void refreshStats() {
private void refreshStatistics() {
progressBar.setVisibility(View.VISIBLE);
totalTimeTextView.setVisibility(View.GONE);
feedStatisticsList.setVisibility(View.GONE);
loadStats();
loadStatistics();
}
private void loadStats() {
private void loadStatistics() {
if (subscription != null) {
subscription.unsubscribe();
}

View File

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

View File

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

View File

@ -31,9 +31,9 @@
<!-- Statistics fragment -->
<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="calculation_type">Calculation type</string>
<string name="calculation_type_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">Statistics mode</string>
<string name="statistics_mode_normal">The time you actually played podcasts, respecting playback speed</string>
<string name="statistics_mode_count_all">Sum up all played podcast durations, including those just marked as played</string>
<!-- Main activity -->
<string name="drawer_open">Open menu</string>