New repeat all, repeat once icons. Hide separators when going offline. Add offline menu item.

This commit is contained in:
Joshua Bahnsen 2013-04-01 23:01:15 -07:00
parent 4e4e12496c
commit e74020bf29
12 changed files with 695 additions and 667 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:a="http://schemas.android.com/apk/res/android"
package="net.sourceforge.subsonic.androidapp"
a:versionCode="64"
a:versionName="3.9.9.23" a:installLocation="auto">
a:versionCode="65"
a:versionName="3.9.9.24" a:installLocation="auto">
<uses-permission a:name="android.permission.INTERNET"/>
<uses-permission a:name="android.permission.READ_PHONE_STATE"/>

View File

@ -73,220 +73,224 @@ public final class R {
public static final int ic_menu_home=0x7f020015;
public static final int ic_menu_moreoverflow=0x7f020016;
public static final int ic_menu_offline=0x7f020017;
public static final int ic_menu_play_all=0x7f020018;
public static final int ic_menu_playlists=0x7f020019;
public static final int ic_menu_refresh=0x7f02001a;
public static final int ic_menu_remove_all=0x7f02001b;
public static final int ic_menu_save=0x7f02001c;
public static final int ic_menu_screen_on_off=0x7f02001d;
public static final int ic_menu_search=0x7f02001e;
public static final int ic_menu_select_artist_folder=0x7f02001f;
public static final int ic_menu_settings=0x7f020020;
public static final int ic_menu_share=0x7f020021;
public static final int ic_menu_shuffle=0x7f020022;
public static final int ic_stat_downloaded=0x7f020023;
public static final int ic_stat_downloading=0x7f020024;
public static final int ic_stat_play=0x7f020025;
public static final int ic_stat_saved=0x7f020026;
public static final int ic_stat_subsonic=0x7f020027;
public static final int list_background=0x7f020028;
public static final int list_focused_holo=0x7f020029;
public static final int list_item_more=0x7f02002a;
public static final int list_longpressed_holo=0x7f02002b;
public static final int list_pressed_holo_dark=0x7f02002c;
public static final int list_pressed_holo_light=0x7f02002d;
public static final int list_selector_background_transition_holo_dark=0x7f02002e;
public static final int list_selector_background_transition_holo_light=0x7f02002f;
public static final int list_selector_disabled_holo_dark=0x7f020030;
public static final int list_selector_disabled_holo_light=0x7f020031;
public static final int list_selector_holo_dark=0x7f020032;
public static final int list_selector_holo_light=0x7f020033;
public static final int main_header_icon=0x7f020034;
public static final int media_backward_normal=0x7f020035;
public static final int media_forward_normal=0x7f020036;
public static final int media_pause_normal=0x7f020037;
public static final int media_repeat_all=0x7f020038;
public static final int media_repeat_off=0x7f020039;
public static final int media_repeat_single=0x7f02003a;
public static final int media_shuffle_normal=0x7f02003b;
public static final int media_start_normal=0x7f02003c;
public static final int media_start_pressed=0x7f02003d;
public static final int media_stop_normal=0x7f02003e;
public static final int media_toggle_list_normal=0x7f02003f;
public static final int menubar_button_disabled=0x7f020040;
public static final int menubar_button_normal=0x7f020041;
public static final int notify_panel_notification_icon_bg=0x7f020042;
public static final int pinstripe_tile=0x7f020043;
public static final int preview=0x7f020044;
public static final int preview_two=0x7f020045;
public static final int progress_bg_holo_dark=0x7f020046;
public static final int progress_horizontal_holo_dark=0x7f020047;
public static final int progress_primary_holo_dark=0x7f020048;
public static final int progress_secondary_holo_dark=0x7f020049;
public static final int select_album_play_all=0x7f02004a;
public static final int select_album_play_all_normal=0x7f02004b;
public static final int select_album_play_all_pressed=0x7f02004c;
public static final int slider_knob=0x7f02004d;
public static final int star=0x7f02004e;
public static final int star_hollow=0x7f02004f;
public static final int status_bg=0x7f020050;
public static final int status_next=0x7f020051;
public static final int status_pause=0x7f020052;
public static final int status_play=0x7f020053;
public static final int status_prev=0x7f020054;
public static final int status_stop=0x7f020055;
public static final int title_bar_shadow=0x7f020056;
public static final int unknown_album=0x7f020057;
public static final int unknown_album_large=0x7f020058;
public static final int ic_menu_offline2=0x7f020018;
public static final int ic_menu_play_all=0x7f020019;
public static final int ic_menu_playlists=0x7f02001a;
public static final int ic_menu_refresh=0x7f02001b;
public static final int ic_menu_remove_all=0x7f02001c;
public static final int ic_menu_save=0x7f02001d;
public static final int ic_menu_screen_on_off=0x7f02001e;
public static final int ic_menu_search=0x7f02001f;
public static final int ic_menu_select_artist_folder=0x7f020020;
public static final int ic_menu_settings=0x7f020021;
public static final int ic_menu_share=0x7f020022;
public static final int ic_menu_shuffle=0x7f020023;
public static final int ic_stat_downloaded=0x7f020024;
public static final int ic_stat_downloading=0x7f020025;
public static final int ic_stat_play=0x7f020026;
public static final int ic_stat_saved=0x7f020027;
public static final int ic_stat_subsonic=0x7f020028;
public static final int list_background=0x7f020029;
public static final int list_focused_holo=0x7f02002a;
public static final int list_item_more=0x7f02002b;
public static final int list_longpressed_holo=0x7f02002c;
public static final int list_pressed_holo_dark=0x7f02002d;
public static final int list_pressed_holo_light=0x7f02002e;
public static final int list_selector_background_transition_holo_dark=0x7f02002f;
public static final int list_selector_background_transition_holo_light=0x7f020030;
public static final int list_selector_disabled_holo_dark=0x7f020031;
public static final int list_selector_disabled_holo_light=0x7f020032;
public static final int list_selector_holo_dark=0x7f020033;
public static final int list_selector_holo_light=0x7f020034;
public static final int main_header_icon=0x7f020035;
public static final int media_backward_normal=0x7f020036;
public static final int media_forward_normal=0x7f020037;
public static final int media_pause_normal=0x7f020038;
public static final int media_repeat_all=0x7f020039;
public static final int media_repeat_off=0x7f02003a;
public static final int media_repeat_single=0x7f02003b;
public static final int media_shuffle_normal=0x7f02003c;
public static final int media_start_normal=0x7f02003d;
public static final int media_start_pressed=0x7f02003e;
public static final int media_stop_normal=0x7f02003f;
public static final int media_toggle_list_normal=0x7f020040;
public static final int menubar_button_disabled=0x7f020041;
public static final int menubar_button_normal=0x7f020042;
public static final int notify_panel_notification_icon_bg=0x7f020043;
public static final int pinstripe_tile=0x7f020044;
public static final int preview=0x7f020045;
public static final int preview_two=0x7f020046;
public static final int progress_bg_holo_dark=0x7f020047;
public static final int progress_horizontal_holo_dark=0x7f020048;
public static final int progress_primary_holo_dark=0x7f020049;
public static final int progress_secondary_holo_dark=0x7f02004a;
public static final int select_album_play_all=0x7f02004b;
public static final int select_album_play_all_normal=0x7f02004c;
public static final int select_album_play_all_pressed=0x7f02004d;
public static final int slider_knob=0x7f02004e;
public static final int star=0x7f02004f;
public static final int star_hollow=0x7f020050;
public static final int status_bg=0x7f020051;
public static final int status_next=0x7f020052;
public static final int status_pause=0x7f020053;
public static final int status_play=0x7f020054;
public static final int status_prev=0x7f020055;
public static final int status_stop=0x7f020056;
public static final int title_bar_shadow=0x7f020057;
public static final int unknown_album=0x7f020058;
public static final int unknown_album_large=0x7f020059;
}
public static final class id {
public static final int album=0x7f0d004d;
public static final int album=0x7f0d004f;
public static final int album_artist=0x7f0d0002;
public static final int album_coverart=0x7f0d0000;
public static final int album_menu_pin=0x7f0d008b;
public static final int album_menu_play_last=0x7f0d008a;
public static final int album_menu_play_now=0x7f0d0089;
public static final int album_menu_pin=0x7f0d008e;
public static final int album_menu_play_last=0x7f0d008d;
public static final int album_menu_play_now=0x7f0d008c;
public static final int album_star=0x7f0d0003;
public static final int album_title=0x7f0d0001;
public static final int appwidget_coverart=0x7f0d0004;
public static final int appwidget_top=0x7f0d0006;
public static final int artist=0x7f0d0008;
public static final int artist_menu_pin=0x7f0d008e;
public static final int artist_menu_play_last=0x7f0d008d;
public static final int artist_menu_play_now=0x7f0d008c;
public static final int artist_menu_pin=0x7f0d0091;
public static final int artist_menu_play_last=0x7f0d0090;
public static final int artist_menu_play_now=0x7f0d008f;
public static final int button_bar=0x7f0d000c;
public static final int button_bar_home=0x7f0d000d;
public static final int button_bar_music=0x7f0d000e;
public static final int button_bar_now_playing=0x7f0d0011;
public static final int button_bar_playlists=0x7f0d0010;
public static final int button_bar_now_playing=0x7f0d0013;
public static final int button_bar_playlists=0x7f0d0011;
public static final int button_bar_playlists_separator=0x7f0d0012;
public static final int button_bar_search=0x7f0d000f;
public static final int button_bar_search_separator=0x7f0d0010;
public static final int control_next=0x7f0d000b;
public static final int control_play=0x7f0d000a;
public static final int control_previous=0x7f0d0009;
public static final int control_stop=0x7f0d004e;
public static final int download_album=0x7f0d0025;
public static final int download_album_art_image=0x7f0d001f;
public static final int download_album_art_layout=0x7f0d001e;
public static final int download_artist=0x7f0d0024;
public static final int download_button_bar_flipper=0x7f0d0021;
public static final int download_control_layout=0x7f0d0012;
public static final int download_duration=0x7f0d0023;
public static final int download_empty=0x7f0d0026;
public static final int download_equalizer=0x7f0d007f;
public static final int download_jukebox=0x7f0d0081;
public static final int download_list=0x7f0d0027;
public static final int download_next=0x7f0d0018;
public static final int download_pause=0x7f0d0015;
public static final int download_playlist_flipper=0x7f0d001d;
public static final int download_position=0x7f0d0022;
public static final int download_previous=0x7f0d0014;
public static final int download_progress_bar=0x7f0d0028;
public static final int download_repeat=0x7f0d0019;
public static final int download_shuffle=0x7f0d0013;
public static final int download_song_title=0x7f0d001c;
public static final int download_start=0x7f0d0017;
public static final int download_status=0x7f0d001b;
public static final int download_stop=0x7f0d0016;
public static final int download_toggle_list=0x7f0d001a;
public static final int download_visualizer=0x7f0d0080;
public static final int download_visualizer_view_layout=0x7f0d0020;
public static final int equalizer_bar=0x7f0d002e;
public static final int equalizer_frequency=0x7f0d002c;
public static final int equalizer_level=0x7f0d002d;
public static final int equalizer_enabled=0x7f0d0029;
public static final int equalizer_layout=0x7f0d002a;
public static final int equalizer_preset=0x7f0d002b;
public static final int help_back=0x7f0d0030;
public static final int help_buttons=0x7f0d002f;
public static final int help_close=0x7f0d0031;
public static final int help_contents=0x7f0d0032;
public static final int icon=0x7f0d0074;
public static final int jukebox_volume_progress_bar=0x7f0d0034;
public static final int control_stop=0x7f0d0050;
public static final int download_album=0x7f0d0027;
public static final int download_album_art_image=0x7f0d0021;
public static final int download_album_art_layout=0x7f0d0020;
public static final int download_artist=0x7f0d0026;
public static final int download_button_bar_flipper=0x7f0d0023;
public static final int download_control_layout=0x7f0d0014;
public static final int download_duration=0x7f0d0025;
public static final int download_empty=0x7f0d0028;
public static final int download_equalizer=0x7f0d0082;
public static final int download_jukebox=0x7f0d0084;
public static final int download_list=0x7f0d0029;
public static final int download_next=0x7f0d001a;
public static final int download_pause=0x7f0d0017;
public static final int download_playlist_flipper=0x7f0d001f;
public static final int download_position=0x7f0d0024;
public static final int download_previous=0x7f0d0016;
public static final int download_progress_bar=0x7f0d002a;
public static final int download_repeat=0x7f0d001b;
public static final int download_shuffle=0x7f0d0015;
public static final int download_song_title=0x7f0d001e;
public static final int download_start=0x7f0d0019;
public static final int download_status=0x7f0d001d;
public static final int download_stop=0x7f0d0018;
public static final int download_toggle_list=0x7f0d001c;
public static final int download_visualizer=0x7f0d0083;
public static final int download_visualizer_view_layout=0x7f0d0022;
public static final int equalizer_bar=0x7f0d0030;
public static final int equalizer_frequency=0x7f0d002e;
public static final int equalizer_level=0x7f0d002f;
public static final int equalizer_enabled=0x7f0d002b;
public static final int equalizer_layout=0x7f0d002c;
public static final int equalizer_preset=0x7f0d002d;
public static final int help_back=0x7f0d0032;
public static final int help_buttons=0x7f0d0031;
public static final int help_close=0x7f0d0033;
public static final int help_contents=0x7f0d0034;
public static final int icon=0x7f0d0076;
public static final int jukebox_volume_progress_bar=0x7f0d0036;
public static final int linearLayout1=0x7f0d0005;
public static final int lyrics_artist=0x7f0d0036;
public static final int lyrics_scrollview=0x7f0d0035;
public static final int lyrics_text=0x7f0d0038;
public static final int lyrics_title=0x7f0d0037;
public static final int main_select_server_1=0x7f0d003c;
public static final int main_select_server_2=0x7f0d003d;
public static final int main_albums=0x7f0d0040;
public static final int main_albums_alphaByArtist=0x7f0d0048;
public static final int main_albums_alphaByName=0x7f0d0047;
public static final int main_albums_frequent=0x7f0d0043;
public static final int main_albums_highest=0x7f0d0044;
public static final int main_albums_newest=0x7f0d0041;
public static final int main_albums_random=0x7f0d0045;
public static final int main_albums_recent=0x7f0d0042;
public static final int main_albums_starred=0x7f0d0046;
public static final int main_dummy=0x7f0d003a;
public static final int main_list=0x7f0d0039;
public static final int main_select_server=0x7f0d003b;
public static final int main_shuffle=0x7f0d007e;
public static final int main_songs=0x7f0d003e;
public static final int main_songs_starred=0x7f0d003f;
public static final int menu_exit=0x7f0d007d;
public static final int menu_help=0x7f0d007c;
public static final int menu_lyrics=0x7f0d0086;
public static final int menu_refresh=0x7f0d008f;
public static final int menu_remove=0x7f0d0087;
public static final int menu_remove_all=0x7f0d0083;
public static final int menu_save_playlist=0x7f0d0082;
public static final int menu_screen_on_off=0x7f0d0084;
public static final int menu_settings=0x7f0d007b;
public static final int menu_show_album=0x7f0d0085;
public static final int menu_shuffle=0x7f0d0088;
public static final int notification_image=0x7f0d004a;
public static final int play_video_contents=0x7f0d004f;
public static final int progress_message=0x7f0d0050;
public static final int save_playlist_name=0x7f0d0052;
public static final int save_playlist_root=0x7f0d0051;
public static final int search_albums=0x7f0d0056;
public static final int search_artists=0x7f0d0055;
public static final int search_list=0x7f0d0053;
public static final int search_more_albums=0x7f0d0059;
public static final int search_more_artists=0x7f0d0058;
public static final int search_more_songs=0x7f0d005a;
public static final int search_search=0x7f0d0054;
public static final int search_songs=0x7f0d0057;
public static final int select_album_cover_art=0x7f0d0064;
public static final int select_album_delete=0x7f0d0062;
public static final int select_album_empty=0x7f0d005b;
public static final int select_album_entries=0x7f0d005c;
public static final int select_album_more=0x7f0d0063;
public static final int select_album_pin=0x7f0d0060;
public static final int select_album_play_all=0x7f0d0067;
public static final int select_album_play_last=0x7f0d005f;
public static final int select_album_play_now=0x7f0d005e;
public static final int select_album_select=0x7f0d005d;
public static final int select_album_text1=0x7f0d0065;
public static final int select_album_text2=0x7f0d0066;
public static final int select_album_unpin=0x7f0d0061;
public static final int select_artist_folder=0x7f0d0069;
public static final int select_artist_folder_1=0x7f0d006a;
public static final int select_artist_folder_2=0x7f0d006b;
public static final int select_artist_list=0x7f0d0068;
public static final int select_playlist_empty=0x7f0d006c;
public static final int select_playlist_list=0x7f0d006d;
public static final int song_artist=0x7f0d0071;
public static final int song_check=0x7f0d006e;
public static final int song_duration=0x7f0d0072;
public static final int song_menu_play_last=0x7f0d0092;
public static final int song_menu_play_next=0x7f0d0091;
public static final int song_menu_play_now=0x7f0d0090;
public static final int song_star=0x7f0d0073;
public static final int song_status=0x7f0d0070;
public static final int song_title=0x7f0d006f;
public static final int status_icon=0x7f0d004b;
public static final int status_media_collapse=0x7f0d0078;
public static final int status_media_next=0x7f0d0077;
public static final int status_media_play=0x7f0d0076;
public static final int status_media_prev=0x7f0d0075;
public static final int statusbar=0x7f0d0049;
public static final int tab_progress=0x7f0d0079;
public static final int tab_progress_message=0x7f0d007a;
public static final int lyrics_artist=0x7f0d0038;
public static final int lyrics_scrollview=0x7f0d0037;
public static final int lyrics_text=0x7f0d003a;
public static final int lyrics_title=0x7f0d0039;
public static final int main_select_server_1=0x7f0d003e;
public static final int main_select_server_2=0x7f0d003f;
public static final int main_albums=0x7f0d0042;
public static final int main_albums_alphaByArtist=0x7f0d004a;
public static final int main_albums_alphaByName=0x7f0d0049;
public static final int main_albums_frequent=0x7f0d0045;
public static final int main_albums_highest=0x7f0d0046;
public static final int main_albums_newest=0x7f0d0043;
public static final int main_albums_random=0x7f0d0047;
public static final int main_albums_recent=0x7f0d0044;
public static final int main_albums_starred=0x7f0d0048;
public static final int main_dummy=0x7f0d003c;
public static final int main_list=0x7f0d003b;
public static final int main_offline=0x7f0d0081;
public static final int main_select_server=0x7f0d003d;
public static final int main_shuffle=0x7f0d0080;
public static final int main_songs=0x7f0d0040;
public static final int main_songs_starred=0x7f0d0041;
public static final int menu_exit=0x7f0d007f;
public static final int menu_help=0x7f0d007e;
public static final int menu_lyrics=0x7f0d0089;
public static final int menu_refresh=0x7f0d0092;
public static final int menu_remove=0x7f0d008a;
public static final int menu_remove_all=0x7f0d0086;
public static final int menu_save_playlist=0x7f0d0085;
public static final int menu_screen_on_off=0x7f0d0087;
public static final int menu_settings=0x7f0d007d;
public static final int menu_show_album=0x7f0d0088;
public static final int menu_shuffle=0x7f0d008b;
public static final int notification_image=0x7f0d004c;
public static final int play_video_contents=0x7f0d0051;
public static final int progress_message=0x7f0d0052;
public static final int save_playlist_name=0x7f0d0054;
public static final int save_playlist_root=0x7f0d0053;
public static final int search_albums=0x7f0d0058;
public static final int search_artists=0x7f0d0057;
public static final int search_list=0x7f0d0055;
public static final int search_more_albums=0x7f0d005b;
public static final int search_more_artists=0x7f0d005a;
public static final int search_more_songs=0x7f0d005c;
public static final int search_search=0x7f0d0056;
public static final int search_songs=0x7f0d0059;
public static final int select_album_cover_art=0x7f0d0066;
public static final int select_album_delete=0x7f0d0064;
public static final int select_album_empty=0x7f0d005d;
public static final int select_album_entries=0x7f0d005e;
public static final int select_album_more=0x7f0d0065;
public static final int select_album_pin=0x7f0d0062;
public static final int select_album_play_all=0x7f0d0069;
public static final int select_album_play_last=0x7f0d0061;
public static final int select_album_play_now=0x7f0d0060;
public static final int select_album_select=0x7f0d005f;
public static final int select_album_text1=0x7f0d0067;
public static final int select_album_text2=0x7f0d0068;
public static final int select_album_unpin=0x7f0d0063;
public static final int select_artist_folder=0x7f0d006b;
public static final int select_artist_folder_1=0x7f0d006c;
public static final int select_artist_folder_2=0x7f0d006d;
public static final int select_artist_list=0x7f0d006a;
public static final int select_playlist_empty=0x7f0d006e;
public static final int select_playlist_list=0x7f0d006f;
public static final int song_artist=0x7f0d0073;
public static final int song_check=0x7f0d0070;
public static final int song_duration=0x7f0d0074;
public static final int song_menu_play_last=0x7f0d0095;
public static final int song_menu_play_next=0x7f0d0094;
public static final int song_menu_play_now=0x7f0d0093;
public static final int song_star=0x7f0d0075;
public static final int song_status=0x7f0d0072;
public static final int song_title=0x7f0d0071;
public static final int status_icon=0x7f0d004d;
public static final int status_media_collapse=0x7f0d007a;
public static final int status_media_next=0x7f0d0079;
public static final int status_media_play=0x7f0d0078;
public static final int status_media_prev=0x7f0d0077;
public static final int statusbar=0x7f0d004b;
public static final int tab_progress=0x7f0d007b;
public static final int tab_progress_message=0x7f0d007c;
public static final int title=0x7f0d0007;
public static final int toast_layout_root=0x7f0d0033;
public static final int trackname=0x7f0d004c;
public static final int toast_layout_root=0x7f0d0035;
public static final int trackname=0x7f0d004e;
}
public static final class integer {
public static final int config_activityDefaultDur=0x7f080001;
@ -328,13 +332,14 @@ public final class R {
public static final class menu {
public static final int common=0x7f0c0000;
public static final int main=0x7f0c0001;
public static final int nowplaying=0x7f0c0002;
public static final int nowplaying_context=0x7f0c0003;
public static final int select_album=0x7f0c0004;
public static final int select_album_context=0x7f0c0005;
public static final int select_artist_context=0x7f0c0006;
public static final int select_common=0x7f0c0007;
public static final int select_song_context=0x7f0c0008;
public static final int main_offline=0x7f0c0002;
public static final int nowplaying=0x7f0c0003;
public static final int nowplaying_context=0x7f0c0004;
public static final int select_album=0x7f0c0005;
public static final int select_album_context=0x7f0c0006;
public static final int select_artist_context=0x7f0c0007;
public static final int select_common=0x7f0c0008;
public static final int select_song_context=0x7f0c0009;
}
public static final class plurals {
public static final int select_album_donate_dialog_n_trial_days_left=0x7f0a0003;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/button_bar" a:orientation="vertical" a:layout_gravity="bottom"
a:layout_width="fill_parent" a:layout_height="wrap_content"
a:background="@drawable/menubar_button_normal">
<LinearLayout a:orientation="horizontal" a:layout_width="fill_parent"
a:layout_height="48dp" a:gravity="center_horizontal" a:background="@drawable/menubar_button_normal">
<ImageButton a:id="@+id/button_bar_home" a:layout_width="0dp"
a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.home"
a:src="@drawable/ic_menu_home" />
<View a:layout_width="1dp" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_music" a:layout_width="0dp"
a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.browse"
a:src="@drawable/ic_menu_browse" />
<View a:layout_width="1dp" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_search" a:layout_width="0dp"
a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.search"
a:src="@drawable/ic_menu_search" />
<View a:layout_width="1dp" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_playlists"
a:layout_width="0dp" a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.playlists"
a:src="@drawable/ic_menu_playlists" />
<View a:layout_width="1dp" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_now_playing"
a:layout_width="0dp" a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.now_playing"
a:src="@drawable/ic_menu_play_all" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:a="http://schemas.android.com/apk/res/android"
a:id="@+id/button_bar" a:orientation="vertical" a:layout_gravity="bottom"
a:layout_width="fill_parent" a:layout_height="wrap_content"
a:background="@drawable/menubar_button_normal">
<LinearLayout a:orientation="horizontal" a:layout_width="fill_parent"
a:layout_height="48dp" a:gravity="center_horizontal" a:background="@drawable/menubar_button_normal">
<ImageButton a:id="@+id/button_bar_home" a:layout_width="0dp"
a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.home"
a:src="@drawable/ic_menu_home" />
<View a:layout_width="1dp" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_music" a:layout_width="0dp"
a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.browse"
a:src="@drawable/ic_menu_browse" />
<View a:layout_width="1dp" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_search" a:layout_width="0dp"
a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.search"
a:src="@drawable/ic_menu_search" />
<View a:layout_width="1dp" a:id="@+id/button_bar_search_separator" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_playlists"
a:layout_width="0dp" a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.playlists"
a:src="@drawable/ic_menu_playlists" />
<View a:layout_width="1dp" a:id="@+id/button_bar_playlists_separator" a:layout_height="fill_parent"
a:layout_marginBottom="5dp" a:layout_marginTop="8dp" a:layout_weight="0.01"
a:background="@drawable/bg_separator" />
<ImageButton a:id="@+id/button_bar_now_playing"
a:layout_width="0dp" a:layout_height="match_parent" a:layout_weight="1"
a:background="@drawable/buttonbar_selector" a:contentDescription="@string/button_bar.now_playing"
a:src="@drawable/ic_menu_play_all" />
</LinearLayout>
</LinearLayout>

View File

@ -1,114 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/statusbar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/notification_image"
android:layout_width="64.0dip"
android:layout_height="64.0dip"
android:layout_weight="0.0"
android:gravity="center" />
<ImageView
android:id="@+id/status_icon"
android:layout_width="64.0dip"
android:layout_height="64.0dip"
android:background="@drawable/status_bg"
android:scaleType="center"
android:visibility="gone" />
<LinearLayout
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1.0"
android:orientation="vertical"
android:paddingLeft="11.0dip" >
<TextView
android:id="@+id/trackname"
style="@android:style/TextAppearance.StatusBar.EventContent.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:ellipsize="marquee"
android:focusable="true"
android:singleLine="true" />
<TextView
android:id="@+id/artist"
style="@android:style/TextAppearance.StatusBar.EventContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:ellipsize="end"
android:scrollHorizontally="true"
android:singleLine="true" />
<TextView
android:id="@+id/album"
style="@android:style/TextAppearance.StatusBar.EventContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:ellipsize="end"
android:scrollHorizontally="true"
android:singleLine="true" />
</LinearLayout>
<ImageButton
android:id="@+id/control_previous"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_prev" />
<ImageButton
android:id="@+id/control_play"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_pause" />
<ImageButton
android:id="@+id/control_stop"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_stop" />
<ImageButton
android:id="@+id/control_next"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_next" />
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/statusbar"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/notification_image"
android:layout_width="64.0dip"
android:layout_height="64.0dip"
android:layout_weight="0.0"
android:gravity="center" />
<ImageView
android:id="@+id/status_icon"
android:layout_width="64.0dip"
android:layout_height="64.0dip"
android:background="@drawable/status_bg"
android:scaleType="center"
android:visibility="gone" />
<LinearLayout
android:layout_width="0.0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1.0"
android:orientation="vertical"
android:paddingLeft="11.0dip">
<TextView
android:id="@+id/trackname"
style="@android:style/TextAppearance.StatusBar.EventContent.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:ellipsize="marquee"
android:focusable="true"
android:singleLine="true" />
<TextView
android:id="@+id/artist"
style="@android:style/TextAppearance.StatusBar.EventContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:ellipsize="end"
android:scrollHorizontally="true"
android:singleLine="true" />
<TextView
android:id="@+id/album"
style="@android:style/TextAppearance.StatusBar.EventContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:ellipsize="end"
android:scrollHorizontally="true"
android:singleLine="true" />
</LinearLayout>
<ImageButton
android:id="@+id/control_previous"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_prev" />
<ImageButton
android:id="@+id/control_play"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_pause" />
<ImageButton
android:id="@+id/control_stop"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_stop" />
<ImageButton
android:id="@+id/control_next"
android:layout_width="40dip"
android:layout_height="40dip"
android:layout_gravity="center|right"
android:layout_marginRight="5dip"
android:layout_marginTop="2dip"
android:layout_weight="0.0"
android:background="@drawable/btn_bg"
android:src="@drawable/status_next" />
</LinearLayout>
</LinearLayout>

10
res/menu/main_offline.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:a="http://schemas.android.com/apk/res/android" >
<item
a:id="@+id/main_offline"
a:icon="@drawable/ic_menu_offline2"
a:showAsAction="ifRoom|withText"
a:title="@string/main.offline"/>
</menu>

View File

@ -1,300 +1,306 @@
/*
This file is part of Subsonic.
Subsonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Subsonic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2009 (C) Sindre Mehus
*/
package net.sourceforge.subsonic.androidapp.activity;
import java.util.Arrays;
import net.sourceforge.subsonic.androidapp.R;
import net.sourceforge.subsonic.androidapp.service.DownloadService;
import net.sourceforge.subsonic.androidapp.service.DownloadServiceImpl;
import net.sourceforge.subsonic.androidapp.util.Constants;
import net.sourceforge.subsonic.androidapp.util.MergeAdapter;
import net.sourceforge.subsonic.androidapp.util.Util;
import net.sourceforge.subsonic.androidapp.util.FileUtil;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends SubsonicTabActivity {
private static final int MENU_GROUP_SERVER = 10;
private static final int MENU_ITEM_SERVER_1 = 101;
private static final int MENU_ITEM_SERVER_2 = 102;
private static final int MENU_ITEM_SERVER_3 = 103;
private static final int MENU_ITEM_OFFLINE = 104;
private String theme;
private static boolean infoDialogDisplayed;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_EXIT)) {
exit();
return;
}
setContentView(R.layout.main);
loadSettings();
View buttons = LayoutInflater.from(this).inflate(R.layout.main_buttons, null);
final View serverButton = buttons.findViewById(R.id.main_select_server);
final TextView serverTextView = (TextView) serverButton.findViewById(R.id.main_select_server_2);
final View albumsTitle = buttons.findViewById(R.id.main_albums);
final View songsTitle = buttons.findViewById(R.id.main_songs);
final View albumsNewestButton = buttons.findViewById(R.id.main_albums_newest);
final View albumsRandomButton = buttons.findViewById(R.id.main_albums_random);
final View albumsHighestButton = buttons.findViewById(R.id.main_albums_highest);
final View albumsStarredButton = buttons.findViewById(R.id.main_albums_starred);
final View albumsRecentButton = buttons.findViewById(R.id.main_albums_recent);
final View albumsFrequentButton = buttons.findViewById(R.id.main_albums_frequent);
final View albumsAlphaByNameButton = buttons.findViewById(R.id.main_albums_alphaByName);
final View albumsAlphaByArtistButton = buttons.findViewById(R.id.main_albums_alphaByArtist);
final View songsStarredButton = buttons.findViewById(R.id.main_songs_starred);
final View dummyView = findViewById(R.id.main_dummy);
int instance = Util.getActiveServer(this);
String name = Util.getServerName(this, instance);
serverTextView.setText(name);
ListView list = (ListView) findViewById(R.id.main_list);
list.setOnTouchListener(gestureListener);
MergeAdapter adapter = new MergeAdapter();
adapter.addViews(Arrays.asList(serverButton), true);
if (!Util.isOffline(this)) {
adapter.addView(songsTitle, false);
adapter.addViews(Arrays.asList(songsStarredButton), true);
adapter.addView(albumsTitle, false);
adapter.addViews(Arrays.asList(albumsNewestButton, albumsRecentButton, albumsFrequentButton, albumsHighestButton, albumsRandomButton, albumsStarredButton, albumsAlphaByNameButton, albumsAlphaByArtistButton), true);
}
list.setAdapter(adapter);
registerForContextMenu(dummyView);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (view == serverButton) {
dummyView.showContextMenu();
} else if (view == albumsNewestButton) {
showAlbumList("newest");
} else if (view == albumsRandomButton) {
showAlbumList("random");
} else if (view == albumsHighestButton) {
showAlbumList("highest");
} else if (view == albumsRecentButton) {
showAlbumList("recent");
} else if (view == albumsFrequentButton) {
showAlbumList("frequent");
} else if (view == albumsStarredButton) {
showAlbumList("starred");
} else if (view == albumsAlphaByNameButton) {
showAlbumList("alphabeticalByName");
} else if (view == albumsAlphaByArtistButton) {
showAlbumList("alphabeticalByArtist");
} else if (view == songsStarredButton) {
showStarredSongs();
}
}
});
// Title: Subsonic
setTitle(R.string.common_appname);
// Remember the current theme.
theme = Util.getTheme(this);
showInfoDialog();
}
private void loadSettings() {
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
SharedPreferences prefs = Util.getPreferences(this);
if (!prefs.contains(Constants.PREFERENCES_KEY_CACHE_LOCATION)) {
SharedPreferences.Editor editor = prefs.edit();
editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory().getPath());
editor.commit();
}
}
@Override
protected void onResume() {
super.onResume();
// Restart activity if theme has changed.
if (theme != null && !theme.equals(Util.getTheme(this))) {
restart();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
super.onCreateOptionsMenu(menu);
return true;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, view, menuInfo);
MenuItem menuItem1 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_1, MENU_ITEM_SERVER_1, Util.getServerName(this, 1));
MenuItem menuItem2 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_2, MENU_ITEM_SERVER_2, Util.getServerName(this, 2));
MenuItem menuItem3 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_3, MENU_ITEM_SERVER_3, Util.getServerName(this, 3));
MenuItem menuItem4 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_OFFLINE, MENU_ITEM_OFFLINE, Util.getServerName(this, 0));
menu.setGroupCheckable(MENU_GROUP_SERVER, true, true);
menu.setHeaderTitle(R.string.main_select_server);
switch (Util.getActiveServer(this)) {
case 0:
menuItem4.setChecked(true);
break;
case 1:
menuItem1.setChecked(true);
break;
case 2:
menuItem2.setChecked(true);
break;
case 3:
menuItem3.setChecked(true);
break;
}
}
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case MENU_ITEM_OFFLINE:
setActiveServer(0);
break;
case MENU_ITEM_SERVER_1:
setActiveServer(1);
break;
case MENU_ITEM_SERVER_2:
setActiveServer(2);
break;
case MENU_ITEM_SERVER_3:
setActiveServer(3);
break;
default:
return super.onContextItemSelected(menuItem);
}
// Restart activity
restart();
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.main_shuffle:
Intent intent1 = new Intent(this, DownloadActivity.class);
intent1.putExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, true);
Util.startActivityWithoutTransition(this, intent1);
return true;
case R.id.menu_exit:
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(Constants.INTENT_EXTRA_NAME_EXIT, true);
Util.startActivityWithoutTransition(this, intent);
return true;
case R.id.menu_settings:
startActivity(new Intent(this, SettingsActivity.class));
return true;
case R.id.menu_help:
startActivity(new Intent(this, HelpActivity.class));
return true;
}
return false;
}
private void setActiveServer(int instance) {
if (Util.getActiveServer(this) != instance) {
DownloadService service = getDownloadService();
if (service != null) {
service.clearIncomplete();
}
Util.setActiveServer(this, instance);
}
}
private void restart() {
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Util.startActivityWithoutTransition(this, intent);
}
private void exit() {
stopService(new Intent(this, DownloadServiceImpl.class));
Util.unregisterMediaButtonEventReceiver(this);
finish();
}
private void showInfoDialog() {
if (!infoDialogDisplayed) {
infoDialogDisplayed = true;
if (Util.getRestUrl(this, null).contains("demo.subsonic.org")) {
Util.info(this, R.string.main_welcome_title, R.string.main_welcome_text);
}
}
}
private void showAlbumList(String type) {
Intent intent = new Intent(this, SelectAlbumActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE, type);
intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, Util.getMaxAlbums(this));
intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0);
Util.startActivityWithoutTransition(this, intent);
}
private void showStarredSongs() {
Intent intent = new Intent(this, SelectAlbumActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_STARRED, 1);
Util.startActivityWithoutTransition(this, intent);
}
/*
This file is part of Subsonic.
Subsonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Subsonic is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2009 (C) Sindre Mehus
*/
package net.sourceforge.subsonic.androidapp.activity;
import java.util.Arrays;
import net.sourceforge.subsonic.androidapp.R;
import net.sourceforge.subsonic.androidapp.service.DownloadService;
import net.sourceforge.subsonic.androidapp.service.DownloadServiceImpl;
import net.sourceforge.subsonic.androidapp.util.Constants;
import net.sourceforge.subsonic.androidapp.util.MergeAdapter;
import net.sourceforge.subsonic.androidapp.util.Util;
import net.sourceforge.subsonic.androidapp.util.FileUtil;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends SubsonicTabActivity {
private static final int MENU_GROUP_SERVER = 10;
private static final int MENU_ITEM_SERVER_1 = 101;
private static final int MENU_ITEM_SERVER_2 = 102;
private static final int MENU_ITEM_SERVER_3 = 103;
private static final int MENU_ITEM_OFFLINE = 104;
private String theme;
private static boolean infoDialogDisplayed;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_EXIT)) {
exit();
return;
}
setContentView(R.layout.main);
loadSettings();
View buttons = LayoutInflater.from(this).inflate(R.layout.main_buttons, null);
final View serverButton = buttons.findViewById(R.id.main_select_server);
final TextView serverTextView = (TextView) serverButton.findViewById(R.id.main_select_server_2);
final View albumsTitle = buttons.findViewById(R.id.main_albums);
final View songsTitle = buttons.findViewById(R.id.main_songs);
final View albumsNewestButton = buttons.findViewById(R.id.main_albums_newest);
final View albumsRandomButton = buttons.findViewById(R.id.main_albums_random);
final View albumsHighestButton = buttons.findViewById(R.id.main_albums_highest);
final View albumsStarredButton = buttons.findViewById(R.id.main_albums_starred);
final View albumsRecentButton = buttons.findViewById(R.id.main_albums_recent);
final View albumsFrequentButton = buttons.findViewById(R.id.main_albums_frequent);
final View albumsAlphaByNameButton = buttons.findViewById(R.id.main_albums_alphaByName);
final View albumsAlphaByArtistButton = buttons.findViewById(R.id.main_albums_alphaByArtist);
final View songsStarredButton = buttons.findViewById(R.id.main_songs_starred);
final View dummyView = findViewById(R.id.main_dummy);
int instance = Util.getActiveServer(this);
String name = Util.getServerName(this, instance);
serverTextView.setText(name);
ListView list = (ListView) findViewById(R.id.main_list);
list.setOnTouchListener(gestureListener);
MergeAdapter adapter = new MergeAdapter();
adapter.addViews(Arrays.asList(serverButton), true);
if (!Util.isOffline(this)) {
adapter.addView(songsTitle, false);
adapter.addViews(Arrays.asList(songsStarredButton), true);
adapter.addView(albumsTitle, false);
adapter.addViews(Arrays.asList(albumsNewestButton, albumsRecentButton, albumsFrequentButton, albumsHighestButton, albumsRandomButton, albumsStarredButton, albumsAlphaByNameButton, albumsAlphaByArtistButton), true);
}
list.setAdapter(adapter);
registerForContextMenu(dummyView);
list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (view == serverButton) {
dummyView.showContextMenu();
} else if (view == albumsNewestButton) {
showAlbumList("newest");
} else if (view == albumsRandomButton) {
showAlbumList("random");
} else if (view == albumsHighestButton) {
showAlbumList("highest");
} else if (view == albumsRecentButton) {
showAlbumList("recent");
} else if (view == albumsFrequentButton) {
showAlbumList("frequent");
} else if (view == albumsStarredButton) {
showAlbumList("starred");
} else if (view == albumsAlphaByNameButton) {
showAlbumList("alphabeticalByName");
} else if (view == albumsAlphaByArtistButton) {
showAlbumList("alphabeticalByArtist");
} else if (view == songsStarredButton) {
showStarredSongs();
}
}
});
// Title: Subsonic
setTitle(R.string.common_appname);
// Remember the current theme.
theme = Util.getTheme(this);
showInfoDialog();
}
private void loadSettings() {
PreferenceManager.setDefaultValues(this, R.xml.settings, false);
SharedPreferences prefs = Util.getPreferences(this);
if (!prefs.contains(Constants.PREFERENCES_KEY_CACHE_LOCATION)) {
SharedPreferences.Editor editor = prefs.edit();
editor.putString(Constants.PREFERENCES_KEY_CACHE_LOCATION, FileUtil.getDefaultMusicDirectory().getPath());
editor.commit();
}
}
@Override
protected void onResume() {
super.onResume();
// Restart activity if theme has changed.
if (theme != null && !theme.equals(Util.getTheme(this))) {
restart();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_offline, menu);
inflater.inflate(R.menu.main, menu);
super.onCreateOptionsMenu(menu);
return true;
}
@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, view, menuInfo);
MenuItem menuItem1 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_1, MENU_ITEM_SERVER_1, Util.getServerName(this, 1));
MenuItem menuItem2 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_2, MENU_ITEM_SERVER_2, Util.getServerName(this, 2));
MenuItem menuItem3 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_SERVER_3, MENU_ITEM_SERVER_3, Util.getServerName(this, 3));
MenuItem menuItem4 = menu.add(MENU_GROUP_SERVER, MENU_ITEM_OFFLINE, MENU_ITEM_OFFLINE, Util.getServerName(this, 0));
menu.setGroupCheckable(MENU_GROUP_SERVER, true, true);
menu.setHeaderTitle(R.string.main_select_server);
switch (Util.getActiveServer(this)) {
case 0:
menuItem4.setChecked(true);
break;
case 1:
menuItem1.setChecked(true);
break;
case 2:
menuItem2.setChecked(true);
break;
case 3:
menuItem3.setChecked(true);
break;
}
}
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
switch (menuItem.getItemId()) {
case MENU_ITEM_OFFLINE:
setActiveServer(0);
break;
case MENU_ITEM_SERVER_1:
setActiveServer(1);
break;
case MENU_ITEM_SERVER_2:
setActiveServer(2);
break;
case MENU_ITEM_SERVER_3:
setActiveServer(3);
break;
default:
return super.onContextItemSelected(menuItem);
}
// Restart activity
restart();
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.main_offline:
setActiveServer(0);
restart();
return true;
case R.id.main_shuffle:
Intent intent1 = new Intent(this, DownloadActivity.class);
intent1.putExtra(Constants.INTENT_EXTRA_NAME_SHUFFLE, true);
Util.startActivityWithoutTransition(this, intent1);
return true;
case R.id.menu_exit:
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(Constants.INTENT_EXTRA_NAME_EXIT, true);
Util.startActivityWithoutTransition(this, intent);
return true;
case R.id.menu_settings:
startActivity(new Intent(this, SettingsActivity.class));
return true;
case R.id.menu_help:
startActivity(new Intent(this, HelpActivity.class));
return true;
}
return false;
}
private void setActiveServer(int instance) {
if (Util.getActiveServer(this) != instance) {
DownloadService service = getDownloadService();
if (service != null) {
service.clearIncomplete();
}
Util.setActiveServer(this, instance);
}
}
private void restart() {
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Util.startActivityWithoutTransition(this, intent);
}
private void exit() {
stopService(new Intent(this, DownloadServiceImpl.class));
Util.unregisterMediaButtonEventReceiver(this);
finish();
}
private void showInfoDialog() {
if (!infoDialogDisplayed) {
infoDialogDisplayed = true;
if (Util.getRestUrl(this, null).contains("demo.subsonic.org")) {
Util.info(this, R.string.main_welcome_title, R.string.main_welcome_text);
}
}
}
private void showAlbumList(String type) {
Intent intent = new Intent(this, SelectAlbumActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_TYPE, type);
intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, Util.getMaxAlbums(this));
intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0);
Util.startActivityWithoutTransition(this, intent);
}
private void showStarredSongs() {
Intent intent = new Intent(this, SelectAlbumActivity.class);
intent.putExtra(Constants.INTENT_EXTRA_NAME_STARRED, 1);
Util.startActivityWithoutTransition(this, intent);
}
}

