diff options
author | Scott Jackson <daneren2005@gmail.com> | 2013-05-07 22:18:02 -0700 |
---|---|---|
committer | Scott Jackson <daneren2005@gmail.com> | 2013-05-07 22:18:02 -0700 |
commit | 5f8ea76c42aac4bc1b5689a0c2a1c5d022280553 (patch) | |
tree | 6aadb3e39eb4e61c7e034978a2ecbce0b82bc594 /subsonic-android/src | |
parent | ce8f467cebc86240422ae8bb555f008e6f237bfa (diff) | |
download | dsub-5f8ea76c42aac4bc1b5689a0c2a1c5d022280553.tar.gz dsub-5f8ea76c42aac4bc1b5689a0c2a1c5d022280553.tar.bz2 dsub-5f8ea76c42aac4bc1b5689a0c2a1c5d022280553.zip |
Fix orientation changing for search activity
Diffstat (limited to 'subsonic-android/src')
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java | 23 | ||||
-rw-r--r-- | subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java | 8 |
2 files changed, 22 insertions, 9 deletions
diff --git a/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java b/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java index 6877fd2a..ac20fe70 100644 --- a/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java +++ b/subsonic-android/src/github/daneren2005/dsub/activity/SearchActivity.java @@ -28,6 +28,8 @@ import github.daneren2005.dsub.util.Constants; import com.actionbarsherlock.view.MenuItem; public class SearchActivity extends SubsonicActivity { + private static final String TAG = SearchActivity.class.getSimpleName(); + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -47,16 +49,19 @@ public class SearchActivity extends SubsonicActivity { @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); - String query = intent.getStringExtra(Constants.INTENT_EXTRA_NAME_QUERY); - boolean autoplay = intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false); - boolean requestsearch = intent.getBooleanExtra(Constants.INTENT_EXTRA_REQUEST_SEARCH, false); + + if(currentFragment != null && currentFragment instanceof SearchFragment) { + String query = intent.getStringExtra(Constants.INTENT_EXTRA_NAME_QUERY); + boolean autoplay = intent.getBooleanExtra(Constants.INTENT_EXTRA_NAME_AUTOPLAY, false); + boolean requestsearch = intent.getBooleanExtra(Constants.INTENT_EXTRA_REQUEST_SEARCH, false); - if (query != null) { - ((SearchFragment)currentFragment).search(query, autoplay); - } else { - ((SearchFragment)currentFragment).populateList(); - if (requestsearch) { - onSearchRequested(); + if (query != null) { + ((SearchFragment)currentFragment).search(query, autoplay); + } else { + ((SearchFragment)currentFragment).populateList(); + if (requestsearch) { + onSearchRequested(); + } } } } diff --git a/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java b/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java index 725f84bd..d71fbf6d 100644 --- a/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java +++ b/subsonic-android/src/github/daneren2005/dsub/fragments/SearchFragment.java @@ -161,6 +161,14 @@ public class SearchFragment extends SubsonicFragment { return true;
}
+
+ @Override
+ public void setPrimaryFragment(boolean primary) {
+ super.setPrimaryFragment(primary);
+ if(rootView != null && primary) {
+ ((SearchActivity)context).onSupportNewIntent(context.getIntent());
+ }
+ }
public void search(final String query, final boolean autoplay) {
mergeAdapter = new MergeAdapter();
|