Merge pull request #718 from nextcloud/fix-search-crash

Fix crashes
This commit is contained in:
Andy Scherzinger 2017-03-05 18:55:24 +01:00 committed by GitHub
commit 20bb144533
3 changed files with 19 additions and 10 deletions

View file

@ -20,8 +20,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.owncloud.android"
android:versionCode="10040202"
android:versionName="1.4.2 RC2">
android:versionCode="10040203"
android:versionName="1.4.2 RC3">
<uses-sdk
android:minSdkVersion="14"

View file

@ -466,12 +466,14 @@ public class FileDisplayActivity extends HookActivity
* @param fragment New second Fragment to set.
*/
private void setSecondFragment(Fragment fragment) {
searchView.post(new Runnable() {
@Override
public void run() {
searchView.setQuery("", true);
}
});
if (searchView != null) {
searchView.post(new Runnable() {
@Override
public void run() {
searchView.setQuery("", true);
}
});
}
setDrawerIndicatorEnabled(false);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.right_fragment_container, fragment, TAG_SECOND_FRAGMENT);

View file

@ -21,6 +21,7 @@
package com.owncloud.android.ui.fragment;
import android.animation.LayoutTransition;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.DrawableRes;
@ -268,8 +269,14 @@ public class ExtendedListFragment extends Fragment
searchView.clearFocus();
}
} else {
if (getActivity() != null) {
((FileDisplayActivity) getActivity()).refreshListOfFilesFragment(true);
Activity activity;
if ((activity = getActivity()) != null) {
if (activity instanceof FileDisplayActivity) {
((FileDisplayActivity) activity).refreshListOfFilesFragment(true);
} else {
LocalFileListAdapter localFileListAdapter = (LocalFileListAdapter) mAdapter;
localFileListAdapter.filter(query);
}
}
}