mirror of
https://github.com/gsantner/dandelion
synced 2025-09-10 10:49:42 +02:00
Merge license and changelog dialog on first start
This commit is contained in:
parent
82ccc54436
commit
d53128e5cb
7 changed files with 20 additions and 25 deletions
|
@ -263,7 +263,7 @@ public class AboutActivity extends ThemedActivity
|
|||
contributors.setTextFormatted(getString(R.string.fragment_license__contributors_thank_you,
|
||||
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.contributors, "")));
|
||||
thirdPartyLibs.setTextFormatted(
|
||||
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.license_third_party, ""));
|
||||
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.licenses_3rd_party, ""));
|
||||
}
|
||||
|
||||
@OnClick({R.id.fragment_license__leafpic_button, R.id.fragment_license__license_button})
|
||||
|
|
|
@ -229,23 +229,16 @@ public class MainActivity extends ThemedActivity
|
|||
}
|
||||
}
|
||||
|
||||
// Show first start dialog
|
||||
// Show first start / update dialog
|
||||
try {
|
||||
SimpleMarkdownParser mdParser = SimpleMarkdownParser.get().setDefaultSmpFilter(SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW);
|
||||
if (_appSettings.isAppFirstStart()) {
|
||||
mdParser.parse(
|
||||
getResources().openRawResource(R.raw.license), "");
|
||||
String html = mdParser.getHtml()
|
||||
+ "<br/><br/><br/>"
|
||||
+ "<h1>" + getString(R.string.fragment_license__thirdparty_libs) + "</h1>"
|
||||
+ mdParser.parse(getResources().openRawResource(R.raw.license_third_party), "");
|
||||
html = mdParser.setHtml(html).removeMultiNewlines().getHtml();
|
||||
ActivityUtils.get(this).showDialogWithHtmlTextView(R.string.about_activity__title_about_license, html);
|
||||
_appSettings.isAppCurrentVersionFirstStart();
|
||||
} else if (_appSettings.isAppCurrentVersionFirstStart()) {
|
||||
SimpleMarkdownParser smp = new SimpleMarkdownParser().parse(
|
||||
getResources().openRawResource(R.raw.changelog), "");
|
||||
ActivityUtils.get(this).showDialogWithHtmlTextView(R.string.changelog, smp.getHtml());
|
||||
if (_appSettings.isAppCurrentVersionFirstStart(true)) {
|
||||
SimpleMarkdownParser smp = SimpleMarkdownParser.get().setDefaultSmpFilter(SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW);
|
||||
String html = "";
|
||||
html += smp.parse(getString(R.string.copyright_license_text_official).replace("\n", " \n"), "").getHtml();
|
||||
html += "<br/><br/><br/><big><big>" + getString(R.string.changelog) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.changelog), "", SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW, SimpleMarkdownParser.FILTER_CHANGELOG).getHtml();
|
||||
html += "<br/><br/><br/><big><big>" + getString(R.string.licenses) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.licenses_3rd_party), "").getHtml();
|
||||
ActivityUtils _au = new ActivityUtils(this);
|
||||
_au.showDialogWithHtmlTextView(R.string.licenses, html);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Locale;
|
|||
|
||||
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"})
|
||||
public class ActivityUtils extends net.gsantner.opoc.util.ActivityUtils {
|
||||
protected ActivityUtils(Activity activity) {
|
||||
public ActivityUtils(Activity activity) {
|
||||
super(activity);
|
||||
}
|
||||
|
||||
|
|
|
@ -367,9 +367,11 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
|||
return value;
|
||||
}
|
||||
|
||||
public boolean isAppCurrentVersionFirstStart() {
|
||||
public boolean isAppCurrentVersionFirstStart(boolean doSet) {
|
||||
int value = getInt(R.string.pref_key__app_first_start_current_version, -1);
|
||||
setInt(R.string.pref_key__app_first_start_current_version, BuildConfig.VERSION_CODE);
|
||||
if (doSet) {
|
||||
setInt(R.string.pref_key__app_first_start_current_version, BuildConfig.VERSION_CODE);
|
||||
}
|
||||
return value != BuildConfig.VERSION_CODE && !BuildConfig.IS_TEST_BUILD;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue