mirror of
https://github.com/gsantner/dandelion
synced 2024-12-22 10:58:01 +01: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;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,14 +108,14 @@
|
|||
style="@android:style/TextAppearance.DeviceDefault.Large"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fragment_license__license"
|
||||
android:text="@string/licenses"
|
||||
android:layout_marginBottom="8dp"/>
|
||||
|
||||
<TextView
|
||||
android:textAppearance="@style/TextAppearance.AppCompat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/fragment_license__license_text"/>
|
||||
android:text="@string/copyright_license_text_official"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/fragment_license__license_button"
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
<string name="fragment_license__maintainers_text">This app is currently being developed and maintained by <br><br>%1$s</string>
|
||||
<string name="fragment_license__contributors">Contributors</string>
|
||||
<string name="fragment_license__contributors_thank_you">%1$s<br><br>Thank you!</string>
|
||||
<string name="fragment_license__license" translatable="false">@string/about_activity__title_about_license</string>
|
||||
<string name="fragment_license__license_text" translatable="false">
|
||||
Copyright © 2015-2017
|
||||
<string name="licenses" translatable="false">@string/about_activity__title_about_license</string>
|
||||
<string name="copyright_license_text_official" translatable="false">
|
||||
Copyright © 2015-2018
|
||||
\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
\n
|
||||
\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
|
Loading…
Reference in a new issue