diff --git a/app/src/main/java/pasta/streamer/activities/HomeActivity.java b/app/src/main/java/pasta/streamer/activities/HomeActivity.java index 507af34..325f70a 100644 --- a/app/src/main/java/pasta/streamer/activities/HomeActivity.java +++ b/app/src/main/java/pasta/streamer/activities/HomeActivity.java @@ -141,8 +141,10 @@ public void onCreate(Bundle savedInstanceState) { } setSupportActionBar(toolbar); - getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setHomeAsUpIndicator(R.drawable.drawer_toggle); + if (drawer_layout != null) { + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setHomeAsUpIndicator(R.drawable.drawer_toggle); + } if (content != null) { FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); @@ -330,6 +332,8 @@ public void onAnimationUpdate(ValueAnimator animation) { } else if (getIntent().getStringExtra("query") != null) { f = new SearchFragment(); getSupportFragmentManager().beginTransaction().add(R.id.fragment, f).commit(); + + getSupportActionBar().setDisplayHomeAsUpEnabled(true); setDrawerEnabled(false); search(getIntent().getStringExtra("query"), true); @@ -360,7 +364,8 @@ public void setDrawerEnabled(boolean enabled) { if (drawer_layout != null) drawer_layout.setDrawerLockMode(enabled ? DrawerLayout.LOCK_MODE_UNLOCKED : DrawerLayout.LOCK_MODE_LOCKED_CLOSED); drawer_container.setVisibility(enabled ? View.VISIBLE : View.GONE); - getSupportActionBar().setHomeAsUpIndicator(enabled ? R.drawable.drawer_toggle : R.drawable.drawer_back); + if (drawer_layout != null || !enabled) + getSupportActionBar().setHomeAsUpIndicator(enabled ? R.drawable.drawer_toggle : R.drawable.drawer_back); } public void setListeners(Fragment f) { @@ -670,8 +675,6 @@ protected void done(@Nullable AlbumListData result) { public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_home, menu); - if (drawer_layout == null) menu.findItem(android.R.id.home).setVisible(false); - SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search)); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {