Add about dialog with license info

This commit is contained in:
Sam Whited 2014-10-21 22:53:30 -04:00
parent ff10b094a0
commit df54ee75b4
3 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,33 @@
package eu.siacs.conversations.ui;
import android.content.Context;
import android.content.pm.PackageManager;
import android.preference.DialogPreference;
import android.util.AttributeSet;
public class AboutDialog extends DialogPreference {
public AboutDialog(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle);
setSummary();
}
public AboutDialog(final Context context, final AttributeSet attrs) {
super(context, attrs);
setSummary();
}
private void setSummary() {
if (getContext() != null &&getContext().getPackageManager() != null) {
final String packageName = getContext().getPackageName();
final String versionName;
try {
versionName = getContext().getPackageManager().getPackageInfo(packageName, 0).versionName;
setSummary("Conversations " + versionName);
} catch (final PackageManager.NameNotFoundException e) {
// Using try/catch as part of the logic is sort of like this:
// https://xkcd.com/292/
}
}
}
}

View file

@ -254,6 +254,43 @@
<string name="pref_enable_legacy_ssl_summary">Enables SSLv3 support for legacy servers. Warning: SSLv3 is considered insecure.</string>
<string name="pref_expert_options">Expert options</string>
<string name="pref_expert_options_summary">Please be careful with these</string>
<string name="pref_about_conversations">About Conversations</string>
<string name="pref_about_conversations_summary">Build and licensing information</string>
<string name="pref_about_message">
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 3 as published
by the Free Software Foundation.\n
\n
Link: http://www.gnu.org/licenses/gpl-3.0.html\n
\n
OpenPGP API is licensed under the Apache License, Version 2.0; You may
obtain a copy of the License at:\n
\n
http://www.apache.org/licenses/LICENSE-2.0\n
\n
Minidns (c) 2014 Rene Treffer and is provided under the WTFPL\n
\n
MemorizingTrustManager Copyright (c) 2010 Georg Lukas\n
\n
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:\n
\n
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.\n
\n
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
</string>
<string name="pref_use_larger_font">Increase font size</string>
<string name="pref_use_larger_font_summary">Use larger font sizes across the entire app</string>
<string name="pref_use_send_button_to_indicate_status">Send button indicates status</string>

View file

@ -110,5 +110,12 @@
android:summary="@string/pref_never_send_crash_summary"
android:title="@string/pref_never_send_crash" />
</PreferenceCategory>
<eu.siacs.conversations.ui.AboutDialog
android:summary="@string/pref_about_conversations_summary"
android:title="@string/pref_about_conversations"
android:dialogIcon="@drawable/ic_activity"
android:negativeButtonText="@null"
android:dialogMessage="@string/pref_about_message">
</eu.siacs.conversations.ui.AboutDialog>
</PreferenceScreen>