android.support.v7.widget.Toolbar.OnMenuItemClickListener的实例源码

项目:WeiboWeiBaTong    文件:DMUserListFragment.java   
@Override
public void onViewCreated(View view,Bundle savedInstanceState) {
    super.onViewCreated(view,savedInstanceState);
    getListView().setDivider(null);

    writeDMToolbar = (Toolbar) ((MainTimeLineActivity) getActivity()).findViewById(R.id.mainTimeLineToolBar);
    writeDMToolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem arg0) {
            switch (arg0.getItemId()) {
                case R.id.menu_write_dm:
                    Intent intent = new Intent(getActivity(),DMSelectUserActivity.class);
                    startActivityForResult(intent,0);
                    break;
            }
            return false;
        }
    });
}
项目:365browser    文件:SelectableListLayout.java   
/**
 * Initializes the SelectionToolbar.
 *
 * @param toolbarLayoutId The resource id of the toolbar layout. This will be inflated into
 *                        a ViewStub.
 * @param delegate The SelectionDelegate that will inform the toolbar of selection changes.
 * @param titleResId The resource id of the title string. May be 0 if this class shouldn't set
 *                   set a title when the selection is cleared.
 * @param drawerLayout The DrawerLayout whose navigation icon is displayed in this toolbar.
 * @param normalGroupResId The resource id of the menu group to show when a selection isn't
 *                         established.
 * @param selectedGroupResId The resource id of the menu item to show when a selection is
 *                           established.
 * @param normalBackgroundColorResId The resource id of the color to use as the background color
 *                                   when selection is not enabled. If null the default appbar
 *                                   background color will be used.
 * @param listener The OnMenuItemClickListener to set on the toolbar.
 * @return The initialized SelectionToolbar.
 */
public SelectableListToolbar<E> initializeToolbar(int toolbarLayoutId,SelectionDelegate<E> delegate,int titleResId,@Nullable DrawerLayout drawerLayout,int normalGroupResId,int selectedGroupResId,@Nullable Integer normalBackgroundColorResId,@Nullable OnMenuItemClickListener listener) {
    mToolbarStub.setLayoutResource(toolbarLayoutId);
    @SuppressWarnings("unchecked")
    SelectableListToolbar<E> toolbar = (SelectableListToolbar<E>) mToolbarStub.inflate();
    mToolbar = toolbar;
    mToolbar.initialize(delegate,titleResId,drawerLayout,normalGroupResId,selectedGroupResId,normalBackgroundColorResId);

    if (listener != null) {
        mToolbar.setOnMenuItemClickListener(listener);
    }

    mToolbarShadow = (FadingShadowView) findViewById(R.id.shadow);
    mToolbarShadow.init(
            ApiCompatibilityUtils.getColor(getResources(),R.color.toolbar_shadow_color),FadingShadow.POSITION_TOP);
    delegate.addObserver(this);
    setToolbarShadowVisibility();

    return mToolbar;
}
项目:chromium-for-android-56-debug-video    文件:EditorView.java   
/**
 * Prepares the toolbar for use.
 *
 * Many of the things that would ideally be set as attributes don't work and need to be set
 * programmatically.  This is likely due to how we compile the support libraries.
 */
private void prepareToolbar() {
    EditorDialogToolbar toolbar = (EditorDialogToolbar) mLayout.findViewById(R.id.action_bar);
    toolbar.setTitle(mEditorModel.getTitle());
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setShowDeleteMenuItem(false);

    // Show the help article when the user asks.
    toolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            launchAutofillHelpPage(mContext);
            return true;
        }
    });

    // Cancel editing when the user hits the back arrow.
    toolbar.setNavigationContentDescription(R.string.cancel);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cancelEdit();
        }
    });

    // Make it appear that the toolbar is floating by adding a shadow.
    FadingShadowView shadow = (FadingShadowView) mLayout.findViewById(R.id.shadow);
    shadow.init(ApiCompatibilityUtils.getColor(mContext.getResources(),FadingShadow.POSITION_TOP);

    // The top shadow is handled by the toolbar,so hide the one used in the field editor.
    FadingEdgeScrollView scrollView =
            (FadingEdgeScrollView) mLayout.findViewById(R.id.scroll_view);
    scrollView.setShadowVisibility(false,true);
}
项目:ChromeLikeTabSwitcher    文件:MainActivity.java   
/**
 * Creates and returns a listener,which allows to observe,when an item of the tab switcher's
 * toolbar has been clicked.
 *
 * @return The listener,which has been created,as an instance of the type {@link
 * OnMenuItemClickListener}. The listener may not be null
 */
@NonNull
private OnMenuItemClickListener createToolbarMenuListener() {
    return new OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(final MenuItem item) {
            switch (item.getItemId()) {
                case R.id.add_tab_menu_item:
                    int index = tabSwitcher.getCount();
                    Tab tab = createTab(index);

                    if (tabSwitcher.isSwitcherShown()) {
                        tabSwitcher.addTab(tab,createRevealAnimation());
                    } else {
                        tabSwitcher.addTab(tab,createPeekAnimation());
                    }

                    return true;
                case R.id.clear_tabs_menu_item:
                    tabSwitcher.clear();
                    return true;
                case R.id.settings_menu_item:
                    Intent intent = new Intent(MainActivity.this,SettingsActivity.class);
                    startActivity(intent);
                default:
                    return false;
            }
        }

    };
}
项目:ChromeLikeTabSwitcher    文件:TabSwitcherModel.java   
@Override
public final void inflateToolbarMenu(@MenuRes final int resourceId,@Nullable final OnMenuItemClickListener listener) {
    this.toolbarMenuId = resourceId;
    this.toolbarMenuItemListener = listener;
    notifyOnToolbarMenuInflated(resourceId,listener);
}
项目:NeoTerm    文件:TabSwitcherModel.java   
@Override
public final void inflateToolbarMenu(@MenuRes final int resourceId,listener);
}
项目:AndroidChromium    文件:EditorView.java   
/**
 * Prepares the toolbar for use.
 *
 * Many of the things that would ideally be set as attributes don't work and need to be set
 * programmatically.  This is likely due to how we compile the support libraries.
 */
private void prepareToolbar() {
    EditorDialogToolbar toolbar = (EditorDialogToolbar) mLayout.findViewById(R.id.action_bar);
    toolbar.setTitle(mEditorModel.getTitle());
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setShowDeleteMenuItem(false);

    // Show the help article when the user asks.
    toolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            launchAutofillHelpPage(mContext);
            return true;
        }
    });

    // Cancel editing when the user hits the back arrow.
    toolbar.setNavigationContentDescription(R.string.cancel);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            cancelEdit();
        }
    });

    // Make it appear that the toolbar is floating by adding a shadow.
    FadingShadowView shadow = (FadingShadowView) mLayout.findViewById(R.id.shadow);
    shadow.init(ApiCompatibilityUtils.getColor(mContext.getResources(),true);
}
项目:WeiboWeiBaTong    文件:EditMyProfileActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.editmyprofileactivity_layout);
    mEditToolBar = (Toolbar) findViewById(R.id.editMyProFileToolbar);

    initLayout();
    userBean = (UserBean) getIntent().getParcelableExtra(Constants.USERBEAN);
    initValue(savedInstanceState);

    mEditToolBar.inflateMenu(R.menu.actionbar_menu_editmyprofileactivity);
    save = mEditToolBar.getMenu().findItem(R.id.menu_save);
    mEditToolBar.setOnMenuItemClickListener(new OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            // TODO Auto-generated method stub
            Intent intent;
            switch (item.getItemId()) {
            case android.R.id.home:
                intent = MainTimeLineActivity.newIntent();
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
                startActivity(intent);
                return true;
            case R.id.menu_save:
                save();
                return true;
            }
            return false;
        }
    });
}
项目:365browser    文件:EditorDialog.java   
/**
 * Prepares the toolbar for use.
 *
 * Many of the things that would ideally be set as attributes don't work and need to be set
 * programmatically.  This is likely due to how we compile the support libraries.
 */
private void prepareToolbar() {
    EditorDialogToolbar toolbar = (EditorDialogToolbar) mLayout.findViewById(R.id.action_bar);
    toolbar.setTitle(mEditorModel.getTitle());
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.setShowDeleteMenuItem(false);

    // Show the help article when the user asks.
    toolbar.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            launchAutofillHelpPage(mContext);
            return true;
        }
    });

    // Cancel editing when the user hits the back arrow.
    toolbar.setNavigationContentDescription(R.string.cancel);
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            dismissDialog();
        }
    });

    // Make it appear that the toolbar is floating by adding a shadow.
    FadingShadowView shadow = (FadingShadowView) mLayout.findViewById(R.id.shadow);
    shadow.init(ApiCompatibilityUtils.getColor(
                        mContext.getResources(),so hide the one used in the field editor.
    FadingEdgeScrollView scrollView =
            (FadingEdgeScrollView) mLayout.findViewById(R.id.scroll_view);
    scrollView.setEdgeVisibility(
            FadingEdgeScrollView.DRAW_NO_EDGE,FadingEdgeScrollView.DRAW_FADING_EDGE);
}
项目:ChromeLikeTabSwitcher    文件:TabSwitcher.java   
@Override
public final void inflateToolbarMenu(@MenuRes final int resourceId,@Nullable final OnMenuItemClickListener listener) {
    model.inflateToolbarMenu(resourceId,listener);
}
项目:ChromeLikeTabSwitcher    文件:AbstractTabSwitcherLayout.java   
@Override
public final void onToolbarMenuInflated(@MenuRes final int resourceId,@Nullable final OnMenuItemClickListener listener) {
    inflateToolbarMenu();
}
项目:NeoTerm    文件:TabSwitcher.java   
@Override
public final void inflateToolbarMenu(@MenuRes final int resourceId,listener);
}
项目:NeoTerm    文件:AbstractTabSwitcherLayout.java   
@Override
public final void onToolbarMenuInflated(@MenuRes final int resourceId,@Nullable final OnMenuItemClickListener listener) {
    inflateToolbarMenu();
}
项目:NeoTerm    文件:PhoneRecyclerAdapter.java   
@Override
public final void onToolbarMenuInflated(@MenuRes final int resourceId,@Nullable final OnMenuItemClickListener listener) {

}
项目:WeiboWeiBaTong    文件:AccountActivity.java   
@Override
    public void onCreate(Bundle savedInstanceState) {

        MobclickAgent.setDebugMode(false);
        MobclickAgent.openActivityDurationTrack(false);
        MobclickAgent.updateOnlineConfig(this);

        // CookieManager manager = CookieManager.getInstance();
        // manager.removeAllCookie();

        String action = getIntent() != null ? getIntent().getAction() : null;

        if (ACTION_OPEN_FROM_APP_INNER.equals(action)) {
            // empty
        } else if (ACTION_OPEN_FROM_APP_INNER_REFRESH_TOKEN.equals(action)) {
            // empty
        } else {
            // finish current Activity
            jumpToMainTimeLineActivity();
        }

        super.onCreate(savedInstanceState);

        setContentView(R.layout.accountactivity_layout);
        mToolBar = (Toolbar) findViewById(R.id.accountToolBar);

        mToolBar.inflateMenu(R.menu.actionbar_menu_accountactivity);
        mToolBar.setOnMenuItemClickListener(new OnMenuItemClickListener() {

            @Override
            public boolean onMenuItemClick(MenuItem arg0) {
                switch (arg0.getItemId()) {
                    case R.id.menu_add_account:{
                        showAddAccountDialog();
                        break;
                    }
                    default:
                        break;
                }
                return false;
            }
        });

//      getActionBar().setTitle(getString(R.string.app_name));
        listAdapter = new AccountAdapter();
        listView = (ListView) findViewById(R.id.listView);
        listView.setOnItemClickListener(new AccountListItemClickListener());
        listView.setAdapter(listAdapter);
        listView.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
        listView.setMultiChoiceModeListener(new AccountMultiChoiceModeListener());
        getLoaderManager().initLoader(LOADER_ID,null,this);

        if (SettingUtils.firstStart()) {
            showChangeLogDialog();
        }

        if (ACTION_OPEN_FROM_APP_INNER_REFRESH_TOKEN.equals(action)) {

            showAddAccountDialog();

            AccountBean accountBean = getIntent().getParcelableExtra(REFRESH_ACTION_EXTRA);

            Toast.makeText(this,String.format(getString(R.string.account_token_has_expired),accountBean.getUsernick()),Toast.LENGTH_SHORT).show();

        }

    }
项目:chromium-for-android-56-debug-video    文件:SelectableListLayout.java   
/**
 * Initializes the SelectionToolbar.
 *
 * @param toolbarLayoutId The resource id of the toolbar layout. This will be inflated into
 *                        a ViewStub.
 * @param delegate The SelectionDelegate that will inform the toolbar of selection changes.
 * @param titleResId The resource id of the title string. May be 0 if this class shouldn't set
 *                   set a title when the selection is cleared.
 * @param drawerLayout The DrawerLayout whose navigation icon is displayed in this toolbar.
 * @param normalGroupResId The resource id of the menu group to show when a selection isn't
 *                         established.
 * @param selectedGroupResId The resource id of the menu item to show when a selection is
 *                           established.
 * @param listener The OnMenuItemClickListener to set on the toolbar.
 * @return The initialized SelectionToolbar.
 */
public <E> SelectionToolbar<E> initializeToolbar(int toolbarLayoutId,OnMenuItemClickListener listener) {
    mToolbarStub.setLayoutResource(toolbarLayoutId);
    @SuppressWarnings("unchecked")
    SelectionToolbar<E> toolbar = (SelectionToolbar<E>) mToolbarStub.inflate();
    toolbar.initialize(delegate,selectedGroupResId);
    toolbar.setOnMenuItemClickListener(listener);
    return toolbar;
}
项目:ChromeLikeTabSwitcher    文件:TabSwitcherModel.java   
/**
 * Notifies the listeners,that the menu of the toolbar,which is shown,when the tab switcher
 * is shown,has been inflated.
 *
 * @param resourceId
 *         The resource id of the menu,which has been inflated,as an {@link Integer} value.
 *         The resource id must correspond to a valid menu resource
 * @param menuItemClickListener
 *         The listener,which has been registered to be notified,when an item of the menu has
 *         been clicked,as an instance of the type OnMenuItemClickListener or null,if no
 *         listener should be notified
 */
private void notifyOnToolbarMenuInflated(@MenuRes final int resourceId,@Nullable final OnMenuItemClickListener menuItemClickListener) {
    for (Listener listener : listeners) {
        listener.onToolbarMenuInflated(resourceId,menuItemClickListener);
    }
}
项目:NeoTerm    文件:TabSwitcherModel.java   
/**
 * Notifies the listeners,menuItemClickListener);
    }
}
项目:AndroidChromium    文件:SelectableListLayout.java   
/**
 * Initializes the SelectionToolbar.
 *
 * @param toolbarLayoutId The resource id of the toolbar layout. This will be inflated into
 *                        a ViewStub.
 * @param delegate The SelectionDelegate that will inform the toolbar of selection changes.
 * @param titleResId The resource id of the title string. May be 0 if this class shouldn't set
 *                   set a title when the selection is cleared.
 * @param drawerLayout The DrawerLayout whose navigation icon is displayed in this toolbar.
 * @param normalGroupResId The resource id of the menu group to show when a selection isn't
 *                         established.
 * @param selectedGroupResId The resource id of the menu item to show when a selection is
 *                           established.
 * @param listener The OnMenuItemClickListener to set on the toolbar.
 * @return The initialized SelectionToolbar.
 */
public <E> SelectionToolbar<E> initializeToolbar(int toolbarLayoutId,selectedGroupResId);
    toolbar.setOnMenuItemClickListener(listener);
    return toolbar;
}
项目:ChromeLikeTabSwitcher    文件:Model.java   
/**
 * The method,which is invoked,when the menu of the toolbar,when the tab
 * switcher is shown,as an {@link Integer}
 *         value. The resource id must correspond to a valid menu resource
 * @param listener
 *         The listener,when an item of the menu
 *         has been clicked,if
 *         no listener should be notified
 */
void onToolbarMenuInflated(@MenuRes int resourceId,@Nullable OnMenuItemClickListener listener);
项目:ChromeLikeTabSwitcher    文件:Model.java   
/**
 * Inflates the menu of the toolbar,when the tab switcher is shown. When using
 * the tablet layout,the menu is inflated into the secondary toolbar. If another menu has
 * already been inflated,its items will be removed.
 *
 * @param resourceId
 *         The resource id of the menu,which should be inflated,as an {@link Integer} value.
 *         The resource id must correspond to a valid menu resource
 * @param listener
 *         The listener,which should be notified,when an menu item has been clicked,as an
 *         instance of the type OnMenuItemClickListener or null,if no listener should be
 *         notified
 */
void inflateToolbarMenu(@MenuRes int resourceId,@Nullable OnMenuItemClickListener listener);
项目:ChromeLikeTabSwitcher    文件:TabSwitcherModel.java   
/**
 * Returns the listener,which is notified,when an item of the menu of the toolbar,which is
 * shown,when the tab switcher is shown,has been clicked.
 *
 * @return The listener,has been clicked as an instance of the type
 * OnMenuItemClickListener or null,if no listener should be notified
 */
@Nullable
public final OnMenuItemClickListener getToolbarMenuItemListener() {
    return toolbarMenuItemListener;
}
项目:NeoTerm    文件:Model.java   
/**
 * The method,@Nullable OnMenuItemClickListener listener);
项目:NeoTerm    文件:Model.java   
/**
 * Inflates the menu of the toolbar,the menu is inflated into the secondary toolbar.
 *
 * @param resourceId
 *         The resource id of the menu,@Nullable OnMenuItemClickListener listener);
项目:NeoTerm    文件:TabSwitcherModel.java   
/**
 * Returns the listener,if no listener should be notified
 */
@Nullable
public final OnMenuItemClickListener getToolbarMenuItemListener() {
    return toolbarMenuItemListener;
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


com.google.gson.internal.bind.ArrayTypeAdapter的实例源码
com.google.gson.JsonSyntaxException的实例源码
com.google.gson.JsonDeserializer的实例源码
com.google.gson.internal.ConstructorConstructor的实例源码
com.google.gson.JsonPrimitive的实例源码
com.google.gson.LongSerializationPolicy的实例源码
com.google.gson.internal.GsonInternalAccess的实例源码
com.google.gson.JsonIOException的实例源码
com.google.gson.internal.StringMap的实例源码
com.google.gson.JsonObject的实例源码
com.google.gson.internal.bind.TimeTypeAdapter的实例源码
com.google.gson.FieldAttributes的实例源码
com.google.gson.internal.bind.TreeTypeAdapter的实例源码
com.google.gson.internal.LinkedHashTreeMap的实例源码
com.google.gson.TypeAdapterFactory的实例源码
com.google.gson.JsonSerializer的实例源码
com.google.gson.FieldNamingPolicy的实例源码
com.google.gson.JsonElement的实例源码
com.google.gson.internal.JsonReaderInternalAccess的实例源码
com.google.gson.TypeAdapter的实例源码