From e31a0caa765347fa553a137e7368f7fc32d6eaf0 Mon Sep 17 00:00:00 2001 From: Adam Baker Date: Sat, 21 May 2016 22:44:25 +0100 Subject: [PATCH] Add an About menu --- build.gradle | 4 +++ src/main/AndroidManifest.xml | 14 ++++++-- .../controldlna/gui/AboutActivity.java | 32 +++++++++++++++++++ .../nutomic/controldlna/gui/MainActivity.java | 8 +++-- .../controldlna/gui/ServerFragment.java | 2 +- src/main/res/layout/about.xml | 19 +++++++++++ src/main/res/menu/menu.xml | 3 ++ src/main/res/values/strings.xml | 14 ++++++++ 8 files changed, 90 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/github/nutomic/controldlna/gui/AboutActivity.java create mode 100644 src/main/res/layout/about.xml diff --git a/build.gradle b/build.gradle index 4c0530e..29fbfa1 100644 --- a/build.gradle +++ b/build.gradle @@ -44,6 +44,10 @@ android { exclude 'about.html' } + defaultConfig { + buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L" + } + signingConfigs { release { // Android Studio does not pass environment variables. diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 96b9fd1..e871fc1 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -3,7 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" package="com.github.nutomic.controldlna" android:versionCode="14" - android:versionName="1.0.2" + android:versionName="1.0.3" tools:ignore="ExportedService" > @@ -42,8 +42,16 @@ + android:name=".gui.PreferencesActivity" + android:label="@string/settings_title" > + + + + diff --git a/src/main/java/com/github/nutomic/controldlna/gui/AboutActivity.java b/src/main/java/com/github/nutomic/controldlna/gui/AboutActivity.java new file mode 100644 index 0000000..9b2041a --- /dev/null +++ b/src/main/java/com/github/nutomic/controldlna/gui/AboutActivity.java @@ -0,0 +1,32 @@ +package com.github.nutomic.controldlna.gui; + +import android.app.Activity; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.os.Bundle; +import android.widget.TextView; +import java.util.Date; + +import com.github.nutomic.controldlna.BuildConfig; +import com.github.nutomic.controldlna.R; + +/** + * Created by aab on 21/05/16. + */ +public class AboutActivity extends Activity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.about); + Date buildDate = new Date(BuildConfig.TIMESTAMP); + TextView aboutBuild = (TextView) findViewById(R.id.about_build); + try { + PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); + aboutBuild.setText("Version: " + pInfo.versionName + "\nBuilt: " + buildDate.toString()); + } + catch(PackageManager.NameNotFoundException e) { + aboutBuild.setText("Version: Unknown\nBuilt: " + buildDate.toString()); + } + + } +} diff --git a/src/main/java/com/github/nutomic/controldlna/gui/MainActivity.java b/src/main/java/com/github/nutomic/controldlna/gui/MainActivity.java index b33d47d..855e12e 100644 --- a/src/main/java/com/github/nutomic/controldlna/gui/MainActivity.java +++ b/src/main/java/com/github/nutomic/controldlna/gui/MainActivity.java @@ -182,12 +182,16 @@ public class MainActivity extends ActionBarActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.preferences: - Intent i = new Intent(this, PreferencesActivity.class); - startActivity(i); + Intent p = new Intent(this, PreferencesActivity.class); + startActivity(p); return true; case R.id.refreshdev: mServerFragment.triggerSearch(); return true; + case R.id.about: + Intent a = new Intent(this, AboutActivity.class); + startActivity(a); + return true; default: return super.onOptionsItemSelected(item); } diff --git a/src/main/java/com/github/nutomic/controldlna/gui/ServerFragment.java b/src/main/java/com/github/nutomic/controldlna/gui/ServerFragment.java index 0c969d0..5a83816 100644 --- a/src/main/java/com/github/nutomic/controldlna/gui/ServerFragment.java +++ b/src/main/java/com/github/nutomic/controldlna/gui/ServerFragment.java @@ -252,7 +252,7 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene return; menu.add(Menu.NONE, 1, Menu.NONE, "Append track to playlist"); - menu.add(Menu.NONE, 2, Menu.NONE, "Append folder playlist"); + menu.add(Menu.NONE, 2, Menu.NONE, "Append folder to playlist"); } /** diff --git a/src/main/res/layout/about.xml b/src/main/res/layout/about.xml new file mode 100644 index 0000000..7b17d47 --- /dev/null +++ b/src/main/res/layout/about.xml @@ -0,0 +1,19 @@ + + + + + + + \ No newline at end of file diff --git a/src/main/res/menu/menu.xml b/src/main/res/menu/menu.xml index b1578a8..7962260 100644 --- a/src/main/res/menu/menu.xml +++ b/src/main/res/menu/menu.xml @@ -8,5 +8,8 @@ + \ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 376db95..f7675b5 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -46,6 +46,20 @@ Refresh Devices + + About + + + ControlDLNA - a UPnP media control point + \nOriginal version: + \nCopyright (c) 2013, Felix Ableitner, All rights reserved. + \nModifications: + \nCopyright (c) 2016 Adam Baker, All rights reserved. + \n + \nBSD 3-Clause License + \n + + Preferences