diff options
Diffstat (limited to 'vdrmanager')
20 files changed, 1135 insertions, 235 deletions
diff --git a/vdrmanager/AndroidManifest.xml b/vdrmanager/AndroidManifest.xml index 7d8d9d1..cfff86a 100644 --- a/vdrmanager/AndroidManifest.xml +++ b/vdrmanager/AndroidManifest.xml @@ -1,9 +1,9 @@ <?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.4b" - android:versionCode="024"> + package="de.bjusystems.vdrmanager" android:versionName="0.2.6b" + android:versionCode="026"> <application android:icon="@drawable/app_logo" - android:label="@string/app_name" android:debuggable="false" + android:label="@string/app_name" android:debuggable="true" android:name=".app.VdrManagerApp"> <activity android:label="@string/app_name" android:name=".gui.VdrManagerActivity" android:configChanges="locale"> <intent-filter> @@ -81,7 +81,9 @@ </activity> <activity android:name=".gui.EpgSearchTimesListActivity" android:configChanges="orientation|locale"/> - + + <activity android:name=".gui.VdrListActivity" android:configChanges="orientation|locale"/> + <activity android:name=".gui.VdrPreferencesActivity" android:configChanges="orientation|locale"/> <provider android:name=".data.db.DataProvider" android:authorities="de.bjusystems.vdrmanager.provider" /> diff --git a/vdrmanager/res/xml/preferences.xml b/vdrmanager/res/xml/preferences.xml index 001b2f9..a24ecaa 100644 --- a/vdrmanager/res/xml/preferences.xml +++ b/vdrmanager/res/xml/preferences.xml @@ -1,138 +1,258 @@ <?xml version="1.0" encoding="utf-8"?> -<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> - - <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" - android:title="@string/vdr_port_title" android:summary="@string/vdr_port_summary" - android:defaultValue="@string/vdr_port_default" /> - <EditTextPreference android:key="@string/vdr_password_key" - android:title="@string/vdr_password_title" android:summary="@string/vdr_password_summary" - 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> - - - <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> - - <PreferenceCategory android:title="@string/wakeup_preferences" - android:key="wakeup_preferences"> - <CheckBoxPreference android:key="@string/wakeup_enabled_key" - android:title="@string/wakeup_enabled_title" android:summary="@string/wakeup_enabled_summary" /> - <ListPreference android:key="@string/wakeup_method_key" - android:title="@string/wakeup_method_title" android:summary="@string/wakeup_method_summary" - android:entries="@array/wakeup_methods" android:entryValues="@array/wakeup_methods_values" - android:defaultValue="@string/default_wakeup_method" - android:dependency="@string/wakeup_enabled_key" /> - <EditTextPreference android:key="@string/wakeup_url_key" - android:title="@string/wakeup_url_title" android:summary="@string/wakeup_url_summary" - android:dependency="@string/wakeup_enabled_key" /> - <EditTextPreference android:key="@string/wakeup_user_key" - android:title="@string/wakeup_user_title" android:summary="@string/wakeup_user_summary" - android:dependency="@string/wakeup_enabled_key" /> - <EditTextPreference android:key="@string/wakeup_password_key" - android:password="true" - android:title="@string/wakeup_password_title" android:summary="@string/wakeup_password_summary" - android:dependency="@string/wakeup_enabled_key" /> - <EditTextPreference android:key="@string/wakeup_wol_mac_key" - android:title="@string/wakeup_wol_mac_title" android:summary="@string/wakeup_wol_mac_summary" - android:dependency="@string/wakeup_enabled_key" /> - <EditTextPreference android:key="@string/wakeup_wol_custom_broadcast_key" - android:title="@string/wakeup_wol_custom_boradcast_title" - android:summaryOn="@string/wakeup_wol_custom_boradcast_summary" - android:dependency="@string/wakeup_enabled_key" android:defaultValue="255.255.255.255" /> - </PreferenceCategory> - - <PreferenceCategory android:title="@string/timer_preferences" - android:key="timer_preferences"> - <EditTextPreference android:key="@string/timer_pre_start_buffer_key" - android:title="@string/timer_pre_start_buffer_title" android:summary="@string/timer_pre_start_buffer_summary" - android:defaultValue="5" /> - <EditTextPreference android:key="@string/timer_post_end_buffer_key" - android:title="@string/timer_post_end_buffer_title" android:summary="@string/timer_post_end_buffer_summary" - android:defaultValue="30" /> - <EditTextPreference android:key="@string/timer_default_lifetime_key" - android:title="@string/timer_default_lifetime_title" android:summary="@string/timer_default_lifetime_summary" - android:defaultValue="99" /> - <EditTextPreference android:key="@string/timer_default_priority_key" - android:title="@string/timer_default_priority_title" android:summary="@string/timer_default_priority_summary" - android:defaultValue="50" /> - </PreferenceCategory> - <PreferenceCategory android:title="@string/gui_preferences" - android:key="gui_preferences"> - <CheckBoxPreference android:key="@string/gui_channels_show_channel_numbers_key" - android:title="@string/gui_channels_show_channel_numbers_title" - android:summary="@string/gui_channels_show_channel_numbers_summary" - android:defaultValue="false" /> - <CheckBoxPreference android:key="@string/gui_enable_24h_format_key" - 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_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_values" android:entryValues="@array/imdb_urls" - android:dependency="@string/qui_show_imdb_button_key" - 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"> - <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" /> - - - </PreferenceCategory> - -</PreferenceScreen> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > + + <PreferenceScreen + android:summary="Define one or more VDR Devices. (comming soon)" + android:title="VDR Devices" android:enabled="false"> + + <intent + android:action="android.intent.action.MAIN" + android:targetClass="de.bjusystems.vdrmanager.gui.VdrPreferencesActivity" + android:targetPackage="de.bjusystems.vdrmanager" /> + </PreferenceScreen> + + <PreferenceCategory + android:key="vdr_preferences" + android:title="@string/vdr_preferences" > + + <EditTextPreference + android:key="@string/vdr_host_key" + android:summary="@string/vdr_host_summary" + android:title="@string/vdr_host_title" /> + + <EditTextPreference + android:defaultValue="@string/vdr_port_default" + android:key="@string/vdr_port_key" + android:summary="@string/vdr_port_summary" + android:title="@string/vdr_port_title" /> + + <EditTextPreference + android:key="@string/vdr_password_key" + android:password="true" + android:summary="@string/vdr_password_summary" + android:title="@string/vdr_password_title" /> + + <CheckBoxPreference + android:key="@string/vdr_ssl_key" + android:summary="@string/vdr_ssl_summary" + android:title="@string/vdr_ssl_title" android:enabled="false" /> + + <PreferenceScreen android:title="Advanced" > + + <EditTextPreference + android:defaultValue="10" + android:inputType="number" + android:key="@string/vdr_conntimeout_key" + android:summary="@string/vdr_conntimeout_sum" + android:title="@string/vdr_conntimeout_title" /> + + <EditTextPreference + android:defaultValue="10" + android:inputType="number" + android:key="@string/vdr_readtimeout_key" + android:summary="@string/vdr_readtimeout_sum" + android:title="@string/vdr_readtimeout_title" /> + + <EditTextPreference + android:defaultValue="120" + android:inputType="number" + android:key="@string/vdr_timeout_key" + android:summary="@string/vdr_timeout_sum" + android:title="@string/vdr_timeout_title" /> + </PreferenceScreen> + </PreferenceCategory> + + <PreferenceCategory + android:key="filter_preferences" + android:title="@string/channel_filter_preferences" > + + <CheckBoxPreference + android:key="@string/channel_filter_filter_key" + android:summary="@string/channel_filter_filter_summary" + android:title="@string/channel_filter_filter_title" /> + + <EditTextPreference + android:defaultValue="1" + android:dependency="@string/channel_filter_filter_key" + android:key="@string/channel_filter_last_key" + android:summary="@string/channel_filter_last_summary" + android:title="@string/channel_filter_last_title" /> + </PreferenceCategory> + + <PreferenceCategory + android:key="wakeup_preferences" + android:title="@string/wakeup_preferences" > + + <CheckBoxPreference + android:key="@string/wakeup_enabled_key" + android:summary="@string/wakeup_enabled_summary" + android:title="@string/wakeup_enabled_title" /> + + <ListPreference + android:defaultValue="@string/default_wakeup_method" + android:dependency="@string/wakeup_enabled_key" + android:entries="@array/wakeup_methods" + android:entryValues="@array/wakeup_methods_values" + android:key="@string/wakeup_method_key" + android:summary="@string/wakeup_method_summary" + android:title="@string/wakeup_method_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_url_key" + android:summary="@string/wakeup_url_summary" + android:title="@string/wakeup_url_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_user_key" + android:summary="@string/wakeup_user_summary" + android:title="@string/wakeup_user_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_password_key" + android:password="true" + android:summary="@string/wakeup_password_summary" + android:title="@string/wakeup_password_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_wol_mac_key" + android:summary="@string/wakeup_wol_mac_summary" + android:title="@string/wakeup_wol_mac_title" /> + + <EditTextPreference + android:defaultValue="255.255.255.255" + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_wol_custom_broadcast_key" + android:summaryOn="@string/wakeup_wol_custom_boradcast_summary" + android:title="@string/wakeup_wol_custom_boradcast_title" /> + </PreferenceCategory> + + <PreferenceCategory + android:key="timer_preferences" + android:title="@string/timer_preferences" > + + <EditTextPreference + android:defaultValue="5" + android:key="@string/timer_pre_start_buffer_key" + android:summary="@string/timer_pre_start_buffer_summary" + android:title="@string/timer_pre_start_buffer_title" /> + + <EditTextPreference + android:defaultValue="30" + android:key="@string/timer_post_end_buffer_key" + android:summary="@string/timer_post_end_buffer_summary" + android:title="@string/timer_post_end_buffer_title" /> + + <EditTextPreference + android:defaultValue="99" + android:key="@string/timer_default_lifetime_key" + android:summary="@string/timer_default_lifetime_summary" + android:title="@string/timer_default_lifetime_title" /> + + <EditTextPreference + android:defaultValue="50" + android:key="@string/timer_default_priority_key" + android:summary="@string/timer_default_priority_summary" + android:title="@string/timer_default_priority_title" /> + </PreferenceCategory> + + <PreferenceCategory + android:key="gui_preferences" + android:title="@string/gui_preferences" > + + <CheckBoxPreference + android:defaultValue="false" + android:key="@string/gui_channels_show_channel_numbers_key" + android:summary="@string/gui_channels_show_channel_numbers_summary" + android:title="@string/gui_channels_show_channel_numbers_title" /> + + <CheckBoxPreference + android:key="@string/gui_enable_24h_format_key" + android:summaryOff="@string/gui_enable_24h_format_summary_off" + android:summaryOn="@string/gui_enable_24h_format_summary_on" + android:title="@string/gui_enable_24h_format_title" /> + + <CheckBoxPreference + android:defaultValue="true" + android:key="@string/qui_show_imdb_button_key" + android:summaryOff="@string/qui_show_imdb_button_summary_off" + android:summaryOn="@string/qui_show_imdb_button_summary_on" + android:title="@string/qui_show_imdb_button_title" /> + + <ListPreference + android:defaultValue="akas.imdb.com" + android:dependency="@string/qui_show_imdb_button_key" + android:entries="@array/imdb_urls_values" + android:entryValues="@array/imdb_urls" + android:key="@string/qui_imdb_url_key" + android:summaryOn="@string/qui_imdb_url_summary" + android:title="@string/qui_imdb_url_title" /> + + <CheckBoxPreference + android:defaultValue="true" + android:key="@string/qui_quit_on_back_key" + android:summaryOff="@string/gui_quit_on_back_summary_off" + android:summaryOn="@string/gui_quit_on_back_summary_on" + android:title="@string/gui_quit_on_back_title" /> + + <ListPreference + android:defaultValue="DEFAULT" + android:entries="@array/lang" + android:entryValues="@array/lang_values" + android:key="@string/gui_custom_locale_key" + android:summary="@string/gui_custom_locale_sum" + android:title="@string/gui_custom_locale_title" /> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/livetv" > + + <EditTextPreference + android:defaultValue="3000" + android:inputType="number" + android:key="streamingport" + android:summary="@string/settings_livetv_port_summary" + android:title="@string/settings_livetv_port" /> + + <EditTextPreference + android:key="@string/streaming_username_key" + android:summary="@string/streaming_username_sum" + android:title="@string/streaming_username_title" /> + + <EditTextPreference + android:password="true" + android:key="@string/streaming_password_key" + android:summary="@string/streaming_password_sum" + android:title="@string/streaming_password_title" /> + + + <ListPreference + android:defaultValue="TS" + android:entries="@array/livetv_streamformat" + android:entryValues="@array/livetv_streamformat_values" + android:key="livetv_streamformat" + android:title="@string/settings_livetv_streamformat" /> + + <CheckBoxPreference + android:key="remux_enable" + android:summary="@string/remux_enable_summary" + android:title="@string/remux_enable_title" /> + + <EditTextPreference + android:defaultValue="EXT" + android:dependency="remux_enable" + android:key="remux_command" + android:summary="@string/remux_command_summary" + android:title="@string/remux_command_title" /> + + <EditTextPreference + android:defaultValue="QUALITY=DSL1000" + android:dependency="remux_enable" + android:key="remux_parameter" + android:summary="@string/remux_parameter_summary" + android:title="@string/remux_parameter_title" /> + </PreferenceCategory> + +</PreferenceScreen>
\ No newline at end of file diff --git a/vdrmanager/res/xml/vdr_prefs.xml b/vdrmanager/res/xml/vdr_prefs.xml new file mode 100644 index 0000000..26be7d1 --- /dev/null +++ b/vdrmanager/res/xml/vdr_prefs.xml @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="utf-8"?> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > + + <PreferenceCategory + android:key="vdr_preferences" + android:title="@string/vdr_preferences" > + + <EditTextPreference + android:key="@string/vdr_host_key" + android:summary="@string/vdr_host_summary" + android:title="@string/vdr_host_title" /> + + <EditTextPreference + android:defaultValue="@string/vdr_port_default" + android:key="@string/vdr_port_key" + android:summary="@string/vdr_port_summary" + android:title="@string/vdr_port_title" /> + + <EditTextPreference + android:key="@string/vdr_password_key" + android:password="true" + android:summary="@string/vdr_password_summary" + android:title="@string/vdr_password_title" /> + + <CheckBoxPreference + android:key="@string/vdr_ssl_key" + android:summary="@string/vdr_ssl_summary" + android:title="@string/vdr_ssl_title" /> + + <PreferenceScreen android:title="Advanced" > + + <EditTextPreference + android:defaultValue="10" + android:inputType="number" + android:key="@string/vdr_conntimeout_key" + android:summary="@string/vdr_conntimeout_sum" + android:title="@string/vdr_conntimeout_title" /> + + <EditTextPreference + android:defaultValue="10" + android:inputType="number" + android:key="@string/vdr_readtimeout_key" + android:summary="@string/vdr_readtimeout_sum" + android:title="@string/vdr_readtimeout_title" /> + + <EditTextPreference + android:defaultValue="120" + android:inputType="number" + android:key="@string/vdr_timeout_key" + android:summary="@string/vdr_timeout_sum" + android:title="@string/vdr_timeout_title" /> + </PreferenceScreen> + </PreferenceCategory> + + <PreferenceCategory + android:key="filter_preferences" + android:title="@string/channel_filter_preferences" > + + <CheckBoxPreference + android:key="@string/channel_filter_filter_key" + android:summary="@string/channel_filter_filter_summary" + android:title="@string/channel_filter_filter_title" /> + + <EditTextPreference + android:defaultValue="1" + android:dependency="@string/channel_filter_filter_key" + android:key="@string/channel_filter_last_key" + android:summary="@string/channel_filter_last_summary" + android:title="@string/channel_filter_last_title" /> + </PreferenceCategory> + + <PreferenceCategory + android:key="wakeup_preferences" + android:title="@string/wakeup_preferences" > + + <CheckBoxPreference + android:key="@string/wakeup_enabled_key" + android:summary="@string/wakeup_enabled_summary" + android:title="@string/wakeup_enabled_title" /> + + <ListPreference + android:defaultValue="@string/default_wakeup_method" + android:dependency="@string/wakeup_enabled_key" + android:entries="@array/wakeup_methods" + android:entryValues="@array/wakeup_methods_values" + android:key="@string/wakeup_method_key" + android:summary="@string/wakeup_method_summary" + android:title="@string/wakeup_method_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_url_key" + android:summary="@string/wakeup_url_summary" + android:title="@string/wakeup_url_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_user_key" + android:summary="@string/wakeup_user_summary" + android:title="@string/wakeup_user_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_password_key" + android:password="true" + android:summary="@string/wakeup_password_summary" + android:title="@string/wakeup_password_title" /> + + <EditTextPreference + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_wol_mac_key" + android:summary="@string/wakeup_wol_mac_summary" + android:title="@string/wakeup_wol_mac_title" /> + + <EditTextPreference + android:defaultValue="255.255.255.255" + android:dependency="@string/wakeup_enabled_key" + android:key="@string/wakeup_wol_custom_broadcast_key" + android:summaryOn="@string/wakeup_wol_custom_boradcast_summary" + android:title="@string/wakeup_wol_custom_boradcast_title" /> + </PreferenceCategory> + + <PreferenceCategory + android:key="timer_preferences" + android:title="@string/timer_preferences" > + + <EditTextPreference + android:defaultValue="5" + android:key="@string/timer_pre_start_buffer_key" + android:summary="@string/timer_pre_start_buffer_summary" + android:title="@string/timer_pre_start_buffer_title" /> + + <EditTextPreference + android:defaultValue="30" + android:key="@string/timer_post_end_buffer_key" + android:summary="@string/timer_post_end_buffer_summary" + android:title="@string/timer_post_end_buffer_title" /> + + <EditTextPreference + android:defaultValue="99" + android:key="@string/timer_default_lifetime_key" + android:summary="@string/timer_default_lifetime_summary" + android:title="@string/timer_default_lifetime_title" /> + + <EditTextPreference + android:defaultValue="50" + android:key="@string/timer_default_priority_key" + android:summary="@string/timer_default_priority_summary" + android:title="@string/timer_default_priority_title" /> + </PreferenceCategory> + + <PreferenceCategory android:title="@string/livetv" > + + <EditTextPreference + android:defaultValue="3000" + android:inputType="number" + android:key="streamingport" + android:summary="@string/settings_livetv_port_summary" + android:title="@string/settings_livetv_port" /> + + <EditTextPreference + android:key="@string/streaming_username_key" + android:summary="@string/streaming_username_sum" + android:title="@string/streaming_username_title" /> + + <EditTextPreference + android:key="@string/streaming_password_key" + android:password="true" + android:summary="@string/streaming_password_sum" + android:title="@string/streaming_password_title" /> + + <ListPreference + android:defaultValue="TS" + android:entries="@array/livetv_streamformat" + android:entryValues="@array/livetv_streamformat_values" + android:key="livetv_streamformat" + android:title="@string/settings_livetv_streamformat" /> + + <CheckBoxPreference + android:key="remux_enable" + android:summary="@string/remux_enable_summary" + android:title="@string/remux_enable_title" /> + + <EditTextPreference + android:defaultValue="EXT" + android:dependency="remux_enable" + android:key="remux_command" + android:summary="@string/remux_command_summary" + android:title="@string/remux_command_title" /> + + <EditTextPreference + android:defaultValue="QUALITY=DSL1000" + android:dependency="remux_enable" + android:key="remux_parameter" + android:summary="@string/remux_parameter_summary" + android:title="@string/remux_parameter_title" /> + </PreferenceCategory> + +</PreferenceScreen>
\ No newline at end of file diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java index c4dc2a4..c04b55b 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/app/VdrManagerApp.java @@ -10,6 +10,7 @@ import de.bjusystems.vdrmanager.data.EpgSearchParams; import de.bjusystems.vdrmanager.data.Event; import de.bjusystems.vdrmanager.data.Preferences; import de.bjusystems.vdrmanager.data.Timer; +import de.bjusystems.vdrmanager.data.VDR; public class VdrManagerApp extends Application { @@ -24,6 +25,16 @@ public class VdrManagerApp extends Application { private Timer currentTimer; private Channel currentChannel; + private VDR currentVDR; + + public VDR getCurrentVDR() { + return currentVDR; + } + + public void setCurrentVDR(VDR currentVDR) { + this.currentVDR = currentVDR; + } + private List<Event> currentEpgList = new ArrayList<Event>(); public List<Event> getCurrentEpgList() { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java index f4e788a..de45363 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/Preferences.java @@ -70,6 +70,10 @@ public class Preferences { * @since 0.2 */ private int streamPort = 3000; + + private String streamingUsername = ""; + + private String streamingPassword = ""; /** * Which format to use for streaming @@ -183,6 +187,15 @@ public class Preferences { return showImdbButton; } + + public String getStreamingUsername() { + return streamingUsername; + } + + public String getStreamingPassword() { + return streamingPassword; + } + /** Properties singleton */ private static Preferences thePrefs; @@ -389,7 +402,7 @@ public class Preferences { public int getStreamPort() { return streamPort; } - + /** * Getter for selected streaming format * @@ -571,6 +584,10 @@ public class Preferences { prefs.readTimeout = getInt(context, R.string.vdr_readtimeout_key, 10); prefs.timeout = getInt(context, R.string.vdr_timeout_key, 120); + prefs.streamingUsername = getString(context, R.string.streaming_username_key, ""); + + prefs.streamingPassword = getString(context, R.string.streaming_password_key, ""); + thePrefs = prefs; } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/VDR.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/VDR.java new file mode 100644 index 0000000..05914c7 --- /dev/null +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/VDR.java @@ -0,0 +1,110 @@ +package de.bjusystems.vdrmanager.data; + +public class VDR { + + /** + * Use secure channel + */ + private boolean secure; + + /** SVDRP host name or ip */ + private String host; + + /** SVDRP port */ + private int port; + + /** Password */ + private String password; + + /** should channels be filtered? */ + private boolean filterChannels; + + /** last channel to retrieve */ + private String channelFilter; + + /** Enable remote wakeup */ + private boolean wakeupEnabled; + + /** URL of the wakeup script */ + private String wakeupUrl; + + /** User for wakeup */ + private String wakeupUser; + + /** Password for wakeup */ + private String wakeupPassword; + + /** + * vdr mac for wol + * + * @since 0.2 + */ + private String mac; + + /** + * which wakeup method to use + * + * @since 0.2 + * + */ + private String wakeupMethod; + + /** Check for running VDR is enabled */ + private boolean aliveCheckEnabled; + + /** Intervall for alive test */ + private int aliveCheckInterval; + + /** Buffer before event */ + private int timerPreMargin; + + /** Buffer after event */ + private int timerPostMargin; + + /** Default priority */ + private int timerDefaultPriority; + + /** Default lifetime */ + private int timerDefaultLifetime; + + /** user defined epg search times */ + private String epgSearchTimes; + + /** + * Which port to use for streaming + * + * @since 0.2 + */ + private int streamPort = 3000; + + /** + * Which format to use for streaming + * + * @since 0.2 + */ + private String streamFormat = "TS"; + + /** + * Do not send broadcasts, send directly to the host (router problem) + * + * @since 0.2 + */ + private String wolCustomBroadcast = ""; + + + /** + * Use remux ? + */ + private boolean enableRemux; + + /** + * Remux command + */ + private String remuxCommand; + + /** + * Remux command Parameter + */ + private String remuxParameter; + +} diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/data/db/DataProvider.java b/vdrmanager/src/de/bjusystems/vdrmanager/data/db/DataProvider.java index 23f93d2..95d4fdc 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/data/db/DataProvider.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/data/db/DataProvider.java @@ -67,6 +67,10 @@ public class DataProvider extends ContentProvider { private static final int REMUX_PARAMS = 1; private static final int REMUX_PARAMS_ID = 2; + + private static final int VDR= 3; + + private static final int VDR_ID = 4; // /** Internal id: terms. */ // private static final int TERMS_ID = 2; @@ -114,6 +118,8 @@ public class DataProvider extends ContentProvider { URI_MATCHER = new UriMatcher(UriMatcher.NO_MATCH); URI_MATCHER.addURI(AUTHORITY, "remux_params", REMUX_PARAMS); URI_MATCHER.addURI(AUTHORITY, "remux_params/#", REMUX_PARAMS_ID); + URI_MATCHER.addURI(AUTHORITY, "vdr", VDR); + URI_MATCHER.addURI(AUTHORITY, "vdr/#", VDR_ID); } /** {@link DatabaseHelper}. */ @@ -231,6 +237,170 @@ public class DataProvider extends ContentProvider { } } + + public static final class Vdr { + /** Table name. */ + public static final String TABLE = "vdr"; + /** {@link HashMap} for projection. */ + private static final HashMap<String, String> PROJECTION_MAP; + + /** Index in projection: ID. */ + public static final int INDEX_ID = 0; + /** Index in projection: name of hours group. */ + public static final int INDEX_NAME = 1; + public static final int INDEX_HOST = 2; + public static final int INDEX_PORT = 3; + public static final int INDEX_SECURE = 4; + public static final int INDEX_FILTER_CHANNELS = 5; + public static final int INDEX_CHANNEL_FILTER = 6; + public static final int INDEX_ENABLE_WAKEUP = 7; + public static final int INDEX_WAKEUP_METHOD = 8; + public static final int INDEX_WAKEUP_URL = 9; + public static final int INDEX_WAKEUP_USER = 10; + public static final int INDEX_WAKEUP_PASSWORD = 11; + public static final int INDEX_VDR_MAC = 12; + public static final int INDEX_ENABLE_ALIVE_CHECK = 13; + public static final int INDEX_ALIVE_CHECK_INTERVAL = 14; + public static final int INDEX_TIMER_PRE_MARGIN = 15; + public static final int INDEX_TIMER_POST_MARGIN = 15; + public static final int INDEX_TIMER_DEFAULT_PRIORITY = 16; + public static final int INDEX_TIMER_DEFAULT_LIFETIME = 17; + public static final int INDEX_STREAM_PORT = 18; + public static final int INDEX_STREAM_USERNAME = 19; + public static final int INDEX_STREAM_PASSWORD = 20; + public static final int INDEX_STREAMFORMAT = 21; + public static final int INDEX_WOL_CUSTOM_BROADCAST = 22; + public static final int INDEX_ENABLE_REMUX = 23; + public static final int INDEX_REMUX_PARAMETER = 24; + + + + /** ID. */ + public static final String ID = "_id"; + public static final String HOST = "host"; + public static final String PORT= "port"; + public static final String SECURE = "secure"; + /* + public static final String = ""; + public static final String = ""; + public static final String = ""; + public static final String = ""; + public static final String = ""; + public static final String = ""; + public static final String = ""; + public static final String = ""; + public static final String = ""; + + public static final String = ""; + public static final String = ""; + */ + + + /** Projection used for query. */ + public static final String[] PROJECTION = new String[] {// + ID,// + HOST, PORT, SECURE }; + + /** Content {@link Uri}. */ + public static final Uri CONTENT_URI = Uri.parse("content://" + + AUTHORITY + "/" + TABLE); + /** + * The MIME type of {@link #CONTENT_URI} providing a list. + */ + public static final String CONTENT_TYPE = // . + "vnd.android.cursor.dir/vnd.vdramager.remux_params"; + + /** + * The MIME type of a {@link #CONTENT_URI} single entry. + */ + public static final String CONTENT_ITEM_TYPE = // . + "vnd.android.cursor.item/vnd.vdramager.jobs"; + + static { + PROJECTION_MAP = new HashMap<String, String>(); + for (String s : PROJECTION) { + PROJECTION_MAP.put(s, s); + } + } + + /** + * Get Name for id. + * + * @param cr + * {@link ContentResolver} + * @param id + * id + * @return name + */ + // public static String getName(final ContentResolver cr, final long id) + // { + // final Cursor cursor = cr.query( + // ContentUris.withAppendedId(CONTENT_URI, id), + // new String[] { NAME }, null, null, null); + // String ret = null; + // if (cursor != null && cursor.moveToFirst()) { + // ret = cursor.getString(0); + // } + // if (cursor != null && !cursor.isClosed()) { + // cursor.close(); + // } + // return ret; + // } + + /** + * Create table in {@link SQLiteDatabase}. + * + * @param db + * {@link SQLiteDatabase} + */ + public static void onCreate(final SQLiteDatabase db) { + Log.i(TAG, "create table: " + TABLE); + db.execSQL("DROP TABLE IF EXISTS " + TABLE); + db.execSQL("CREATE TABLE " + TABLE + " (" // . + + ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " // . + + HOST + " TEXT, "// + + PORT + " INTEGER, " + + SECURE +" INTEGER" + + " " + + " " + + + + + + ");");// + } + + /** + * Upgrade table. + * + * @param db + * {@link SQLiteDatabase} + * @param oldVersion + * old version + * @param newVersion + * new version + */ + public static void onUpgrade(final SQLiteDatabase db, + final int oldVersion, final int newVersion) { + Log.w(TAG, "Upgrading table: " + TABLE); + // if(newVersion == 2){ + // final ContentValues[] values = backup(db, TABLE, PROJECTION, + // null); + // onCreate(db); + // reload(db, TABLE, values); + // } else if (newVersion >) + // db.execSQL("DROP INDEX IF EXISTS jobs.canceled_index"); + // db.execSQL("CREATE INDEX canceled_index ON jobs(canceled)"); + // db.execSQL("ALTER TABLE JOBS ADD " + EVENT_ID2 + " LONG"); + } + + /** Default constructor. */ + private Vdr() { + } + } + + + /** * Try to backup fields from table. * diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java index 0318699..57017f7 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java @@ -21,7 +21,7 @@ import de.bjusystems.vdrmanager.utils.svdrp.SvdrpException; public abstract class BaseActivity<Result, T extends ListView> extends Activity implements OnClickListener, SvdrpAsyncListener<Result> { - + public static final String TAG = BaseActivity.class.getName(); public static final int MENU_GROUP_REFRESH = 99; @@ -33,32 +33,33 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity protected ViewFlipper flipper; private Button retry; - + protected SvdrpProgressDialog progress; - - abstract protected int getWindowTitle(); - + + abstract protected String getWindowTitle(); + abstract protected int getMainLayout(); protected void switchNothinFound() { if (flipper == null) { return; } - //say("can not connect..."); - //flipper.setDisplayedChild(1); + // say("can not connect..."); + // flipper.setDisplayedChild(1); } - + protected void switchNoConnection() { if (flipper == null) { return; } - //say("can not connect..."); - //flipper.setDisplayedChild(1); + //TODO check if we are displaying something (results + // say("can not connect..."); + // flipper.setDisplayedChild(1); } protected void initFlipper() { this.flipper = (ViewFlipper) findViewById(R.id.flipper); - retry = (Button) findViewById(R.id.retry_button); + retry = (Button) findViewById(R.id.retry_button); retry.setOnClickListener(this); } @@ -67,23 +68,23 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity retry(); } } - - protected void updateWindowTitle(int topic, int subtopic) { - String title; - title = getString(topic); - if (subtopic != -1) { - title += " > " + getString(subtopic); - } - setTitle(title); - } - - protected void updateWindowTitle(String topic, String subtopic) { - String title = topic; - if (subtopic != null) { - title += " > " + subtopic; - } - setTitle(title); - } +// +// protected void updateWindowTitle(int topic, int subtopic) { +// String title; +// title = getString(topic); +// if (subtopic != -1) { +// title += " > " + getString(subtopic); +// } +// setTitle(title); +// } +// +// protected void updateWindowTitle(String topic, String subtopic) { +// String title = topic; +// if (subtopic != null) { +// title += " > " + subtopic; +// } +// setTitle(title); +// } @Override public boolean onCreateOptionsMenu(final Menu menu) { @@ -215,10 +216,10 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity cacheHit(); return; case FINISHED_SUCCESS: - if (finishedSuccess() == false) { - say(R.string.epg_no_items); - } else { + if (finishedSuccess()) { restoreViewSelection(); + } else { + say(R.string.epg_no_items); } break; case RESULT_RECEIVED: @@ -242,7 +243,7 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity protected abstract void resultReceived(Result result); protected void connected() { - + } public void svdrpException(final SvdrpException exception) { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java index 22be292..a433e64 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseEventListActivity.java @@ -329,7 +329,7 @@ public abstract class BaseEventListActivity<T extends Event> extends abstract protected boolean finishedSuccessImpl(); protected final boolean finishedSuccess() { - setTitle(getString(R.string.epg_window_title_count, getString(getWindowTitle()), results.size())); + setTitle(getString(R.string.epg_window_title_count, getWindowTitle(), results.size())); return finishedSuccessImpl(); } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BasePreferencesActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BasePreferencesActivity.java new file mode 100644 index 0000000..ced04c7 --- /dev/null +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BasePreferencesActivity.java @@ -0,0 +1,188 @@ +package de.bjusystems.vdrmanager.gui; + +import android.preference.DialogPreference; +import android.preference.EditTextPreference; +import android.preference.ListPreference; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.text.TextUtils; +import android.view.inputmethod.EditorInfo; +import android.widget.EditText; +import de.bjusystems.vdrmanager.R; + +/** + * + * Basis class for PreferencesActivities with some goodies in it + * @author lado + * + */ +public abstract class BasePreferencesActivity extends PreferenceActivity { + + protected void updateSummary(Preference ep) { + if (ep instanceof EditTextPreference) { + updateSummary((EditTextPreference) ep); + } else if (ep instanceof ListPreference) { + updateSummary((ListPreference) ep); + } + } + + /** + * If text set add it to the summary + * + * @param ep + */ + protected void updateSummary(EditTextPreference ep) { + String text = ep.getText(); + if (text == null) { + return; + } + + if(isPassword(ep.getEditText())){ + text = text.replaceAll(".", "*"); + } + + setSummary(text, ep); + } + + protected boolean isPassword(EditText et){ + if((et.getInputType() & EditorInfo.TYPE_TEXT_VARIATION_PASSWORD) == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD){ + return true; + } + return false; + } + + protected void setSummary(CharSequence text, DialogPreference ep){ + 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(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 { + sum = sum + " " + + getString(R.string.prefs_current_value_template, text); + } + ep.setSummary(sum); + } + + protected void updateSummary(ListPreference ep) { + CharSequence text = ep.getEntry(); + + if (text == null) { + return; + } + setSummary(text, ep); + } + + /** + * <p> + * Gets the substring before the last occurrence of a separator. The + * separator is not returned. + * </p> + * + * <p> + * A <code>null</code> string input will return <code>null</code>. An empty + * ("") string input will return the empty string. An empty or + * <code>null</code> separator will return the input string. + * </p> + * + * <pre> + * StringUtils.substringBeforeLast(null, *) = null + * StringUtils.substringBeforeLast("", *) = "" + * StringUtils.substringBeforeLast("abcba", "b") = "abc" + * StringUtils.substringBeforeLast("abc", "c") = "ab" + * StringUtils.substringBeforeLast("a", "a") = "" + * StringUtils.substringBeforeLast("a", "z") = "a" + * StringUtils.substringBeforeLast("a", null) = "a" + * StringUtils.substringBeforeLast("a", "") = "a" + * </pre> + * + * @param str + * the String to get a substring from, may be null + * @param separator + * the String to search for, may be null + * @return the substring before the last occurrence of the separator, + * <code>null</code> if null String input + * @since 2.0 + */ + public static String substringBeforeLast(String str, String separator) { + if (isEmpty(str) || isEmpty(separator)) { + return str; + } + int pos = str.lastIndexOf(separator); + if (pos == -1) { + return str; + } + return str.substring(0, pos); + } + + // Empty checks + // ----------------------------------------------------------------------- + /** + * <p> + * Checks if a String is empty ("") or null. + * </p> + * + * <pre> + * StringUtils.isEmpty(null) = true + * StringUtils.isEmpty("") = true + * StringUtils.isEmpty(" ") = false + * StringUtils.isEmpty("bob") = false + * StringUtils.isEmpty(" bob ") = false + * </pre> + * + * <p> + * NOTE: This method changed in Lang version 2.0. It no longer trims the + * String. That functionality is available in isBlank(). + * </p> + * + * @param str + * the String to check, may be null + * @return <code>true</code> if the String is empty or null + */ + public static boolean isEmpty(String str) { + return str == null || str.length() == 0; + } + + /** + * <p> + * Checks if a String is whitespace, empty ("") or null. + * </p> + * + * <pre> + * StringUtils.isBlank(null) = true + * StringUtils.isBlank("") = true + * StringUtils.isBlank(" ") = true + * StringUtils.isBlank("bob") = false + * StringUtils.isBlank(" bob ") = false + * </pre> + * + * @param str + * the String to check, may be null + * @return <code>true</code> if the String is null, empty or whitespace + * @since 2.0 + */ + public static boolean isBlank(String str) { + int strLen; + if (str == null || (strLen = str.length()) == 0) { + return true; + } + for (int i = 0; i < strLen; i++) { + if ((Character.isWhitespace(str.charAt(i)) == false)) { + return false; + } + } + return true; + } + +} diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java index fff74a9..69d31fd 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelAdapter.java @@ -5,7 +5,6 @@ import java.util.HashMap; import java.util.Map; import android.content.Context; -import android.graphics.Color; import android.util.Pair; import android.view.LayoutInflater; import android.view.View; @@ -91,7 +90,7 @@ class ChannelAdapter extends BaseExpandableListAdapter implements Filterable// , itemHolder = (ChannelHolder) view.getTag(); } - view.setBackgroundColor(Color.BLACK); + //view.setBackgroundColor(Color.BLACK); CharSequence name = item.getName(); name = Utils.highlight(String.valueOf(name), channelFilter); @@ -158,6 +157,7 @@ class ChannelAdapter extends BaseExpandableListAdapter implements Filterable// , } itemHolder.name.setText(groupDisplay); itemHolder.aux.setText(String.valueOf(channelCount)); + return view; } diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java index b320ace..77ec58b 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/ChannelListActivity.java @@ -8,6 +8,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.Bundle; +import android.text.TextUtils; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; @@ -118,13 +119,12 @@ public class ChannelListActivity extends case MENU_GROUP: ArrayList<String> cgs = ChannelClient.getChannelGroups(); adapter.fill(cgs, ChannelClient.getGroupChannels(), groupBy); - if (cgs.size() == 1) { + if (cgs.size() == 1 ) {//one group or first no first group + listView.expandGroup(0); + } else if ((cgs.size() > 1 && TextUtils.isEmpty(cgs.get(0)))){ listView.expandGroup(0); } - updateWindowTitle( - getString(R.string.action_menu_channels), - getString(R.string.groupby_window_title_templte, - getString(R.string.groupby_group))); + updateWindowTitle(); break; case MENU_PROVIDER: ArrayList<String> gs = new ArrayList<String>(ChannelClient @@ -133,10 +133,7 @@ public class ChannelListActivity extends if (gs.size() == 1) { listView.expandGroup(0); } - updateWindowTitle( - getString(R.string.action_menu_channels), - getString(R.string.groupby_window_title_templte, - getString(R.string.groupby_provider))); + updateWindowTitle(); break; case MENU_NAME: if (ALL_CHANNELS_GROUP.isEmpty()) { @@ -149,10 +146,7 @@ public class ChannelListActivity extends ChannelClient.getChannels()); adapter.fill(ALL_CHANNELS_GROUP, channels, groupBy); listView.expandGroup(0); - - updateWindowTitle(R.string.action_menu_channels, - R.string.groupby_name_all_channels_group); - break; + updateWindowTitle(); } } @@ -330,12 +324,31 @@ public class ChannelListActivity extends return R.layout.channel_list; } + private String resolveWindowTitle(){ + StringBuilder sb = new StringBuilder(); + switch(groupBy){ + case MENU_NAME: + sb.append(getString(R.string.action_menu_channels)).append(" > ").append(getString(R.string.groupby_name_all_channels_group)); + break; + case MENU_PROVIDER: + sb.append(getString(R.string.action_menu_channels)).append(" > ").append(getString(R.string.groupby_window_title_templte,getString(R.string.groupby_provider))); + break; + case MENU_GROUP: + sb.append(getString(R.string.action_menu_channels)).append(" > ").append(getString(R.string.groupby_window_title_templte,getString(R.string.groupby_group))); + break; + } + return sb.toString(); + } + + private void updateWindowTitle(){ + setTitle(getString(R.string.channels_window_title_count,resolveWindowTitle(), adapter.groups.size(), ChannelClient.getChannels().size())); + } + @Override protected boolean finishedSuccess() { fillAdapter(); restoreViewSelection(); - setTitle(getString(R.string.channels_window_title_count,getString(getWindowTitle()), ChannelClient.getChannelGroups().size(), ChannelClient.getChannels().size())); - + updateWindowTitle(); return ChannelClient.getChannels().isEmpty() == false; } @@ -349,8 +362,8 @@ public class ChannelListActivity extends } @Override - protected int getWindowTitle() { - return R.string.action_menu_channels; + protected String getWindowTitle() { + return resolveWindowTitle(); } }
\ No newline at end of file diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java index b59b3d3..b7fb8bc 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EpgSearchListActivity.java @@ -90,7 +90,7 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements EpgSearchParams sp = new EpgSearchParams(); sp.setTitle(highlight); - setTitle(getString(R.string.epg_by_search_param, highlight)); + setTitle(getWindowTitle()); epgClient = new EpgClient(sp); // remove old listeners // epgClient.clearSvdrpListener(); @@ -163,8 +163,12 @@ public class EpgSearchListActivity extends BaseTimerEditActivity<Epg> implements } @Override - protected int getWindowTitle() { - return R.string.epg_by_search; + protected String getWindowTitle() { + if(TextUtils.isEmpty(highlight)){ + return getString(R.string.epg_by_search); + } + + return getString(R.string.epg_by_search_param, highlight); } @Override diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java index 96e2e7e..978e344 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventAdapter.java @@ -34,6 +34,15 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements String highlight; + /** + * Lock used to modify the content of {@link #mObjects}. Any write operation + * performed on the array should be synchronized on this lock. This lock is also + * used by the filter (see {@link #getFilter()} to make a synchronized copy of + * the original array of data. + */ + private final Object _Lock = new Object(); + + public EventAdapter(final Context context, int layout) { super(context, layout); this.layout = layout; @@ -224,7 +233,7 @@ abstract class EventAdapter extends ArrayAdapter<EventListItem> implements } // TODO implement locking in performFiltering, check the parent class - // + //http://stackoverflow.com/questions/5846385/how-to-update-android-listview-with-dynamic-data-in-real-time public Filter getFilter() { return new Filter() { /** diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java index c99a8ed..70128cb 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/EventEpgListActivity.java @@ -6,6 +6,7 @@ import java.util.Date; import android.content.Intent; import android.os.Bundle; +import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; @@ -20,6 +21,7 @@ import de.bjusystems.vdrmanager.data.Channel; import de.bjusystems.vdrmanager.data.Epg; import de.bjusystems.vdrmanager.data.Event; import de.bjusystems.vdrmanager.data.EventListItem; +import de.bjusystems.vdrmanager.tasks.ChannelsTask; import de.bjusystems.vdrmanager.utils.date.DateFormatter; import de.bjusystems.vdrmanager.utils.svdrp.ChannelClient; import de.bjusystems.vdrmanager.utils.svdrp.EpgClient; @@ -39,6 +41,8 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements private final static ArrayList<Event> CACHE = new ArrayList<Event>(); + private static final String TAG = EventEpgListActivity.class.getSimpleName(); + protected static Date nextForceCache = null; private static Channel cachedChannel = null; @@ -61,7 +65,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); channelSpinner = (Spinner) findViewById(R.id.epg_list_channel_spinner); channelSpinner.setAdapter(channelSpinnerAdapter); - channelSpinner.setOnItemSelectedListener(this); + switcher = findViewById(R.id.switch_epg_view); switcher.setOnClickListener(this); @@ -88,7 +92,26 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements // register EPG item click listView.setOnItemClickListener(this); - startEpgQuery(); + + + new ChannelsTask(this, new ChannelClient()){ + public void finished(SvdrpEvent event) { + if (event == SvdrpEvent.CACHE_HIT + || event == SvdrpEvent.FINISHED_SUCCESS) { + ArrayList<Channel> channels = ChannelClient.getChannels(); + for (final Channel c : channels) { + channelSpinnerAdapter.add(c); + } + currentChannel = getApp().getCurrentChannel(); + if(currentChannel != null){ + channelSpinner.setSelection(currentChannel.getNumber() - 1); + } + channelSpinner.setOnItemSelectedListener(EventEpgListActivity.this); + } else { + noConnection(event); + } + }}.start(); + } // private void ensureChannelList() { @@ -101,6 +124,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements @Override protected void onResume() { super.onResume(); + Log.d(TAG, "onResume()"); //backupViewSelection(); //startEpgQuery(); // @@ -108,15 +132,14 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { - + Log.d(TAG, "onItemSelected()"); // get spinner value final Channel channel = (Channel) channelSpinner.getSelectedItem(); currentChannel = channel; setCurrent(channel); // setAsCurrent(channel); // update search - startEpgQuery(); - + startEpgQueryImpl(false); } // class LoadChannelsTask extends AsyncProgressTask<Channel> { @@ -144,6 +167,7 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements // } public void onNothingSelected(final AdapterView<?> arg0) { + Log.d(TAG, "onNothingSelected()"); // startTimeEpgQuery(((EpgTimeSpinnerValue)timeSpinner.getAdapter().getItem(0)).getValue()); } @@ -168,15 +192,6 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements return true; } - // - - //private void startEpgQuery(boolean force) { - //startEpgQuery(force); - //} - - synchronized private void startEpgQuery() { - startEpgQuery(false); - } @Override public void onClick(View view) { @@ -191,20 +206,28 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements } } - private void startEpgQuery(boolean force) { + private void startEpgQuery(final boolean force) { + if(true){ + startEpgQueryImpl(force); + } + Log.d(TAG, "startEpgQuery, " + force); try { ChannelClient client = new ChannelClient(); + client.addSvdrpListener(new SvdrpListener<Channel>() { public void svdrpEvent(SvdrpEvent event, Channel result) { if (event == SvdrpEvent.CACHE_HIT || event == SvdrpEvent.FINISHED_SUCCESS) { - ArrayList<Channel> channels = ChannelClient - .getChannels(); + channelSpinnerAdapter.clear(); + ArrayList<Channel> channels = ChannelClient.getChannels(); for (final Channel c : channels) { channelSpinnerAdapter.add(c); } + // startEpgQueryImpl(force); + } else { + noConnection(event); } - noConnection(event); + } }); client.run(); @@ -212,19 +235,21 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements svdrpException(ex); return; } - if(currentChannel == null && ChannelClient.getChannels().isEmpty() == false){ - currentChannel = ChannelClient.getChannels().get(0); - setCurrent(currentChannel); - } - if(currentChannel != null){ - startEpgQueryImpl(force); - } + //if(currentChannel == null && ChannelClient.getChannels().isEmpty() == false){ + //currentChannel = ChannelClient.getChannels().get(0); + //setCurrent(currentChannel); + //} + + //if(currentChannel != null){ + + //} } - synchronized private void startEpgQueryImpl(boolean force) { + private void startEpgQueryImpl(boolean force) { + Log.d(TAG,"startEpgQueryImpl"); if (useCache() && !force) { Calendar cal = Calendar.getInstance(); @@ -324,8 +349,8 @@ public class EventEpgListActivity extends BaseTimerEditActivity<Epg> implements } @Override - protected int getWindowTitle() { - return R.string.epg_by_channel; + protected String getWindowTitle() { + return getString(R.string.epg_by_channel); } private void nextEvent() { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java index 9974721..4ddca83 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/RecordingListActivity.java @@ -159,8 +159,8 @@ public class RecordingListActivity extends BaseEventListActivity<Recording> } @Override - protected int getWindowTitle() { - return R.string.action_menu_recordings; + protected String getWindowTitle() { + return getString(R.string.action_menu_recordings); } @Override diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java index 5746170..72c2fb0 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimeEpgListActivity.java @@ -151,11 +151,23 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements counter++; } timeSpinner.setSelection(select); - setTitle(getString(R.string.epg_by_time_args, tm)); + setTitle(resolveWindowTitle()); // update search startEpgQuery(time.getValue(), false); } + private String resolveWindowTitle() { + if (timeSpinner == null) { + return getString(R.string.epg_by_time); + } + EpgSearchTimeValue v = (EpgSearchTimeValue) timeSpinner + .getSelectedItem(); + if (v == null) { + return getString(R.string.epg_by_time); + } + return getString(R.string.epg_by_time_args, v.getText()); + } + public void onItemSelected(final AdapterView<?> parent, final View view, final int position, final long id) { @@ -262,7 +274,7 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements if (results.isEmpty()) { return false; } - + adapter.add(new EventListItem(new DateFormatter(results.get(0) .getStart()).getDailyHeader())); @@ -306,8 +318,8 @@ public class TimeEpgListActivity extends BaseTimerEditActivity<Epg> implements } @Override - protected int getWindowTitle() { - return R.string.epg_by_time; + protected String getWindowTitle() { + return resolveWindowTitle(); } private void nextEvent() { diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java index b0c9b46..b9d8ee1 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/TimerListActivity.java @@ -137,8 +137,8 @@ public class TimerListActivity extends BaseTimerEditActivity<Timer> implements } @Override - protected int getWindowTitle() { - return R.string.action_menu_timers; + protected String getWindowTitle() { + return getString(R.string.action_menu_timers); } @Override diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java index f22b4e3..1eea3ad 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/Utils.java @@ -100,7 +100,14 @@ public class Utils { // "http://192.168.1.119:3000/TS/" StringBuilder sb = new StringBuilder(); Preferences p = Preferences.getPreferences(); - sb.append("http://").append(p.getSvdrpHost()).append(":") + String auth = p.getStreamingUsername().trim() + ":" + p.getStreamingPassword(); + if(auth.length() == 1){ + auth = ""; + } else { + auth += "@"; + } + + sb.append("http://").append(auth).append(p.getSvdrpHost()).append(":") .append(p.getStreamPort()).append("/") .append(p.getStreamFormat()).append("/").append(chn); return sb.toString(); diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ChannelsTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ChannelsTask.java new file mode 100644 index 0000000..f4a3358 --- /dev/null +++ b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/ChannelsTask.java @@ -0,0 +1,12 @@ +package de.bjusystems.vdrmanager.tasks; + +import android.app.Activity; +import de.bjusystems.vdrmanager.R; +import de.bjusystems.vdrmanager.data.Channel; +import de.bjusystems.vdrmanager.utils.svdrp.ChannelClient; + +public abstract class ChannelsTask extends AsyncProgressTask<Channel> { + public ChannelsTask(final Activity activity, final ChannelClient client) { + super(activity, client); + } +} |