From f10dd428bab50a05883a9f7f3d65db085e2e5359 Mon Sep 17 00:00:00 2001 From: Sam Whited Date: Tue, 4 Nov 2014 12:08:30 -0500 Subject: Convert about dialog to activity --- .../eu/siacs/conversations/ui/AboutActivity.java | 15 ++++++++ .../eu/siacs/conversations/ui/AboutDialog.java | 33 ----------------- .../eu/siacs/conversations/ui/AboutPreference.java | 41 ++++++++++++++++++++++ 3 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 src/main/java/eu/siacs/conversations/ui/AboutActivity.java delete mode 100644 src/main/java/eu/siacs/conversations/ui/AboutDialog.java create mode 100644 src/main/java/eu/siacs/conversations/ui/AboutPreference.java (limited to 'src/main/java/eu') diff --git a/src/main/java/eu/siacs/conversations/ui/AboutActivity.java b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java new file mode 100644 index 00000000..a61b872a --- /dev/null +++ b/src/main/java/eu/siacs/conversations/ui/AboutActivity.java @@ -0,0 +1,15 @@ +package eu.siacs.conversations.ui; + +import android.app.Activity; +import android.os.Bundle; + +import eu.siacs.conversations.R; + +public class AboutActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_about); + } +} diff --git a/src/main/java/eu/siacs/conversations/ui/AboutDialog.java b/src/main/java/eu/siacs/conversations/ui/AboutDialog.java deleted file mode 100644 index 994d1bd9..00000000 --- a/src/main/java/eu/siacs/conversations/ui/AboutDialog.java +++ /dev/null @@ -1,33 +0,0 @@ -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/java/eu/siacs/conversations/ui/AboutPreference.java b/src/main/java/eu/siacs/conversations/ui/AboutPreference.java new file mode 100644 index 00000000..804b4e23 --- /dev/null +++ b/src/main/java/eu/siacs/conversations/ui/AboutPreference.java @@ -0,0 +1,41 @@ +package eu.siacs.conversations.ui; + +import android.content.Context; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.preference.Preference; +import android.util.AttributeSet; + +public class AboutPreference extends Preference { + public AboutPreference(final Context context, final AttributeSet attrs, final int defStyle) { + super(context, attrs, defStyle); + setSummary(); + } + + public AboutPreference(final Context context, final AttributeSet attrs) { + super(context, attrs); + setSummary(); + } + + @Override + protected void onClick() { + super.onClick(); + final Intent intent = new Intent(getContext(), AboutActivity.class); + getContext().startActivity(intent); + } + + 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/ + } + } + } +} + -- cgit v1.2.3