Skip to content

Commit

Permalink
Added searching functionality across app
Browse files Browse the repository at this point in the history
This required creating a customized view in the database for searching and all the usual provider/activity/view stuff
  • Loading branch information
nperrier committed Dec 10, 2012
1 parent dbb6ad8 commit 09de376
Show file tree
Hide file tree
Showing 12 changed files with 1,006 additions and 91 deletions.
29 changes: 24 additions & 5 deletions AndroidManifest.xml
Expand Up @@ -19,10 +19,15 @@
<uses-permission android:name="android.permission.READ_SYNC_STATS" />

<application
android:allowBackup="false"
android:debuggable="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<meta-data
android:name="android.app.default_searchable"
android:value=".activity.SearchActivity" />

<activity android:name=".activity.LoginActivity" >
</activity>
<activity
Expand All @@ -38,18 +43,31 @@
<activity android:name=".activity.AlbumListFragmentActivity" >
</activity>
<activity android:name=".activity.AlbumActivity" >
</activity>
</activity>
<activity android:name=".activity.ArtistListFragmentActivity" >
</activity>
<activity android:name=".activity.ArtistActivity" >
</activity>
</activity>
<activity android:name=".activity.TrackListFragmentActivity" >
</activity>
<activity android:name=".activity.PlayerActivity" >
</activity>
<activity
android:name=".activity.SearchActivity"
android:exported="false"
android:launchMode="singleTop" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>

<meta-data
android:name="android.app.searchable"
android:resource="@xml/searchable" />
</activity>
<activity
android:name=".activity.SettingsActivity"
android:configChanges="orientation|keyboardHidden" >
android:configChanges="orientation|keyboardHidden"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />

Expand All @@ -60,12 +78,13 @@
<provider
android:name=".data.SocksoProvider"
android:authorities="com.pugh.sockso.android.data.SocksoProvider"
android:exported="true"
android:multiprocess="true" >
</provider>

<service
android:name=".sync.SocksoSyncService"
android:exported="true" >
android:exported="false" >
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
Expand All @@ -77,7 +96,7 @@
</service>
<service
android:name=".account.SocksoAccountAuthenticatorService"
android:exported="true" >
android:exported="false" >
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator" />
</intent-filter>
Expand Down
9 changes: 9 additions & 0 deletions TODO
@@ -1,5 +1,7 @@
TODO List:

* Use layout @include tag to group common views widgits for list items and other layouts

* Implement remaining buttons on player UI:
- Progress bar seeking

Expand All @@ -17,3 +19,10 @@ TODO List:
- How to handle "delete" operations?

* Fix player to pause & resume when system detects a phone call

* Move cover art image retrieval to ContentProvider

* Fix memory issue with loading images in listview while "flinging" (scrolling really fast)

* Implement search functionality

17 changes: 17 additions & 0 deletions res/layout/search_result_list_item.xml
@@ -0,0 +1,17 @@
<?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="wrap_content"
android:gravity="center"
android:minHeight="?android:attr/listPreferredItemHeight"
android:orientation="horizontal" >
<TextView
android:id="@+id/name_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fadingEdge="horizontal"
android:maxLines="2"
android:padding="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>
11 changes: 11 additions & 0 deletions res/layout/search_result_section_header.xml
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/section_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:gravity="center"
android:padding="2dp"
android:textColor="@android:color/black"
android:textSize="18sp"
android:textStyle="bold" />
12 changes: 12 additions & 0 deletions res/layout/search_results.xml
@@ -0,0 +1,12 @@
<?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:orientation="vertical" >

<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>
2 changes: 2 additions & 0 deletions res/values/strings.xml
Expand Up @@ -32,5 +32,7 @@
<string name="menu_library">Library</string>
<string name="menu_player">Player</string>
<string name="player_error">Error playing track</string>
<string name="search_hint">Search artists, albums or tracks</string>
<string name="no_search_results">Nothing found</string>

</resources>
5 changes: 5 additions & 0 deletions res/xml/searchable.xml
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
android:label="@string/app_name"
android:hint="@string/search_hint" >
</searchable>
Expand Up @@ -56,7 +56,7 @@ public static class ArtistCursorAdapter extends SimpleCursorAdapter {

private Context mContext;
private int mLayout;
CoverArtFetcher mCoverFetcher;
private CoverArtFetcher mCoverFetcher;


public ArtistCursorAdapter(Context context, int layout, Cursor cursor, String[] from, int[] to, int flags) {
Expand Down

0 comments on commit 09de376

Please sign in to comment.