Added preferences with "Contact Developer" option.
This commit is contained in:
parent
bdef179b7d
commit
a861c1a81f
7 changed files with 123 additions and 8 deletions
|
@ -27,7 +27,7 @@
|
|||
on Android 4.4 (but that's not my error).
|
||||
-->
|
||||
<activity
|
||||
android:name="com.github.nutomic.controldlna.gui.MainActivity"
|
||||
android:name=".gui.MainActivity"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
android:configChanges="orientation|keyboardHidden|screenSize" >
|
||||
|
@ -41,13 +41,17 @@
|
|||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".gui.PreferencesActivity"
|
||||
android:label="@string/settings_title" />
|
||||
|
||||
<service android:name="org.teleal.cling.android.AndroidUpnpServiceImpl" />
|
||||
|
||||
<service android:name="com.github.nutomic.controldlna.mediarouter.MediaRouterPlayService" />
|
||||
<service android:name=".mediarouter.MediaRouterPlayService" />
|
||||
|
||||
<service android:name="com.github.nutomic.controldlna.upnp.RemotePlayService" />
|
||||
<service android:name=".upnp.RemotePlayService" />
|
||||
|
||||
<service android:name="com.github.nutomic.controldlna.upnp.ProviderService"
|
||||
<service android:name=".upnp.ProviderService"
|
||||
android:label="@string/upnp_route_provider_service"
|
||||
android:process=":mrp">
|
||||
<intent-filter>
|
||||
|
|
|
@ -4,7 +4,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:0.7.0'
|
||||
classpath 'com.android.tools.build:gradle:0.8.3'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
9
res/menu/menu.xml
Normal file
9
res/menu/menu.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/preferences"
|
||||
android:title="@string/settings_title" />
|
||||
|
||||
</menu>
|
|
@ -37,4 +37,13 @@
|
|||
<!-- MediaRouter strings -->
|
||||
<string name="upnp_route_provider_service">UPNP Route Provider Service</string>
|
||||
|
||||
<!-- Developer contact mail with '@', '.' replaced -->
|
||||
<string name="contact_mail" translatable="false">controldlna%1$snutomic%2$scom</string>
|
||||
|
||||
<!-- Title for the SettingsActivity -->
|
||||
<string name="settings_title">Preferences</string>
|
||||
|
||||
<!-- Title for the contact developer preference -->
|
||||
<string name="contact_dev_title">Contact Developer</string>
|
||||
|
||||
</resources>
|
||||
|
|
8
res/xml/preferences.xml
Normal file
8
res/xml/preferences.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Preference
|
||||
android:key="contact_dev"
|
||||
android:title="@string/contact_dev_title" />
|
||||
|
||||
</PreferenceScreen>
|
|
@ -46,7 +46,10 @@ import android.support.v7.app.ActionBar;
|
|||
import android.support.v7.app.ActionBar.Tab;
|
||||
import android.support.v7.app.ActionBar.TabListener;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
@ -103,8 +106,6 @@ public class MainActivity extends ActionBarActivity {
|
|||
final ActionBar actionBar = getSupportActionBar();
|
||||
|
||||
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
|
||||
actionBar.setDisplayShowTitleEnabled(false);
|
||||
actionBar.setDisplayShowHomeEnabled(false);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
|
@ -177,7 +178,25 @@ public class MainActivity extends ActionBarActivity {
|
|||
onNewIntent(getIntent());
|
||||
}
|
||||
|
||||
/**
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.menu, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
case R.id.preferences:
|
||||
Intent i = new Intent(this, PreferencesActivity.class);
|
||||
startActivity(i);
|
||||
return true;
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the RouteFragment immediately (instead of ServerFragment).
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
Copyright (c) 2013, Felix Ableitner
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package com.github.nutomic.controldlna.gui;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceActivity;
|
||||
import android.preference.PreferenceScreen;
|
||||
|
||||
import com.github.nutomic.controldlna.R;
|
||||
|
||||
public class PreferencesActivity extends PreferenceActivity {
|
||||
|
||||
private static final String KEY_CONTACT_DEV = "contact_dev";
|
||||
|
||||
private Preference mContactDev;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
addPreferencesFromResource(R.xml.preferences);
|
||||
final PreferenceScreen screen = getPreferenceScreen();
|
||||
mContactDev = screen.findPreference(KEY_CONTACT_DEV);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen,
|
||||
Preference preference) {
|
||||
if (preference == mContactDev) {
|
||||
Intent i = new Intent(Intent.ACTION_SENDTO, Uri.fromParts(
|
||||
"mailto", getString(R.string.contact_mail, "@", "."), null));
|
||||
startActivity(i);
|
||||
return true;
|
||||
}
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue