summaryrefslogtreecommitdiff
path: root/vdrmanager
diff options
context:
space:
mode:
Diffstat (limited to 'vdrmanager')
-rw-r--r--vdrmanager/res/menu-v11/channellist.xml16
-rw-r--r--vdrmanager/res/menu-v11/epg_details.xml20
-rw-r--r--vdrmanager/res/menu-v11/epg_list_item_menu.xml30
-rw-r--r--vdrmanager/res/menu-v11/epg_list_menu.xml27
-rw-r--r--vdrmanager/res/menu-v11/epg_search_time_item_menu.xml8
-rw-r--r--vdrmanager/res/menu-v11/recording_list_menu.xml21
-rw-r--r--vdrmanager/res/menu-v11/refresh_menu.xml11
-rw-r--r--vdrmanager/res/menu-v11/timer_list_menu.xml21
-rw-r--r--vdrmanager/res/menu/channellist.xml14
-rw-r--r--vdrmanager/res/menu/epg_details.xml20
-rw-r--r--vdrmanager/res/menu/epg_list_item_menu.xml11
-rw-r--r--vdrmanager/res/menu/epg_list_menu.xml21
-rw-r--r--vdrmanager/res/menu/epg_search_time_item_menu.xml8
-rw-r--r--vdrmanager/res/menu/recording_list_menu.xml20
-rw-r--r--vdrmanager/res/menu/refresh_menu.xml10
-rw-r--r--vdrmanager/res/menu/timer_list_menu.xml20
-rw-r--r--vdrmanager/res/values/arrays.xml11
-rw-r--r--vdrmanager/res/values/strings.xml6
-rw-r--r--vdrmanager/res/xml/vdr_prefs.xml4
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java189
20 files changed, 187 insertions, 301 deletions
diff --git a/vdrmanager/res/menu-v11/channellist.xml b/vdrmanager/res/menu-v11/channellist.xml
deleted file mode 100644
index 2ca3884..0000000
--- a/vdrmanager/res/menu-v11/channellist.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/channels_recent_channels" android:alphabeticShortcut="r"
- android:icon="@drawable/ic_menu_recent_history"
- android:showAsAction="ifRoom"
- android:title="@string/recent_channels"/>
-
- <item
- android:id="@+id/channels_groupby" android:alphabeticShortcut="g"
- android:icon="@android:drawable/ic_menu_sort_alphabetically"
- android:showAsAction="ifRoom"
- android:title="@string/menu_groupby"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu-v11/epg_details.xml b/vdrmanager/res/menu-v11/epg_details.xml
deleted file mode 100644
index 4458f09..0000000
--- a/vdrmanager/res/menu-v11/epg_details.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/epg_details_menu_search_repeat"
- android:showAsAction="ifRoom"
- android:icon="@drawable/ic_menu_view"
- android:title="@string/search_reapt"/>
-
- <item
- android:showAsAction="ifRoom|withText"
- android:id="@+id/epg_details_menu_share"
- android:icon="@android:drawable/ic_menu_share"
- android:title="@string/share"/>
-
- <item
- android:id="@+id/epg_details_menu_switch"
- android:icon="@drawable/ic_menu_goto"
- android:title="@string/switch_to_channel"/>
-</menu>
diff --git a/vdrmanager/res/menu-v11/epg_list_item_menu.xml b/vdrmanager/res/menu-v11/epg_list_item_menu.xml
deleted file mode 100644
index 93ccb68..0000000
--- a/vdrmanager/res/menu-v11/epg_list_item_menu.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/epg_item_menu_timer_toggle"
- android:title="@string/epg_item_menu_timer_enable"
- android:visible="false"/>
-
- <item
- android:id="@+id/epg_item_menu_timer_add"
- android:title="@string/epg_item_menu_timer_add"/>
-
- <item
- android:id="@+id/epg_item_menu_timer_delete"
- android:title="@string/epg_item_menu_timer_delete"
- android:visible="false"/>
-
- <item
- android:id="@+id/epg_item_menu_timer_modify"
- android:title="@string/epg_item_menu_timer_modify"
- android:visible="false"/>
-
- <item
- android:id="@+id/epg_item_menu_live_tv"
- android:title="@string/livetv"
- android:visible="false"/>
-
- <item android:id="@+id/epg_item_menu_switchto" android:title="@string/switch_to_channel" android:visible="true" />
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu-v11/epg_list_menu.xml b/vdrmanager/res/menu-v11/epg_list_menu.xml
deleted file mode 100644
index ea31378..0000000
--- a/vdrmanager/res/menu-v11/epg_list_menu.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
- <item
- android:id="@+id/epg_menu_search"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_search"/>
--->
-<!--
- <item
- android:id="@+id/epg_menu_times"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_times"/>
- -->
- <item
- android:id="@+id/epg_list_menu_channels"
- android:icon="@drawable/ic_menu_moreoverflow"
- android:showAsAction="ifRoom"
- android:title="@string/action_menu_channels"/>
-
- <item
- android:showAsAction="ifRoom"
- android:id="@+id/epg_list_sort_menu"
- android:icon="@android:drawable/ic_menu_sort_alphabetically"
- android:title="@string/sort"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu-v11/epg_search_time_item_menu.xml b/vdrmanager/res/menu-v11/epg_search_time_item_menu.xml
deleted file mode 100644
index a54abf0..0000000
--- a/vdrmanager/res/menu-v11/epg_search_time_item_menu.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:id="@+id/epg_search_time_delete"
- android:title="@string/common_delete"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu-v11/recording_list_menu.xml b/vdrmanager/res/menu-v11/recording_list_menu.xml
deleted file mode 100644
index 2edc02b..0000000
--- a/vdrmanager/res/menu-v11/recording_list_menu.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
- <item
- android:id="@+id/epg_menu_search"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_search"/>
--->
-<!--
- <item
- android:id="@+id/epg_menu_times"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_times"/>
- -->
-
- <item
- android:id="@+id/menu_groupby" android:alphabeticShortcut="g"
- android:icon="@android:drawable/ic_menu_sort_alphabetically"
- android:showAsAction="ifRoom"
- android:title="@string/menu_groupby"/>
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu-v11/refresh_menu.xml b/vdrmanager/res/menu-v11/refresh_menu.xml
deleted file mode 100644
index 9c31b62..0000000
--- a/vdrmanager/res/menu-v11/refresh_menu.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/list_refresh"
- android:alphabeticShortcut="r"
- android:icon="@drawable/ic_menu_refresh"
- android:showAsAction="ifRoom"
- android:title="@string/refresh"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu-v11/timer_list_menu.xml b/vdrmanager/res/menu-v11/timer_list_menu.xml
deleted file mode 100644
index fa00a26..0000000
--- a/vdrmanager/res/menu-v11/timer_list_menu.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
- <item
- android:id="@+id/epg_menu_search"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_search"/>
--->
-<!-- -->
- <item
- android:id="@+id/timer_menu_add"
- android:icon="@android:drawable/ic_menu_add"
- android:alphabeticShortcut="a"
- android:title="@string/epg_item_menu_timer_add"/>
-
- <item
- android:id="@+id/epg_list_menu_channels"
- android:icon="@drawable/ic_menu_moreoverflow"
- android:showAsAction="ifRoom"
- android:title="@string/action_menu_channels"/>
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/channellist.xml b/vdrmanager/res/menu/channellist.xml
deleted file mode 100644
index c62dd18..0000000
--- a/vdrmanager/res/menu/channellist.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/channels_recent_channels" android:alphabeticShortcut="r"
- android:icon="@drawable/ic_menu_recent_history"
- android:title="@string/recent_channels"/>
-
- <item
- android:id="@+id/channels_groupby" android:alphabeticShortcut="g"
- android:icon="@android:drawable/ic_menu_sort_alphabetically"
- android:title="@string/menu_groupby"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/epg_details.xml b/vdrmanager/res/menu/epg_details.xml
deleted file mode 100644
index df19218..0000000
--- a/vdrmanager/res/menu/epg_details.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/epg_details_menu_search_repeat"
- android:icon="@drawable/ic_menu_view"
- android:title="@string/search_reapt"/>
-
- <item
- android:id="@+id/epg_details_menu_share"
- android:icon="@android:drawable/ic_menu_share"
- android:title="@string/share"/>
-
-
- <item
- android:id="@+id/epg_details_menu_switch"
- android:icon="@drawable/ic_menu_goto"
- android:title="@string/switch_to_channel"/>
-
-</menu>
diff --git a/vdrmanager/res/menu/epg_list_item_menu.xml b/vdrmanager/res/menu/epg_list_item_menu.xml
deleted file mode 100644
index cc6ed44..0000000
--- a/vdrmanager/res/menu/epg_list_item_menu.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item android:id="@+id/epg_item_menu_timer_toggle" android:title="@string/epg_item_menu_timer_enable" android:visible="false"/>
- <item android:id="@+id/epg_item_menu_timer_add" android:title="@string/epg_item_menu_timer_add" />
- <item android:id="@+id/epg_item_menu_timer_delete" android:title="@string/epg_item_menu_timer_delete" android:visible="false"/>
- <item android:id="@+id/epg_item_menu_timer_modify" android:title="@string/epg_item_menu_timer_modify" android:visible="false" />
- <item android:id="@+id/epg_item_menu_live_tv" android:title="@string/livetv" android:visible="false" />
- <item android:id="@+id/epg_item_menu_switchto" android:title="@string/switch_to_channel" android:visible="true" />
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/epg_list_menu.xml b/vdrmanager/res/menu/epg_list_menu.xml
deleted file mode 100644
index 2335101..0000000
--- a/vdrmanager/res/menu/epg_list_menu.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
- <item
- android:id="@+id/epg_menu_search"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_search"/>
--->
-<!-- -->
- <item
- android:id="@+id/epg_list_menu_channels"
- android:icon="@android:drawable/ic_menu_agenda"
- android:title="@string/action_menu_channels"/>
-
- <item
- android:id="@+id/epg_list_sort_menu"
- android:icon="@android:drawable/ic_menu_sort_alphabetically"
- android:title="@string/sort"/>
-
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/epg_search_time_item_menu.xml b/vdrmanager/res/menu/epg_search_time_item_menu.xml
deleted file mode 100644
index a54abf0..0000000
--- a/vdrmanager/res/menu/epg_search_time_item_menu.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-
- <item
- android:id="@+id/epg_search_time_delete"
- android:title="@string/common_delete"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/recording_list_menu.xml b/vdrmanager/res/menu/recording_list_menu.xml
deleted file mode 100644
index 8b3e72d..0000000
--- a/vdrmanager/res/menu/recording_list_menu.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
- <item
- android:id="@+id/epg_menu_search"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_search"/>
--->
-<!--
- <item
- android:id="@+id/epg_menu_times"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_times"/>
- -->
-
- <item
- android:id="@+id/menu_groupby" android:alphabeticShortcut="g"
- android:icon="@android:drawable/ic_menu_sort_alphabetically"
- android:title="@string/menu_groupby"/>
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/refresh_menu.xml b/vdrmanager/res/menu/refresh_menu.xml
deleted file mode 100644
index 8bfe27d..0000000
--- a/vdrmanager/res/menu/refresh_menu.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <item
- android:id="@+id/list_refresh"
- android:alphabeticShortcut="r"
- android:icon="@drawable/ic_menu_refresh"
- android:title="@string/refresh"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/menu/timer_list_menu.xml b/vdrmanager/res/menu/timer_list_menu.xml
deleted file mode 100644
index 93509ec..0000000
--- a/vdrmanager/res/menu/timer_list_menu.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-<!--
- <item
- android:id="@+id/epg_menu_search"
- android:icon="@android:drawable/ic_menu_search"
- android:title="@string/epg_menu_search"/>
--->
-<!-- -->
- <item
- android:id="@+id/timer_menu_add"
- android:icon="@android:drawable/ic_menu_add"
- android:alphabeticShortcut="a"
- android:title="@string/epg_item_menu_timer_add"/>
- <item
- android:id="@+id/epg_list_menu_channels"
- android:icon="@android:drawable/ic_menu_agenda"
- android:title="@string/action_menu_channels"/>
-
-</menu> \ No newline at end of file
diff --git a/vdrmanager/res/values/arrays.xml b/vdrmanager/res/values/arrays.xml
index 73baaf7..33e08ac 100644
--- a/vdrmanager/res/values/arrays.xml
+++ b/vdrmanager/res/values/arrays.xml
@@ -11,12 +11,12 @@
<item>it</item>
<item>uk</item>
</string-array>
-
+
<string-array name="remux_entry_values">
<item>EXT</item>
<item>EXTERN</item>
</string-array>
-
+
<string-array name="imdb_urls_velues">
<item>akas.imdb.com</item>
<item>imdb.com</item>
@@ -27,11 +27,12 @@
<item>imdb.it</item>
<item>imdb.pt</item>
</string-array>
-
-
+
+
<string-array name="recstream_entry_values">
<item>vdr-live</item>
+ <item>vdr-streamdev</item>
</string-array>
-
+
</resources> \ No newline at end of file
diff --git a/vdrmanager/res/values/strings.xml b/vdrmanager/res/values/strings.xml
index 5796515..9812c55 100644
--- a/vdrmanager/res/values/strings.xml
+++ b/vdrmanager/res/values/strings.xml
@@ -32,6 +32,7 @@
<string name="refresh">Refresh</string>
<string name="done">Done</string>
<string name="share">Share</string>
+ <string name="addtocal">Add to calendar</string>
<string name="search_reapt">Reruns</string>
<string name="share_chooser">Share EPG Entry</string>
<string name="about_text">
@@ -274,10 +275,11 @@
<string-array name="recstream_entries">
<item>VDR live plugin</item>
+ <item>VDR streamdev plugin</item>
</string-array>
<string name="recstream_method_title">Streaming method</string>
- <string name="recstream_method_summary">Currently Streaming over VDR live plugin is supported</string>
+ <string name="recstream_method_summary">Currently Streaming over VDR live and or streamdev plugin is supported</string>
<string name="settings_live_port">VDR live plugin port</string>
<string name="settings_live_port_summary">VDR live plugin has default port 8008.</string>
@@ -347,4 +349,6 @@
<string name="sortby_alphabet">Alphabet</string>
<string name="sortby_channellist">Chanellist</string>
<string name="main_menu_clear_search">Clear Search History</string>
+ <string name="vdr_host_not_defined">VDR host not defined</string>
+ <string name="processing">Processing…</string>
</resources> \ No newline at end of file
diff --git a/vdrmanager/res/xml/vdr_prefs.xml b/vdrmanager/res/xml/vdr_prefs.xml
index c83f014..20d9823 100644
--- a/vdrmanager/res/xml/vdr_prefs.xml
+++ b/vdrmanager/res/xml/vdr_prefs.xml
@@ -68,7 +68,7 @@
android:key="@string/wakeup_password_key" android:password="true"
android:summary="@string/wakeup_password_summary" android:title="@string/wakeup_password_title" />
- <EditTextPreference android:dependency="@string/wakeup_enabled_key"
+ <de.bjusystems.vdrmanager.data.MacFetchEditTextPreference android:dependency="@string/wakeup_enabled_key"
android:key="@string/wakeup_wol_mac_key" android:summary="@string/wakeup_wol_mac_summary"
android:title="@string/wakeup_wol_mac_title" />
@@ -129,7 +129,7 @@
android:summary="@string/remux_parameter_summary" android:title="@string/remux_parameter_title" />
</PreferenceCategory>
- <PreferenceCategory android:title="@string/recstream">
+ <PreferenceCategory android:title="@string/recstream" android:key="key_streaming_category">
<CheckBoxPreference android:key="key_rec_stream_enable"
android:defaultValue="false" android:summary="@string/recstream_enable_summary"
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java
index 20b251c..5d5ff0e 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrPreferencesActivity.java
@@ -1,20 +1,32 @@
package de.bjusystems.vdrmanager.gui;
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+
+import android.app.ProgressDialog;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.Preference;
+import android.view.View;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.Intents;
+import de.bjusystems.vdrmanager.data.MacFetchEditTextPreference;
import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.data.Vdr;
import de.bjusystems.vdrmanager.data.VdrSharedPreferences;
import de.bjusystems.vdrmanager.data.db.DBAccess;
+import de.bjusystems.vdrmanager.tasks.VoidAsyncTask;
public class VdrPreferencesActivity extends BasePreferencesActivity implements
OnSharedPreferenceChangeListener {
Vdr vdr;
+
VdrSharedPreferences pref;
int id = -1;
@@ -29,24 +41,81 @@ public class VdrPreferencesActivity extends BasePreferencesActivity implements
return super.findPreference(key);
}
- private void initVDR() {
+ private void initVDRInstance() {
id = getIntent().getIntExtra(Intents.VDR_ID, -1);
if (id == -1) {// new vdr
vdr = new Vdr();
- pref = new VdrSharedPreferences();
- pref.instance = vdr;
+
} else {// edit
Vdr v = DBAccess.get(this).getVdrDAO().queryForId(id);
if (v != null) {
vdr = v;
- pref = new VdrSharedPreferences(vdr);
} else {
vdr = new Vdr();
- pref = new VdrSharedPreferences();
- pref.instance = vdr;
id = -1;
}
}
+ pref.setInstance(vdr);
+ }
+
+ public static String ARP_CACHE = "/proc/net/arp";
+
+ /**
+ * return mac address as a string.
+ *
+ * @param ip
+ * @return
+ */
+ public static String getMacFromArpCache(String ip) {
+
+ if (ip == null) {
+ return null;
+ }
+
+ BufferedReader br = null;
+
+ try {
+ br = new BufferedReader(new FileReader(ARP_CACHE));
+
+ String line;
+
+ while ((line = br.readLine()) != null) {
+ String[] values = line.split("\\s+");
+ if (values != null && values.length >= 4
+ && ip.equals(values[0])) {
+ // format check
+ String mac = values[3];
+ if (mac.matches("..:..:..:..:..:..")) {
+ return mac;
+ } else {
+ return null;
+ }
+ }
+ }
+ } catch (Exception e) {
+
+ } finally {
+ try {
+ br.close();
+ } catch (IOException e) {
+
+ }
+ }
+ return null;
+ }
+
+ private String getIp() throws Exception {
+ final Preferences prefs = Preferences.get();
+ String host = prefs.getSvdrpHost();
+ return InetAddress.getByName(host).getHostAddress();
+ }
+
+ private void ping(String ip) throws Exception {
+ final Preferences prefs = Preferences.get();
+ Socket socket = new Socket();
+ socket.connect(new InetSocketAddress(ip, prefs.getSvdrpPort()),
+ 5 * 1000);
+ socket.setSoTimeout(5 * 1000);
}
@Override
@@ -54,15 +123,88 @@ public class VdrPreferencesActivity extends BasePreferencesActivity implements
super.onCreate(savedInstanceState);
- initVDR();
+ pref = new VdrSharedPreferences();
+
+ pref.dao = DBAccess.get(this).getVdrDAO();
+
+ initVDRInstance();
+
+ this.addPreferencesFromResource(R.xml.vdr_prefs);
// this.getPreferenceManager().setSharedPreferencesName(Preferences.getPreferenceFile(this));
- pref.instance = vdr;
- pref.dao = DBAccess.get(this).getVdrDAO();
pref.registerOnSharedPreferenceChangeListener(this);
- this.addPreferencesFromResource(R.xml.vdr_prefs);
+
+
+ String recstream = pref.getString("key_recstream_method", "vdr-live");
+
+ if (recstream.equals("vdr-live") == false) {
+ Preference p = findPreference("key_live_port");
+ p.setEnabled(false);
+ // PreferenceCategory cat = (PreferenceCategory)
+ // findPreference("key_streaming_category");
+ // cat.removePreference(p);
+ }
+
+ final String host = pref.getString(getString(R.string.vdr_host_key),
+ null);
+
+ // create background task
+
+ // start task
+
+ final MacFetchEditTextPreference macedit = (MacFetchEditTextPreference) findPreference(getString(R.string.wakeup_wol_mac_key));
+ String mac = vdr.getMac();
+ macedit.setText(mac);
+ macedit.setCompoundButtonListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+
+ if (host == null) {
+ Utils.say(VdrPreferencesActivity.this,
+ getString(R.string.vdr_host_not_defined));
+ return;
+ }
+
+ new VoidAsyncTask() {
+
+ ProgressDialog pd;
+
+ private String mac;
+
+ String message;
+
+ protected void onPreExecute() {
+ pd = new ProgressDialog(VdrPreferencesActivity.this);
+ pd.setMessage(getString(R.string.processing));
+ pd.show();
+ };
+
+ protected void onPostExecute(Void result) {
+ pd.dismiss();
+ if (message != null) {
+ Utils.say(VdrPreferencesActivity.this, message);
+ return;
+ }
+ macedit.setEditText(mac);
+ };
+
+ @Override
+ protected Void doInBackground(Void... params) {
+ try {
+ String ip = getIp();
+ ping(ip);
+ mac = getMacFromArpCache(ip);
+ } catch (Exception ex) {
+ message = ex.getLocalizedMessage();
+ }
+
+ return null;
+ }
+ }.execute();
+ }
+ });
updateChildPreferences();
}
@@ -71,15 +213,33 @@ public class VdrPreferencesActivity extends BasePreferencesActivity implements
updateChildPreferences();
Preference p = findPreference(key);
updateSummary(p);
+
+ if (key != null && key.equals("key_recstream_method")) {
+ String recstream = pref.getString("key_recstream_method",
+ "vdr-live");
+ Preference pk = findPreference("key_live_port");
+ if (recstream.equals("vdr-live") == false) {
+ pk.setEnabled(false);
+ // PreferenceCategory cat = (PreferenceCategory)
+ // findPreference("key_streaming_category");
+ // cat.removePreference(p);
+ } else {
+ pk.setEnabled(true);
+ }
+
+ // if(pk)
+ // cat.addPreference(pk);
+ // } else {
+ // cat.removePreference(pk);
+ // }
+ }
+
Preferences.reloadVDR(this);
}
@Override
protected void onResume() {
super.onResume();
- // Set up a listener whenever a key changes
- pref.registerOnSharedPreferenceChangeListener(this);
-
}
@Override
@@ -162,7 +322,6 @@ public class VdrPreferencesActivity extends BasePreferencesActivity implements
}
-
@Override
public void onBackPressed() {
if (id != -1) {// no new devices
@@ -171,7 +330,7 @@ public class VdrPreferencesActivity extends BasePreferencesActivity implements
return;
}
if (pref.commits < 2) {// user has not changed anything
- DBAccess.get(this).getVdrDAO().delete(pref.instance);
+ DBAccess.get(this).getVdrDAO().delete(pref.getInstance());
finish();
return;
}