Browse Source

Fix crash on tablets when opening search. Should still improve the UI but at least this fixes #235.

pull/256/head v2.5.4
Eric Kok 9 years ago
parent
commit
6b76ebcad3
  1. 8
      app/build.gradle
  2. 13
      app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java
  3. 3
      app/src/main/res/values/changelog.xml

8
app/build.gradle

@ -9,8 +9,8 @@ android { @@ -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 { @@ -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'

13
app/src/main/java/org/transdroid/core/gui/search/SearchActivity.java

@ -16,9 +16,11 @@ @@ -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 class SearchActivity extends AppCompatActivity { @@ -128,7 +130,6 @@ public class SearchActivity extends AppCompatActivity {
// 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 class SearchActivity extends AppCompatActivity { @@ -162,7 +163,7 @@ public class SearchActivity extends AppCompatActivity {
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 @@ public class SearchActivity extends AppCompatActivity { @@ -266,6 +267,12 @@ public class SearchActivity extends AppCompatActivity {
}
@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 @@ public class SearchActivity extends AppCompatActivity { @@ -286,7 +293,7 @@ public class SearchActivity extends AppCompatActivity {
// 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

3
app/src/main/res/values/changelog.xml

@ -17,6 +17,9 @@ @@ -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

Loading…
Cancel
Save