mirror of
https://github.com/gsantner/dandelion
synced 2024-12-22 19:08:03 +01:00
forward clicks on bottom toolbar to fragments onOptionsItemSelected
This commit is contained in:
parent
179fb3e741
commit
a1ca8596b8
2 changed files with 14 additions and 1 deletions
|
@ -188,7 +188,8 @@ public class MainActivity extends AppCompatActivity
|
|||
getMenuInflater().inflate(R.menu.main__menu_bottom, toolbarBottom.getMenu());
|
||||
toolbarBottom.setOnMenuItemClickListener(new ActionMenuView.OnMenuItemClickListener() {
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
return MainActivity.this.onOptionsItemSelected(item);
|
||||
CustomFragment topFrag = (CustomFragment) getTopFragment();
|
||||
return MainActivity.this.onOptionsItemSelected(item) || (topFrag != null && topFrag.onOptionsItemSelected(item));
|
||||
}
|
||||
});
|
||||
setTitle(R.string.app_name);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.github.dfa.diaspora_android.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -10,6 +11,17 @@ import android.view.MenuInflater;
|
|||
*/
|
||||
|
||||
public abstract class CustomFragment extends Fragment {
|
||||
|
||||
/**
|
||||
* We have an optionsMenu
|
||||
* @param savedInstanceState state
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the tag used to identify the Fragment.
|
||||
* @return tag
|
||||
|
|
Loading…
Reference in a new issue