summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vdrmanager/AndroidManifest.xml24
-rw-r--r--vdrmanager/res/anim/slide_down_in.xml19
-rw-r--r--vdrmanager/res/anim/slide_down_out.xml19
-rw-r--r--vdrmanager/res/anim/slide_left_in.xml19
-rw-r--r--vdrmanager/res/anim/slide_left_out.xml19
-rw-r--r--vdrmanager/res/anim/slide_right_in.xml19
-rw-r--r--vdrmanager/res/anim/slide_right_out.xml19
-rw-r--r--vdrmanager/res/anim/slide_up_in.xml19
-rw-r--r--vdrmanager/res/anim/slide_up_out.xml19
-rw-r--r--vdrmanager/res/drawable/ic_menu_refresh.pngbin0 -> 3289 bytes
-rw-r--r--vdrmanager/res/drawable/imdb.pngbin3122 -> 2204 bytes
-rw-r--r--vdrmanager/res/layout/epg_detail.xml2
-rw-r--r--vdrmanager/res/layout/event_epg_list.xml101
-rw-r--r--vdrmanager/res/menu/recording_list_item_menu.xml2
-rw-r--r--vdrmanager/res/values-de/action_menu.xml11
-rw-r--r--vdrmanager/res/values-de/application.xml4
-rw-r--r--vdrmanager/res/values-de/channel_list.xml18
-rw-r--r--vdrmanager/res/values-de/common.xml12
-rw-r--r--vdrmanager/res/values-de/epg.xml30
-rw-r--r--vdrmanager/res/values-de/epg_list.xml5
-rw-r--r--vdrmanager/res/values-de/epg_list_menu.xml15
-rw-r--r--vdrmanager/res/values-de/epg_search_times.xml6
-rw-r--r--vdrmanager/res/values-de/errors.xml6
-rw-r--r--vdrmanager/res/values-de/livetv.xml38
-rw-r--r--vdrmanager/res/values-de/main_menu.xml8
-rw-r--r--vdrmanager/res/values-de/preferences.xml126
-rw-r--r--vdrmanager/res/values-de/preferences_keys.xml31
-rw-r--r--vdrmanager/res/values-de/progress.xml27
-rw-r--r--vdrmanager/res/values-de/recording_list_menu.xml5
-rw-r--r--vdrmanager/res/values-de/timers.xml13
-rw-r--r--vdrmanager/res/values/common.xml4
-rw-r--r--vdrmanager/res/values/preferences.xml210
-rw-r--r--vdrmanager/res/values/progress.xml4
-rw-r--r--vdrmanager/res/xml/preferences.xml15
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/StringUtils.java151
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/app/C.java15
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java4
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java29
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java14
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java200
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java17
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java64
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java120
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java121
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java31
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java4
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java98
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java32
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java61
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java147
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java17
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java48
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java24
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java60
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java10
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java5
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java21
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java2
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java7
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java13
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java36
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java1
62 files changed, 1569 insertions, 652 deletions
diff --git a/vdrmanager/AndroidManifest.xml b/vdrmanager/AndroidManifest.xml
index 35fb221..fa6ec31 100644
--- a/vdrmanager/AndroidManifest.xml
+++ b/vdrmanager/AndroidManifest.xml
@@ -20,9 +20,9 @@
</activity>
<activity android:name=".gui.TimeEpgListActivity"
- android:configChanges="orientation" />
+ android:configChanges="orientation|locale" />
<activity android:name=".gui.EventEpgListActivity"
- android:configChanges="orientation">
+ android:configChanges="orientation|locale">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
@@ -30,7 +30,7 @@
android:value=".gui.EpgSearchListActivity" />
</activity>
<activity android:name=".gui.TimerListActivity"
- android:configChanges="orientation">
+ android:configChanges="orientation|locale">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
@@ -38,9 +38,9 @@
android:value=".gui.EpgSearchListActivity" />
</activity>
<activity android:name=".gui.PreferencesActivity"
- android:configChanges="orientation"></activity>
+ android:configChanges="orientation|locale"/>
<activity android:name=".gui.ChannelListActivity"
- android:configChanges="orientation">
+ android:configChanges="orientation|locale">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
@@ -48,7 +48,7 @@
android:value=".gui.EpgSearchListActivity" />
</activity>
<activity android:name=".gui.EpgDetailsActivity"
- android:configChanges="orientation">
+ android:configChanges="orientation|locale">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
@@ -63,19 +63,19 @@
android:value=".gui.EpgSearchListActivity" />
</activity>
<activity android:name=".gui.RecordingListActivity"
- android:configChanges="orientation">
+ android:configChanges="orientation|locale">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.default_searchable"
android:value=".gui.EpgSearchListActivity" />
</activity>
- <activity android:name=".gui.EpgSearchListActivity"
- android:configChanges="orientation">
+ <activity android:name=".gui.EpgSearchListActivity" android:launchMode="singleTask"
+ android:configChanges="orientation|locale">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
- <meta-data android:name="android.app.searchable"
+ <meta-data android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
@@ -88,7 +88,9 @@
</application>
- <uses-permission android:name="android.permission.INTERNET"></uses-permission>
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
+
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" />
diff --git a/vdrmanager/res/anim/slide_down_in.xml b/vdrmanager/res/anim/slide_down_in.xml
new file mode 100644
index 0000000..dd1ca08
--- /dev/null
+++ b/vdrmanager/res/anim/slide_down_in.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromYDelta="-100%p" android:toYDelta="0" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/anim/slide_down_out.xml b/vdrmanager/res/anim/slide_down_out.xml
new file mode 100644
index 0000000..188c817
--- /dev/null
+++ b/vdrmanager/res/anim/slide_down_out.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromYDelta="0" android:toYDelta="100%p" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/anim/slide_left_in.xml b/vdrmanager/res/anim/slide_left_in.xml
new file mode 100644
index 0000000..c72fd87
--- /dev/null
+++ b/vdrmanager/res/anim/slide_left_in.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromXDelta="100%p" android:toXDelta="0" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/anim/slide_left_out.xml b/vdrmanager/res/anim/slide_left_out.xml
new file mode 100644
index 0000000..e4308ec
--- /dev/null
+++ b/vdrmanager/res/anim/slide_left_out.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromXDelta="0" android:toXDelta="-100%p" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/anim/slide_right_in.xml b/vdrmanager/res/anim/slide_right_in.xml
new file mode 100644
index 0000000..f2f97fc
--- /dev/null
+++ b/vdrmanager/res/anim/slide_right_in.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromXDelta="-100%p" android:toXDelta="0" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/anim/slide_right_out.xml b/vdrmanager/res/anim/slide_right_out.xml
new file mode 100644
index 0000000..1807f10
--- /dev/null
+++ b/vdrmanager/res/anim/slide_right_out.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromXDelta="0" android:toXDelta="100%p" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/anim/slide_up_in.xml b/vdrmanager/res/anim/slide_up_in.xml
new file mode 100644
index 0000000..675908f
--- /dev/null
+++ b/vdrmanager/res/anim/slide_up_in.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/anim/slide_up_out.xml b/vdrmanager/res/anim/slide_up_out.xml
new file mode 100644
index 0000000..a1303a5
--- /dev/null
+++ b/vdrmanager/res/anim/slide_up_out.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+ <translate android:fromYDelta="0" android:toYDelta="-100%p" android:duration="400"/>
+</set>
diff --git a/vdrmanager/res/drawable/ic_menu_refresh.png b/vdrmanager/res/drawable/ic_menu_refresh.png
new file mode 100644
index 0000000..bbb08f1
--- /dev/null
+++ b/vdrmanager/res/drawable/ic_menu_refresh.png
Binary files differ
diff --git a/vdrmanager/res/drawable/imdb.png b/vdrmanager/res/drawable/imdb.png
index b0652a5..e1e0853 100644
--- a/vdrmanager/res/drawable/imdb.png
+++ b/vdrmanager/res/drawable/imdb.png
Binary files differ
diff --git a/vdrmanager/res/layout/epg_detail.xml b/vdrmanager/res/layout/epg_detail.xml
index b7761be..d763429 100644
--- a/vdrmanager/res/layout/epg_detail.xml
+++ b/vdrmanager/res/layout/epg_detail.xml
@@ -93,7 +93,7 @@
android:layout_height="wrap_content"
android:layout_weight="1">
- <TextView android:textSize="17dip"
+ <TextView android:textSize="16dip"
android:id="@+id/epg_detail_description"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
diff --git a/vdrmanager/res/layout/event_epg_list.xml b/vdrmanager/res/layout/event_epg_list.xml
index eb9e23b..436ca23 100644
--- a/vdrmanager/res/layout/event_epg_list.xml
+++ b/vdrmanager/res/layout/event_epg_list.xml
@@ -1,49 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
+<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/flipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:orientation="vertical">
+ android:orientation="vertical" >
- <Spinner
- android:id="@+id/epg_list_channel_spinner"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:prompt="@string/epg_list_channel_spinner"/>
-
- <ListView
- android:id="@+id/whatson_list"
+ <LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
- android:layout_below="@id/epg_list_channel_spinner"
- android:layout_alignWithParentIfMissing="true"
- android:layout_alignParentTop="true"
- android:layout_centerHorizontal="true"
- android:cacheColorHint="?android:attr/colorBackground"/>
-
- <TextView
- android:id="@+id/epg_list_search_label"
+ android:orientation="vertical" >
+
+ <Spinner
+ android:id="@+id/epg_list_channel_spinner"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:prompt="@string/epg_list_channel_spinner" />
+
+ <ListView
+ android:id="@+id/whatson_list"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:layout_alignParentTop="true"
+ android:layout_alignWithParentIfMissing="true"
+ android:layout_below="@id/epg_list_channel_spinner"
+ android:layout_centerHorizontal="true"
+ android:cacheColorHint="?android:attr/colorBackground" />
+
+ <TextView
+ android:id="@+id/epg_list_search_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="@string/epg_list_search_label"/>
-
- <LinearLayout android:orientation="vertical"
- android:id="@+id/no_connection_layout" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:visibility="gone">
- <LinearLayout android:layout_height="fill_parent"
- android:gravity="center" android:layout_width="fill_parent"
- android:orientation="horizontal">
- <TextView android:text="@string/no_connection"
- android:layout_height="wrap_content" android:layout_width="wrap_content"
- android:textSize="18dip" />
- <ImageView android:src="@drawable/sad"
- android:layout_height="wrap_content" android:layout_width="wrap_content" />
- <Button android:text="@string/no_connection_retry"
- android:textSize="18dip" android:layout_height="wrap_content"
- android:layout_width="wrap_content" android:id="@+id/retry_button" />
-
- </LinearLayout>
- </LinearLayout>
-
-
-</LinearLayout>
+ android:text="@string/epg_list_search_label" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/no_connection_layout"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:gravity="center"
+ android:orientation="horizontal" >
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/no_connection"
+ android:textSize="18dip" />
+
+ <ImageView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:src="@drawable/sad" />
+
+ <Button
+ android:id="@+id/retry_button"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/no_connection_retry"
+ android:textSize="18dip" />
+ </LinearLayout>
+ </LinearLayout>
+</ViewFlipper> \ No newline at end of file
diff --git a/vdrmanager/res/menu/recording_list_item_menu.xml b/vdrmanager/res/menu/recording_list_item_menu.xml
index 4c664ea..c94161a 100644
--- a/vdrmanager/res/menu/recording_list_item_menu.xml
+++ b/vdrmanager/res/menu/recording_list_item_menu.xml
@@ -3,5 +3,5 @@
<item android:id="@+id/recording_item_menu_delete" android:title="@string/recording_item_menu_delete"/>
<item android:id="@+id/recording_item_menu_stream" android:title="@string/recording_item_menu_stream"/>
-
+ <item android:id="@+id/epg_item_menu_live_tv" android:title="@string/livetv" android:visible="false" />
</menu> \ No newline at end of file
diff --git a/vdrmanager/res/values-de/action_menu.xml b/vdrmanager/res/values-de/action_menu.xml
new file mode 100644
index 0000000..4a45dec
--- /dev/null
+++ b/vdrmanager/res/values-de/action_menu.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="action_menu_channels">Kanäle</string>
+ <string name="action_menu_timers">Timers</string>
+ <string name="action_menu_recordings">Aufnahmen</string>
+ <string name="action_menu_epg">EPG Liste</string>
+ <string name="action_menu_search">EPG Suche</string>
+ <string name="action_menu_wakeup">Aufwecken</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/application.xml b/vdrmanager/res/values-de/application.xml
new file mode 100644
index 0000000..a09283c
--- /dev/null
+++ b/vdrmanager/res/values-de/application.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="app_name">VDR-Manager</string>
+</resources>
diff --git a/vdrmanager/res/values-de/channel_list.xml b/vdrmanager/res/values-de/channel_list.xml
new file mode 100644
index 0000000..556dcaf
--- /dev/null
+++ b/vdrmanager/res/values-de/channel_list.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="channel_item_menu_epg">Zeige EPG</string>
+ <string name="channel_item_menu_stream">Zeige Livestream</string>
+ <string name="channel_item_menu_hide">Verbergen</string>
+ <string name="channel_item_menu_hide_permanent">Permanent verbergen</string>
+
+ <string name="channel_group_menu_hide">Verbergen</string>
+ <string name="channel_group_menu_hide_permanent">Permanent verbergen</string>
+
+ <string name="menu_groupby">Anordnen nach</string>
+ <string name="groupby_group">Gruppe</string>
+ <string name="groupby_provider">Provider</string>
+ <string name="groupby_name">Name</string>
+ <string name="groupby_name_all_channels_group">Alle Kanäle</string>
+ <string name="groupby_window_title_templte">Nach %1$s anordnen</string>
+</resources>
diff --git a/vdrmanager/res/values-de/common.xml b/vdrmanager/res/values-de/common.xml
new file mode 100644
index 0000000..5a5952d
--- /dev/null
+++ b/vdrmanager/res/values-de/common.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="common_delete">Löschen</string>
+ <string name="prefs_current_value">Aktuell:</string>
+ <string name="prefs_current_value_template">Aktuell: %1$s</string>
+ <string name="no_connection">Keine Verbindung</string>
+ <string name="no_connection_retry">Wiederholen</string>
+ <string name="refresh">Auffrischen</string>
+ <string name="done">Fertig</string>
+ <string name="share">Share</string>
+ <string name="share_chooser">Share EPG Eintrag</string>
+</resources>
diff --git a/vdrmanager/res/values-de/epg.xml b/vdrmanager/res/values-de/epg.xml
new file mode 100644
index 0000000..3c2e905
--- /dev/null
+++ b/vdrmanager/res/values-de/epg.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <!-- What's on display -->
+ <string name="epg_list_time_label">Was kommt</string>
+ <string name="epg_list_time_now">jetzt</string>
+ <string name="epg_list_time_next">als nächstes</string>
+ <string name="epg_list_channel_spinner">Kanal</string>
+ <string name="epg_list_search_label">Suchergebnisse</string>
+
+ <!-- create timer -->
+ <string name="epg_event_share_text">Share</string>
+ <string name="epg_event_imdb_text">IMDB Suche</string>
+ <string name="epg_eent_livetv_text">Stream</string>
+ <string name="epg_event_create_timer_text">Timer hinzufügen</string>
+ <string name="epg_event_modify_timer_text">Timer modifizieren</string>
+
+ <!-- search -->
+ <string name="epg_search_button">Suchen</string>
+ <string name="epg_duration_template">%1$s min</string>
+ <string name="epg_duration_template_live">%1$s/%2$s min</string>
+ <string name="epg_of_a_channel">EPG -> %1$s</string>
+ <string name="epg_by_channel">EPG nach Kanälen</string>
+ <string name="epg_by_search">EPG Suche</string>
+ <string name="epg_by_search_param">EPG Suche: \'%1$s\'</string>
+ <string name="epg_by_time">EPG nach Zeit</string>
+ <string name="search_epg_hint">Suche EPG</string>
+ <string name="epg_search_settings_description">Suche VDR EPG</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/epg_list.xml b/vdrmanager/res/values-de/epg_list.xml
new file mode 100644
index 0000000..431f57b
--- /dev/null
+++ b/vdrmanager/res/values-de/epg_list.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="navigae_at_the_end">Ende</string>
+ <string name="navigae_at_the_start">Anfang</string>
+</resources>
diff --git a/vdrmanager/res/values-de/epg_list_menu.xml b/vdrmanager/res/values-de/epg_list_menu.xml
new file mode 100644
index 0000000..0a7e8df
--- /dev/null
+++ b/vdrmanager/res/values-de/epg_list_menu.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="epg_menu_search">Suche EPG</string>
+ <string name="epg_menu_times">Zeiten einstellen</string>
+
+ <string name="epg_item_menu_timer_add">Erzeuge Timer</string>
+ <string name="epg_item_menu_timer_delete">Lösche Timer</string>
+ <string name="epg_item_menu_timer_modify">Bearbeite Timer</string>
+ <string name="epg_item_menu_timer_enable">Aktiviere Timer</string>
+ <string name="epg_item_menu_timer_disable">Deaktiviere Timer</string>
+ <string name="epg_no_items">Nichts gefunden…</string>
+ <string name="epg_client_errors">Ein Fehler ist aufgetreten, prüfe Log…</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/epg_search_times.xml b/vdrmanager/res/values-de/epg_search_times.xml
new file mode 100644
index 0000000..c44d2ab
--- /dev/null
+++ b/vdrmanager/res/values-de/epg_search_times.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="epg_search_times_add">Zeit hinzufügen</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/errors.xml b/vdrmanager/res/values-de/errors.xml
new file mode 100644
index 0000000..9e774b5
--- /dev/null
+++ b/vdrmanager/res/values-de/errors.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="vdr_error_text">Bei der Kommunikation mit dem VDR ist ein Fehler aufgetreten: %1$s</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/livetv.xml b/vdrmanager/res/values-de/livetv.xml
new file mode 100644
index 0000000..fd08ffe
--- /dev/null
+++ b/vdrmanager/res/values-de/livetv.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="livetv">Live TV</string>
+ <string name="settings_livetv_summary">Benötigt Streamdev-server auf dem VDR und ein externes Wiedergabeprogramm wie z.B. VPlayer</string>
+ <string name="settings_livetv_streamformat">Stream-Format</string>
+ <string name="settings_livetv_port">Stream-Port</string>
+ <string name="settings_livetv_port_summary">Default 3000. Der Zugriff muss in der Datei
+ streamdevhosts.conf aktiviert sein.</string>
+ <string-array name="livetv_streamformat">
+ <item>TS</item>
+ <item>PES</item>
+ <item>ES</item>
+ <item>PS</item>
+ </string-array>
+ <string-array name="livetv_streamformat_values">
+ <item>TS</item>
+ <item>PES</item>
+ <item>ES</item>
+ <item>PS</item>
+ </string-array>
+ <string name="key_remux_enable">remux_enable</string>
+ <string name="key_remux_command">remux_command</string>
+ <string name="key_remux_parameter">remux_parameter</string>
+
+ <string name="stream_via_as">Stream</string>
+ <string name="stream_via">über %s</string>
+ <string name="stream_as">als %s</string>
+ <string name="remux_title">Remux</string>
+ <string name="remux_enable_title">Aktiviere Remux</string>
+ <string name="remux_enable_summary">Aktiviere Streaming mittels remux (z.B. externremux.sh)</string>
+
+ <string name="remux_command_title">Format</string>
+ <string name="remux_command_summary">Typischerweise EXT oder Extern z.B. http://vdr:3000/Extern/1</string>
+
+ <string name="remux_parameter_title">Parameter</string>
+ <string name="remux_parameter_summary">Steuert Streaming Qualität. z.B. http://vdr:3000/Extern;DSL1000/1</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/main_menu.xml b/vdrmanager/res/values-de/main_menu.xml
new file mode 100644
index 0000000..098dda0
--- /dev/null
+++ b/vdrmanager/res/values-de/main_menu.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="main_menu_preferences">Einstellungen</string>
+ <string name="main_menu_info">Infomationen</string>
+ <string name="main_menu_exit">Beenden</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/preferences.xml b/vdrmanager/res/values-de/preferences.xml
new file mode 100644
index 0000000..4ee50fe
--- /dev/null
+++ b/vdrmanager/res/values-de/preferences.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <!-- VDR plugin preferences -->
+ <string name="vdr_preferences">Netzwerkeinstellungen</string>
+ <string name="vdr_host_title">VDR Rechner</string>
+ <string name="vdr_host_summary">Host running VDR</string>
+ <string name="vdr_port_title">VDR Plugin port </string>
+ <string name="vdr_port_summary">Port für Verbindungen zum VDR Plugin</string>
+ <string name="vdr_port_default">6420</string>
+ <string name="vdr_password_title">VDR Plugin Passwort</string>
+ <string name="vdr_password_summary">Passwort für das VDR Plugin</string>
+ <string name="vdr_ssl_title">Sichere Verbindung</string>
+ <string name="vdr_ssl_summary">Verwende SSL für Verbindungen</string>
+
+ <!-- channel filter preferences -->
+ <string name="channel_filter_preferences">Kanaleinstellungen</string>
+ <string name="channel_filter_filter_title">Begrenze Kanäle</string>
+ <string name="channel_filter_filter_summary">Nur ausgewählte Kanäle verwenden</string>
+ <string name="channel_filter_last_title">Kanalfilter</string>
+ <string name="channel_filter_last_summary">Kommagetrennte Kanalnummern oder Bereiche (\'-\'). z.B. 1,2,4-10</string>
+
+ <!-- wakeup -->
+ <string name="wakeup_preferences">Ferngesteueren VDR Rechner wecken</string>
+ <string name="wakeup_enabled_title">VDR kann geweckt werden</string>
+ <string name="wakeup_enabled_summary">Aktiviert das Wecken des ferngesteuerten VDR Rechners</string>
+ <string name="wakeup_url_title">URL für Wecken in der Ferne</string>
+ <string name="wakeup_url_summary">URL für die Aufforderung zum Wecken</string>
+ <string name="wakeup_user_title">Nutzeraccount</string>
+ <string name="wakeup_user_summary">Account für Remote-Wecken</string>
+ <string name="wakeup_password_title">Passwort</string>
+ <string name="wakeup_password_summary">Passwort für Remote-Wecken</string>
+ <string name="wakeup_method_key">key_wakeup_method</string>
+ <string name="wakeup_method_title">Weckmethode</string>
+ <string name="wakeup_method_summary">Wähle eine Methode zum Wecken des VDR Rechners</string>
+ <string-array name="wakeup_methods">
+ <item>Rufe ein URL auf</item>
+ <item>WOL</item>
+ </string-array>
+ <string-array name="wakeup_methods_values">
+ <item>url</item>
+ <item>wol</item>
+ </string-array>
+ <string name="default_wakeup_method">url</string>
+ <string name="wakeup_wol_custom_broadcast_key">key_wol_custom_broadcast</string>
+ <string name="wakeup_wol_custom_boradcast_title">Eigene WOL-Netzwerkadresse</string>
+ <string name="wakeup_wol_custom_boradcast_summary">Eine WOL-Netzwerkadresse von 255.255.255.255 abweichend. Zum Beispiel sinnvoll für VPN Verbindungen.</string>
+ <string name="wakeup_wol_custom_boradcast_summary_on">Broadcast </string>
+
+
+ <string name="wakeup_wol_mac_key">key_wakeup_wol_mac</string>
+ <string name="wakeup_wol_mac_title">MAC-Adresse</string>
+ <string name="wakeup_wol_mac_summary">MAC-Adresse des VDR Rechners. Verwende \':\' , \'-\' oder ein Leerzeichen als Trennzeichen.</string>
+
+ <!-- timer -->
+ <string name="timer_preferences">Voreinstellungen für Timer</string>
+ <string name="timer_pre_start_buffer_title">Vorlaufzeit</string>
+ <string name="timer_pre_start_buffer_summary">Minuten der Aufzeichnung vor dem Beginn der Sendung</string>
+ <string name="timer_post_end_buffer_title">Nachlaufzeit</string>
+ <string name="timer_post_end_buffer_summary">Minuten der Aufzeichnung nach dem Ende der Sendung</string>
+ <string name="timer_default_priority_title">Priorität</string>
+ <string name="timer_default_priority_summary">Standardmässig verwendete Priorität</string>
+ <string name="timer_default_primary_limit_title">Primärlimit</string>
+ <string name="timer_default_primary_limit_summary">Standardmässig verwendetes Primärlimit</string>
+ <string name="timer_default_lifetime_title">Lebenszeit</string>
+ <string name="timer_default_lifetime_summary">Standardmässig verwendete Lebenszeit</string>
+
+ <!-- GUI -->
+ <string name="gui_preferences">Einstellungen der Benutzeroberfläche</string>
+ <string name="gui_enable_24h_format_key">key_enable_24h</string>
+ <string name="gui_enable_24h_format_title">Verwende 24-h Format</string>
+ <string name="gui_enable_24h_format_summary_on">13:00</string>
+ <string name="gui_enable_24h_format_summary_off">1:00 PM</string>
+ <string name="gui_channels_show_channel_numbers_key">key_channels_show_channel_numbers</string>
+ <string name="gui_channels_show_channel_numbers_title">Zeige Kanalnummern</string>
+ <string name="gui_channels_show_channel_numbers_summary">Zeige Kanalnummern in der Kanalliste.</string>
+
+ <string name="qui_quit_on_back_key">key_gui_quit_on_back</string>
+ <string name="gui_quit_on_back_title">Beenden mit Zurück Button</string>
+ <string name="gui_quit_on_back_summary_on">Zurück Button schließt den VDR-Manager</string>
+ <string name="gui_quit_on_back_summary_off">Zurück Button beendet den VDR-Manager nicht</string>
+
+ <string name="qui_show_imdb_button_key">key_qui_show_imdb_button</string>
+ <string name="qui_show_imdb_button_title">Zeige IMDB Button</string>
+ <string name="qui_show_imdb_button_summary_on">IMDB Button anzeigen</string>
+ <string name="qui_show_imdb_button_summary_off">IMDB Button nicht anzeigen</string>
+
+ <string name="qui_imdb_url_key">key_qui_imdb_url</string>
+ <string name="qui_imdb_url_title">IMDb Seite</string>
+ <string name="qui_imdb_url_summary">Welche IMDb Seite für die Suche verwenden.</string>
+ <string name="gui_custom_locale_title">Andere Sprache</string>
+ <string name="gui_custom_locale_sum">Eine andere Sprache aktivieren.</string>
+
+ <string-array name="imdb_urls">
+ <item>imdb.com</item>
+ <item>uk.imdb.com</item>
+ <item>imdb.de</item>
+ <item>imdb.es</item>
+ <item>imdb.fr</item>
+ <item>imdb.it</item>
+ <item>imdb.pt</item>
+ </string-array>
+
+ <string-array name="imdb_urls_values">
+ <item>International</item>
+ <item>imdb.com</item>
+ <item>uk.imdb.com</item>
+ <item>imdb.de</item>
+ <item>imdb.es</item>
+ <item>imdb.fr</item>
+ <item>imdb.it</item>
+ <item>imdb.pt</item>
+ </string-array>
+
+ <string-array name="lang_values">
+ <item></item>
+ <item>en</item>
+ <item>de</item>
+ </string-array>
+ <string-array name="lang">
+ <item>Voreinstellung</item>
+ <item>Englisch</item>
+ <item>Deutsch</item>
+ </string-array>
+
+</resources>
diff --git a/vdrmanager/res/values-de/preferences_keys.xml b/vdrmanager/res/values-de/preferences_keys.xml
new file mode 100644
index 0000000..7eb0c6d
--- /dev/null
+++ b/vdrmanager/res/values-de/preferences_keys.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="vdr_host_key">svdrp_host</string>
+ <string name="vdr_port_key">svdrp_port </string>
+ <string name="vdr_password_key">svdrp_password</string>
+ <string name="vdr_ssl_key">svdrp_ssl</string>
+ <string name="vdr_stream_format">stream_format</string>
+ <string name="vdr_stream_port">stream_port</string>
+
+ <string name="alive_check_enabled_key">alive_check_enabled</string>
+ <string name="alive_check_interval_key">alive_check_interval</string>
+
+ <string name="channel_filter_filter_key">limit_channels</string>
+ <string name="channel_filter_last_key">last_channel</string>
+
+ <string name="wakeup_enabled_key">wakeup_enabled</string>
+
+ <string name="wakeup_url_key">wakeup_url</string>
+ <string name="wakeup_user_key">wakeup_user</string>
+ <string name="wakeup_password_key">wakeup_password</string>
+
+ <string name="timer_pre_start_buffer_key">timer_pre_start_buffer</string>
+ <string name="timer_post_end_buffer_key">timer_post_end_buffer</string>
+ <string name="timer_default_priority_key">timer_default_priority</string>
+ <string name="timer_default_primary_limit_key">timer_default_primary_limit</string>
+ <string name="timer_default_lifetime_key">timer_default_lifetime</string>
+
+ <string name="epg_search_times_key">epg_search_times</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/progress.xml b/vdrmanager/res/values-de/progress.xml
new file mode 100644
index 0000000..89bdb39
--- /dev/null
+++ b/vdrmanager/res/values-de/progress.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <!-- progress -->
+ <string name="progress_connect">Verbinde…</string>
+ <string name="progress_connect_error">Verbindung fehlgeschlagen</string>
+ <string name="progress_login">Anmelden.</string>
+ <string name="progress_login_error">Anmelden fehlgeschlagen.</string>
+ <string name="progress_whatson_loading">Lade EPG…</string>
+ <string name="progress_timers_loading">Lade Timer…</string>
+ <string name="progress_recordings_loading">Lade Aufnahmen…</string>
+ <string name="progress_channels_loading">Lade Kanäle…</string>
+ <string name="progress_disconnect">Trenne…</string>
+ <string name="progress_wakeup_sending">Initalisiere aufwecken…</string>
+ <string name="progress_wakeup_sent">Aufforderung zum Wecken gesendet</string>
+ <string name="progress_wakeup_error">Fehler beim Senden der Aufforderung zum Wecken: %1$s</string>
+ <string name="progress_timer_save">Speichere Timer…</string>
+ <string name="progress_timer_delete">Lösche Timer…</string>
+ <string name="progress_recording_delete">Lösche Aufnahme…</string>
+ <string name="progress_timer_enable">Aktiviere Timer…</string>
+ <string name="progress_timer_modify">Modifiziere Timer…</string>
+ <string name="progress_timer_disable">Deaktiviere Timer…</string>
+ <string name="progress_connect_finished_abnormal">Verbindung unnormal beeendet…</string>
+ <string name="progress_connect_finished_abnormal_arg">Verbindung unnormal beeendet: %1$s</string>
+ <string name="progress_cache_hit">Lade aus Cache.</string>
+
+</resources>
diff --git a/vdrmanager/res/values-de/recording_list_menu.xml b/vdrmanager/res/values-de/recording_list_menu.xml
new file mode 100644
index 0000000..ce91bc8
--- /dev/null
+++ b/vdrmanager/res/values-de/recording_list_menu.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="recording_item_menu_delete">Löschen</string>
+ <string name="recording_item_menu_stream">Stream</string>
+</resources>
diff --git a/vdrmanager/res/values-de/timers.xml b/vdrmanager/res/values-de/timers.xml
new file mode 100644
index 0000000..3410395
--- /dev/null
+++ b/vdrmanager/res/values-de/timers.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <string name="timer_detail_title_title">Titel:</string>
+ <string name="timer_detail_channel_title">Kanal:</string>
+ <string name="timer_detail_start_title">Start:</string>
+ <string name="timer_detail_end_title">Ende:</string>
+
+ <string name="timer_details_create_title">Erzeuge Timer</string>
+ <string name="timer_details_save_title">Speichere Änderungen</string>
+ <string name="timer_details_delete_title">Lösche Timer</string>
+
+</resources>
diff --git a/vdrmanager/res/values/common.xml b/vdrmanager/res/values/common.xml
index 9d1670e..6808c70 100644
--- a/vdrmanager/res/values/common.xml
+++ b/vdrmanager/res/values/common.xml
@@ -2,8 +2,10 @@
<resources>
<string name="common_delete">Delete</string>
<string name="prefs_current_value">Current:</string>
- <string name="prefs_current_value_template">Current: %1$s</string>
+ <string name="prefs_current_value_template">\nCurrent: %1$s</string>
+ <string name="prefs_current_value_not_set">&lt;not set&gt;</string>
<string name="no_connection">No connection</string>
+ <string name="aborted">Connection aborted.</string>
<string name="no_connection_retry">Retry</string>
<string name="refresh">Refresh</string>
<string name="done">Done</string>
diff --git a/vdrmanager/res/values/preferences.xml b/vdrmanager/res/values/preferences.xml
index a1d3f81..45d0b34 100644
--- a/vdrmanager/res/values/preferences.xml
+++ b/vdrmanager/res/values/preferences.xml
@@ -1,105 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <!-- VDR plugin preferences -->
- <string name="vdr_preferences">Network settings</string>
- <string name="vdr_host_title">VDR host</string>
- <string name="vdr_host_summary">Host running VDR</string>
- <string name="vdr_port_title">VDR plugin port </string>
- <string name="vdr_port_summary">Port for connections to VDR plugin</string>
- <string name="vdr_port_default">6420</string>
- <string name="vdr_password_title">VDR plugin password</string>
- <string name="vdr_password_summary">Password for the VDR plugin</string>
- <string name="vdr_ssl_title">Secure connect</string>
- <string name="vdr_ssl_summary">Use SSL for connections</string>
+ <!-- VDR plugin preferences -->
+ <string name="vdr_preferences">Network settings</string>
+ <string name="vdr_host_title">VDR host</string>
+ <string name="vdr_host_summary">Host running VDR</string>
+ <string name="vdr_port_title">VDR plugin port </string>
+ <string name="vdr_port_summary">Port for connections to VDR plugin</string>
+ <string name="vdr_port_default">6420</string>
+ <string name="vdr_password_title">VDR plugin password</string>
+ <string name="vdr_password_summary">Password for the VDR plugin</string>
+ <string name="vdr_ssl_title">Secure connect</string>
+ <string name="vdr_ssl_summary">Use SSL for connections</string>
- <!-- channel filter preferences -->
- <string name="channel_filter_preferences">Channel settings</string>
- <string name="channel_filter_filter_title">Limit channels</string>
- <string name="channel_filter_filter_summary">Use only given channels</string>
- <string name="channel_filter_last_title">Channel filter</string>
- <string name="channel_filter_last_summary">Comma separated channelnumbers or ranges (separator \'-\'). A.e. 1,2,4-10</string>
+ <!-- channel filter preferences -->
+ <string name="channel_filter_preferences">Channel settings</string>
+ <string name="channel_filter_filter_title">Limit channels</string>
+ <string name="channel_filter_filter_summary">Use only given channels</string>
+ <string name="channel_filter_last_title">Channel filter</string>
+ <string name="channel_filter_last_summary">Comma separated channelnumbers or ranges (separator \'-\'). A.e. 1,2,4-10</string>
- <!-- wakeup -->
- <string name="wakeup_preferences">Remote VDR host wakeup</string>
- <string name="wakeup_enabled_title">Can remote wakeup VDR</string>
- <string name="wakeup_enabled_summary">Enables to remote wakeup the VDR host</string>
- <string name="wakeup_url_title">URL for remote wakeup</string>
- <string name="wakeup_url_summary">URL for a request doing the wakeup</string>
- <string name="wakeup_user_title">Wakeup user</string>
- <string name="wakeup_user_summary">User for remote wakeup</string>
- <string name="wakeup_password_title">Wakeup password</string>
- <string name="wakeup_password_summary">Password for remote wakeup</string>
- <string name="wakeup_method_key">key_wakeup_method</string>
- <string name="wakeup_method_title">Wakeup method</string>
- <string name="wakeup_method_summary">Choose a method to wakeup the vdr host</string>
- <string-array name="wakeup_methods">
- <item>Call a URL</item>
- <item>WOL</item>
- </string-array>
- <string-array name="wakeup_methods_values">
- <item>url</item>
- <item>wol</item>
- </string-array>
- <string name="default_wakeup_method">url</string>
- <string name="wakeup_wol_custom_broadcast_key">key_wol_custom_broadcast</string>
+ <!-- wakeup -->
+ <string name="wakeup_preferences">Remote VDR host wakeup</string>
+ <string name="wakeup_enabled_title">Can remote wakeup VDR</string>
+ <string name="wakeup_enabled_summary">Enables to remote wakeup the VDR host</string>
+ <string name="wakeup_url_title">URL for remote wakeup</string>
+ <string name="wakeup_url_summary">URL for a request doing the wakeup</string>
+ <string name="wakeup_user_title">Wakeup user</string>
+ <string name="wakeup_user_summary">User for remote wakeup</string>
+ <string name="wakeup_password_title">Wakeup password</string>
+ <string name="wakeup_password_summary">Password for remote wakeup</string>
+ <string name="wakeup_method_key">key_wakeup_method</string>
+ <string name="wakeup_method_title">Wakeup method</string>
+ <string name="wakeup_method_summary">Choose a method to wakeup the vdr host</string>
+
+ <string-array name="wakeup_methods">
+ <item>Call a URL</item>
+ <item>WOL</item>
+ </string-array>
+ <string-array name="wakeup_methods_values">
+ <item>url</item>
+ <item>wol</item>
+ </string-array>
+
+ <string name="default_wakeup_method">url</string>
+ <string name="wakeup_wol_custom_broadcast_key">key_wol_custom_broadcast</string>
<string name="wakeup_wol_custom_boradcast_title">Custom broadcast address</string>
<string name="wakeup_wol_custom_boradcast_summary">Enter custom broadcast address rather then 255.255.255.255. Useful for VPN connection as example.</string>
<string name="wakeup_wol_custom_boradcast_summary_on">Broadcast </string>
-
-
- <string name="wakeup_wol_mac_key">key_wakeup_wol_mac</string>
+ <string name="wakeup_wol_mac_key">key_wakeup_wol_mac</string>
<string name="wakeup_wol_mac_title">MAC-Address</string>
- <string name="wakeup_wol_mac_summary">MAC-Address of the VDR host. User \':\' or \'-\' or a space as separator.</string>
+ <string name="wakeup_wol_mac_summary">MAC-Address of the VDR host. Use \':\' or \'-\' or a space as separator.</string>
- <!-- timer -->
- <string name="timer_preferences">Timer defaults</string>
- <string name="timer_pre_start_buffer_title">Margin at start</string>
- <string name="timer_pre_start_buffer_summary">Minutes recording starts before the beginning of
+ <!-- timer -->
+ <string name="timer_preferences">Timer defaults</string>
+ <string name="timer_pre_start_buffer_title">Margin at start</string>
+ <string name="timer_pre_start_buffer_summary">Minutes recording starts before the beginning of
the broadcast</string>
- <string name="timer_post_end_buffer_title">Margin at stop</string>
- <string name="timer_post_end_buffer_summary">Minutes recording stops after the end of the
+ <string name="timer_post_end_buffer_title">Margin at stop</string>
+ <string name="timer_post_end_buffer_summary">Minutes recording stops after the end of the
broadcast</string>
- <string name="timer_default_priority_title">Default priority</string>
- <string name="timer_default_priority_summary">Default priority</string>
- <string name="timer_default_primary_limit_title">Default primary limit</string>
- <string name="timer_default_primary_limit_summary">Default primary limit</string>
- <string name="timer_default_lifetime_title">Default lifetime</string>
- <string name="timer_default_lifetime_summary">Default lifetime</string>
+ <string name="timer_default_priority_title">Default priority</string>
+ <string name="timer_default_priority_summary">Default priority</string>
+ <string name="timer_default_primary_limit_title">Default primary limit</string>
+ <string name="timer_default_primary_limit_summary">Default primary limit</string>
+ <string name="timer_default_lifetime_title">Default lifetime</string>
+ <string name="timer_default_lifetime_summary">Default lifetime</string>
- <!-- GUI -->
- <string name="gui_preferences">GUI Settings</string>
- <string name="gui_enable_24h_format_key">key_enable_24h</string>
- <string name="gui_enable_24h_format_title">Use 24-hour format</string>
- <string name="gui_enable_24h_format_summary_on">13:00</string>
- <string name="gui_enable_24h_format_summary_off">1:00 PM</string>
- <string name="gui_channels_show_channel_numbers_key">key_channels_show_channel_numbers</string>
- <string name="gui_channels_show_channel_numbers_title">Show channel numbers</string>
+ <!-- GUI -->
+ <string name="gui_preferences">GUI Settings</string>
+ <string name="gui_enable_24h_format_key">key_enable_24h</string>
+ <string name="gui_enable_24h_format_title">Use 24-hour format</string>
+ <string name="gui_enable_24h_format_summary_on">13:00</string>
+ <string name="gui_enable_24h_format_summary_off">1:00 PM</string>
+ <string name="gui_channels_show_channel_numbers_key">key_channels_show_channel_numbers</string>
+ <string name="gui_channels_show_channel_numbers_title">Show channel numbers</string>
<string name="gui_channels_show_channel_numbers_summary">Show channel numbers in the channel list.</string>
-
- <string name="qui_quit_on_back_key">key_gui_quit_on_back</string>
- <string name="gui_quit_on_back_title">Quit on back button</string>
- <string name="gui_quit_on_back_summary_on">Back button quits the VDR-Manager</string>
- <string name="gui_quit_on_back_summary_off">Back button does not quit VDR-Manager</string>
-
- <string name="qui_show_imdb_button_key">key_qui_show_imdb_button</string>
- <string name="qui_show_imdb_button_title">Show IMDB Button</string>
- <string name="qui_show_imdb_button_summary_on">IMDB Button is shown</string>
- <string name="qui_show_imdb_button_summary_off">IMDB Button is not shown</string>
-
- <string name="qui_imdb_url_key">key_qui_imdb_url</string>
- <string name="qui_imdb_url_title">IMDb Site</string>
- <string name="qui_imdb_url_summary">Which IMDb site to search.</string>
-
-
- <string-array name="imdb_urls">
- <item>imdb.com</item>
- <item>uk.imdb.com</item>
- <item>imdb.de</item>
- <item>imdb.es</item>
- <item>imdb.fr</item>
- <item>imdb.it</item>
- <item>imdb.pt</item>
- </string-array>
+ <string name="qui_quit_on_back_key">key_gui_quit_on_back</string>
+ <string name="gui_quit_on_back_title">Quit on back button</string>
+ <string name="gui_quit_on_back_summary_on">Back button quits the VDR-Manager</string>
+ <string name="gui_quit_on_back_summary_off">Back button does not quit VDR-Manager</string>
+ <string name="qui_show_imdb_button_key">key_qui_show_imdb_button</string>
+ <string name="qui_show_imdb_button_title">Show IMDB Button</string>
+ <string name="qui_show_imdb_button_summary_on">IMDB Button is shown</string>
+ <string name="qui_show_imdb_button_summary_off">IMDB Button is not shown</string>
+ <string name="qui_imdb_url_key">key_qui_imdb_url</string>
+ <string name="qui_imdb_url_title">IMDb Site</string>
+ <string name="qui_imdb_url_summary">Which IMDb site to search.</string>
+ <string name="gui_custom_locale_key">key_gui_custom_locale</string>
+ <string name="gui_custom_locale_title">Custom language</string>
+ <string name="gui_custom_locale_sum">Set a custom language.</string>
+
+ <string-array name="imdb_urls">
+ <item>akas.imdb.com</item>
+ <item>imdb.com</item>
+ <item>uk.imdb.com</item>
+ <item>imdb.de</item>
+ <item>imdb.es</item>
+ <item>imdb.fr</item>
+ <item>imdb.it</item>
+ <item>imdb.pt</item>
+ </string-array>
+ <string-array name="imdb_urls_values">
+ <item>International</item>
+ <item>imdb.com</item>
+ <item>uk.imdb.com</item>
+ <item>imdb.de</item>
+ <item>imdb.es</item>
+ <item>imdb.fr</item>
+ <item>imdb.it</item>
+ <item>imdb.pt</item>
+ </string-array>
+ <string-array name="lang_values">
+ <item>DEFAULT</item>
+ <item>en</item>
+ <item>de</item>
+ </string-array>
+ <string-array name="lang">
+ <item>Default language</item>
+ <item>English</item>
+ <item>German</item>
+ </string-array>
+
+ <string name="vdr_conntimeout_key">key_conntimeout_key</string>
+ <string name="vdr_conntimeout_title">Connection Timeout</string>
+ <string name="vdr_conntimeout_sum">How long (in seconds) to wait before the connection is established?</string>
+ <string name="vdr_readtimeout_key">key_vdr_readtimeout</string>
+ <string name="vdr_readtimeout_title">Read Timeout</string>
+ <string name="vdr_readtimeout_sum">How long (in seconds) to wait for every read line operation?</string>
+ <string name="vdr_timeout_key">key_vdr_timeout</string>
+ <string name="vdr_timeout_title">Total timeout</string>
+ <string name="vdr_timeout_sum">How long (in seconds) to wait for a whole I/O operation, before it gets aborted?</string>
-</resources>
+</resources> \ No newline at end of file
diff --git a/vdrmanager/res/values/progress.xml b/vdrmanager/res/values/progress.xml
index 8edb21c..9074a7a 100644
--- a/vdrmanager/res/values/progress.xml
+++ b/vdrmanager/res/values/progress.xml
@@ -20,8 +20,8 @@
<string name="progress_timer_enable">Enabling timer…</string>
<string name="progress_timer_modify">Updating timer…</string>
<string name="progress_timer_disable">Disabling timer…</string>
- <string name="progress_connect_finished_abnormal">Connection finished abnormal…</string>
+ <string name="progress_connect_finished_abnormal">Connection finished abnormal</string>
<string name="progress_connect_finished_abnormal_arg">Connection finished abnormal: %1$s</string>
- <string name="progress_cache_hit">Loader from cache.</string>
+ <string name="progress_cache_hit">Loaded from cache.</string>
</resources>
diff --git a/vdrmanager/res/xml/preferences.xml b/vdrmanager/res/xml/preferences.xml
index b0383de..001b2f9 100644
--- a/vdrmanager/res/xml/preferences.xml
+++ b/vdrmanager/res/xml/preferences.xml
@@ -14,6 +14,11 @@
android:password="true" />
<CheckBoxPreference android:key="@string/vdr_ssl_key"
android:title="@string/vdr_ssl_title" android:summary="@string/vdr_ssl_summary" />
+ <PreferenceScreen android:title="Advanced">
+ <EditTextPreference android:key="@string/vdr_conntimeout_key" android:title="@string/vdr_conntimeout_title" android:summary="@string/vdr_conntimeout_sum" android:defaultValue="10" android:inputType="number" />
+ <EditTextPreference android:key="@string/vdr_readtimeout_key" android:title="@string/vdr_readtimeout_title" android:summary="@string/vdr_readtimeout_sum" android:defaultValue="10" android:inputType="number" />
+ <EditTextPreference android:key="@string/vdr_timeout_key" android:title="@string/vdr_timeout_title" android:summary="@string/vdr_timeout_sum" android:defaultValue="120" android:inputType="number" />
+ </PreferenceScreen>
</PreferenceCategory>
@@ -88,15 +93,20 @@
<ListPreference android:key="@string/qui_imdb_url_key"
android:title="@string/qui_imdb_url_title" android:summaryOn="@string/qui_imdb_url_summary"
- android:entries="@array/imdb_urls" android:entryValues="@array/imdb_urls"
+ android:entries="@array/imdb_urls_values" android:entryValues="@array/imdb_urls"
android:dependency="@string/qui_show_imdb_button_key"
- android:defaultValue="imdb.de" />
+ android:defaultValue="akas.imdb.com" />
<CheckBoxPreference android:key="@string/qui_quit_on_back_key"
android:title="@string/gui_quit_on_back_title"
android:summaryOn="@string/gui_quit_on_back_summary_on"
android:summaryOff="@string/gui_quit_on_back_summary_off"
android:defaultValue="true" />
+
+ <ListPreference android:key="@string/gui_custom_locale_key"
+ android:title="@string/gui_custom_locale_title" android:summary="@string/gui_custom_locale_sum"
+ android:entries="@array/lang" android:entryValues="@array/lang_values" android:defaultValue="DEFAULT" />
+
</PreferenceCategory>
<PreferenceCategory android:title="@string/livetv">
@@ -112,6 +122,7 @@
<CheckBoxPreference android:key="remux_enable"
android:title="@string/remux_enable_title" android:summary="@string/remux_enable_summary" />
+
<EditTextPreference android:dependency="remux_enable"
android:key="remux_command" android:title="@string/remux_command_title"
android:defaultValue="EXT" android:summary="@string/remux_command_summary" />
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/StringUtils.java b/vdrmanager/src/de/bjusystems/vdrmanager/StringUtils.java
new file mode 100644
index 0000000..23f1845
--- /dev/null
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/StringUtils.java
@@ -0,0 +1,151 @@
+package de.bjusystems.vdrmanager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class StringUtils {
+
+ /**
+ * An empty immutable <code>String</code> array.
+ */
+ public static final String[] EMPTY_STRING_ARRAY = new String[0];
+
+
+ /**
+ * Performs the logic for the <code>split</code> and
+ * <code>splitPreserveAllTokens</code> methods that return a maximum array
+ * length.
+ *
+ * @param str the String to parse, may be <code>null</code>
+ * @param separatorChars the separate character
+ * @param max the maximum number of elements to include in the
+ * array. A zero or negative value implies no limit.
+ * @param preserveAllTokens if <code>true</code>, adjacent separators are
+ * treated as empty token separators; if <code>false</code>, adjacent
+ * separators are treated as one separator.
+ * @return an array of parsed Strings, <code>null</code> if null String input
+ */
+ private static String[] splitWorker(String str, String separatorChars, int max, boolean preserveAllTokens) {
+ // Performance tuned for 2.0 (JDK1.4)
+ // Direct code is quicker than StringTokenizer.
+ // Also, StringTokenizer uses isSpace() not isWhitespace()
+
+ if (str == null) {
+ return null;
+ }
+ int len = str.length();
+ if (len == 0) {
+ return EMPTY_STRING_ARRAY;
+ }
+ List list = new ArrayList();
+ int sizePlus1 = 1;
+ int i = 0, start = 0;
+ boolean match = false;
+ boolean lastMatch = false;
+ if (separatorChars == null) {
+ // Null separator means use whitespace
+ while (i < len) {
+ if (Character.isWhitespace(str.charAt(i))) {
+ if (match || preserveAllTokens) {
+ lastMatch = true;
+ if (sizePlus1++ == max) {
+ i = len;
+ lastMatch = false;
+ }
+ list.add(str.substring(start, i));
+ match = false;
+ }
+ start = ++i;
+ continue;
+ }
+ lastMatch = false;
+ match = true;
+ i++;
+ }
+ } else if (separatorChars.length() == 1) {
+ // Optimise 1 character case
+ char sep = separatorChars.charAt(0);
+ while (i < len) {
+ if (str.charAt(i) == sep) {
+ if (match || preserveAllTokens) {
+ lastMatch = true;
+ if (sizePlus1++ == max) {
+ i = len;
+ lastMatch = false;
+ }
+ list.add(str.substring(start, i));
+ match = false;
+ }
+ start = ++i;
+ continue;
+ }
+ lastMatch = false;
+ match = true;
+ i++;
+ }
+ } else {
+ // standard case
+ while (i < len) {
+ if (separatorChars.indexOf(str.charAt(i)) >= 0) {
+ if (match || preserveAllTokens) {
+ lastMatch = true;
+ if (sizePlus1++ == max) {
+ i = len;
+ lastMatch = false;
+ }
+ list.add(str.substring(start, i));
+ match = false;
+ }
+ start = ++i;
+ continue;
+ }
+ lastMatch = false;
+ match = true;
+ i++;
+ }
+ }
+ if (match || (preserveAllTokens && lastMatch)) {
+ list.add(str.substring(start, i));
+ }
+ return (String[]) list.toArray(new String[list.size()]);
+ }
+
+ /**
+ * <p>Splits the provided text into an array, separators specified,
+ * preserving all tokens, including empty tokens created by adjacent
+ * separators. This is an alternative to using StringTokenizer.</p>
+ *
+ * <p>The separator is not included in the returned String array.
+ * Adjacent separators are treated as separators for empty tokens.
+ * For more control over the split use the StrTokenizer class.</p>
+ *
+ * <p>A <code>null</code> input String returns <code>null</code>.
+ * A <code>null</code> separatorChars splits on whitespace.</p>
+ *
+ * <pre>
+ * StringUtils.splitPreserveAllTokens(null, *) = null
+ * StringUtils.splitPreserveAllTokens("", *) = []
+ * StringUtils.splitPreserveAllTokens("abc def", null) = ["abc", "def"]
+ * StringUtils.splitPreserveAllTokens("abc def", " ") = ["abc", "def"]
+ * StringUtils.splitPreserveAllTokens("abc def", " ") = ["abc", "", def"]
+ * StringUtils.splitPreserveAllTokens("ab:cd:ef", ":") = ["ab", "cd", "ef"]
+ * StringUtils.splitPreserveAllTokens("ab:cd:ef:", ":") = ["ab", "cd", "ef", ""]
+ * StringUtils.splitPreserveAllTokens("ab:cd:ef::", ":") = ["ab", "cd", "ef", "", ""]
+ * StringUtils.splitPreserveAllTokens("ab::cd:ef", ":") = ["ab", "", cd", "ef"]
+ * StringUtils.splitPreserveAllTokens(":cd:ef", ":") = ["", cd", "ef"]
+ * StringUtils.splitPreserveAllTokens("::cd:ef", ":") = ["", "", cd", "ef"]
+ * StringUtils.splitPreserveAllTokens(":cd:ef:", ":") = ["", cd", "ef", ""]
+ * </pre>
+ *
+ * @param str the String to parse, may be <code>null</code>
+ * @param separatorChars the characters used as the delimiters,
+ * <code>null</code> splits on whitespace
+ * @return an array of parsed Strings, <code>null</code> if null String input
+ * @since 2.1
+ */
+ public static String[] splitPreserveAllTokens(String str, String separatorChars) {
+ return splitWorker(str, separatorChars, -1, true);
+ }
+
+}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/app/C.java b/vdrmanager/src/de/bjusystems/vdrmanager/app/C.java
new file mode 100644
index 0000000..8156f69
--- /dev/null
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/app/C.java
@@ -0,0 +1,15 @@
+package de.bjusystems.vdrmanager.app;
+
+/**
+ *
+ * Some constants
+ * @author lado
+ *
+ *
+ */
+public interface C {
+
+ public static final String DATA_SEPARATOR = ":";
+
+ public static final long ONE_MINUTE_IN_MILLIS = 60 * 1000;
+}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java
index 6f19f36..7029a53 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java
@@ -6,9 +6,9 @@ import java.util.List;
import android.app.Activity;
import android.app.Application;
import de.bjusystems.vdrmanager.data.Channel;
-import de.bjusystems.vdrmanager.data.Epg;
import de.bjusystems.vdrmanager.data.EpgSearchParams;
import de.bjusystems.vdrmanager.data.Event;
+import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.data.Timer;
public class VdrManagerApp extends Application {
@@ -42,8 +42,10 @@ public class VdrManagerApp extends Application {
@Override
public void onCreate() {
super.onCreate();
+ Preferences.loadPreferences(this);
}
+
public void clear() {
this.currentEvent = null;
this.currentTimer = null;
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java
index eeda768..9cc8396 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Channel.java
@@ -1,23 +1,37 @@
package de.bjusystems.vdrmanager.data;
+
+import de.bjusystems.vdrmanager.StringUtils;
+import de.bjusystems.vdrmanager.app.C;
+
import android.os.Parcel;
import android.os.Parcelable;
public class Channel implements Parcelable {
- private final int number;
- private final String name;
- private final String provider;
+ String id;
+ private int number;
+ private String name;
+ private String provider;
+ private String rawAudio;
+
+ public String getRawAudio() {
+ return rawAudio;
+ }
public Channel(final String channelData) {
- String[] words = channelData.split(":");
+ String[] words = StringUtils.splitPreserveAllTokens(channelData, C.DATA_SEPARATOR);
this.number = Integer.valueOf(words[0].substring(1));
if (words.length > 2) {
this.name = words[1];
this.provider = words[2];
+ this.id = words[3];
+ this.rawAudio = words[4];
} else {
this.name = words[1];
+ this.id = "-1";
this.provider = "Unknown";
+ this.rawAudio = "";
}
}
@@ -25,12 +39,16 @@ public class Channel implements Parcelable {
this.number = 0;
this.name = "Unknown";
this.provider = "Unknown";
+ this.id = "Uknwon";
+ this.rawAudio = "";
}
public Channel(Parcel in) {
this.number = in.readInt();
this.name = in.readString();
this.provider = in.readString();
+ this.id = in.readString();
+ this.rawAudio = in.readString();
}
public boolean isGroupSeparator() {
@@ -68,6 +86,9 @@ public class Channel implements Parcelable {
dest.writeInt(number);
dest.writeString(name);
dest.writeString(provider);
+ dest.writeString(id);
+ dest.writeString(rawAudio);
+
}
public static final Parcelable.Creator<Channel> CREATOR = new Parcelable.Creator<Channel>() {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java
index 079fcf0..f9ca15a 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Epg.java
@@ -2,6 +2,12 @@ package de.bjusystems.vdrmanager.data;
import java.util.Date;
+
+import de.bjusystems.vdrmanager.StringUtils;
+import de.bjusystems.vdrmanager.app.C;
+
+import static de.bjusystems.vdrmanager.gui.Utils.mapSpecialChars;
+
/**
* Class for EPG events
* @author bju
@@ -11,14 +17,14 @@ public class Epg extends BaseEvent {
private Timer timer;
public Epg(final String line) {
- final String[] words = line.split(":");
+ final String[] words = StringUtils.splitPreserveAllTokens(line, C.DATA_SEPARATOR);
channelNumber = words[0].substring(1);
channelName = words[1];
start = new Date(Long.parseLong(words[2])*1000);
stop = new Date(Long.parseLong(words[3])*1000);
- title = words[4];
- description = words.length > 5 ? words[5] : "";
- shortText = words.length > 6 ? words[6] : "";
+ title = mapSpecialChars(words[4]);
+ description = words.length > 5 ? mapSpecialChars(words[5]): "";
+ shortText = words.length > 6 ? mapSpecialChars(words[6]) : "";
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
index 2570e67..9f4151f 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
@@ -1,17 +1,23 @@
package de.bjusystems.vdrmanager.data;
+import java.util.Locale;
+
import android.content.Context;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
+import android.text.TextUtils;
import de.bjusystems.vdrmanager.R;
/**
* Class for all preferences
*
* @author bju, lado
- *
+ *
*/
public class Preferences {
+ public static final String DEFAULT_LANGUAGE_VALUE = "DEFAULT";
+
private boolean ssl;
/** SVDRP host name or ip */
private String svdrpHost;
@@ -81,12 +87,14 @@ public class Preferences {
/**
* Do not send broadcasts, send directly to the host (router problem)
+ *
* @since 0.2
*/
private String wolCustomBroadcast = "";
/**
* Whether to show channel numbers in the overviews
+ *
* @since 0.2
*/
private boolean showChannelNumbers = false;
@@ -95,45 +103,81 @@ public class Preferences {
* Use remux ?
*/
private boolean enableRemux;
-
+
/**
* Remux command
*/
private String remuxCommand;
-
+
/**
- * Remux command Parameter
+ * Remux command Parameter
*/
private String remuxParameter;
-
+
/**
* Quits the app on back button
*/
- private boolean quiteOnBackButton = true;
-
-
+ private boolean quiteOnBackButton = true;
+
/**
- * Show IMDB buttons, where possible (e.g. EPG Details)
+ * Show IMDB buttons, where possible (e.g. EPG Details)
*/
private boolean showImdbButton = true;
-
-
+
/**
* On Which imdb site to search?
*/
- private String imdbUrl = "imdb.de";
+ private String imdbUrl = "akas.imdb.com";
+
+
+ /**
+ * Connection timeout
+ */
+ private int connectionTimeout;
+ /**
+ * Read Timeout
+ */
+ private int readTimeout;
+
+ /**
+ * Timeout for a whole command run
+ */
+ private int timeout;
+
+ public int getConnectionTimeout() {
+ return connectionTimeout;
+ }
+
+ public int getReadTimeout() {
+ return readTimeout;
+ }
+
+ public int getTimeout() {
+ return timeout;
+ }
+
+ public void setConnectionTimeout(int connectionTimeout) {
+ this.connectionTimeout = connectionTimeout;
+ }
+
+ public void setReadTimeout(int readTimeout) {
+ this.readTimeout = readTimeout;
+ }
+
+ public void setTimeout(int timeout) {
+ this.timeout = timeout;
+ }
+
public String getImdbUrl() {
return imdbUrl;
}
-
public void setImdbUrl(String imdbUrl) {
this.imdbUrl = imdbUrl;
}
-
/**
* @return whether to shwo imdb button
*/
@@ -144,10 +188,9 @@ public class Preferences {
/** Properties singleton */
private static Preferences thePrefs;
-
/**
- * Whether to send Packets to the custom broadcast address.
- * It is used, if the address ist not empty
+ * Whether to send Packets to the custom broadcast address. It is used, if
+ * the address ist not empty
*
* @return
* @since 0.2
@@ -156,7 +199,6 @@ public class Preferences {
return wolCustomBroadcast;
}
-
/**
* Getter for use24hFormat
*
@@ -376,7 +418,7 @@ public class Preferences {
editor.commit();
// reload
- loadPreferences(context);
+ init(context);
}
/**
@@ -390,48 +432,43 @@ public class Preferences {
return context.getString(R.string.app_name);
}
-
-
-
-
/**
* Show Channel Numbers in the overviews
+ *
* @since 0.2
* @return
*/
public boolean isShowChannelNumbers() {
return showChannelNumbers;
}
-
-
/**
- * getter
+ * getter
+ *
* @return
*/
public boolean isEnableRemux() {
return enableRemux;
}
-
/**
* getter
+ *
* @return
*/
public String getRemuxCommand() {
return remuxCommand;
}
-
/**
* getter
+ *
* @return
*/
public String getRemuxParameter() {
return remuxParameter;
}
-
/**
* getter
*
@@ -441,7 +478,6 @@ public class Preferences {
return quiteOnBackButton;
}
-
/**
* Gets the previous loaded preferences
*
@@ -450,30 +486,23 @@ public class Preferences {
public static Preferences getPreferences() {
return thePrefs;
}
-
+
/**
*
* Gets the previous loaded preferences, same as getPreferences();
*
* @return
*/
- public static Preferences get(){
+ public static Preferences get() {
return thePrefs;
}
- /**
- * Loads all preferences
- *
- * @param context
- * Context
- * @return Preferences
- */
- public static void loadPreferences(final Context context) {
+ private static void initInternal(final Context context) {
final Preferences prefs = new Preferences();
prefs.svdrpHost = getString(context, R.string.vdr_host_key, "0.0.0.0");
- prefs.svdrpPort = getInt(context, R.string.vdr_port_key, 6419);
+ prefs.svdrpPort = getInt(context, R.string.vdr_port_key, 6420);
prefs.password = getString(context, R.string.vdr_password_key, "");
prefs.ssl = getBoolean(context, R.string.vdr_ssl_key, false);
prefs.streamPort = getInt(context, R.string.vdr_stream_port, 3000);
@@ -515,26 +544,64 @@ public class Preferences {
prefs.use24hFormat = getBoolean(context,
R.string.gui_enable_24h_format_key, true);
-
- prefs.wolCustomBroadcast = getString(context, R.string.wakeup_wol_custom_broadcast_key, "");
- prefs.showChannelNumbers = getBoolean(context, R.string.gui_channels_show_channel_numbers_key, false);
-
- prefs.enableRemux = getBoolean(context, R.string.key_remux_enable, false);
-
- prefs.remuxCommand =getString(context, R.string.key_remux_command, "EXT");
-
- prefs.remuxParameter = getString(context, R.string.key_remux_parameter, "");
-
- prefs.quiteOnBackButton = getBoolean(context, R.string.qui_quit_on_back_key, true);
-
- prefs.showImdbButton = getBoolean(context, R.string.qui_show_imdb_button_key, true);
-
+ prefs.wolCustomBroadcast = getString(context,
+ R.string.wakeup_wol_custom_broadcast_key, "");
+
+ prefs.showChannelNumbers = getBoolean(context,
+ R.string.gui_channels_show_channel_numbers_key, false);
+
+ prefs.enableRemux = getBoolean(context, R.string.key_remux_enable,
+ false);
+
+ prefs.remuxCommand = getString(context, R.string.key_remux_command,
+ "EXT");
+
+ prefs.remuxParameter = getString(context, R.string.key_remux_parameter,
+ "");
+
+ prefs.quiteOnBackButton = getBoolean(context,
+ R.string.qui_quit_on_back_key, true);
+
+ prefs.showImdbButton = getBoolean(context,
+ R.string.qui_show_imdb_button_key, true);
+
prefs.imdbUrl = getString(context, R.string.qui_imdb_url_key, "imdb.de");
+ prefs.connectionTimeout = getInt(context, R.string.vdr_conntimeout_key, 10);
+ prefs.readTimeout = getInt(context, R.string.vdr_readtimeout_key, 10);
+ prefs.timeout = getInt(context, R.string.vdr_timeout_key, 120);
+
thePrefs = prefs;
}
+ public static void reset(){
+ thePrefs = null;
+ }
+
+ /**
+ * Loads all preferences
+ *
+ * @param context
+ * Context
+ * @return Preferences
+ */
+ public static void init(final Context context) {
+
+// if (thePrefs != null) {
+// return;
+// }
+
+ synchronized (Preferences.class) {
+// if (thePrefs != null) {
+// return;
+// }
+ initInternal(context);
+ setLocale(context);
+ }
+
+ }
+
/**
* Gets the persistent preferences
*
@@ -581,7 +648,6 @@ public class Preferences {
return sharedPrefs.getBoolean(context.getString(resId), defValue);
}
-
/**
* Helper for retrieving string values from preferences
*
@@ -599,10 +665,30 @@ public class Preferences {
return sharedPrefs.getString(context.getString(resId), defValue);
}
- public String getTimeFormat() {
+ public String getTimeFormat() {
if (isUse24hFormat()) {
return "HH:mm";
}
return "h:mm a";
}
+
+ /**
+ * Set locale read from preferences to context.
+ *
+ * @param context
+ * {@link Context}
+ */
+ public static void setLocale(final Context context) {
+ String lc = getString(context, R.string.gui_custom_locale_key, DEFAULT_LANGUAGE_VALUE);
+ Locale locale;
+ if(lc.equals(DEFAULT_LANGUAGE_VALUE) == false){
+ locale = new Locale(lc);
+ } else {
+ locale = new Locale("");
+ }
+ Locale.setDefault(locale);
+ final Configuration config = new Configuration();
+ config.locale = locale;
+ context.getResources().updateConfiguration(config, null);
+ }
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
index 75fe9af..378ec00 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Recording.java
@@ -3,19 +3,24 @@ package de.bjusystems.vdrmanager.data;
import java.util.Date;
+import de.bjusystems.vdrmanager.StringUtils;
+import de.bjusystems.vdrmanager.app.C;
+
+import static de.bjusystems.vdrmanager.gui.Utils.mapSpecialChars;
+
public class Recording extends BaseEvent{
public Recording(String line) {
- final String[] words = line.split(":");
+ final String[] words = StringUtils.splitPreserveAllTokens(line, C.DATA_SEPARATOR);
int idx = 0;
index = Integer.valueOf(words[idx++]);
start = new Date(Long.parseLong(words[idx++]) * 1000);
stop = new Date(Long.parseLong(words[idx++]) * 1000);
- channelName = words[idx++];
- title = words[idx++];
- shortText = words[idx++];
- description = words[idx++];
- fileName = words[idx++];
+ channelName = mapSpecialChars(words[idx++]);
+ title = mapSpecialChars(words[idx++]);
+ shortText = mapSpecialChars(words[idx++]);
+ description = mapSpecialChars(words[idx++]);
+ fileName = mapSpecialChars(words[idx++]);
fileSize = Integer.valueOf(words[idx++]);
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
index d357d5a..fb79fde 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Timer.java
@@ -4,10 +4,15 @@ import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
+
+import de.bjusystems.vdrmanager.StringUtils;
+import de.bjusystems.vdrmanager.app.C;
+import de.bjusystems.vdrmanager.gui.Utils;
import de.bjusystems.vdrmanager.utils.svdrp.SetTimerClient.TimerOperation;
/**
* Class for timer data
+ *
* @author bju
*/
public class Timer extends BaseEvent {
@@ -22,15 +27,18 @@ public class Timer extends BaseEvent {
private final int priority;
private final int lifetime;
-
/**
* Constructs a timer from SvdrpHelper result line
- * @param timerData result line
- * @param channels list of channels
+ *
+ * @param timerData
+ * result line
+ * @param channels
+ * list of channels
*/
public Timer(final String timerData) {
- final String[] values = timerData.split(":");
+ final String[] values = StringUtils.splitPreserveAllTokens(timerData,
+ C.DATA_SEPARATOR);
// number
this.number = Integer.valueOf(values[0].substring(1));
@@ -38,7 +46,7 @@ public class Timer extends BaseEvent {
// flags, channel number and channel name
this.flags = Integer.valueOf(values[1]);
this.channelNumber = values[2];
- this.channelName = values[3];
+ this.channelName = Utils.mapSpecialChars(values[3]);
// get start and stop
this.start = new Date(Long.parseLong(values[4]) * 1000);
@@ -49,17 +57,19 @@ public class Timer extends BaseEvent {
this.lifetime = Integer.valueOf(values[7]);
// title and description
- this.title = values[8];
-
- this.description = values.length > 9 ? values[9] : "";
-
- this.shortText = values.length > 10 ? values[10] : "";
-
- if(values.length > 11){
- this.description = values[11];
+ this.title = Utils.mapSpecialChars(values[8]);
+
+ this.description = values.length > 9 ? values[9] : "";// aux
+
+ // 10 and 11 are optional if there where event with this timer
+ this.shortText = values.length > 10 ? Utils
+ .mapSpecialChars(values[10]) : "";
+
+ if (values.length > 11) {
+ this.description = values[11]; // if real description, set it
}
-
-
+
+ description = Utils.mapSpecialChars(description);
}
public Timer(final Event event) {
@@ -72,8 +82,10 @@ public class Timer extends BaseEvent {
this.priority = prefs.getTimerDefaultPriority();
this.lifetime = prefs.getTimerDefaultLifetime();
- this.start = new Date(event.getStart().getTime() - prefs.getTimerPreMargin() * 60000);
- this.stop = new Date(event.getStop().getTime() + prefs.getTimerPostMargin() * 60000);
+ this.start = new Date(event.getStart().getTime()
+ - prefs.getTimerPreMargin() * 60000);
+ this.stop = new Date(event.getStop().getTime()
+ + prefs.getTimerPostMargin() * 60000);
this.title = event.getTitle();
this.description = event.getDescription();
@@ -89,26 +101,25 @@ public class Timer extends BaseEvent {
final Calendar cal = new GregorianCalendar();
cal.setTime(start);
- line.append(String.format("%04d-%02d-%02d:", cal.get(Calendar.YEAR), cal.get(Calendar.MONTH)+1, cal.get(Calendar.DAY_OF_MONTH)));
- line.append(String.format("%02d%02d:", cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE)));
+ line.append(String.format("%04d-%02d-%02d:", cal.get(Calendar.YEAR),
+ cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH)));
+ line.append(String.format("%02d%02d:", cal.get(Calendar.HOUR_OF_DAY),
+ cal.get(Calendar.MINUTE)));
cal.setTime(stop);
- line.append(String.format("%02d%02d:", cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE)));
+ line.append(String.format("%02d%02d:", cal.get(Calendar.HOUR_OF_DAY),
+ cal.get(Calendar.MINUTE)));
line.append(priority).append(":");
line.append(lifetime).append(":");
- line.append(title).append(":");
- if(op != TimerOperation.DELETE){
- line.append(description);
- }
-
+ line.append(Utils.unMapSpecialChars(title));
return line.toString();
}
public int getNumber() {
return number;
}
-
+
public int getPriority() {
return priority;
}
@@ -138,6 +149,7 @@ public class Timer extends BaseEvent {
public boolean isVps() {
return (flags & VPS) == VPS;
}
+
public boolean isRecording() {
return (flags & RECORDING) == RECORDING;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
index 629f2a6..5e2e49c 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java
@@ -1,48 +1,70 @@
package de.bjusystems.vdrmanager.gui;
-import de.bjusystems.vdrmanager.R;
-import de.bjusystems.vdrmanager.app.VdrManagerApp;
-import de.bjusystems.vdrmanager.data.Channel;
import android.app.Activity;
+import android.app.AlertDialog;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
+import android.widget.ListView;
+import android.widget.Toast;
+import android.widget.ViewFlipper;
+import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.app.VdrManagerApp;
+import de.bjusystems.vdrmanager.data.Channel;
+import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
-public abstract class BaseActivity extends Activity implements OnClickListener{
-
+public abstract class BaseActivity<T extends ListView> extends Activity
+ implements OnClickListener {
public static final int MENU_GROUP_REFRESH = 99;
-
+
public static final int MENU_REFRESH = 99;
+
+ protected T listView;
+ protected ViewFlipper flipper;
+
+ protected SvdrpProgressDialog progress;
+
abstract protected int getMainLayout();
-
- protected void switchNoConnection(){
+
+ public void svdrpException(final SvdrpException exception) {
+ // Log.w(TAG, exception);
+ alert(getString(R.string.vdr_error_text, exception.getMessage()));
+ }
+
+ protected void switchNoConnection() {
View view = findViewById(R.id.main_content);
- if(view != null){
+ if (view != null) {
view.setVisibility(View.GONE);
}
- findViewById(R.id.no_connection_layout).setVisibility(View.VISIBLE);
- Button b = (Button) findViewById(R.id.retry_button);
+ view = findViewById(R.id.no_connection_layout);
+ if (view != null) {
+ view.setVisibility(View.VISIBLE);
+ }
+ Button b = (Button) findViewById(R.id.retry_button);
b.setOnClickListener(this);
}
public void onClick(View v) {
- if(v.getId() == R.id.retry_button){
- findViewById(R.id.no_connection_layout).setVisibility(View.GONE);
- View view = findViewById(R.id.main_content);
- if(view != null){
+ if (v.getId() == R.id.retry_button) {
+ View view = findViewById(R.id.no_connection_layout);
+ if (view != null) {
+ view.setVisibility(View.GONE);
+ }
+ view = findViewById(R.id.main_content);
+ if (view != null) {
view.setVisibility(View.VISIBLE);
}
retry();
}
}
-
+
protected void updateWindowTitle(int topic, int subtopic) {
String title;
- title = getString(topic);
+ title = getString(topic);
if (subtopic != -1) {
title += " > " + getString(subtopic);
}
@@ -57,7 +79,6 @@ public abstract class BaseActivity extends Activity implements OnClickListener{
setTitle(title);
}
-
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
MenuItem item;
@@ -66,40 +87,69 @@ public abstract class BaseActivity extends Activity implements OnClickListener{
item.setAlphabeticShortcut('r');
return true;
}
-
- abstract protected void refresh();
-
- abstract protected void retry();
-
+
+ abstract protected void refresh();
+
+ abstract protected void retry();
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_REFRESH:
+ backupViewSelection();
refresh();
return true;
-
default:
return false;
}
}
-
protected void setAsCurrent(Channel channel) {
getApp().setCurrentChannel(channel);
}
-
- protected VdrManagerApp getApp(){
+ protected VdrManagerApp getApp() {
final VdrManagerApp app = (VdrManagerApp) getApplication();
return app;
}
-
- //protected Channel getCurrentChannel(){
- //final Channel channel = ((VdrManagerApp) getApplication())
- //.getCurrentChannel();
- //return channel;
-// }
-
-
+ // protected Channel getCurrentChannel(){
+ // final Channel channel = ((VdrManagerApp) getApplication())
+ // .getCurrentChannel();
+ // return channel;
+ // }
+
+ protected void say(int res) {
+ Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
+ }
+
+ protected void say(String msg) {
+ Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
+ }
+
+ protected void alert(String msg) {
+ new AlertDialog.Builder(this)//
+ .setMessage(msg)//
+ .setPositiveButton(android.R.string.ok, null)//
+ .create()//
+ .show();//
+ }
+
+ protected void alert(int resId) {
+ alert(getString(resId));
+ }
+
+ protected void restoreViewSelection() {
+ listView.setSelectionFromTop(index, top);
+ }
+
+ protected void backupViewSelection() {
+ index = listView.getFirstVisiblePosition();
+ View v = listView.getChildAt(0);
+ top = (v == null) ? 0 : v.getTop();
+ }
+
+ int index;
+ int top;
+
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
index e8dd66b..7174803 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java
@@ -10,6 +10,7 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
@@ -21,7 +22,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
-import android.widget.Toast;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.Intents;
import de.bjusystems.vdrmanager.data.Channel;
@@ -38,8 +38,10 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
*
*/
public abstract class BaseEventListActivity<T extends Event> extends
- BaseActivity implements OnItemClickListener, SvdrpAsyncListener<T>,
- SimpleGestureListener {
+ BaseActivity<ListView> implements OnItemClickListener,
+ SvdrpAsyncListener<T>, SimpleGestureListener {
+
+ public static final String TAG = BaseEventListActivity.class.getName();
public static final int MENU_GROUP_SHARE = 90;
@@ -51,8 +53,6 @@ public abstract class BaseEventListActivity<T extends Event> extends
protected EventAdapter adapter;
- protected SvdrpProgressDialog progress;
-
protected String highlight = null;
protected static final Date FUTURE = new Date(Long.MAX_VALUE);
@@ -61,8 +61,6 @@ public abstract class BaseEventListActivity<T extends Event> extends
protected Channel currentChannel = null;
- protected ListView listView;
-
abstract protected int getWindowTitle();
protected List<Event> results = new ArrayList<Event>();
@@ -82,6 +80,16 @@ public abstract class BaseEventListActivity<T extends Event> extends
.getParcelableExtra(Intents.CURRENT_CHANNEL);
}
+ private boolean refreshViewOnResume = false;
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ if (refreshViewOnResume) {
+ adapter.notifyDataSetChanged();
+ }
+ }
+
/*
* (non-Javadoc)
*
@@ -130,7 +138,7 @@ public abstract class BaseEventListActivity<T extends Event> extends
return super.onContextItemSelected(item);
}
- return true;
+ return true;
}
/*
@@ -167,7 +175,6 @@ public abstract class BaseEventListActivity<T extends Event> extends
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v,
final ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
// if (v.getId() == R.id.whatson_list) {
final AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
@@ -175,12 +182,14 @@ public abstract class BaseEventListActivity<T extends Event> extends
// set menu title
final EventListItem item = adapter.getItem(info.position);
+ MenuItem mi = menu.findItem(R.id.epg_item_menu_live_tv);
if (item.isLive()) {
- menu.findItem(R.id.epg_item_menu_live_tv).setVisible(true);
+ mi.setVisible(true);
+ } else {
+ mi.setVisible(false);
}
-
menu.add(MENU_GROUP_SHARE, MENU_SHARE, 0, R.string.share);
- // }
+ super.onCreateContextMenu(menu, v, menuInfo);
}
@@ -217,40 +226,48 @@ public abstract class BaseEventListActivity<T extends Event> extends
@Override
protected void onPause() {
super.onPause();
- if (epgClient != null) {
- epgClient.abort();
- }
- if (progress != null) {
- progress.dismiss();
- progress = null;
- }
+ refreshViewOnResume = true;
+ // if (epgClient != null) {
+ // epgClient.abort();
+ // }
+ // if (progress != null) {
+ // progress.dismiss();
+ // progress = null;
+ // }
}
public void svdrpEvent(final SvdrpEvent event, final T result) {
- if (progress != null) {
- progress.svdrpEvent(event);
- }
-
switch (event) {
- case ERROR:
- Toast.makeText(this, R.string.epg_client_errors, Toast.LENGTH_SHORT)
- .show();
- dismiss(progress);
+ case ABORTED:
+ alert(R.string.aborted);
break;
- case CONNECTING:
+ case ERROR:
+ alert(R.string.epg_client_errors);
+ // say(R.string.epg_client_errors);
+ // dismiss(progress);
break;
+ // case CONNECTING:
+ // break;
case CONNECTED:
results.clear();
break;
case CONNECT_ERROR:
+ say(R.string.progress_connect_error);
+ switchNoConnection();
+ break;
case FINISHED_ABNORMALY:
+ alert(R.string.progress_connect_finished_abnormal);
+ switchNoConnection();
+ break;
case LOGIN_ERROR:
switchNoConnection();
break;
case FINISHED_SUCCESS:
if (finishedSuccess() == false) {
say(R.string.epg_no_items);
+ } else {
+ restoreViewSelection();
}
break;
case RESULT_RECEIVED:
@@ -263,24 +280,23 @@ public abstract class BaseEventListActivity<T extends Event> extends
results.add(result);
}
- //
- // @Override
- // protected void onRestoreInstanceState(Bundle savedInstanceState) {
- // super.onRestoreInstanceState(savedInstanceState);
- // int index = savedInstanceState.getInt("INDEX");
- // int top = savedInstanceState.getInt("TOP");
- // listView.setSelectionFromTop(index, top);
- // }
- //
- // @Override
- // protected void onSaveInstanceState(Bundle outState) {
- // int index = listView.getFirstVisiblePosition();
- // View v = listView.getChildAt(0);
- // int top = (v == null) ? 0 : v.getTop();
- // outState.putInt("INDEX", index);
- // outState.putInt("TOP", top);
- // super.onSaveInstanceState(outState);
- // }
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ int index = savedInstanceState.getInt("INDEX");
+ int top = savedInstanceState.getInt("TOP");
+ listView.setSelectionFromTop(index, top);
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ int index = listView.getFirstVisiblePosition();
+ View v = listView.getChildAt(0);
+ int top = (v == null) ? 0 : v.getTop();
+ outState.putInt("INDEX", index);
+ outState.putInt("TOP", top);
+ super.onSaveInstanceState(outState);
+ }
protected void dismiss(AlertDialog dialog) {
if (dialog == null) {
@@ -346,17 +362,8 @@ public abstract class BaseEventListActivity<T extends Event> extends
}
public void svdrpException(final SvdrpException exception) {
- if (progress != null) {
- progress.svdrpException(exception);
- }
- }
-
- protected void say(int res) {
- Toast.makeText(this, res, Toast.LENGTH_SHORT).show();
- }
-
- protected void say(String msg) {
- Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
+ Log.w(TAG, exception);
+ alert(getString(R.string.vdr_error_text, exception.getMessage()));
}
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
index c4fc5fd..55cc468 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseTimerEditActivity.java
@@ -21,7 +21,6 @@ import android.widget.DatePicker;
import android.widget.TextView;
import android.widget.TimePicker;
import de.bjusystems.vdrmanager.R;
-import de.bjusystems.vdrmanager.data.Epg;
import de.bjusystems.vdrmanager.data.Event;
import de.bjusystems.vdrmanager.data.EventFormatter;
import de.bjusystems.vdrmanager.data.EventListItem;
@@ -30,7 +29,6 @@ import de.bjusystems.vdrmanager.tasks.CreateTimerTask;
import de.bjusystems.vdrmanager.tasks.DeleteTimerTask;
import de.bjusystems.vdrmanager.tasks.ModifyTimerTask;
import de.bjusystems.vdrmanager.tasks.ToggleTimerTask;
-import de.bjusystems.vdrmanager.utils.date.DateFormatter;
import de.bjusystems.vdrmanager.utils.svdrp.SetTimerClient.TimerOperation;
public abstract class BaseTimerEditActivity<T extends Event> extends
@@ -64,24 +62,25 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
case CREATE:
tView.modifyButton.setVisibility(View.GONE);
tView.saveButton.setVisibility(View.VISIBLE);
- tView.saveButton.setText(R.string.timer_details_save_title);
+ tView.saveButton.setText(R.string.timer_details_create_title);
break;
case MODIFY:
tView.saveButton.setVisibility(View.GONE);
tView.modifyButton.setVisibility(View.VISIBLE);
+ tView.saveButton.setText(R.string.timer_details_save_title);
+ break;
}
}
private void updateDisplay() {
- final DateFormatter dateFormatter = new DateFormatter(timer.getStart());
+ EventFormatter f = new EventFormatter(timer,true);
tView.channel.setText(timer.getChannelNumber() + " "
+ timer.getChannelName());
- tView.title.setText(timer.getTitle());
- tView.dateField.setText(dateFormatter.getDateString());
- tView.startField.setText(dateFormatter.getTimeString());
- tView.endField.setText(new DateFormatter(timer.getStop())
- .getTimeString());
+ tView.title.setText(f.getTitle());
+ tView.dateField.setText(f.getDate());
+ tView.startField.setText(f.getTime());
+ tView.endField.setText(f.getStop());
}
protected Timer getTimer(EventListItem item) {
@@ -258,38 +257,44 @@ public abstract class BaseTimerEditActivity<T extends Event> extends
say(R.string.done);
break;
}
+
+ default:
+ super.onClick(view);
}
}
private void modifyTimer(Timer timer) {
+ backupViewSelection();
final ModifyTimerTask task = new ModifyTimerTask(this, timer) {
@Override
public void finished() {
refresh();
- say(R.string.done);
+ //say(R.string.done);
}
};
task.start();
}
protected void deleteTimer(final Timer timer) {
-
+ backupViewSelection();
final DeleteTimerTask task = new DeleteTimerTask(this, timer) {
@Override
public void finished() {
refresh();
- say(R.string.done);
+ restoreViewSelection();
+ //say(R.string.done);
}
};
task.start();
}
private void createTimer(Timer timer) {
+ backupViewSelection();
final CreateTimerTask task = new CreateTimerTask(this, timer) {
@Override
public void finished() {
refresh();
- say(R.string.done);
+ //say(R.string.done);
}
};
task.start();
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java
index 7c0ff05..fff74a9 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java
@@ -2,14 +2,10 @@ package de.bjusystems.vdrmanager.gui;
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import android.content.Context;
import android.graphics.Color;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.TextUtils;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
index a2249b9..1c2c4ff 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
@@ -3,15 +3,12 @@ package de.bjusystems.vdrmanager.gui;
import java.util.ArrayList;
import java.util.HashMap;
-import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-import android.text.Editable;
-import android.text.TextUtils;
-import android.text.TextWatcher;
+import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.Menu;
@@ -19,15 +16,12 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
-import android.widget.ArrayAdapter;
-import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.ExpandableListView.OnChildClickListener;
import android.widget.ExpandableListView.OnGroupClickListener;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.Intents;
-import de.bjusystems.vdrmanager.app.VdrManagerApp;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.utils.svdrp.ChannelClient;
@@ -42,14 +36,16 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
*
* @author bju
*/
-public class ChannelListActivity extends BaseActivity implements
+public class ChannelListActivity extends BaseActivity<ExpandableListView> implements
OnChildClickListener, OnGroupClickListener, SvdrpAsyncListener<Channel> {
+ private static final String TAG = ChannelListActivity.class.getName();
ChannelClient channelClient;
+
ChannelAdapter adapter;
+
Preferences prefs;
- SvdrpProgressDialog progress;
-
+
public static final int MENU_GROUP = 0;
public static final int MENU_PROVIDER = 1;
public static final int MENU_NAME = 2;
@@ -59,7 +55,7 @@ public class ChannelListActivity extends BaseActivity implements
final static ArrayList<String> ALL_CHANNELS_GROUP = new ArrayList<String>(
1);
- ExpandableListView listView;
+ //ExpandableListView listView;
// @Override
// public boolean onKeyLongPress(int keyCode, KeyEvent event) {
@@ -79,6 +75,12 @@ public class ChannelListActivity extends BaseActivity implements
// return super.onKeyUp(keyCode, event);
// }
//
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ }
+
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -106,27 +108,12 @@ public class ChannelListActivity extends BaseActivity implements
//
@Override
- protected void onResume() {
- super.onResume();
-
- }
-
- @Override
protected void onPause() {
super.onPause();
- if (channelClient != null) {
- channelClient.abort();
- }
- if (progress != null) {
- progress.dismiss();
- progress = null;
- }
- if (groupByDialog != null) {
- groupByDialog.dismiss();
- }
}
private void startChannelQuery() {
+ backupViewSelection();
startChannelQuery(true);
}
@@ -140,10 +127,11 @@ public class ChannelListActivity extends BaseActivity implements
channelClient);
// create progress
- progress = new SvdrpProgressDialog(this, channelClient);
+ progress = new SvdrpProgressDialog<Channel>(this, channelClient);
// attach listener
task.addListener(this);
+ task.addListener(progress);
// start task
task.run();
@@ -152,20 +140,24 @@ public class ChannelListActivity extends BaseActivity implements
private void fillAdapter() {
switch (groupBy) {
case MENU_GROUP:
- adapter.fill(
- channelClient.getChannelGroups(),
- channelClient.getGroupChannels(), groupBy);
- listView.collapseGroup(0);
+ ArrayList<String> cgs = channelClient.getChannelGroups();
+ adapter.fill(cgs, channelClient.getGroupChannels(), groupBy);
+ if(cgs.size() == 1){
+ listView.expandGroup(0);
+ }
updateWindowTitle(
getString(R.string.action_menu_channels),
getString(R.string.groupby_window_title_templte,
getString(R.string.groupby_group)));
break;
case MENU_PROVIDER:
- adapter.fill(new ArrayList<String>(channelClient
- .getProviderChannels().keySet()), channelClient
+ ArrayList<String> gs = new ArrayList<String>(channelClient
+ .getProviderChannels().keySet());
+ adapter.fill(gs, channelClient
.getProviderChannels(), groupBy);
- listView.collapseGroup(0);
+ if(gs.size() == 1){
+ listView.expandGroup(0);
+ }
updateWindowTitle(
getString(R.string.action_menu_channels),
getString(R.string.groupby_window_title_templte,
@@ -190,36 +182,47 @@ public class ChannelListActivity extends BaseActivity implements
}
public void svdrpEvent(final SvdrpEvent event, final Channel result) {
-
- if (progress != null) {
- progress.svdrpEvent(event);
- }
-
switch (event) {
+ case ABORTED:
+ say(R.string.aborted);
+ break;
+ case ERROR:
+ say(R.string.epg_client_errors);
+ break;
case CONNECTING:
break;
case CONNECT_ERROR:
+ say(R.string.progress_connect_error);
+ switchNoConnection();
+ break;
+ case FINISHED_ABNORMALY:
+ say(R.string.progress_connect_finished_abnormal);
switchNoConnection();
break;
case LOGIN_ERROR:
switchNoConnection();
break;
- case FINISHED_SUCCESS:
case CACHE_HIT:
+ say(R.string.progress_cache_hit);
fillAdapter();
+ restoreViewSelection();
break;
- case FINISHED_ABNORMALY:
- switchNoConnection();
+ case FINISHED_SUCCESS:
+ fillAdapter();
+ restoreViewSelection();
break;
+
}
}
+
public void svdrpException(final SvdrpException exception) {
- if (progress != null) {
- progress.svdrpException(exception);
- }
+ progress.svdrpException(exception);
+ Log.w(TAG, exception);
+ alert(getString(R.string.vdr_error_text, exception.getMessage()));
}
+
public boolean onPrepareOptionsMenu(Menu menu) {
return super.onPrepareOptionsMenu(menu);
@@ -420,12 +423,13 @@ public class ChannelListActivity extends BaseActivity implements
@Override
protected void refresh() {
+ backupViewSelection();
startChannelQuery(false);
}
@Override
protected void retry() {
- startChannelQuery(false);
+ refresh();
}
@Override
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
index ca492d5..40d54fe 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
@@ -44,7 +44,7 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
public class EpgDetailsActivity extends Activity implements OnClickListener,
SimpleGestureListener {
- public static String IMDB_URL = "http://www.%s/find?s=all&q=%s";
+ public static String IMDB_URL = "http://%s/find?s=all&q=%s";
private SimpleGestureFilter detector;
@@ -61,6 +61,7 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
super.onCreate(savedInstanceState);
Intent i = getIntent();
+
highlight = i.getStringExtra(Intents.HIGHLIGHT);
// Attach view
@@ -84,29 +85,7 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
counter++;
}
- new AsyncTask<Void, Void, Void>() {
-
- protected void onPreExecute() {
- // event_left.setEnabled(false);
- // event_right.setEnabled(false);
- };
-
- protected Void doInBackground(Void... params) {
- initEPGs();
- return null;
- };
-
- protected void onPostExecute(Void result) {
- // event_left.setEnabled(true);
- // event_right.setEnabled(true);
- };
-
- }.execute((Void) null);
-
publishEPG(epg);
-
- // TODO was ist das?
- app.clearActivitiesToFinish();
}
private void setState(ImageView view, int res) {
@@ -280,9 +259,10 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
}
- List<Event> epgs = null;
+ List<Event> epgs = new ArrayList<Event>();
+
int counter = 0;
-
+/*
public void initEPGs() {
if (epgs != null) {
@@ -323,7 +303,7 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
;
}
}
-
+*/
private void nextEPG() {
if (counter < epgs.size() - 1) {
counter++;
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
index 85aae19..3ff0df2 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
@@ -1,7 +1,6 @@
package de.bjusystems.vdrmanager.gui;
import java.util.Calendar;
-import java.util.List;
import android.app.SearchManager;
import android.content.Intent;
@@ -16,56 +15,66 @@ import de.bjusystems.vdrmanager.data.Epg;
import de.bjusystems.vdrmanager.data.EpgSearchParams;
import de.bjusystems.vdrmanager.data.Event;
import de.bjusystems.vdrmanager.data.EventListItem;
+import de.bjusystems.vdrmanager.data.Preferences;
import de.bjusystems.vdrmanager.utils.date.DateFormatter;
import de.bjusystems.vdrmanager.utils.svdrp.EpgClient;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpAsyncListener;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpAsyncTask;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
-import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
/**
* This class is used for showing what's current running on all channels
*
* @author bju
*/
-public class EpgSearchListActivity extends BaseEventListActivity<Epg> implements
+public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements
OnItemClickListener, SvdrpAsyncListener<Epg> {
- @Override
- protected void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- Intent intent = getIntent();
+ private void initSearch(Intent intent){
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String query = intent.getStringExtra(SearchManager.QUERY);
if (TextUtils.isEmpty(query) == false) {
highlight = query.trim();
}
}
- adapter = new TimeEventAdapter(this);
- adapter.setHideDescription(false);
+ }
+
+
+ @Override
+ protected void onNewIntent(Intent intent) {
+ initSearch(intent);
+ startSearch();
+ }
+
+
+ private void startSearch(){
startEpgQuery();
+ }
+ @Override
+ protected void onCreate(final Bundle savedInstanceState) {
+
+ Preferences.init(this);
+
+ super.onCreate(savedInstanceState);
+
+
+ Intent intent = getIntent();
+ initSearch(intent);
+ adapter = new TimeEventAdapter(this);
+
// Create adapter for EPG list
+ adapter.setHideDescription(false);
listView = (ListView) findViewById(R.id.whatson_list);
listView.setAdapter(adapter);
- listView.setFastScrollEnabled(true);
listView.setTextFilterEnabled(true);
registerForContextMenu(listView);
-
// register EPG item click
listView.setOnItemClickListener(this);
-
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- // adapter.notifyDataSetChanged();
-
+ startSearch();
}
-
public void onNothingSelected(final AdapterView<?> arg0) {
// startTimeEpgQuery(((EpgTimeSpinnerValue)timeSpinner.getAdapter().getItem(0)).getValue());
}
@@ -78,7 +87,7 @@ public class EpgSearchListActivity extends BaseEventListActivity<Epg> implements
sp.setTitle(highlight);
setTitle(getString(R.string.epg_by_search_param, highlight));
epgClient = new EpgClient(sp);
-
+ epgClient.setResultInfoEnabled(true);
// remove old listeners
// epgClient.clearSvdrpListener();
@@ -87,8 +96,9 @@ public class EpgSearchListActivity extends BaseEventListActivity<Epg> implements
epgClient);
// create progress
- progress = new SvdrpProgressDialog(this, epgClient);
+ progress = new SvdrpProgressDialog<Epg>(this, epgClient);
// attach listener
+ task.addListener(progress);
task.addListener(this);
// start task
@@ -126,13 +136,6 @@ public class EpgSearchListActivity extends BaseEventListActivity<Epg> implements
return results.isEmpty() == false;
}
-
-
- public void svdrpException(final SvdrpException exception) {
- if (progress != null) {
- progress.svdrpException(exception);
- }
- }
protected void prepareTimer(final EventListItem item) {
final VdrManagerApp app = (VdrManagerApp) getApplication();
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java
index 3f7fc4d..96e2e7e 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java
@@ -12,7 +12,6 @@ import android.widget.ArrayAdapter;
import android.widget.Filter;
import android.widget.Filterable;
import android.widget.ImageView;
-import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import de.bjusystems.vdrmanager.R;
@@ -23,6 +22,8 @@ import de.bjusystems.vdrmanager.data.EventListItem;
abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
Filterable {
+ private final int TYPE_ITEM = 0;
+ private final int TYPE_HEADER = 1;
protected final int layout;
protected final LayoutInflater inflater;
protected final List<EventListItem> items = new ArrayList<EventListItem>();
@@ -39,8 +40,10 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
inflater = LayoutInflater.from(context);
}
-
-
+ @Override
+ public int getViewTypeCount() {
+ return 2;
+ }
@Override
public void add(EventListItem object) {
@@ -49,78 +52,103 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
}
@Override
- public View getView(final int position, final View convertView,
- final ViewGroup parent) {
+ public int getItemViewType(int position) {
// get item
final EventListItem item = getItem(position);
if (item.isHeader()) {
- return getHeaderView(item, convertView, parent);
+ return TYPE_HEADER;
+ }
+ return TYPE_ITEM;
+ }
+
+ @Override
+ public View getView(final int position, View convertView,
+ final ViewGroup parent) {
+
+ // get item
+ final EventListItem item = getItem(position);
+
+ Object holder = null;
+ int type = getItemViewType(position);
+ if (convertView == null) {
+ switch (type) {
+ case TYPE_ITEM:
+ convertView = inflater.inflate(layout, null);
+ holder = getEventViewHolder(item, convertView);
+ break;
+ case TYPE_HEADER:
+ convertView = inflater.inflate(R.layout.header_item, null);
+ holder = getHeaderViewHolder(item, convertView);
+ break;
+ }
+ convertView.setTag(holder);
} else {
- return getEventView(item, convertView, parent);
+ holder = convertView.getTag();
}
+ switch (type) {
+ case TYPE_ITEM:
+ convertView = inflater.inflate(layout, null);
+ holder = getEventViewHolder(item, convertView);
+ break;
+ case TYPE_HEADER:
+ convertView = inflater.inflate(R.layout.header_item, null);
+ holder = getHeaderViewHolder(item, convertView);
+ break;
+ }
+
+ if (type == TYPE_ITEM) {
+ fillEventViewHolder((EventListItemHolder) holder, item);
+ } else {
+ ((EventListItemHeaderHolder) holder).header.setText(item
+ .getHeader());
+ }
+ return convertView;
}
- private View getEventView(EventListItem item, View convertView,
- ViewGroup parent) {
+ private EventListItemHolder getEventViewHolder(EventListItem item, View view) {
EventListItemHolder itemHolder = new EventListItemHolder();
- // recycle view?
- View view = convertView;
- if (view == null || view instanceof ListView == false) {
- view = inflater.inflate(layout, null);
-
- itemHolder = new EventListItemHolder();
-
- itemHolder.state = (ImageView) view
- .findViewById(R.id.timer_item_state);
- itemHolder.time = (TextView) view
- .findViewById(R.id.timer_item_time);
- itemHolder.channel = (TextView) view
- .findViewById(R.id.timer_item_channel);
- itemHolder.title = (TextView) view
- .findViewById(R.id.timer_item_title);
- itemHolder.progress = (ProgressBar) view
- .findViewById(R.id.timer_progress);
- itemHolder.shortText = (TextView) view
- .findViewById(R.id.timer_item_shorttext);
- itemHolder.duration = (TextView) view
- .findViewById(R.id.timer_item_duration);
- itemHolder.description = (TextView) view
- .findViewById(R.id.event_item_description);
- view.setTag(itemHolder);
- } else {
- itemHolder = (EventListItemHolder) view.getTag();
- }
+ itemHolder = new EventListItemHolder();
+
+ itemHolder.state = (ImageView) view.findViewById(R.id.timer_item_state);
+ itemHolder.time = (TextView) view.findViewById(R.id.timer_item_time);
+ itemHolder.channel = (TextView) view
+ .findViewById(R.id.timer_item_channel);
+ itemHolder.title = (TextView) view.findViewById(R.id.timer_item_title);
+ itemHolder.progress = (ProgressBar) view
+ .findViewById(R.id.timer_progress);
+ itemHolder.shortText = (TextView) view
+ .findViewById(R.id.timer_item_shorttext);
+ itemHolder.duration = (TextView) view
+ .findViewById(R.id.timer_item_duration);
+ itemHolder.description = (TextView) view
+ .findViewById(R.id.event_item_description);
+ return itemHolder;
+ }
+ public void fillEventViewHolder(EventListItemHolder itemHolder,
+ EventListItem item) {
-// itemHolder.title.setVisibility(View.VISIBLE);
itemHolder.state.setVisibility(View.VISIBLE);
- //itemHolder.shortText.setVisibility(View.VISIBLE);
- //itemHolder.duration.setVisibility(View.VISIBLE);
- // itemHolder.state.setVisibility(View.);
switch (item.getTimerState()) {
case Active:
- //itemHolder.state.setVisibility(View.VISIBLE);
itemHolder.state.setImageResource(R.drawable.timer_active);
break;
case Inactive:
- //itemHolder.state.setVisibility(View.VISIBLE);
itemHolder.state.setImageResource(R.drawable.timer_inactive);
break;
case Recording:
- //itemHolder.state.setVisibility(View.VISIBLE);
itemHolder.state.setImageResource(R.drawable.timer_recording);
break;
case None:
- //itemHolder.state.setVisibility(View.GONE);
itemHolder.state.setImageResource(R.drawable.timer_none);
break;
}
-
+
final EventFormatter formatter = getEventFormatter(item);
itemHolder.time.setText(formatter.getTime());
if (hideChannelName) {
@@ -147,49 +175,28 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
int p = Utils.getProgress(item);
if (p == -1) {
itemHolder.progress.setVisibility(View.GONE);
- // itemHolder.time.setTypeface(null, Typeface.NORMAL);
- // itemHolder.title.setTypeface(null, Typeface.NORMAL);
- // itemHolder.shortText.setTypeface(null, Typeface.NORMAL);
int dura = Utils.getDuration(item);
itemHolder.duration.setText(getContext().getString(
R.string.epg_duration_template, dura));
} else {
itemHolder.progress.setVisibility(View.VISIBLE);
itemHolder.progress.setProgress(p);
- // itemHolder.time.setTypeface(null, Typeface.BOLD);
- // itemHolder.title.setTypeface(null, Typeface.BOLD);
- // itemHolder.shortText.setTypeface(null, Typeface.BOLD);
int dura = Utils.getDuration(item);
int rest = dura - (dura * p / 100);
itemHolder.duration.setText(getContext().getString(
R.string.epg_duration_template_live, rest, dura));
}
-
- return view;
}
class EventListItemHeaderHolder {
public TextView header;
}
- private View getHeaderView(EventListItem item, View convertView,
- ViewGroup parent) {
-
+ private EventListItemHeaderHolder getHeaderViewHolder(EventListItem item,
+ View view) {
EventListItemHeaderHolder itemHolder = new EventListItemHeaderHolder();
-
- // recycle view?
- View view = convertView;
- if (view == null || convertView instanceof TextView == false) {
- view = inflater.inflate(R.layout.header_item, null);
-
- itemHolder = new EventListItemHeaderHolder();
-
- itemHolder.header = (TextView) view.findViewById(R.id.header_item);
- } else {
- itemHolder = (EventListItemHeaderHolder) view.getTag();
- }
- itemHolder.header.setText(item.getHeader());
- return view;
+ itemHolder.header = (TextView) view.findViewById(R.id.header_item);
+ return itemHolder;
}
protected EventFormatter getEventFormatter(Event event) {
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
index f481244..257eea5 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
@@ -77,7 +77,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
// Create adapter for EPG list
listView = (ListView) findViewById(R.id.whatson_list);
listView.setAdapter(adapter);
- listView.setFastScrollEnabled(true);
+ //listView.setFastScrollEnabled(true);
listView.setTextFilterEnabled(true);
registerForContextMenu(listView);
@@ -86,12 +86,6 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
- @Override
- protected void onResume() {
- super.onResume();
- // adapter.notifyDataSetChanged();
- // startEpgQuery();
- }
public void onItemSelected(final AdapterView<?> parent, final View view,
final int position, final long id) {
@@ -171,10 +165,12 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
epgClient);
// create progress
- progress = new SvdrpProgressDialog(this, epgClient);
+ progress = new SvdrpProgressDialog<Epg>(this, epgClient);
// attach listener
+ task.addListener(progress);
task.addListener(this);
+
// start task
task.run();
}
@@ -208,7 +204,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
cachedChannel = currentChannel;
- listView.setSelectionAfterHeaderView();
+ //listView.setSelectionAfterHeaderView();
dismiss(progress);
return CACHE.isEmpty() == false;
}
@@ -252,8 +248,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements
private void prevEvent() {
int pos = channelSpinner.getSelectedItemPosition();
if (pos <= 0) {
- Toast.makeText(this, R.string.navigae_at_the_start,
- Toast.LENGTH_SHORT).show();
+ say(R.string.navigae_at_the_start);
return;
}
channelSpinner.setSelection(pos - 1, true);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
index dfffc0c..d741004 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/PreferencesActivity.java
@@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
+import android.preference.DialogPreference;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -12,6 +13,9 @@ import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceManager;
+import android.text.TextUtils;
+import android.view.inputmethod.EditorInfo;
+import android.widget.EditText;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.app.VdrManagerApp;
import de.bjusystems.vdrmanager.data.Preferences;
@@ -134,7 +138,9 @@ public class PreferencesActivity extends PreferenceActivity implements
updateChildPreferences();
Preference p = findPreference(key);
updateSummary(p);
- Preferences.loadPreferences(this);
+ //Preferences.reset();
+ Preferences.init(this);
+ //Preferences.setLocale(getBaseContext());
}
public boolean onPreferenceChange(Preference arg0, Object arg1) {
@@ -183,7 +189,22 @@ public class PreferencesActivity extends PreferenceActivity implements
if (text == null) {
return;
}
+
+ if(isPassword(ep.getEditText())){
+ text = text.replaceAll(".", "*");
+ }
+
+ setSummary(text, ep);
+ }
+ private boolean isPassword(EditText et){
+ if((et.getInputType() & EditorInfo.TYPE_TEXT_VARIATION_PASSWORD) == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD){
+ return true;
+ }
+ return false;
+ }
+
+ private void setSummary(CharSequence text, DialogPreference ep){
CharSequence sm = ep.getSummary();
String sum;
if (sm != null) {
@@ -193,6 +214,11 @@ public class PreferencesActivity extends PreferenceActivity implements
} else {
sum = "";
}
+
+ if(TextUtils.isEmpty(text)){
+ text = getString(R.string.prefs_current_value_not_set);
+ }
+
if (isBlank(sum)) {
sum = getString(R.string.prefs_current_value_template, text);
} else {
@@ -201,30 +227,14 @@ public class PreferencesActivity extends PreferenceActivity implements
}
ep.setSummary(sum);
}
-
+
private void updateSummary(ListPreference ep) {
CharSequence text = ep.getEntry();
if (text == null) {
return;
}
-
- CharSequence sm = ep.getSummary();
- String sum;
- if (sm != null) {
- sum = ep.getSummary().toString();
- sum = substringBeforeLast(sum,
- getString(R.string.prefs_current_value)).trim();
- } else {
- sum = "";
- }
- if (isBlank(sum)) {
- sum = getString(R.string.prefs_current_value_template, text);
- } else {
- sum = sum + " "
- + getString(R.string.prefs_current_value_template, text);
- }
- ep.setSummary(sum);
+ setSummary(text, ep);
}
/**
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
index b194b22..b13d3ae 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java
@@ -40,7 +40,7 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
adapter = new RecordingAdapter(this);
// attach adapter to ListView
- final ListView listView = (ListView) findViewById(R.id.recording_list);
+ listView = (ListView) findViewById(R.id.recording_list);
listView.setAdapter(adapter);
// set click listener
@@ -55,17 +55,8 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
}
@Override
- protected void onResume() {
- super.onResume();
- }
-
- @Override
protected void onPause() {
super.onPause();
- if (recordingClient != null) {
- recordingClient.abort();
- }
- dismiss(progress);
}
@Override
@@ -77,7 +68,6 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v,
final ContextMenuInfo menuInfo) {
- super.onCreateContextMenu(menu, v, menuInfo);
if (v.getId() == R.id.recording_list) {
final MenuInflater inflater = getMenuInflater();
@@ -90,6 +80,7 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
inflater.inflate(R.menu.recording_list_item_menu, menu);
}
+ super.onCreateContextMenu(menu, v, menuInfo);
}
@Override
@@ -101,7 +92,7 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
Recording rec = event.getRecording();
switch (item.getItemId()) {
case R.id.recording_item_menu_delete: {
- DeleteRecordingTask drt = new DeleteRecordingTask(this,rec) {
+ DeleteRecordingTask drt = new DeleteRecordingTask(this, rec) {
@Override
public void finished() {
dismiss(progress);
@@ -112,10 +103,10 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
break;
}
case R.id.recording_item_menu_stream: {
- say("Sorry, not yet. It would be. File -> "+ rec.getFileName());
+ say("Sorry, not yet. It would be. File -> " + rec.getFileName());
break;
}
-
+
default:
return super.onContextItemSelected(item);
}
@@ -132,9 +123,12 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
recordingClient);
// create progress dialog
+
progress = new SvdrpProgressDialog(this, recordingClient);
+
// attach listener
+ task.addListener(progress);
task.addListener(this);
// start task
@@ -156,7 +150,7 @@ public class RecordingListActivity extends BaseEventListActivity<Recording>
@Override
protected int getWindowTitle() {
- return R.string.remux_title;
+ return R.string.action_menu_recordings;
}
@Override
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java
index 8997214..f3468f8 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java
@@ -2,22 +2,20 @@ package de.bjusystems.vdrmanager.gui;
import android.app.Activity;
import android.app.ProgressDialog;
-import android.util.Log;
-import android.widget.Toast;
import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.utils.svdrp.SvdrpAsyncListener;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpClient;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
-public class SvdrpProgressDialog extends ProgressDialog {
-
- private static final String TAG = SvdrpProgressDialog.class.getName();
+public class SvdrpProgressDialog<T> extends ProgressDialog implements
+ SvdrpAsyncListener<T> {
ProgressDialog progress;
Activity activity;
SvdrpClient<? extends Object> client;
public SvdrpProgressDialog(final Activity activity,
- final SvdrpClient<? extends Object> client) {
+ final SvdrpClient<T> client) {
super(activity);
this.activity = activity;
this.client = client;
@@ -28,24 +26,25 @@ public class SvdrpProgressDialog extends ProgressDialog {
svdrpEvent(event, null);
}
- public void svdrpEvent(final SvdrpEvent event, Throwable error) {
- switch (event) {
+ public void svdrpEvent(final SvdrpEvent sevent, T e) {
+ switch (sevent) {
+ case ABORTED:
+ case CONNECT_ERROR:
+ case ERROR:
+ case LOGIN_ERROR:
+ case FINISHED_ABNORMALY:
+ case FINISHED_SUCCESS:
+ case CACHE_HIT:
+ progress.dismiss();
+ break;
case CONNECTING:
progress.setProgressStyle(ProgressDialog.STYLE_SPINNER);
setMessage(R.string.progress_connect);
progress.show();
break;
- case CONNECT_ERROR:
- progress.dismiss();
- showToast(R.string.progress_connect_error);
- break;
case LOGGED_IN:
setMessage(R.string.progress_login);
break;
- case LOGIN_ERROR:
- progress.dismiss();
- showToast(R.string.progress_login_error);
- break;
case COMMAND_SENT:
setMessage(client.getProgressTextId());
break;
@@ -56,27 +55,11 @@ public class SvdrpProgressDialog extends ProgressDialog {
break;
case DISCONNECTED:
break;
- case FINISHED_ABNORMALY:
- progress.dismiss();
- if (error == null) {
- showToast(R.string.progress_connect_finished_abnormal);
- } else {
- showToast(R.string.progress_connect_finished_abnormal_arg,
- error.getMessage());
- }
- case FINISHED_SUCCESS:
- progress.dismiss();
- break;
- case CACHE_HIT:
- progress.dismiss();
- setMessage(R.string.progress_cache_hit);
- break;
}
}
public void svdrpException(final SvdrpException exception) {
- Log.w(TAG, String.valueOf(activity), exception);
- showToast(R.string.vdr_error_text, exception.getMessage());
+ progress.dismiss();
}
private void setMessage(final int resId, Object... args) {
@@ -86,17 +69,8 @@ public class SvdrpProgressDialog extends ProgressDialog {
progress.setMessage(activity.getString(resId, args));
}
}
-
- private void showToast(final int resId, Object... args) {
- progress.dismiss();
- final CharSequence text = args.length == 0 ? activity.getString(resId)
- : activity.getString(resId, args);
- final int duration = Toast.LENGTH_SHORT;
- final Toast toast = Toast.makeText(activity, text, duration);
- toast.show();
- }
- public void dismiss(){
+ public void dismiss() {
progress.dismiss();
}
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
index f237a89..dfa7e6c 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java
@@ -77,9 +77,7 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
- private void addCustom() {
- }
private void fillTimeSpinnerValues() {
final EpgSearchTimeValues values = new EpgSearchTimeValues(this);
@@ -89,7 +87,6 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
}
- private int currentPostion = 0;
@Override
protected void onPause() {
@@ -97,10 +94,6 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
}
- @Override
- protected void onResume() {
- super.onResume();
- }
public void onItemSelected(final AdapterView<?> parent, final View view,
final int position, final long id) {
@@ -171,8 +164,9 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements
epgClient);
// create progress
- progress = new SvdrpProgressDialog(this, epgClient);
+ progress = new SvdrpProgressDialog<Epg>(this, epgClient);
// attach listener
+ task.addListener(progress);
task.addListener(this);
// start task
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
index f796fa6..7c3c77b 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java
@@ -53,10 +53,6 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
startTimerQuery();
}
- @Override
- protected void onResume() {
- super.onResume();
- }
@Override
protected void onPause() {
@@ -87,7 +83,6 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements
task.run();
}
-
@Override
protected Timer getTimer(EventListItem item) {
return item.getTimer();
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
index 6886e37..fef4108 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
@@ -1,6 +1,8 @@
package de.bjusystems.vdrmanager.gui;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
@@ -14,6 +16,7 @@ import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
import android.util.Pair;
import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.app.C;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Event;
import de.bjusystems.vdrmanager.data.EventFormatter;
@@ -21,6 +24,7 @@ import de.bjusystems.vdrmanager.data.Preferences;
public class Utils {
+ public static final List EMPTY_LIST = new ArrayList(0);
public static final ForegroundColorSpan HIGHLIGHT_TEXT = new ForegroundColorSpan(
Color.RED);
@@ -84,7 +88,7 @@ public class Utils {
}
public static boolean isLive(Event event) {
- long now = new Date().getTime();
+ long now = System.currentTimeMillis();
return now >= event.getStart().getTime()
&& now < event.getStop().getTime();
}
@@ -182,7 +186,7 @@ public class Utils {
share.putExtra(android.content.Intent.EXTRA_SUBJECT, sb.toString());
sb = new StringBuilder();
sb.append(title).append("\n\n");
- sb.append(event.getChannelNumber() +" " + event.getChannelName());
+ sb.append(event.getChannelNumber() + " " + event.getChannelName());
sb.append("\n\n");
sb.append(ef.getShortText());
sb.append("\n\n");
@@ -192,14 +196,19 @@ public class Utils {
activity.startActivity(Intent.createChooser(share,
activity.getString(R.string.share_chooser)));
}
-
- public static String mapSpecialChars(String src){
- if(src == null){
+ public static String mapSpecialChars(String src) {
+ if (src == null) {
return "";
}
- return src.replace("|##", ":").replace("||#", "\n");
+ return src.replace("|##", C.DATA_SEPARATOR).replace("||#", "\n");
}
+ public static String unMapSpecialChars(String src) {
+ if (src == null) {
+ return "";
+ }
+ return src.replace(C.DATA_SEPARATOR, "|##").replace("\n", "||#");
+ }
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
index 70a56dc..983fb28 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
@@ -23,7 +23,7 @@ public class VdrManagerActivity extends Activity implements OnClickListener {
// attach view
setContentView(R.layout.vdrmanager);
- Preferences.loadPreferences(this);
+ //Preferences.loadPreferences(this);
findViewById(R.id.action_menu_channels).setOnClickListener(this);
findViewById(R.id.action_menu_recordings).setOnClickListener(this);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java
index 2b80499..daf7d73 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java
@@ -9,17 +9,18 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
public abstract class AsyncProgressTask<Result> {
- class AsyncProgress extends SvdrpProgressDialog implements SvdrpAsyncListener<Result> {
+ class AsyncProgress extends SvdrpProgressDialog<Result> implements SvdrpAsyncListener<Result> {
public AsyncProgress(final Activity activity, final SvdrpClient<Result> client) {
super(activity, client);
}
- public void svdrpEvent(final SvdrpEvent event, final Object result) {
- svdrpEvent(event);
+ public void svdrpEvent(final SvdrpEvent event, final Result result) {
+ super.svdrpEvent(event, result);
switch (event) {
case FINISHED_ABNORMALY:
case FINISHED_SUCCESS:
+ case ABORTED:
AsyncProgressTask.this.finished();
break;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java
index 7dc0097..fd4c63b 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpAsyncTask.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import android.os.AsyncTask;
+import android.util.Log;
public class SvdrpAsyncTask<Result, Client extends SvdrpClient<Result>>
extends AsyncTask<Void, Object, Void>
@@ -34,13 +35,13 @@ public class SvdrpAsyncTask<Result, Client extends SvdrpClient<Result>>
try {
client.run();
} catch (final SvdrpException e) {
- publishProgress(null, null, e);
+ publishProgress(e);
}
return null;
}
public void svdrpEvent(final SvdrpEvent event, final Result result) {
- publishProgress(event, result, null);
+ publishProgress(event, result);
}
@SuppressWarnings("unchecked")
@@ -48,14 +49,16 @@ public class SvdrpAsyncTask<Result, Client extends SvdrpClient<Result>>
protected void onProgressUpdate(final Object... values) {
super.onProgressUpdate(values);
- if (values[2] == null) {
+ if (values.length == 2) {
for(final SvdrpAsyncListener<Result> listener : listeners) {
listener.svdrpEvent((SvdrpEvent)values[0], (Result)values[1]);
}
- } else {
+ } else if(values.length == 1) {
for(final SvdrpAsyncListener<Result> listener : listeners) {
- listener.svdrpException((SvdrpException)values[2]);
+ listener.svdrpException((SvdrpException)values[0]);
}
+ } else {
+ Log.w(toString(), "Unknonw count of argument in onProgressUpdate");
}
}
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java
index 5f04578..35016b1 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java
@@ -4,11 +4,15 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
+import java.util.Timer;
+import java.util.TimerTask;
import android.util.Log;
+import de.bjusystems.vdrmanager.app.C;
import de.bjusystems.vdrmanager.data.Preferences;
/**
@@ -36,6 +40,8 @@ public abstract class SvdrpClient<Result> {
/** should the listener be informed about each received result */
private boolean resultInfoEnabled = false;
+ private Timer watchDog = new Timer();
+
/**
* Parse received answer line
*
@@ -116,12 +122,22 @@ public abstract class SvdrpClient<Result> {
*/
protected boolean connect() throws IOException {
- final Preferences prefs = Preferences.getPreferences();
-
+ Preferences prefs = Preferences.get();
try {
// connect
+ //TODO prefs
informListener(SvdrpEvent.CONNECTING, null);
- socket = new Socket(prefs.getSvdrpHost(), prefs.getSvdrpPort());
+ socket = new Socket();
+ socket.connect(new InetSocketAddress(prefs.getSvdrpHost(), prefs.getSvdrpPort()), 10 * 1000);//8 secs for connect
+ socket.setSoTimeout(15 * 1000);//15 sec for each read
+ final long delay = C.ONE_MINUTE_IN_MILLIS * 3; //in 3 minutes we abort the communication
+ watchDog.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ Log.w(TAG, "Aborted after " + delay + " ms");
+ abort = true;
+ }
+ }, delay);
informListener(SvdrpEvent.CONNECTED, null);
} catch (final IOException e) {
Log.w(TAG, e);
@@ -236,12 +252,12 @@ public abstract class SvdrpClient<Result> {
informListener(SvdrpEvent.COMMAND_SENDING, null);
writeLine(command);
informListener(SvdrpEvent.COMMAND_SENT, null);
- Log.i(TAG, SvdrpEvent.COMMAND_SENT +":" + command);
-
+ Log.i(TAG, SvdrpEvent.COMMAND_SENT + ":" + command);
+
// read first line
String line = readLine();
if (!line.startsWith("START")) {
- Log.w(TAG,line);
+ Log.w(TAG, line);
throw new IOException("Answer not wellformed: " + line);
}
@@ -270,7 +286,7 @@ public abstract class SvdrpClient<Result> {
Result result = null;
try {
result = parseAnswer(line);
- } catch(Exception ex){
+ } catch (Exception ex) {
Log.w(TAG, ex);
Log.w(TAG, "line: " + line);
informListener(SvdrpEvent.ERROR, null);
@@ -289,7 +305,11 @@ public abstract class SvdrpClient<Result> {
// disconnect
disconnect();
- informListener(SvdrpEvent.FINISHED_SUCCESS, null);
+ if (abort) {
+ informListener(SvdrpEvent.ABORTED, null);
+ } else {
+ informListener(SvdrpEvent.FINISHED_SUCCESS, null);
+ }
} catch (final Exception e) {
// throw new SvdrpException(e);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java
index bb1ebb8..4384136 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java
@@ -14,6 +14,7 @@ public enum SvdrpEvent {
DISCONNECTED,
FINISHED_ABNORMALY,
FINISHED_SUCCESS,
+ ABORTED,
ERROR,
CACHE_HIT,
}