tabs to spaces

This commit is contained in:
Bartosz Przybylski 2016-02-13 21:24:38 +01:00 committed by AndyScherzinger
parent 2663ff871e
commit 5ee2fbacf6
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

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