From df54ee75b4802107ed28019f2284154459b0e6f5 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Tue, 21 Oct 2014 22:53:30 -0400 Subject: [PATCH] Add about dialog with license info --- .../siacs/conversations/ui/AboutDialog.java | 33 +++++++++++++++++ src/main/res/values/strings.xml | 37 +++++++++++++++++++ src/main/res/xml/preferences.xml | 7 ++++ 3 files changed, 77 insertions(+) create mode 100644 src/eu/siacs/conversations/ui/AboutDialog.java diff --git a/src/eu/siacs/conversations/ui/AboutDialog.java b/src/eu/siacs/conversations/ui/AboutDialog.java new file mode 100644 index 000000000..994d1bd92 --- /dev/null +++ b/src/eu/siacs/conversations/ui/AboutDialog.java @@ -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/ + } + } + } +} + diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 0dbb49adb..640447747 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -254,6 +254,43 @@ Enables SSLv3 support for legacy servers. Warning: SSLv3 is considered insecure. Expert options Please be careful with these + About Conversations + Build and licensing information + + 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. + Increase font size Use larger font sizes across the entire app Send button indicates status diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 06ab7560e..adcde7462 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -110,5 +110,12 @@ android:summary="@string/pref_never_send_crash_summary" android:title="@string/pref_never_send_crash" /> + +