Permalink
Browse files

Fix crash on tablets when opening search. Should still improve the UI…

… but at least this fixes #235.
  • Loading branch information...
erickok committed Sep 7, 2015
1 parent f333aab commit 6b76ebcad324a3f2e8ce12fd0bc4963a284b013a
@@ -9,8 +9,8 @@ android {
defaultConfig {
minSdkVersion 15
targetSdkVersion 23
versionCode 223
versionName '2.5.3'
versionCode 224
versionName '2.5.4'
}
buildTypes {
release {
@@ -38,8 +38,8 @@ dependencies {
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:support-annotations:23.0.0'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:support-annotations:23.0.1'
compile 'com.getbase:floatingactionbutton:1.8.0'
compile 'com.afollestad:material-dialogs:0.6.3.3'
compile 'com.nispok:snackbar:2.10.6'
@@ -16,9 +16,11 @@
*/
package org.transdroid.core.gui.search;
import android.annotation.TargetApi;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.provider.SearchRecentSuggestions;
import android.support.v4.view.MenuItemCompat;
@@ -128,7 +130,6 @@ public void onClick(View v) {
// Allow site selection via list (on large screens) or action bar spinner
if (searchsitesList != null) {
// The current layout has a dedicated list view to select the search site
sitesSpinner.setVisibility(View.GONE);
SearchSitesAdapter searchSitesAdapter = SearchSitesAdapter_.getInstance_(this);
searchSitesAdapter.update(searchSites);
searchsitesList.setAdapter(searchSitesAdapter);
@@ -162,7 +163,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
searchToolbar.inflateMenu(R.menu.activity_search);
// Add an expandable SearchView to the action bar
MenuItem item = menu.findItem(R.id.action_search);
final SearchView searchView = new SearchView(searchToolbar.getContext());
final SearchView searchView = new SearchView(getSupportActionBar().getThemedContext());
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setQueryRefinementEnabled(true);
searchView.setIconified(false);
@@ -266,6 +267,12 @@ private String parseQuery(Intent intent) {
}
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@OptionsItem(android.R.id.home)
protected void navigateUp() {
TorrentsActivity_.intent(this).flags(Intent.FLAG_ACTIVITY_CLEAR_TOP).start();
}
@OptionsItem(R.id.action_refresh)
protected void refreshSearch() {
@@ -286,7 +293,7 @@ protected void refreshSearch() {
// Save the search site currently used to search for future usage
applicationSettings.setLastUsedSearchSite(lastUsedSite);
// Update the activity title (only shown on large devices)
if (sitesSpinner.getVisibility() == View.GONE)
if (sitesSpinner != null)
searchToolbar.setTitle(
NavigationHelper.buildCondensedFontString(getString(R.string.search_queryonsite, lastUsedQuery, lastUsedSite.getName())));
// Ask the results fragment to start a search for the specified query
@@ -17,6 +17,9 @@
-->
<resources>
<string name="system_changelog">
Transdroid 2.5.4\n
- Fixes crash in search on tablets\n
\n
Transdroid 2.5.3\n
- Fixes in UI for dialogs and dark theme\n
\n

0 comments on commit 6b76ebc

Please sign in to comment.