Skip to content

Commit

Permalink
Search library and lazy load images in lists
Browse files Browse the repository at this point in the history
* search CLI command implemented
* List are optimized to enable smooth scrolling and flinging. Most importantly they lazy load images.
  • Loading branch information
kaaholst committed Jan 30, 2011
1 parent 6532639 commit 278ea97
Show file tree
Hide file tree
Showing 55 changed files with 1,446 additions and 718 deletions.
2 changes: 2 additions & 0 deletions AndroidManifest.xml
Expand Up @@ -22,6 +22,7 @@
</activity>

<activity android:name=".SettingsActivity" android:label="@string/activity_settings_name" />
<activity android:name=".SqueezerSearchActivity" android:label="@string/app_name" />
<activity android:name=".SqueezerHomeActivity" android:label="@string/app_name" />
<activity android:name=".SqueezerMusicActivity" android:label="@string/app_name" />
<activity android:name=".SqueezerRandomplayActivity" android:label="@string/app_name" />
Expand All @@ -31,6 +32,7 @@
<activity android:name=".itemlists.SqueezerYearListActivity" android:label="@string/app_name" />
<activity android:name=".itemlists.SqueezerGenreListActivity" android:label="@string/app_name" />
<activity android:name=".itemlists.SqueezerSongListActivity" android:label="@string/app_name" />
<activity android:name=".itemlists.SqueezerCurrentPlaylistActivity" android:label="@string/app_name" />

<service android:exported="false" android:label="Squeezer Service"
android:name="com.danga.squeezer.SqueezeService">
Expand Down
Binary file added res/drawable/icon_search.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions res/layout/audio_player_common.xml
Expand Up @@ -16,12 +16,12 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android">

<View
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#ffffffff" />

<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff5a5a5a"
android:paddingTop="1px"
Expand Down Expand Up @@ -79,7 +79,7 @@
<SeekBar android:id="@+id/seekbar"
android:background="#ff5a5a5a"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="36px"
android:paddingLeft="5px"
android:paddingRight="5px"
Expand Down
16 changes: 8 additions & 8 deletions res/layout/filter_dialog.xml
Expand Up @@ -2,37 +2,37 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
android:layout_width="match_parent"
android:layout_height="match_parent" >
<EditText
android:id="@+id/search_string"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
<Spinner
android:id="@+id/genre_spinner"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:prompt="@string/genre_prompt"
/>
<Spinner
android:id="@+id/year_spinner"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:prompt="@string/year_prompt"
/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageButton android:id="@+id/button_filter"
android:src="@drawable/icon_filter"
android:layout_width="118dip"
android:layout_width="wrap_content"
android:layout_height="54dip"
android:layout_weight="1" />
<ImageButton android:id="@+id/button_cancel"
android:src="@android:drawable/ic_menu_close_clear_cancel"
android:layout_width="118dip"
android:layout_width="wrap_content"
android:layout_height="54dip"
android:layout_weight="1" />
</LinearLayout>
Expand Down
28 changes: 28 additions & 0 deletions res/layout/group_item.xml
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="40px"
android:paddingRight="10px"
android:paddingTop="8px"
android:paddingBottom="8px"
>
<ImageView
android:id="@+id/icon"
android:layout_width="32px"
android:layout_height="32px"
android:maxWidth="32px"
android:minWidth="32px"
android:maxHeight="32px"
android:minHeight="32px"
/>
<TextView
android:id="@+id/label"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
</LinearLayout>
2 changes: 1 addition & 1 deletion res/layout/icon_large_row_layout.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="10px"
Expand Down
2 changes: 1 addition & 1 deletion res/layout/icon_small_row_layout.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="10px"
Expand Down
4 changes: 2 additions & 2 deletions res/layout/icon_two_line_layout.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="10px"
Expand All @@ -17,7 +17,7 @@
android:maxHeight="40px"
android:minHeight="40px"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
Expand Down
26 changes: 20 additions & 6 deletions res/layout/item_list.xml
@@ -1,7 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<ListView android:id="@+id/item_list"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fastScrollEnabled="true"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<ListView android:id="@+id/item_list"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fastScrollEnabled="true"
/>
<TextView
android:id="@+id/loading_label"
android:text="@string/loading_text"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