View File

@ -68,7 +68,9 @@ public class SubsonicTabActivity extends Activity implements OnClickListener{
private View homeButton;
private View musicButton;
private View searchButton;
private View searchSeparator;
private View playlistButton;
private View playlistSeparator;
private View nowPlayingButton;
//private boolean shortPress = false;
@ -132,6 +134,8 @@ public class SubsonicTabActivity extends Activity implements OnClickListener{
}
});
searchSeparator = findViewById(R.id.button_bar_search_separator);
searchButton = findViewById(R.id.button_bar_search);
searchButton.setOnClickListener(new View.OnClickListener() {
@Override
@ -142,6 +146,8 @@ public class SubsonicTabActivity extends Activity implements OnClickListener{
}
});
playlistSeparator = findViewById(R.id.button_bar_playlists_separator);
playlistButton = findViewById(R.id.button_bar_playlists);
playlistButton.setOnClickListener(new View.OnClickListener() {
@Override
@ -265,7 +271,9 @@ public class SubsonicTabActivity extends Activity implements OnClickListener{
private void updateButtonVisibility() {
int visibility = Util.isOffline(this) ? View.GONE : View.VISIBLE;
searchButton.setVisibility(visibility);
searchSeparator.setVisibility(visibility);
playlistButton.setVisibility(visibility);
playlistSeparator.setVisibility(visibility);
}
public void setProgressVisible(boolean visible) {