Select home on home back

This commit is contained in:
Mario Danic 2017-03-11 01:15:57 +01:00 committed by AndyScherzinger
parent b0835b981f
commit 1e16812ab3
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B
2 changed files with 10 additions and 3 deletions

View file

@ -41,6 +41,7 @@ import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.support.design.widget.BottomNavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
@ -940,7 +941,6 @@ public class FileDisplayActivity extends HookActivity
return (mSearchEditFrame != null && mSearchEditFrame.getVisibility() == View.VISIBLE);
}
@Override
public void onBackPressed() {
boolean isFabOpen = isFabOpen();
@ -954,6 +954,15 @@ public class FileDisplayActivity extends HookActivity
* 3. close FAB if open (only if drawer isn't open)
* 4. navigate up (only if drawer and FAB aren't open)
*/
if (getResources().getBoolean(R.bool.bottom_toolbar_enabled)) {
BottomNavigationView bottomNavigationView = (BottomNavigationView) getListOfFilesFragment().getView()
.findViewById(R.id.bottom_navigation_view);
if (bottomNavigationView.getMenu().findItem(R.id.nav_bar_settings).isChecked()) {
bottomNavigationView.getMenu().findItem(R.id.nav_bar_files).setChecked(true);
}
}
if (isSearchOpen && searchView != null) {
searchView.setQuery("", true);
searchView.onActionViewCollapsed();

View file

@ -198,8 +198,6 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
getString(R.string.drawer_item_home));
}
bottomNavigationView.getMenu().findItem(R.id.nav_bar_settings).setCheckable(false);
bottomNavigationView.setOnNavigationItemSelectedListener(
new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override