VERSION_CODE constant instead of hard coded number

This commit is contained in:
serso 2015-02-10 23:56:26 +01:00
parent c410e0f662
commit 15e7b0ee50
4 changed files with 8 additions and 5 deletions

View File

@ -6,6 +6,8 @@ import android.support.v4.app.Fragment;
import javax.annotation.Nonnull;
public class ChooseThemeReleaseNoteStep extends ReleaseNoteStep {
public static final int VERSION_CODE = 137;
public ChooseThemeReleaseNoteStep(Integer version) {
super(version);
}

View File

@ -13,6 +13,7 @@ import java.util.List;
import static org.solovyev.android.Android.getAppVersionCode;
public final class ReleaseNotes {
@Nonnull
public static String getReleaseNotes(@Nonnull Context context) {
return getReleaseNotesString(context, 0);
@ -54,8 +55,8 @@ public final class ReleaseNotes {
final TextHelper textHelper = new TextHelper(context.getResources(), CalculatorApplication.class.getPackage().getName());
for (int versionCode = currentVersionCode; versionCode >= minVersion; versionCode--) {
if (versionCode == 136) {
releaseNotes.add(136);
if (versionCode == ChooseThemeReleaseNoteStep.VERSION_CODE) {
releaseNotes.add(ChooseThemeReleaseNoteStep.VERSION_CODE);
}
final String releaseNotesForVersion = textHelper.getText(makeReleaseNotesResourceId(versionCode));
if (!Strings.isEmpty(releaseNotesForVersion)) {
@ -71,7 +72,7 @@ public final class ReleaseNotes {
final TextHelper textHelper = new TextHelper(context.getResources(), CalculatorApplication.class.getPackage().getName());
for (int versionCode = currentVersionCode; versionCode >= minVersion; versionCode--) {
if (versionCode == 136) {
if (versionCode == ChooseThemeReleaseNoteStep.VERSION_CODE) {
return true;
}
String releaseNotesForVersion = textHelper.getText(makeReleaseNotesResourceId(versionCode));

View File

@ -88,7 +88,7 @@ public class CalculatorWizards implements Wizards {
for (Integer version : versions) {
switch (version) {
case 136:
case ChooseThemeReleaseNoteStep.VERSION_CODE:
wizardSteps.add(new ChooseThemeReleaseNoteStep(version));
break;
default:

View File

@ -331,5 +331,5 @@
<string name="cpp_var_show_greek_keyboard">Показать греческий алфавит</string>
<string name="cpp_var_hide_greek_keyboard">Скрыть греческий алфавит</string>
<string name="cpp_new_in_version">Новое в версии %1$s</string>
<string name="cpp_release_notes_choose_theme">Хотите попробовать новые темы в стиле Material? Выберите их из списка:</string>
<string name="cpp_release_notes_choose_theme">Хотите попробовать новые темы в стиле Матириал? Выберите их из списка:</string>
</resources>