|
@@ -38,75 +38,75 @@ import java.util.regex.Pattern;
|
|
|
*/
|
|
|
public class FeatureList {
|
|
|
|
|
|
- static final private boolean SHOW_ON_FIRST_RUN = true;
|
|
|
- static final private boolean SHOW_ON_UPGRADE = false;
|
|
|
+ static final private boolean SHOW_ON_FIRST_RUN = true;
|
|
|
+ static final private boolean SHOW_ON_UPGRADE = false;
|
|
|
|
|
|
|
|
|
- static final private FeatureItem featuresList[] = {
|
|
|
+ static final private FeatureItem featuresList[] = {
|
|
|
// Basic features showed on first install
|
|
|
- new FeatureItem(R.drawable.what_new_instant_upload, R.string.welcome_feature_1_title, R.string.welcome_feature_1_text, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
- new FeatureItem(R.drawable.whats_new_files, R.string.welcome_feature_2_title, R.string.welcome_feature_2_text, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
- new FeatureItem(R.drawable.whats_new_share, R.string.welcome_feature_3_title, R.string.welcome_feature_3_text, "1.0.0", "0" ,SHOW_ON_FIRST_RUN),
|
|
|
- new FeatureItem(R.drawable.whats_new_accounts, R.string.welcome_feature_4_title, R.string.welcome_feature_4_text, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
- new FeatureItem(R.drawable.whats_new_oc_files, R.string.welcome_feature_5_title, FeatureItem.DO_NOT_SHOW, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
+ new FeatureItem(R.drawable.what_new_instant_upload, R.string.welcome_feature_1_title, R.string.welcome_feature_1_text, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
+ new FeatureItem(R.drawable.whats_new_files, R.string.welcome_feature_2_title, R.string.welcome_feature_2_text, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
+ new FeatureItem(R.drawable.whats_new_share, R.string.welcome_feature_3_title, R.string.welcome_feature_3_text, "1.0.0", "0" ,SHOW_ON_FIRST_RUN),
|
|
|
+ new FeatureItem(R.drawable.whats_new_accounts, R.string.welcome_feature_4_title, R.string.welcome_feature_4_text, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
+ new FeatureItem(R.drawable.whats_new_oc_files, R.string.welcome_feature_5_title, FeatureItem.DO_NOT_SHOW, "1.0.0", "0", SHOW_ON_FIRST_RUN),
|
|
|
// Features introduced in certain point in time
|
|
|
};
|
|
|
|
|
|
|
|
|
- static public FeatureItem[] get() {
|
|
|
- return featuresList;
|
|
|
- }
|
|
|
+ static public FeatureItem[] get() {
|
|
|
+ return featuresList;
|
|
|
+ }
|
|
|
|
|
|
- static public FeatureItem[] getFiltered(final int lastSeenVersionCode, final boolean isFirstRun, boolean isBeta) {
|
|
|
- List<FeatureItem> features = new LinkedList<>();
|
|
|
+ static public FeatureItem[] getFiltered(final int lastSeenVersionCode, final boolean isFirstRun, boolean isBeta) {
|
|
|
+ List<FeatureItem> features = new LinkedList<>();
|
|
|
|
|
|
- for (FeatureItem item : get()) {
|
|
|
+ for (FeatureItem item : get()) {
|
|
|
final int itemVersionCode = isBeta ? item.getBetaVersionNumber() : item.getVersionNumber();
|
|
|
- if (isFirstRun && item.shouldShowOnFirstRun()) {
|
|
|
- features.add(item);
|
|
|
- } else if (!isFirstRun && !item.shouldShowOnFirstRun() &&
|
|
|
- MainApp.getVersionCode() >= itemVersionCode &&
|
|
|
- lastSeenVersionCode < itemVersionCode) {
|
|
|
- features.add(item);
|
|
|
- }
|
|
|
- }
|
|
|
- return features.toArray(new FeatureItem[features.size()]);
|
|
|
- }
|
|
|
-
|
|
|
- static public class FeatureItem implements Parcelable {
|
|
|
- public static final int DO_NOT_SHOW = -1;
|
|
|
- private int image;
|
|
|
- private int titleText;
|
|
|
- private int contentText;
|
|
|
- private int versionNumber;
|
|
|
+ if (isFirstRun && item.shouldShowOnFirstRun()) {
|
|
|
+ features.add(item);
|
|
|
+ } else if (!isFirstRun && !item.shouldShowOnFirstRun() &&
|
|
|
+ MainApp.getVersionCode() >= itemVersionCode &&
|
|
|
+ lastSeenVersionCode < itemVersionCode) {
|
|
|
+ features.add(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return features.toArray(new FeatureItem[features.size()]);
|
|
|
+ }
|
|
|
+
|
|
|
+ static public class FeatureItem implements Parcelable {
|
|
|
+ public static final int DO_NOT_SHOW = -1;
|
|
|
+ private int image;
|
|
|
+ private int titleText;
|
|
|
+ private int contentText;
|
|
|
+ private int versionNumber;
|
|
|
private int betaVersion;
|
|
|
- private boolean showOnInitialRun;
|
|
|
+ private boolean showOnInitialRun;
|
|
|
|
|
|
- public FeatureItem(int image, int titleText, int contentText, String version, String betaVersion) {
|
|
|
- this(image, titleText, contentText, version, betaVersion, false);
|
|
|
- }
|
|
|
+ public FeatureItem(int image, int titleText, int contentText, String version, String betaVersion) {
|
|
|
+ this(image, titleText, contentText, version, betaVersion, false);
|
|
|
+ }
|
|
|
|
|
|
- public FeatureItem(int image, int titleText, int contentText, String version, String betaVersion, boolean showOnInitialRun) {
|
|
|
- this.image = image;
|
|
|
- this.titleText = titleText;
|
|
|
- this.contentText = contentText;
|
|
|
- this.versionNumber = versionCodeFromString(version);
|
|
|
+ public FeatureItem(int image, int titleText, int contentText, String version, String betaVersion, boolean showOnInitialRun) {
|
|
|
+ this.image = image;
|
|
|
+ this.titleText = titleText;
|
|
|
+ this.contentText = contentText;
|
|
|
+ this.versionNumber = versionCodeFromString(version);
|
|
|
this.betaVersion = Integer.parseInt(betaVersion);
|
|
|
- this.showOnInitialRun = showOnInitialRun;
|
|
|
- }
|
|
|
+ this.showOnInitialRun = showOnInitialRun;
|
|
|
+ }
|
|
|
|
|
|
- public boolean shouldShowImage() { return image != DO_NOT_SHOW; }
|
|
|
- public int getImage() { return image; }
|
|
|
+ public boolean shouldShowImage() { return image != DO_NOT_SHOW; }
|
|
|
+ public int getImage() { return image; }
|
|
|
|
|
|
- public boolean shouldShowTitleText() { return titleText != DO_NOT_SHOW; }
|
|
|
- public int getTitleText() { return titleText; }
|
|
|
+ public boolean shouldShowTitleText() { return titleText != DO_NOT_SHOW; }
|
|
|
+ public int getTitleText() { return titleText; }
|
|
|
|
|
|
- public boolean shouldShowContentText() { return contentText != DO_NOT_SHOW; }
|
|
|
- public int getContentText() { return contentText; }
|
|
|
+ public boolean shouldShowContentText() { return contentText != DO_NOT_SHOW; }
|
|
|
+ public int getContentText() { return contentText; }
|
|
|
|
|
|
- public int getVersionNumber() { return versionNumber; }
|
|
|
+ public int getVersionNumber() { return versionNumber; }
|
|
|
public int getBetaVersionNumber() { return betaVersion; }
|
|
|
- public boolean shouldShowOnFirstRun() { return showOnInitialRun; }
|
|
|
+ public boolean shouldShowOnFirstRun() { return showOnInitialRun; }
|
|
|
|
|
|
@Override
|
|
|
public int describeContents() {
|
|
@@ -146,16 +146,16 @@ public class FeatureList {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- static int versionCodeFromString(String version) {
|
|
|
- String v[] = version.split(Pattern.quote("."));
|
|
|
- if (v.length != 3) {
|
|
|
- Log_OC.wtf("FeatureList", "Version string is incorrect " + version);
|
|
|
- return 0;
|
|
|
- }
|
|
|
- int result = Integer.parseInt(v[0])*(int)(10e6) +
|
|
|
- Integer.parseInt(v[1])*(int)(10e4) +
|
|
|
- Integer.parseInt(v[2])*100;
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
+ static int versionCodeFromString(String version) {
|
|
|
+ String v[] = version.split(Pattern.quote("."));
|
|
|
+ if (v.length != 3) {
|
|
|
+ Log_OC.wtf("FeatureList", "Version string is incorrect " + version);
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ int result = Integer.parseInt(v[0])*(int)(10e6) +
|
|
|
+ Integer.parseInt(v[1])*(int)(10e4) +
|
|
|
+ Integer.parseInt(v[2])*100;
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|