aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Jackson <daneren2005@gmail.com>2013-11-26 07:21:19 -0800
committerScott Jackson <daneren2005@gmail.com>2013-11-26 07:21:19 -0800
commit433bf25da269aa95646e4479b7716687e95e802e (patch)
tree00adf712d645c03fd9e95b52fdf78ae7e6b853a6
parentbe94e0bbfaa7ff2a23e5aae75e2446855143e49d (diff)
downloaddsub-433bf25da269aa95646e4479b7716687e95e802e.tar.gz
dsub-433bf25da269aa95646e4479b7716687e95e802e.tar.bz2
dsub-433bf25da269aa95646e4479b7716687e95e802e.zip
#191 Fix results not being clickable
-rw-r--r--res/xml/searchable.xml3
-rw-r--r--src/github/daneren2005/dsub/activity/QueryReceiverActivity.java37
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicActivity.java2
-rw-r--r--src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java2
-rw-r--r--src/github/daneren2005/dsub/provider/DSubSearchProvider.java2
5 files changed, 35 insertions, 11 deletions
diff --git a/res/xml/searchable.xml b/res/xml/searchable.xml
index a3713aa3..35ff18f3 100644
--- a/res/xml/searchable.xml
+++ b/res/xml/searchable.xml
@@ -5,5 +5,6 @@
android:voiceSearchMode="showVoiceSearchButton|launchRecognizer"
android:voiceLanguageModel="web_search"
android:searchSuggestAuthority="github.daneren2005.dsub.provider.DSubSearchProvider"
- android:searchSuggestSelection=" ?" >
+ android:searchSuggestSelection=" unused"
+ android:searchSuggestIntentAction="android.intent.action.VIEW">
</searchable> \ No newline at end of file
diff --git a/src/github/daneren2005/dsub/activity/QueryReceiverActivity.java b/src/github/daneren2005/dsub/activity/QueryReceiverActivity.java
index b28d542e..9289397a 100644
--- a/src/github/daneren2005/dsub/activity/QueryReceiverActivity.java
+++ b/src/github/daneren2005/dsub/activity/QueryReceiverActivity.java
@@ -41,15 +41,36 @@ public class QueryReceiverActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- String query = getIntent().getStringExtra(SearchManager.QUERY);
-
- if (query != null) {
- Intent intent = new Intent(QueryReceiverActivity.this, SubsonicFragmentActivity.class);
- intent.putExtra(Constants.INTENT_EXTRA_NAME_QUERY, query);
- intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
- Util.startActivityWithoutTransition(QueryReceiverActivity.this, intent);
- }
+ Intent intent = getIntent();
+ if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
+ doSearch();
+ } else if(Intent.ACTION_VIEW.equals(intent.getAction())) {
+ showResult(intent.getDataString(), intent.getStringExtra(SearchManager.EXTRA_DATA_KEY));
+ }
finish();
Util.disablePendingTransition(this);
}
+
+ private void doSearch() {
+ String query = getIntent().getStringExtra(SearchManager.QUERY);
+ if (query != null) {
+ Intent intent = new Intent(QueryReceiverActivity.this, SubsonicFragmentActivity.class);
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_QUERY, query);
+ intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ Util.startActivityWithoutTransition(QueryReceiverActivity.this, intent);
+ }
+ }
+ private void showResult(String albumId, String name) {
+ if (albumId != null) {
+ Intent intent = new Intent(this, SubsonicFragmentActivity.class);
+ intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ intent.putExtra(Constants.INTENT_EXTRA_VIEW_ALBUM, true);
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_ID, albumId);
+ intent.putExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE, "Artist");
+ if (name != null) {
+ intent.putExtra(Constants.INTENT_EXTRA_NAME_NAME, name);
+ }
+ Util.startActivityWithoutTransition(this, intent);
+ }
+ }
} \ No newline at end of file
diff --git a/src/github/daneren2005/dsub/activity/SubsonicActivity.java b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
index 78ed14f3..944495c9 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicActivity.java
@@ -377,6 +377,8 @@ public class SubsonicActivity extends ActionBarActivity implements OnItemSelecte
SearchFragment fragment = new SearchFragment();
replaceFragment(fragment, currentFragment.getRootId(), fragment.getSupportTag());
+ } else {
+ setIntent(intent);
}
}
diff --git a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
index 6e2a9642..2967dc3a 100644
--- a/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
+++ b/src/github/daneren2005/dsub/activity/SubsonicFragmentActivity.java
@@ -224,7 +224,7 @@ public class SubsonicFragmentActivity extends SubsonicActivity {
};
if(getIntent().hasExtra(Constants.INTENT_EXTRA_VIEW_ALBUM)) {
- int fragmentID = R.id.fragment_list_layout;
+ int fragmentID = currentFragment != null ? currentFragment.getRootId() : R.id.fragment_list_layout;
if(getIntent().hasExtra(Constants.INTENT_EXTRA_NAME_PARENT_ID)) {
SubsonicFragment fragment = new SelectDirectoryFragment();
Bundle args = new Bundle();
diff --git a/src/github/daneren2005/dsub/provider/DSubSearchProvider.java b/src/github/daneren2005/dsub/provider/DSubSearchProvider.java
index b7164cef..eee48357 100644
--- a/src/github/daneren2005/dsub/provider/DSubSearchProvider.java
+++ b/src/github/daneren2005/dsub/provider/DSubSearchProvider.java
@@ -83,7 +83,7 @@ public class DSubSearchProvider extends ContentProvider {
}
for (MusicDirectory.Entry song : searchResult.getSongs()) {
String icon = RESOURCE_PREFIX + R.drawable.ic_action_song;
- cursor.addRow(new Object[]{song.getId(), song.getTitle(), song.getArtist(), song.getParent(), null, icon});
+ cursor.addRow(new Object[]{song.getId(), song.getTitle(), song.getArtist(), song.getParent(), song.getTitle(), icon});
}
return cursor;
}