mirror of
https://github.com/gsantner/dandelion
synced 2024-11-22 04:12:08 +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,
|
contributors.setTextFormatted(getString(R.string.fragment_license__contributors_thank_you,
|
||||||
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.contributors, "")));
|
ContextUtils.get().loadMarkdownForTextViewFromRaw(R.raw.contributors, "")));
|
||||||
thirdPartyLibs.setTextFormatted(
|
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})
|
@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 {
|
try {
|
||||||
SimpleMarkdownParser mdParser = SimpleMarkdownParser.get().setDefaultSmpFilter(SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW);
|
if (_appSettings.isAppCurrentVersionFirstStart(true)) {
|
||||||
if (_appSettings.isAppFirstStart()) {
|
SimpleMarkdownParser smp = SimpleMarkdownParser.get().setDefaultSmpFilter(SimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW);
|
||||||
mdParser.parse(
|
String html = "";
|
||||||
getResources().openRawResource(R.raw.license), "");
|
html += smp.parse(getString(R.string.copyright_license_text_official).replace("\n", " \n"), "").getHtml();
|
||||||
String html = mdParser.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();
|
||||||
+ "<br/><br/><br/>"
|
html += "<br/><br/><br/><big><big>" + getString(R.string.licenses) + "</big></big><br/>" + smp.parse(getResources().openRawResource(R.raw.licenses_3rd_party), "").getHtml();
|
||||||
+ "<h1>" + getString(R.string.fragment_license__thirdparty_libs) + "</h1>"
|
ActivityUtils _au = new ActivityUtils(this);
|
||||||
+ mdParser.parse(getResources().openRawResource(R.raw.license_third_party), "");
|
_au.showDialogWithHtmlTextView(R.string.licenses, html);
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Locale;
|
||||||
|
|
||||||
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"})
|
@SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue"})
|
||||||
public class ActivityUtils extends net.gsantner.opoc.util.ActivityUtils {
|
public class ActivityUtils extends net.gsantner.opoc.util.ActivityUtils {
|
||||||
protected ActivityUtils(Activity activity) {
|
public ActivityUtils(Activity activity) {
|
||||||
super(activity);
|
super(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -367,9 +367,11 @@ public class AppSettings extends SharedPreferencesPropertyBackend {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAppCurrentVersionFirstStart() {
|
public boolean isAppCurrentVersionFirstStart(boolean doSet) {
|
||||||
int value = getInt(R.string.pref_key__app_first_start_current_version, -1);
|
int value = getInt(R.string.pref_key__app_first_start_current_version, -1);
|
||||||
|
if (doSet) {
|
||||||
setInt(R.string.pref_key__app_first_start_current_version, BuildConfig.VERSION_CODE);
|
setInt(R.string.pref_key__app_first_start_current_version, BuildConfig.VERSION_CODE);
|
||||||
|
}
|
||||||
return value != BuildConfig.VERSION_CODE && !BuildConfig.IS_TEST_BUILD;
|
return value != BuildConfig.VERSION_CODE && !BuildConfig.IS_TEST_BUILD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,14 +108,14 @@
|
||||||
style="@android:style/TextAppearance.DeviceDefault.Large"
|
style="@android:style/TextAppearance.DeviceDefault.Large"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/fragment_license__license"
|
android:text="@string/licenses"
|
||||||
android:layout_marginBottom="8dp"/>
|
android:layout_marginBottom="8dp"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat"
|
android:textAppearance="@style/TextAppearance.AppCompat"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/fragment_license__license_text"/>
|
android:text="@string/copyright_license_text_official"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/fragment_license__license_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__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">Contributors</string>
|
||||||
<string name="fragment_license__contributors_thank_you">%1$s<br><br>Thank you!</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="licenses" translatable="false">@string/about_activity__title_about_license</string>
|
||||||
<string name="fragment_license__license_text" translatable="false">
|
<string name="copyright_license_text_official" translatable="false">
|
||||||
Copyright © 2015-2017
|
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.
|
\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
|
\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.
|
\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