</LinearLayout>
4 changes: 2 additions & 2 deletions res/layout/list_item.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"
/>
18 changes: 9 additions & 9 deletions res/layout/main.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/root_layout"
>

<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:orientation="horizontal"
Expand Down Expand Up @@ -70,7 +70,7 @@

</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"
Expand All @@ -90,13 +90,13 @@
android:ellipsize="end"
android:textStyle="bold"
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</LinearLayout>

<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"
Expand All @@ -115,13 +115,13 @@
android:singleLine="true"
android:ellipsize="end"
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</LinearLayout>

<LinearLayout
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:baselineAligned="false"
Expand All @@ -140,7 +140,7 @@
android:singleLine="true"
android:ellipsize="end"
android:layout_gravity="center_vertical"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

</LinearLayout>
Expand Down
45 changes: 45 additions & 0 deletions res/layout/search_layout.xml
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
android:id="@+id/search_instructions_text"
android:text="@string/search_instructions_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<EditText
android:id="@+id/search_input"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<ImageButton
android:id="@+id/search_button"
android:src="@drawable/icon_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
</LinearLayout>
<ExpandableListView
android:id="@+id/search_expandable_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fastScrollEnabled="true"
/>
<TextView
android:id="@+id/loading_label"
android:text="@string/loading_text"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>

</LinearLayout>
15 changes: 15 additions & 0 deletions res/menu/searchmenu.xml
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu_item_main"
android:title="@string/menu_item_main" android:icon="@drawable/icon_music"
/>
<item
android:id="@+id/menu_item_home"
android:title="@string/menu_item_home" android:icon="@drawable/icon_home"
/>
<item
android:id="@+id/menu_item_fetch_all"
android:title="@string/menu_item_fetch_all" android:icon="@android:drawable/stat_sys_download"
/>
</menu>
5 changes: 3 additions & 2 deletions res/values-da/strings.xml
Expand Up @@ -25,9 +25,10 @@
<string name="connecting_to_text">Forbinder til SqueezeBox CLI på %s</string>
<string name="connection_failed_text">Forbindelse mislykkedes. Kontrollér indstillingerne.</string>
<string name="disconnected_text">Afbrudt.</string>
<string name="search_instructions_text">Angiv kunster, album, genre eller titel.</string>
<string name="loading_text">Henter...</string>
<string name="browse_items_text">Viser %d %s</string>
<string name="browse_max_items_text">Viser %d ud af i alt %d %s</string>
<string name="browse_items_text">Viser %2$d %1$s</string>
<string name="browse_max_items_text">Viser %2$d ud af i alt %3$d %1$s</string>
<string name="choose_albums_sort_order">Vælg rækkefølge af album</string>
<string name="genre_prompt">Vælg genre</string>
<string name="year_prompt">Vælg år</string>
Expand Down
5 changes: 3 additions & 2 deletions res/values/strings.xml
Expand Up @@ -25,9 +25,10 @@
<string name="connecting_to_text">Connecting to SqueezeBox CLI at %s</string>
<string name="connection_failed_text">Connection failed. Check settings.</string>
<string name="disconnected_text">Disconnected.</string>
<string name="search_instructions_text">Enter artist, album, genre or song title.</string>
<string name="loading_text">Loading...</string>
<string name="browse_items_text">Browse %2d %1s</string>
<string name="browse_max_items_text">Browse %2d of a total %3d %1s</string>
<string name="browse_items_text" >Browse %2$d %1$s</string>
<string name="browse_max_items_text">Browse %2$d of a total %3$d %1$s</string>
<string name="choose_albums_sort_order">Choose ordering of albums</string>
<string name="genre_prompt">Choose genre</string>
<string name="year_prompt">Choose year</string>
Expand Down

0 comments on commit 278ea97

Please sign in to comment.