summaryrefslogtreecommitdiff
path: root/vdrmanager
diff options
context:
space:
mode:
Diffstat (limited to 'vdrmanager')
-rw-r--r--vdrmanager/AndroidManifest.xml75
-rw-r--r--vdrmanager/res/layout/epg_detail.xml14
-rw-r--r--vdrmanager/res/layout/epg_event_item.xml12
-rw-r--r--vdrmanager/res/menu/epg_list_menu.xml2
-rw-r--r--vdrmanager/res/values/channel_list.xml1
-rw-r--r--vdrmanager/res/values/epg.xml6
-rw-r--r--vdrmanager/res/values/preferences.xml25
-rw-r--r--vdrmanager/res/xml/preferences.xml48
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/app/Intents.java1
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java6
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java38
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEpgListActivity.java110
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java84
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java163
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java104
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchActivity.java62
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java168
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java72
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java9
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/EventListItemHolder.java1
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java48
-rw-r--r--vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java3
22 files changed, 677 insertions, 375 deletions
diff --git a/vdrmanager/AndroidManifest.xml b/vdrmanager/AndroidManifest.xml
index c22a0e8..35fb221 100644
--- a/vdrmanager/AndroidManifest.xml
+++ b/vdrmanager/AndroidManifest.xml
@@ -1,39 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="de.bjusystems.vdrmanager" android:versionName="0.2"
+ package="de.bjusystems.vdrmanager" android:versionName="0.2_12102011"
android:versionCode="02">
- <application android:icon="@drawable/app_logo" android:label="@string/app_name"
- android:debuggable="true" android:name=".app.VdrManagerApp">
+ <application android:icon="@drawable/app_logo"
+ android:label="@string/app_name" android:debuggable="true"
+ android:name=".app.VdrManagerApp">
<activity android:label="@string/app_name" android:name=".gui.VdrManagerActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
-
+
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
- <meta-data android:name="android.app.default_searchable"
- android:value=".gui.EpgSearchActivity" />
-
+ <meta-data android:name="android.app.default_searchable"
+ android:value=".gui.EpgSearchListActivity" />
+
</activity>
<activity android:name=".gui.TimeEpgListActivity"
android:configChanges="orientation" />
<activity android:name=".gui.EventEpgListActivity"
- android:configChanges="orientation" />
+ android:configChanges="orientation">
+ <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.TimerListActivity"
- android:configChanges="orientation"></activity>
+ android:configChanges="orientation">
+ <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.PreferencesActivity"
android:configChanges="orientation"></activity>
<activity android:name=".gui.ChannelListActivity"
- android:configChanges="orientation"></activity>
+ android:configChanges="orientation">
+ <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.EpgDetailsActivity"
- android:configChanges="orientation"></activity>
- <activity android:name=".gui.TimerDetailsActivity"></activity>
+ android:configChanges="orientation">
+ <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.TimerDetailsActivity">
+ <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.RecordingListActivity"
- android:configChanges="orientation"></activity>
- <activity android:name=".gui.EpgSearchActivity">
+ android:configChanges="orientation">
+ <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">
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
@@ -42,10 +80,11 @@
</activity>
<activity android:name=".gui.EpgSearchTimesListActivity"></activity>
-
-
- <provider android:name=".data.db.DataProvider" android:authorities="de.bjusystems.vdrmanager.provider" />
-
+
+
+ <provider android:name=".data.db.DataProvider"
+ android:authorities="de.bjusystems.vdrmanager.provider" />
+
</application>
diff --git a/vdrmanager/res/layout/epg_detail.xml b/vdrmanager/res/layout/epg_detail.xml
index 41305a2..bc64690 100644
--- a/vdrmanager/res/layout/epg_detail.xml
+++ b/vdrmanager/res/layout/epg_detail.xml
@@ -129,7 +129,7 @@
android:layout_centerHorizontal="true"
style="?android:attr/buttonStyleSmall" android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
android:background="@android:drawable/list_selector_background"
- android:text="@string/epg_event_create_timer_text"/>
+ android:text="@string/epg_eent_livetv_text"/>
<ImageButton
android:id="@+id/epg_event_create_timer"
@@ -141,6 +141,18 @@
android:background="@android:drawable/list_selector_background"
style="?android:attr/buttonStyleSmall"
android:text="@string/epg_event_create_timer_text"/>
+
+ <ImageButton
+ android:id="@+id/epg_event_imdb"
+ android:src="@drawable/imdb"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content" android:layout_marginLeft="20dip" android:layout_marginRight="20dip"
+ android:layout_gravity="center_horizontal"
+ android:layout_centerHorizontal="true"
+ android:background="@android:drawable/list_selector_background"
+ style="?android:attr/buttonStyleSmall"
+ android:text="@string/epg_event_imdb_text"/>
+
<!--
<ImageButton
diff --git a/vdrmanager/res/layout/epg_event_item.xml b/vdrmanager/res/layout/epg_event_item.xml
index c1ce677..bf54b10 100644
--- a/vdrmanager/res/layout/epg_event_item.xml
+++ b/vdrmanager/res/layout/epg_event_item.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/timer_item" android:layout_width="fill_parent"
- android:layout_height="fill_parent" android:padding="4dp"
+ android:layout_height="fill_parent" android:padding="5dp"
android:orientation="vertical">
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"
@@ -31,7 +31,7 @@
</LinearLayout>
- <LinearLayout android:layout_width="fill_parent"
+ <LinearLayout android:layout_width="fill_parent" android:padding="3dip"
android:layout_height="wrap_content" android:layout_marginTop="0dip"
android:orientation="horizontal">
@@ -49,5 +49,13 @@
android:layout_height="wrap_content" android:text="89min"/>
</LinearLayout>
+
+ <TextView android:id="@+id/event_item_description"
+ android:layout_width="wrap_content"
+ android:textAppearance="?android:textAppearanceSmall"
+ android:visibility="gone"
+ android:textSize="12dip"
+ android:padding="3dip"
+ android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout> \ No newline at end of file
diff --git a/vdrmanager/res/menu/epg_list_menu.xml b/vdrmanager/res/menu/epg_list_menu.xml
index cb5e4cf..44ae64d 100644
--- a/vdrmanager/res/menu/epg_list_menu.xml
+++ b/vdrmanager/res/menu/epg_list_menu.xml
@@ -3,9 +3,11 @@
<item
android:id="@+id/epg_menu_search"
+ android:icon="@android:drawable/ic_menu_search"
android:title="@string/epg_menu_search"/>
<item
android:id="@+id/epg_menu_times"
+ android:icon="@android:drawable/ic_menu_search"
android:title="@string/epg_menu_times"/>
</menu> \ No newline at end of file
diff --git a/vdrmanager/res/values/channel_list.xml b/vdrmanager/res/values/channel_list.xml
index 8c3bd89..2a15cc9 100644
--- a/vdrmanager/res/values/channel_list.xml
+++ b/vdrmanager/res/values/channel_list.xml
@@ -9,6 +9,7 @@
<string name="channel_group_menu_hide">Hide</string>
<string name="channel_group_menu_hide_permanent">Hide permanent</string>
+ <string name="menu_groupby">Group by</string>
<string name="groupby_group">Group</string>
<string name="groupby_provider">Provider</string>
<string name="groupby_name">Name</string>
diff --git a/vdrmanager/res/values/epg.xml b/vdrmanager/res/values/epg.xml
index a5e32fe..db84fdd 100644
--- a/vdrmanager/res/values/epg.xml
+++ b/vdrmanager/res/values/epg.xml
@@ -9,6 +9,8 @@
<string name="epg_list_search_label">Search results</string>
<!-- create timer -->
+ <string name="epg_event_imdb_text">IMDB Search</string>
+ <string name="epg_eent_livetv_text">Stream</string>
<string name="epg_event_create_timer_text">Add timer</string>
<string name="epg_event_modify_timer_text">Modify timer</string>
@@ -18,8 +20,10 @@
<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 by channel</string>
+ <string name="epg_by_search">EPG Search</string>
+ <string name="epg_by_search_param">EPG Search: \'%1$s\'</string>
<string name="epg_by_time">EPG by time</string>
<string name="search_epg_hint">Search EPG</string>
- <string name="epg_search_settings_description">Searcg VDR EPG</string>
+ <string name="epg_search_settings_description">Search VDR EPG</string>
</resources>
diff --git a/vdrmanager/res/values/preferences.xml b/vdrmanager/res/values/preferences.xml
index 16737ef..a1d3f81 100644
--- a/vdrmanager/res/values/preferences.xml
+++ b/vdrmanager/res/values/preferences.xml
@@ -17,8 +17,8 @@
<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">Channels</string>
- <string name="channel_filter_last_summary">Channels to use</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>
@@ -76,9 +76,30 @@
<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>
</resources>
diff --git a/vdrmanager/res/xml/preferences.xml b/vdrmanager/res/xml/preferences.xml
index 1f54c26..88c27d6 100644
--- a/vdrmanager/res/xml/preferences.xml
+++ b/vdrmanager/res/xml/preferences.xml
@@ -3,7 +3,7 @@
<PreferenceCategory android:title="@string/vdr_preferences"
android:key="vdr_preferences">
-
+
<EditTextPreference android:key="@string/vdr_host_key"
android:title="@string/vdr_host_title" android:summary="@string/vdr_host_summary" />
<EditTextPreference android:key="@string/vdr_port_key"
@@ -16,13 +16,14 @@
android:title="@string/vdr_ssl_title" android:summary="@string/vdr_ssl_summary" />
</PreferenceCategory>
-
+
<PreferenceCategory android:title="@string/channel_filter_preferences"
android:key="filter_preferences">
<CheckBoxPreference android:key="@string/channel_filter_filter_key"
android:title="@string/channel_filter_filter_title" android:summary="@string/channel_filter_filter_summary" />
<EditTextPreference android:key="@string/channel_filter_last_key"
android:title="@string/channel_filter_last_title" android:summary="@string/channel_filter_last_summary"
+ android:dependency="@string/channel_filter_filter_key"
android:defaultValue="1" />
</PreferenceCategory>
@@ -78,35 +79,48 @@
android:title="@string/gui_enable_24h_format_title"
android:summaryOn="@string/gui_enable_24h_format_summary_on"
android:summaryOff="@string/gui_enable_24h_format_summary_off" />
-
- <CheckBoxPreference android:key="@string/qui_quit_on_back_key"
+
+ <CheckBoxPreference android:key="@string/qui_show_imdb_button_key"
+ android:title="@string/qui_show_imdb_button_title" android:summaryOn="@string/qui_show_imdb_button_summary_on"
+ android:summaryOff="@string/qui_show_imdb_button_summary_off"
+ android:defaultValue="true" />
+
+ <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:dependency="@string/qui_show_imdb_button_key"
+ android:defaultValue="imdb.de" />
+
+ <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" />
</PreferenceCategory>
+
<PreferenceCategory android:title="@string/livetv">
<EditTextPreference android:key="streamingport"
android:inputType="number" android:title="@string/settings_livetv_port"
android:summary="@string/settings_livetv_port_summary"
android:defaultValue="3000" />
-
+
<ListPreference android:key="livetv_streamformat"
android:title="@string/settings_livetv_streamformat"
android:defaultValue="TS" android:entries="@array/livetv_streamformat"
android:entryValues="@array/livetv_streamformat_values" />
-
- <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"
- />
- <EditTextPreference android:dependency="remux_enable" android:key="remux_parameter" android:title="@string/remux_parameter_title" android:summary="@string/remux_parameter_summary"
- android:defaultValue="QUALITY=DSL1000"
- />
-
-
+ <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" />
+
+ <EditTextPreference android:dependency="remux_enable"
+ android:key="remux_parameter" android:title="@string/remux_parameter_title"
+ android:summary="@string/remux_parameter_summary"
+ android:defaultValue="QUALITY=DSL1000" />
+
+
</PreferenceCategory>
-
+
</PreferenceScreen>
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/app/Intents.java b/vdrmanager/src/de/bjusystems/vdrmanager/app/Intents.java
index 9b113e8..dc71105 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/app/Intents.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/app/Intents.java
@@ -3,5 +3,6 @@ package de.bjusystems.vdrmanager.app;
public interface Intents {
public static final String CURRENT_CHANNEL = "CURRENT_CHANNEL";
+ public static final String HIGHLIGHT = "HIGHLIGHT";
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java
index fd84f25..a714845 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java
@@ -23,12 +23,12 @@ public class VdrManagerApp extends Application {
private Timer currentTimer;
private Channel currentChannel;
- private ArrayList<Epg> currentEpgList = new ArrayList<Epg>();
- public ArrayList<Epg> getCurrentEpgList() {
+ private List<Epg> currentEpgList = new ArrayList<Epg>();
+ public List<Epg> getCurrentEpgList() {
return currentEpgList;
}
- public void setCurrentEpgList(ArrayList<Epg> currentEpgList) {
+ public void setCurrentEpgList(List<Epg> currentEpgList) {
this.currentEpgList = currentEpgList;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
index c415465..2570e67 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java
@@ -2,13 +2,13 @@ package de.bjusystems.vdrmanager.data;
import android.content.Context;
import android.content.SharedPreferences;
-import android.test.IsolatedContext;
import de.bjusystems.vdrmanager.R;
/**
* Class for all preferences
*
- * @author bju
+ * @author bju, lado
+ *
*/
public class Preferences {
@@ -110,6 +110,36 @@ public class Preferences {
* Quits the app on back button
*/
private boolean quiteOnBackButton = true;
+
+
+ /**
+ * Show IMDB buttons, where possible (e.g. EPG Details)
+ */
+ private boolean showImdbButton = true;
+
+
+ /**
+ * On Which imdb site to search?
+ */
+ private String imdbUrl = "imdb.de";
+
+
+ public String getImdbUrl() {
+ return imdbUrl;
+ }
+
+
+ public void setImdbUrl(String imdbUrl) {
+ this.imdbUrl = imdbUrl;
+ }
+
+
+ /**
+ * @return whether to shwo imdb button
+ */
+ public boolean isShowImdbButton() {
+ return showImdbButton;
+ }
/** Properties singleton */
private static Preferences thePrefs;
@@ -498,6 +528,10 @@ public class Preferences {
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");
+
thePrefs = prefs;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEpgListActivity.java
index c1530dc..d298de1 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEpgListActivity.java
@@ -30,33 +30,33 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpEvent;
/**
* @author lado
- *
+ *
*/
-public abstract class BaseEpgListActivity extends BaseActivity implements SimpleGestureListener{
+public abstract class BaseEpgListActivity extends BaseActivity implements
+ SimpleGestureListener {
-
private static final int REQUEST_CODE_TIMED_EDIT = 41;
-
+
private SimpleGestureFilter detector;
-
+
protected EpgClient epgClient;
-
+
protected EventAdapter adapter;
-
+
protected SvdrpProgressDialog progress;
-
+
+ protected String highlight = null;
+
protected static final Date FUTURE = new Date(Long.MAX_VALUE);
-
- //private static final Date BEGIN = new Date(0);
+ // private static final Date BEGIN = new Date(0);
protected Channel currentChannel = null;
-
+
protected ListView listView;
abstract protected int getWindowTitle();
-
-
+
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -66,11 +66,12 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
setTitle(getWindowTitle());
initChannel();
}
-
- private void initChannel(){
- currentChannel = getIntent().getParcelableExtra(Intents.CURRENT_CHANNEL);
+
+ private void initChannel() {
+ currentChannel = getIntent()
+ .getParcelableExtra(Intents.CURRENT_CHANNEL);
}
-
+
protected void deleteTimer(final EventListItem item) {
final DeleteTimerTask task = new DeleteTimerTask(this, item.getEpg()
@@ -82,11 +83,13 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
};
task.start();
}
-
-
- /* (non-Javadoc)
- * @see de.bjusystems.vdrmanager.gui.BaseActivity#onCreateOptionsMenu(android.view.Menu)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * de.bjusystems.vdrmanager.gui.BaseActivity#onCreateOptionsMenu(android
+ * .view.Menu)
*/
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
@@ -97,11 +100,13 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
return true;
}
- protected void prepareTimer(EventListItem event){
-
+ protected void prepareTimer(EventListItem event) {
+
}
-
- /* (non-Javadoc)
+
+ /*
+ * (non-Javadoc)
+ *
* @see android.app.Activity#onContextItemSelected(android.view.MenuItem)
*/
@Override
@@ -137,9 +142,13 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
return true;
}
-
- /* (non-Javadoc)
- * @see de.bjusystems.vdrmanager.gui.BaseActivity#onOptionsItemSelected(android.view.MenuItem)
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * de.bjusystems.vdrmanager.gui.BaseActivity#onOptionsItemSelected(android
+ * .view.MenuItem)
*/
public boolean onOptionsItemSelected(final MenuItem item) {
@@ -147,9 +156,8 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
switch (item.getItemId()) {
case R.id.epg_menu_search:
- intent = new Intent();
- intent.setClass(this, EpgSearchActivity.class);
- startActivity(intent);
+ //startSearchManager();
+ super.onSearchRequested();
break;
case R.id.epg_menu_times:
intent = new Intent();
@@ -160,9 +168,11 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
return super.onOptionsItemSelected(item);
}
-
- /* (non-Javadoc)
- * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu,
+ * android.view.View, android.view.ContextMenu.ContextMenuInfo)
*/
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v,
@@ -201,7 +211,6 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
}
-
protected void toggleTimer(final EventListItem item) {
final ToggleTimerTask task = new ToggleTimerTask(this, item.getEpg()
.getTimer()) {
@@ -213,8 +222,11 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
task.start();
}
- /* (non-Javadoc)
- * @see android.app.Activity#onActivityResult(int, int, android.content.Intent)
+ /*
+ * (non-Javadoc)
+ *
+ * @see android.app.Activity#onActivityResult(int, int,
+ * android.content.Intent)
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@@ -224,7 +236,7 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
}
}
}
-
+
/**
* @param parent
* @param view
@@ -247,10 +259,14 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
// show details
final Intent intent = new Intent();
intent.setClass(this, EpgDetailsActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
+ | Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ if (highlight != null) {
+ intent.putExtra(Intents.HIGHLIGHT, highlight);
+ }
startActivity(intent);
}
-
@Override
protected void onPause() {
super.onPause();
@@ -262,7 +278,6 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
progress = null;
}
}
-
public void svdrpEvent(final SvdrpEvent event, final Epg result) {
@@ -285,7 +300,7 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
break;
}
}
-
+
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
@@ -293,6 +308,7 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
int top = savedInstanceState.getInt("TOP");
listView.setSelectionFromTop(index, top);
}
+
@Override
protected void onSaveInstanceState(Bundle outState) {
int index = listView.getFirstVisiblePosition();
@@ -302,7 +318,7 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
outState.putInt("TOP", top);
super.onSaveInstanceState(outState);
}
-
+
protected abstract void finishedSuccess();
public boolean onSearchRequested() {
@@ -311,6 +327,11 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
return true;
}
+ protected void startSearchManager() {
+ Bundle appData = new Bundle();
+ startSearch(highlight, false, appData, false);
+ }
+
@Override
public boolean dispatchTouchEvent(MotionEvent me) {
this.detector.onTouchEvent(me);
@@ -318,11 +339,12 @@ public abstract class BaseEpgListActivity extends BaseActivity implements Simple
}
public void onSwipe(int direction) {
-
+
}
+
public void onDoubleTap() {
// TODO Auto-generated method stub
-
+
}
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java
index c712cdd..7c0ff05 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java
@@ -7,6 +7,10 @@ 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;
import android.view.ViewGroup;
@@ -18,11 +22,11 @@ import android.widget.TextView;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Preferences;
+import de.bjusystems.vdrmanager.utils.svdrp.ChannelClient;
class ChannelAdapter extends BaseExpandableListAdapter implements Filterable// ,
- // SectionIndexer
+// SectionIndexer
{
-
@Override
public boolean areAllItemsEnabled() {
return true;
@@ -93,18 +97,20 @@ class ChannelAdapter extends BaseExpandableListAdapter implements Filterable// ,
view.setBackgroundColor(Color.BLACK);
- String name = item.getName();
+ CharSequence name = item.getName();
+ name = Utils.highlight(String.valueOf(name), channelFilter);
+
if (showChannelNumber) {
name = item.getNumber() + " - " + name;
}
itemHolder.name.setText(name);
-
- if(groupBy != ChannelListActivity.MENU_PROVIDER){
+
+ if (groupBy != ChannelListActivity.MENU_PROVIDER) {
itemHolder.aux.setText(item.getProvider());
} else {
itemHolder.aux.setText("");
}
-
+
return view;
}
@@ -132,6 +138,11 @@ class ChannelAdapter extends BaseExpandableListAdapter implements Filterable// ,
View convertView, ViewGroup parent) {
String group = (String) getGroup(groupPosition);
+
+ int channelCount = this.channels.get(group).size();
+
+ CharSequence groupDisplay = Utils.highlight(group, groupFilter);
+
ChannelHolder itemHolder = new ChannelHolder();
// recycle view?
@@ -149,8 +160,8 @@ class ChannelAdapter extends BaseExpandableListAdapter implements Filterable// ,
} else {
itemHolder = (ChannelHolder) view.getTag();
}
- itemHolder.name.setText(group);
- itemHolder.aux.setText(String.valueOf(this.channels.get(group).size()));
+ itemHolder.name.setText(groupDisplay);
+ itemHolder.aux.setText(String.valueOf(channelCount));
return view;
}
@@ -168,27 +179,64 @@ class ChannelAdapter extends BaseExpandableListAdapter implements Filterable// ,
return true;
}
- public Filter getFilter() {
- return new Filter() {
+ private String groupFilter = null;
- private ArrayList<Channel> ALL = channels.get(0);
+ private String channelFilter = null;
+ public Filter getFilter() {
+ return new Filter() {
@Override
protected FilterResults performFiltering(CharSequence arg0) {
- ArrayList<Channel> c = new ArrayList<Channel>(ALL);
- Iterator<Channel> ci = c.iterator();
- while (ci.hasNext()) {
- if (ci.next().getName().startsWith(arg0.toString()) == false) {
- ci.remove();
+ FilterResults fr = new FilterResults();
+ String q = String.valueOf(arg0).toLowerCase();
+ ArrayList<String> groups = new ArrayList<String>();
+ HashMap<String, ArrayList<Channel>> groupChannels = new HashMap<String, ArrayList<Channel>>();
+ if (groupBy == ChannelListActivity.MENU_GROUP) {
+ groupFilter = String.valueOf(arg0).toLowerCase();
+ for (String str : ChannelClient.getChannelGroups()) {
+ String g = str.toLowerCase();
+ if (g.indexOf(q) != -1) {
+ groups.add(str);
+ groupChannels.put(str, ChannelClient
+ .getGroupChannels().get(str));
+ }
+ }
+
+ } else if (groupBy == ChannelListActivity.MENU_PROVIDER) {
+ groupFilter = String.valueOf(arg0).toLowerCase();
+ for (Map.Entry<String, ArrayList<Channel>> p : ChannelClient
+ .getProviderChannels().entrySet()) {
+ String pr = p.getKey();
+ String g = pr.toLowerCase();
+ if (g.indexOf(q) != -1) {
+ groups.add(pr);
+ groupChannels.put(pr, p.getValue());
+ }
}
+
+ } else {
+ channelFilter = String.valueOf(arg0).toLowerCase();
+ ArrayList<Channel> channels = new ArrayList<Channel>();
+ for(Channel c : ChannelClient.getChannels()){
+ String cname = c.getName();
+ String tmp = cname.toLowerCase();
+ if(tmp.indexOf(channelFilter) != -1){
+ channels.add(c);
+ }
+ }
+ String fakeGroup = context.getString(R.string.groupby_name_all_channels_group);
+ groups.add (fakeGroup);
+ groupChannels.put(fakeGroup, channels);
}
- FilterResults fr = new FilterResults();
+ fr.values = Pair.create(groups, groupChannels);
return fr;
}
@Override
protected void publishResults(CharSequence arg0, FilterResults arg1) {
- notifyDataSetChanged();
+ Pair<ArrayList<String>, HashMap<String, ArrayList<Channel>>> res = (Pair<ArrayList<String>, HashMap<String, ArrayList<Channel>>>) arg1.values;
+ fill(res.first, res.second, groupBy);
+
}
};
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
index a89034b..a2249b9 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java
@@ -4,7 +4,9 @@ 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;
@@ -17,6 +19,7 @@ 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;
@@ -46,22 +49,14 @@ public class ChannelListActivity extends BaseActivity implements
ChannelAdapter adapter;
Preferences prefs;
SvdrpProgressDialog progress;
- private EditText searchBox;
- public static final int MENU_GROUP_GROUP = 1;
- public static final int MENU_GROUP_PROVIDER = 2;
- public static final int MENU_GROUP_NAME = 3;
- // public static final int MENU_GROUP_SHOW_CHANNEL_NUMBERS = 2;
-
- public static final int MENU_GROUP = 1;
- public static final int MENU_PROVIDER = 2;
- public static final int MENU_NAME = 3;
-
- private TextWatcher filterTextWatcher;
+ public static final int MENU_GROUP = 0;
+ public static final int MENU_PROVIDER = 1;
+ public static final int MENU_NAME = 2;
private int groupBy = MENU_GROUP;
- private final ArrayList<String> ALL_CHANNELS_GROUP = new ArrayList<String>(
+ final static ArrayList<String> ALL_CHANNELS_GROUP = new ArrayList<String>(
1);
ExpandableListView listView;
@@ -95,58 +90,17 @@ public class ChannelListActivity extends BaseActivity implements
setTitle(R.string.action_menu_channels);
adapter = new ChannelAdapter(this);
- searchBox = (EditText) findViewById(R.id.search_box);
-
- filterTextWatcher = new TextWatcher() {
-
- public void afterTextChanged(Editable s) {
- }
-
- public void beforeTextChanged(CharSequence s, int start, int count,
- int after) {
- }
-
- public void onTextChanged(CharSequence s, int start, int before,
- int count) {
- adapter.getFilter().filter(s);
- }
- };
- searchBox.addTextChangedListener(filterTextWatcher);
-
// Create adapter for ListView
listView = (ExpandableListView) findViewById(R.id.channel_list);
// listView.setOnItemClickListener(this);
listView.setOnChildClickListener(this);
- // listView.setOnGroupClickListener(this);
- //
- // public boolean onChildClick(ExpandableListView arg0, View arg1,
- // int arg2, int arg3, long arg4) {
- // Toast.makeText(getBaseContext(), "Child clicked",
- // Toast.LENGTH_LONG).show();
- // return false;
- // }
- // });
- //
- // listView.setOnGroupClickListener(new OnGroupClickListener() {
- //
- // public boolean onGroupClick(ExpandableListView arg0, View arg1,
- // int arg2, long arg3) {
- // Toast.makeText(getBaseContext(), "Group clicked",
- // Toast.LENGTH_LONG).show();
- // return false;
- // }
- // });
listView.setTextFilterEnabled(true);
listView.setFastScrollEnabled(true);
listView.setAdapter(adapter);
// register context menu
registerForContextMenu(listView);
startChannelQuery();
-
- // create channel list
-
- // listView.setOnItemClickListener(this);
}
//
@@ -167,6 +121,9 @@ public class ChannelListActivity extends BaseActivity implements
progress.dismiss();
progress = null;
}
+ if (groupByDialog != null) {
+ groupByDialog.dismiss();
+ }
}
private void startChannelQuery() {
@@ -196,7 +153,7 @@ public class ChannelListActivity extends BaseActivity implements
switch (groupBy) {
case MENU_GROUP:
adapter.fill(
- new ArrayList<String>(channelClient.getChannelGroups()),
+ channelClient.getChannelGroups(),
channelClient.getGroupChannels(), groupBy);
listView.collapseGroup(0);
updateWindowTitle(
@@ -204,7 +161,7 @@ public class ChannelListActivity extends BaseActivity implements
getString(R.string.groupby_window_title_templte,
getString(R.string.groupby_group)));
break;
- case MENU_GROUP_PROVIDER:
+ case MENU_PROVIDER:
adapter.fill(new ArrayList<String>(channelClient
.getProviderChannels().keySet()), channelClient
.getProviderChannels(), groupBy);
@@ -214,7 +171,7 @@ public class ChannelListActivity extends BaseActivity implements
getString(R.string.groupby_window_title_templte,
getString(R.string.groupby_provider)));
break;
- case MENU_GROUP_NAME:
+ case MENU_NAME:
if (ALL_CHANNELS_GROUP.isEmpty()) {
ALL_CHANNELS_GROUP
.add(getString(R.string.groupby_name_all_channels_group));
@@ -264,62 +221,69 @@ public class ChannelListActivity extends BaseActivity implements
}
public boolean onPrepareOptionsMenu(Menu menu) {
- switch (groupBy) {
- case MENU_GROUP:
- menu.setGroupVisible(MENU_GROUP_GROUP, false);
- menu.setGroupVisible(MENU_GROUP_PROVIDER, true);
- menu.setGroupVisible(MENU_GROUP_NAME, true);
- break;
-
- case MENU_PROVIDER:
- menu.setGroupVisible(MENU_GROUP_PROVIDER, false);
- menu.setGroupVisible(MENU_GROUP_GROUP, true);
- menu.setGroupVisible(MENU_GROUP_NAME, true);
- break;
-
- case MENU_NAME:
- menu.setGroupVisible(MENU_GROUP_NAME, false);
- menu.setGroupVisible(MENU_GROUP_GROUP, true);
- menu.setGroupVisible(MENU_GROUP_PROVIDER, true);
- break;
- default:
- return super.onPrepareOptionsMenu(menu);
- }
- return true;
-
+
+ return super.onPrepareOptionsMenu(menu);
}
+
@Override
public final boolean onCreateOptionsMenu(final Menu menu) {
super.onCreateOptionsMenu(menu);
MenuItem item;
- item = menu
- .add(MENU_GROUP_GROUP, MENU_GROUP, 0, R.string.groupby_group);
+ item = menu.add(MENU_GROUP, MENU_GROUP, 0, R.string.menu_groupby);
item.setIcon(android.R.drawable.ic_menu_sort_alphabetically);
item.setAlphabeticShortcut('g');
- item = menu.add(MENU_GROUP_PROVIDER, MENU_PROVIDER, 0,
- R.string.groupby_provider);
- item.setIcon(android.R.drawable.ic_menu_sort_alphabetically);
- item.setAlphabeticShortcut('p');
+ // item = menu.add(MENU_GROUP_PROVIDER, MENU_PROVIDER, 0,
+ // R.string.groupby_provider);
+ // item.setIcon(android.R.drawable.ic_menu_sort_alphabetically);
+ // item.setAlphabeticShortcut('p');
- item = menu.add(MENU_GROUP_NAME, MENU_NAME, 0, R.string.groupby_name);
- item.setIcon(android.R.drawable.ic_menu_sort_alphabetically);
- item.setAlphabeticShortcut('n');
+ // item = menu.add(MENU_GROUP_NAME, MENU_NAME, 0,
+ // R.string.groupby_name);
+ // item.setIcon(android.R.drawable.ic_menu_sort_alphabetically);
+ // item.setAlphabeticShortcut('n');
return true;
}
+ private static final String[] EMPTY = new String[] {};
+
+ private String[] getAvailableGroupByEntries() {
+ ArrayList<String> entries = new ArrayList<String>(2);
+ entries.add(getString(R.string.groupby_group));
+ entries.add(getString(R.string.groupby_provider));
+ entries.add(getString(R.string.groupby_name));
+ return entries.toArray(EMPTY);
+ }
+
+ AlertDialog groupByDialog = null;
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case MENU_GROUP:
- case MENU_PROVIDER:
- case MENU_NAME:
- groupBy = item.getItemId();
- fillAdapter();
+ // case MENU_PROVIDER:
+ // case MENU_NAME:
+ if (groupByDialog == null) {
+ groupByDialog = new AlertDialog.Builder(this)
+ .setTitle(R.string.menu_groupby)
+ .setIcon(android.R.drawable.ic_menu_sort_alphabetically)
+ .setSingleChoiceItems(getAvailableGroupByEntries(),
+ groupBy, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog,
+ int which) {
+ groupBy = which;
+ fillAdapter();
+ groupByDialog.dismiss();
+ }
+ }).create();
+ }
+
+ groupByDialog.show();
+
return true;
default:
return super.onOptionsItemSelected(item);
@@ -418,11 +382,6 @@ public class ChannelListActivity extends BaseActivity implements
@Override
public boolean onSearchRequested() {
- if (groupBy != MENU_NAME) {
- return true;
- }
- searchBox.setVisibility(View.VISIBLE);
- searchBox.requestFocus();
InputMethodManager inputMgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMgr.toggleSoftInput(0, 0);
return true;
@@ -430,11 +389,7 @@ public class ChannelListActivity extends BaseActivity implements
@Override
public void onBackPressed() {
- if (searchBox.getVisibility() == View.VISIBLE) {
- searchBox.setVisibility(View.GONE);
- } else {
- super.onBackPressed();
- }
+ super.onBackPressed();
}
public boolean onGroupClick(ExpandableListView arg0, View arg1, int arg2,
@@ -445,8 +400,8 @@ public class ChannelListActivity extends BaseActivity implements
private void startChannelEPG(Channel channel) {
// find and remember item
// final Channel channel = adapter.getItem(position);
- //final VdrManagerApp app = (VdrManagerApp) getApplication();
- //app.setCurrentChannel(channel);
+ // final VdrManagerApp app = (VdrManagerApp) getApplication();
+ // app.setCurrentChannel(channel);
// show details
final Intent intent = new Intent();
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
index 6e61099..8c52801 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgDetailsActivity.java
@@ -1,11 +1,11 @@
package de.bjusystems.vdrmanager.gui;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
+import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.MotionEvent;
@@ -16,6 +16,7 @@ import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
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.Epg;
@@ -33,10 +34,12 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException;
public class EpgDetailsActivity extends Activity implements OnClickListener,
SimpleGestureListener {
- Preferences prefs;
-
+ public static String IMDB_URL = "http://www.%s/find?s=all&q=%s";
+
private SimpleGestureFilter detector;
+ private String highlight = null;
+
ImageButton event_left;
ImageButton event_right;
@@ -45,8 +48,13 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ Intent i = getIntent();
+ highlight = i.getStringExtra(Intents.HIGHLIGHT);
+
// Attach view
setContentView(R.layout.epg_detail);
+
+
detector = new SimpleGestureFilter(this, this);
//event_left = (ImageButton) findViewById(R.id.epg_event_left);
@@ -89,53 +97,8 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
}.execute((Void)null);
publishEPG(epg);
- // final EventFormatter formatter = new EventFormatter(event);
- //
- // final TextView title = (TextView)
- // findViewById(R.id.epg_detail_title);
- // title.setText(formatter.getTitle());
- // title.setTextSize(TypedValue.COMPLEX_UNIT_PX, title.getTextSize()
- // * (float) 1.3);
- //
- // ((TextView) findViewById(R.id.epg_detail_time)).setText(formatter
- // .getTime());
- // ((TextView) findViewById(R.id.epg_detail_channel)).setText(event
- // .getChannelName());
- // ((TextView) findViewById(R.id.epg_detail_date)).setText(formatter
- // .getLongDate());
- // final TextView textView = (TextView)
- // findViewById(R.id.epg_detail_description);
- // textView.setText(formatter.getDescription());
- //
- // // copy color for separator lines
- // final int color = textView.getTextColors().getDefaultColor();
- // // ((TextView) findViewById(R.id.epg_detail_separator_1))
- // // .setBackgroundColor(color);
- //
- // ((ProgressBar) findViewById(R.id.epg_detail_progress))
- // .setProgress(Utils.getProgress(event));
- //
- // ((TextView) findViewById(R.id.epg_detail_separator_2))
- // .setBackgroundColor(color);
- //
- // // register button handler
- // final ImageButton timeButton = (ImageButton)
- // findViewById(R.id.epg_event_create_timer);
- // timeButton.setOnClickListener(this);
- //
- // final ImageButton livetvButton = (ImageButton)
- // findViewById(R.id.epg_event_livetv);
- // livetvButton.setOnClickListener(this);
- //
- //
- // // set button text
- // if (event.getTimer() == null) {
- // // timeButton.setText(R.string.epg_event_create_timer_text);
- // } else {
- // // timeButton.setText(R.string.epg_event_modify_timer_text);
- // }
-
- // clear list of activities to finish
+
+ //TODO was ist das?
app.clearActivitiesToFinish();
}
@@ -148,7 +111,8 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
final EventFormatter formatter = new EventFormatter(event);
final TextView title = (TextView) findViewById(R.id.epg_detail_title);
- title.setText(formatter.getTitle());
+ String titleText = formatter.getTitle();
+ title.setText(Utils.highlight(titleText, highlight));
// title.setTextSize(TypedValue.COMPLEX_UNIT_PX, title.getTextSize()
// * (float) 1.3);
@@ -163,11 +127,11 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
// .getLongDate());
final TextView shortText = (TextView) findViewById(R.id.epg_detail_shorttext);
- shortText.setText(formatter.getShortText());
+ shortText.setText(Utils.highlight(formatter.getShortText(), highlight));
final TextView textView = (TextView) findViewById(R.id.epg_detail_description);
- textView.setText(formatter.getDescription());
+ textView.setText(Utils.highlight(formatter.getDescription(), highlight));
// copy color for separator lines
final int color = textView.getTextColors().getDefaultColor();
@@ -191,7 +155,18 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
// register button handler
setThisAsOnClickListener(R.id.epg_event_create_timer);
- View b = findViewById(R.id.epg_event_livetv);
+
+
+ View b = findViewById(R.id.epg_event_imdb);
+
+ if(Preferences.get().isShowImdbButton() == false){
+ b.setVisibility(View.GONE);
+ } else {
+ b.setVisibility(View.VISIBLE);
+ setThisAsOnClickListener(b);
+ }
+
+ b = findViewById(R.id.epg_event_livetv);
if (Utils.isLive(event) == false) {
b.setVisibility(View.GONE);
} else {
@@ -223,6 +198,9 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
@Override
protected void onResume() {
super.onResume();
+ //TODO Check here whether the config has changed for imdb
+ //TODO check here if we are still live ?
+
}
@Override
@@ -241,13 +219,13 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
case R.id.epg_event_create_timer:
Toast.makeText(this, "Soon we get here the timer menu", Toast.LENGTH_SHORT).show();
break;
-
-// case R.id.epg_event_left:
-// prevEPG();
-// break;
-// case R.id.epg_event_right:
-// nextEPG();
-// break;
+ case R.id.epg_event_imdb:
+ final TextView title = (TextView) findViewById(R.id.epg_detail_title);
+ String url = String.format(IMDB_URL,Preferences.get().getImdbUrl(), String.valueOf(title.getText()));
+ Intent i = new Intent(Intent.ACTION_VIEW);
+ i.setData(Uri.parse(url));
+ startActivity(i);
+ break;
}
}
@@ -274,13 +252,11 @@ public class EpgDetailsActivity extends Activity implements OnClickListener,
}
- ArrayList<Epg> epgs = null;
+ List<Epg> epgs = null;
int counter = 0;
public void initEPGs() {
- // epgs = ((VdrManagerApp)getApplication()).getCurrentEpgList();
-
if (epgs != null) {
return;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchActivity.java
deleted file mode 100644
index e6fbfdd..0000000
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchActivity.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package de.bjusystems.vdrmanager.gui;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-import de.bjusystems.vdrmanager.R;
-import de.bjusystems.vdrmanager.app.VdrManagerApp;
-import de.bjusystems.vdrmanager.data.EpgSearchParams;
-import de.bjusystems.vdrmanager.data.Preferences;
-
-/**
- * This class is used for showing what's current running on all channels
- *
- * @author bju
- */
-public class EpgSearchActivity extends Activity implements OnClickListener {
-
- Preferences prefs;
- TextView text;
-
- @Override
- protected void onCreate(final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // Attach view
- setContentView(R.layout.epg_search);
-
- // save fields
- text = (TextView) findViewById(R.id.epg_search_text);
-
- // register button
- final Button button = (Button) findViewById(R.id.epg_search_button);
- button.setOnClickListener(this);
- }
-
- @Override
- protected void onResume() {
- super.onResume();
- }
-
- @Override
- protected void onPause() {
- super.onPause();
- }
-
- public void onClick(final View v) {
-
- // Save search parameters
- final EpgSearchParams search = new EpgSearchParams();
- search.setTitle(text.getText().toString());
- ((VdrManagerApp) getApplication()).setCurrentSearch(search);
-
- // show timer details
- final Intent intent = new Intent();
- //intent.setClass(this, EpgListActivity.class);
- startActivity(intent);
- }
-}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
new file mode 100644
index 0000000..4dba61d
--- /dev/null
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java
@@ -0,0 +1,168 @@
+package de.bjusystems.vdrmanager.gui;
+
+import java.util.Calendar;
+import java.util.List;
+
+import android.app.SearchManager;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.ListView;
+import de.bjusystems.vdrmanager.R;
+import de.bjusystems.vdrmanager.app.VdrManagerApp;
+import de.bjusystems.vdrmanager.data.Epg;
+import de.bjusystems.vdrmanager.data.EpgSearchParams;
+import de.bjusystems.vdrmanager.data.EventListItem;
+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 BaseEpgListActivity implements
+ OnItemClickListener, SvdrpAsyncListener<Epg> {
+
+ public List<Epg> results;
+
+ @Override
+ protected void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ String query = intent.getStringExtra(SearchManager.QUERY);
+ if (TextUtils.isEmpty(query) == false) {
+ highlight = query.trim();
+ }
+ }
+ adapter = new ChannelEventAdapter(this);
+ adapter.setHideDescription(false);
+
+ // Create adapter for EPG list
+ 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();
+ startEpgQuery();
+ }
+
+
+
+ public void onNothingSelected(final AdapterView<?> arg0) {
+ // startTimeEpgQuery(((EpgTimeSpinnerValue)timeSpinner.getAdapter().getItem(0)).getValue());
+ }
+
+ //
+
+ private void startEpgQuery() {
+
+ EpgSearchParams sp = new EpgSearchParams();
+ sp.setTitle(highlight);
+ setTitle(getString(R.string.epg_by_search_param, highlight));
+ epgClient = new EpgClient(sp);
+
+ // remove old listeners
+ // epgClient.clearSvdrpListener();
+
+ // create background task
+ final SvdrpAsyncTask<Epg, SvdrpClient<Epg>> task = new SvdrpAsyncTask<Epg, SvdrpClient<Epg>>(
+ epgClient);
+
+ // create progress
+ progress = new SvdrpProgressDialog(this, epgClient);
+ // attach listener
+ task.addListener(this);
+
+ // start task
+ task.run();
+ }
+
+ /*
+ * (non-Javadoc) TODO this method also should be used in startEpgQuery on
+ * cache hit
+ *
+ * @see de.bjusystems.vdrmanager.gui.BaseEpgListActivity#finishedSuccess()
+ */
+ @Override
+ protected void finishedSuccess() {
+ adapter.clear();
+ adapter.highlight = this.highlight;
+
+ Calendar cal = Calendar.getInstance();
+ int day = -1;
+ results = epgClient.getResults();
+ for (Epg e : results) {
+ cal.setTime(e.getStart());
+ int eday = cal.get(Calendar.DAY_OF_YEAR);
+ if (eday != day) {
+ day = eday;
+ adapter.add(new EventListItem(new DateFormatter(cal)
+ .getDailyHeader()));
+ }
+ adapter.add(new EventListItem(e));
+ }
+ listView.setSelectionAfterHeaderView();
+ if (progress != null) {
+ progress.dismiss();
+ progress = null;
+ }
+ }
+
+ public void svdrpException(final SvdrpException exception) {
+ if (progress != null) {
+ progress.svdrpException(exception);
+ }
+ }
+
+ protected void prepareTimer(final EventListItem item) {
+ final VdrManagerApp app = (VdrManagerApp) getApplication();
+ app.setCurrentEvent(item.getEpg());
+ app.setCurrentEpgList(results);
+ }
+
+ @Override
+ protected int getMainLayout() {
+ return R.layout.search_epg_list;
+ }
+
+ @Override
+ protected void refresh() {
+ startEpgQuery();
+ }
+
+ @Override
+ protected void retry() {
+ startEpgQuery();
+ }
+
+ @Override
+ protected int getWindowTitle() {
+ return R.string.epg_by_search;
+ }
+
+ @Override
+ public boolean onSearchRequested() {
+ startSearchManager();
+ return true;
+ }
+
+}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java
index 78e5dc6..98adbb9 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java
@@ -9,6 +9,7 @@ import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextUtils;
import android.text.style.ForegroundColorSpan;
+import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -26,15 +27,16 @@ import de.bjusystems.vdrmanager.data.EventListItem;
abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
Filterable {
- private static final ForegroundColorSpan HIGHLIGHT = new ForegroundColorSpan(
- Color.RED);
-
protected final int layout;
protected final LayoutInflater inflater;
protected final List<EventListItem> items = new ArrayList<EventListItem>();
+ protected boolean hideDescription = true;
+
protected boolean hideChannelName = false;
+ String highlight;
+
public EventAdapter(final Context context, int layout) {
super(context, layout);
this.layout = layout;
@@ -47,8 +49,6 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
super.add(object);
}
- private String highlight;
-
@Override
public View getView(final int position, final View convertView,
final ViewGroup parent) {
@@ -76,6 +76,8 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
.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();
@@ -96,7 +98,7 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
itemHolder.progress.setVisibility(View.GONE);
itemHolder.shortText.setVisibility(View.GONE);
itemHolder.duration.setVisibility(View.GONE);
-
+ itemHolder.description.setVisibility(View.GONE);
} else {
view.setBackgroundColor(Color.BLACK);
@@ -130,12 +132,22 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
itemHolder.channel.setText(item.getChannelName());
}
-
- CharSequence title = highlight(formatter.getTitle(), highlight);
- CharSequence shortText = highlight(formatter.getShortText(), highlight);
-
+ CharSequence title = Utils.highlight(formatter.getTitle(),
+ highlight);
+ CharSequence shortText = Utils.highlight(formatter.getShortText(),
+ highlight);
itemHolder.title.setText(title);
itemHolder.shortText.setText(shortText);
+
+ if (hideDescription == false) {
+ Pair<Boolean, CharSequence> desc = Utils.highlight2(
+ formatter.getDescription(), highlight);
+ if (desc.first == true) {
+ itemHolder.description.setVisibility(View.VISIBLE);
+ itemHolder.description.setText(desc.second);
+ }
+ }
+
int p = Utils.getProgress(item);
if (p == -1) {
itemHolder.progress.setVisibility(View.GONE);
@@ -160,22 +172,6 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
return view;
}
- private CharSequence highlight(String where, String what){
- if(TextUtils.isEmpty(what)){
- return where;
- }
-
- String str = where.toLowerCase();
- int idx = str.indexOf(highlight);
- if(idx == -1){
- return where;
- }
- SpannableString ss = new SpannableString(str);
- ss.setSpan(HIGHLIGHT, idx, idx + highlight.length(),
- Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- return ss;
- }
-
protected EventFormatter getEventFormatter(Event event) {
return new EventFormatter(event);
}
@@ -184,7 +180,23 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
super.add(item);
}
- //TODO implement locking in performFiltering, check the parent class
+ public boolean isHideDescription() {
+ return hideDescription;
+ }
+
+ public void setHideDescription(boolean hideDescription) {
+ this.hideDescription = hideDescription;
+ }
+
+ public boolean isHideChannelName() {
+ return hideChannelName;
+ }
+
+ public void setHideChannelName(boolean hideChannelName) {
+ this.hideChannelName = hideChannelName;
+ }
+
+ // TODO implement locking in performFiltering, check the parent class
//
public Filter getFilter() {
return new Filter() {
@@ -199,8 +211,8 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
ArrayList<EventListItem> result = new ArrayList<EventListItem>();
for (EventListItem event : items) {
if (event.isHeader()) {
- prevHead = event;
- //result.add(event);
+ prevHead = event;
+ // result.add(event);
continue;
}
if (event.getTitle().toLowerCase()
@@ -208,7 +220,7 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements
|| event.getShortText()
.toLowerCase()
.indexOf(String.valueOf(arg0).toLowerCase()) != -1) {
- if(prevHead != null){
+ if (prevHead != null) {
result.add(prevHead);
prevHead = null;
}
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
index 4e0987d..476bdd9 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java
@@ -5,7 +5,10 @@ import java.util.Calendar;
import java.util.Date;
import java.util.List;
+import android.app.SearchManager;
+import android.content.Intent;
import android.os.Bundle;
+import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
@@ -44,7 +47,7 @@ public class EventEpgListActivity extends BaseEpgListActivity implements
Spinner channelSpinner;
ArrayAdapter<Channel> channelSpinnerAdapter;
-
+
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -53,8 +56,8 @@ public class EventEpgListActivity extends BaseEpgListActivity implements
final List<Channel> channels = ChannelClient.getChannels();
// create adapter for channel spinner
- channelSpinnerAdapter = new ArrayAdapter<Channel>(
- this, android.R.layout.simple_spinner_item);
+ channelSpinnerAdapter = new ArrayAdapter<Channel>(this,
+ android.R.layout.simple_spinner_item);
channelSpinnerAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
channelSpinner = (Spinner) findViewById(R.id.epg_list_channel_spinner);
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventListItemHolder.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventListItemHolder.java
index f7086b0..7b9c93b 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventListItemHolder.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventListItemHolder.java
@@ -14,4 +14,5 @@ class EventListItemHolder {
public TextView shortText;
public ProgressBar progress;
public TextView duration;
+ public TextView description;
} \ No newline at end of file
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
index f7d359c..ff51637 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java
@@ -4,11 +4,15 @@ import java.util.Date;
import android.app.Activity;
import android.app.AlertDialog;
-import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
+import android.graphics.Color;
import android.net.Uri;
-
+import android.text.Spannable;
+import android.text.SpannableString;
+import android.text.TextUtils;
+import android.text.style.ForegroundColorSpan;
+import android.util.Pair;
import de.bjusystems.vdrmanager.R;
import de.bjusystems.vdrmanager.data.Channel;
import de.bjusystems.vdrmanager.data.Event;
@@ -16,6 +20,46 @@ import de.bjusystems.vdrmanager.data.Preferences;
public class Utils {
+ public static final ForegroundColorSpan HIGHLIGHT_TEXT = new ForegroundColorSpan(
+ Color.RED);
+
+
+
+ public static CharSequence highlight(String where, String what){
+ if(TextUtils.isEmpty(what)){
+ return where;
+ }
+
+ String str = where.toLowerCase();
+ what = what.toLowerCase();
+ int idx = str.indexOf(what);
+ if(idx == -1){
+ return where;
+ }
+ SpannableString ss = new SpannableString(where);
+ ss.setSpan(HIGHLIGHT_TEXT, idx, idx + what.length(),
+ Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ return ss;
+ }
+
+ public static Pair<Boolean,CharSequence> highlight2(String where, String what){
+ if(TextUtils.isEmpty(what)){
+ return Pair.create(Boolean.FALSE, (CharSequence)where);
+ }
+
+ String str = where.toLowerCase();
+ what = what.toLowerCase();
+ int idx = str.indexOf(what);
+ if(idx == -1){
+ return Pair.create(Boolean.FALSE, (CharSequence)where);
+ }
+ SpannableString ss = new SpannableString(where);
+ ss.setSpan(HIGHLIGHT_TEXT, idx, idx + what.length(),
+ Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
+ return Pair.create(Boolean.TRUE, (CharSequence)ss);
+ }
+
+
public static int getProgress(Date start, Date stop) {
long now = System.currentTimeMillis();
return getProgress(now, start.getTime(), stop.getTime());
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
index 8aa4107..70a56dc 100644
--- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
+++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/VdrManagerActivity.java
@@ -101,7 +101,7 @@ public class VdrManagerActivity extends Activity implements OnClickListener {
startActivity(TimeEpgListActivity.class);
break;
case R.id.action_menu_search:
- startActivity(EpgSearchActivity.class);
+ onSearchRequested();
break;
case R.id.action_menu_wakeup:
final AsyncWakeupTask wakeupTask = new AsyncWakeupTask(this);
@@ -117,6 +117,5 @@ public class VdrManagerActivity extends Activity implements OnClickListener {
//appData.putBoolean(SearchableActivity.JARGON, true);
startSearch(null, false, appData, false);
return true;
-
}
}