Add an About menu
This commit is contained in:
parent
c14e3d077c
commit
e31a0caa76
8 changed files with 90 additions and 6 deletions
|
@ -44,6 +44,10 @@ android {
|
|||
exclude 'about.html'
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
buildConfigField "long", "TIMESTAMP", System.currentTimeMillis() + "L"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
// Android Studio does not pass environment variables.
|
||||
|
|
|
@ -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" >
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
@ -49,6 +49,14 @@
|
|||
android:value=".gui.MainActivity" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".gui.AboutActivity"
|
||||
android:label="@string/about_title" >
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".gui.MainActivity" />
|
||||
</activity>
|
||||
|
||||
<service android:name="org.fourthline.cling.android.AndroidUpnpServiceImpl" />
|
||||
|
||||
<service android:name=".mediarouter.MediaRouterPlayService" />
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
19
src/main/res/layout/about.xml
Normal file
19
src/main/res/layout/about.xml
Normal 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>
|
|
@ -8,5 +8,8 @@
|
|||
<item
|
||||
android:id="@+id/refreshdev"
|
||||
android:title="@string/refresh_title" />
|
||||
<item
|
||||
android:id="@+id/about"
|
||||
android:title="@string/about_title" />
|
||||
|
||||
</menu>
|
|
@ -46,6 +46,20 @@
|
|||
<!-- Title for the Refresh Devices Action-->
|
||||
<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 -->
|
||||
<string name="settings_title">Preferences</string>
|
||||
|
||||
|
|
Reference in a new issue