if searchView does not exist, search is not opened

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
tobiasKaminsky 2018-02-21 13:01:11 +01:00 committed by AndyScherzinger
parent 7b44f3b296
commit df55697cc2
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -42,6 +42,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
@ -342,8 +343,8 @@ public class FileDisplayActivity extends HookActivity
}
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],
@NonNull int[] grantResults) {
switch (requestCode) {
case PermissionUtil.PERMISSIONS_WRITE_EXTERNAL_STORAGE: {
// If request is cancelled, result arrays are empty.
@ -1002,9 +1003,13 @@ public class FileDisplayActivity extends HookActivity
}
private boolean isSearchOpen() {
final View mSearchEditFrame = searchView.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
if (searchView == null) {
return false;
} else {
View mSearchEditFrame = searchView.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
return (mSearchEditFrame != null && mSearchEditFrame.getVisibility() == View.VISIBLE);
}
}
private void revertBottomNavigationBarToAllFiles() {
if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {