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; import javax.annotation.Nonnull;
public class ChooseThemeReleaseNoteStep extends ReleaseNoteStep { public class ChooseThemeReleaseNoteStep extends ReleaseNoteStep {
public static final int VERSION_CODE = 137;
public ChooseThemeReleaseNoteStep(Integer version) { public ChooseThemeReleaseNoteStep(Integer version) {
super(version); super(version);
} }

View File

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

View File

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

View File

@ -331,5 +331,5 @@
<string name="cpp_var_show_greek_keyboard">Показать греческий алфавит</string> <string name="cpp_var_show_greek_keyboard">Показать греческий алфавит</string>
<string name="cpp_var_hide_greek_keyboard">Скрыть греческий алфавит</string> <string name="cpp_var_hide_greek_keyboard">Скрыть греческий алфавит</string>
<string name="cpp_new_in_version">Новое в версии %1$s</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> </resources>