Add an About menu

This commit is contained in:
Adam Baker 2016-05-21 22:44:25 +01:00
parent c14e3d077c
commit e31a0caa76
8 changed files with 90 additions and 6 deletions

View file

@ -44,6 +44,10 @@ android {
exclude 'about.html' exclude 'about.html'
} }
defaultConfig {
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
}
signingConfigs { signingConfigs {
release { release {
// Android Studio does not pass environment variables. // Android Studio does not pass environment variables.

View file

@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
package="com.github.nutomic.controldlna" package="com.github.nutomic.controldlna"
android:versionCode="14" android:versionCode="14"
android:versionName="1.0.2" android:versionName="1.0.3"
tools:ignore="ExportedService" > tools:ignore="ExportedService" >
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET"/>
@ -42,8 +42,16 @@
</activity> </activity>
<activity <activity
android:name=".gui.PreferencesActivity" android:name=".gui.PreferencesActivity"
android:label="@string/settings_title" > android:label="@string/settings_title" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".gui.MainActivity" />
</activity>
<activity
android:name=".gui.AboutActivity"
android:label="@string/about_title" >
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".gui.MainActivity" /> android:value=".gui.MainActivity" />

View file

@ -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());
}
}
}

View file

@ -182,12 +182,16 @@ public class MainActivity extends ActionBarActivity {
public boolean onOptionsItemSelected(MenuItem item) { public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) { switch (item.getItemId()) {
case R.id.preferences: case R.id.preferences:
Intent i = new Intent(this, PreferencesActivity.class); Intent p = new Intent(this, PreferencesActivity.class);
startActivity(i); startActivity(p);
return true; return true;
case R.id.refreshdev: case R.id.refreshdev:
mServerFragment.triggerSearch(); mServerFragment.triggerSearch();
return true; return true;
case R.id.about:
Intent a = new Intent(this, AboutActivity.class);
startActivity(a);
return true;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }

View file

@ -252,7 +252,7 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene
return; return;
menu.add(Menu.NONE, 1, Menu.NONE, "Append track to playlist"); 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");
} }
/** /**

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/about_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/about_text" />
<TextView
android:id="@+id/about_build"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Version Displayed Here"/>
</LinearLayout>
</ScrollView>

View file

@ -8,5 +8,8 @@
<item <item
android:id="@+id/refreshdev" android:id="@+id/refreshdev"
android:title="@string/refresh_title" /> android:title="@string/refresh_title" />
<item
android:id="@+id/about"
android:title="@string/about_title" />
</menu> </menu>

View file

@ -46,6 +46,20 @@
<!-- Title for the Refresh Devices Action--> <!-- Title for the Refresh Devices Action-->
<string name="refresh_title">Refresh Devices</string> <string name="refresh_title">Refresh Devices</string>
<!-- Title for the About Menu-->
<string name="about_title">About</string>
<!-- Title for the About Menu-->
<string name="about_text">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
</string>
<!-- Title for the SettingsActivity --> <!-- Title for the SettingsActivity -->
<string name="settings_title">Preferences</string> <string name="settings_title">Preferences</string>