Java 类android.view.MenuItem 实例源码

项目:yaacc-code    文件:MultiContentPlayerActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_settings:
            Intent i = new Intent(this, SettingsActivity.class);
            startActivity(i);
            return true;
        case R.id.yaacc_about:
            AboutActivity.showAbout(this);
            return true;
        case R.id.yaacc_log:
            YaaccLogActivity.showLog(this);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:yaacc-code    文件:ThirdPartieMusicPlayerActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_settings:
            Intent i = new Intent(this, SettingsActivity.class);
            startActivity(i);
            return true;
        case R.id.yaacc_about:
            AboutActivity.showAbout(this);
            return true;
        case R.id.yaacc_log:
            YaaccLogActivity.showLog(this);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:Todule-android    文件:ToduleLabelFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.label_new:
            ToduleLabelAddFragment f = ToduleLabelAddFragment.newInstance(null);
            myActivity.getSupportFragmentManager().beginTransaction()
                    .setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right)
                    .replace(R.id.fragment_container, f)
                    .addToBackStack(null)
                    .commit();
            return true;
        case R.id.label_confirm:
            mCallback.onLabelSelected(selectedLabelId);
            myActivity.onBackPressed();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
项目:Quran    文件:AyahToolBar.java   
private void showMenu(Menu menu) {
  if (currentMenu == menu) {
    // no need to re-draw
    return;
  }

  menuLayout.removeAllViews();
  final int count = menu.size();
  for (int i=0; i<count; i++) {
    final MenuItem item = menu.getItem(i);
    if (item.isVisible()) {
      final View view = getMenuItemView(item);
      menuLayout.addView(view);
    }
  }

  currentMenu = menu;
}
项目:Protestr    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.action_logout:
            Prefs.with(this).clear();
            startActivity(new Intent(this, LoginActivity.class));
            overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
            finish();
            return true;
        case R.id.action_settings:
            startActivity(new Intent(this, SettingsActivity.class));
            overridePendingTransition(R.anim.activity_in, R.anim.activity_out);
            return true;
        default:
            return false;
    }
}
项目:BizareChat    文件:UsersFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.users_action_filter:
            sortItem.collapseActionView();
            item.expandActionView();
            return true;
        case R.id.users_action_sort:
            filterItem.collapseActionView();
            item.expandActionView();
            return true;
        case R.id.filter_default:
            presenter.sortDefault();
            sortItem.collapseActionView();
            return true;
        case R.id.filter_name_asc:
            presenter.sortByNameAsc();
            sortItem.collapseActionView();
            return true;
        case R.id.filter_name_desc:
            presenter.sortByNameDesc();
            sortItem.collapseActionView();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
项目:WarningSystemWeather-Android-App    文件:ListFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {

        case R.id.refresh_main:
            if (isNetworkAvailable()) {
                grabData();
            }
            break;
        case R.id.more_apps:
            moreApps();
            break;
        default:
    }
    return super.onOptionsItemSelected(item);
}
项目:Mixtape    文件:RecyclerBodyView.java   
/**
 * Shows a contextual popup menu anchored to the supplied view. Item selections are passed to
 * the presenter.
 *
 * @param anchor
 *      the view to anchor the menu to, not null
 * @param item
 *      the LibraryItem associated with the contextual menu, not null
 */
private void showMenu(final View anchor, final LibraryItem item) {
    checkNotNull(item, "item cannot be null.");
    checkNotNull(anchor, "overflowButton cannot be null.");

    final PopupMenu menu = new PopupMenu(getContext(), anchor);
    menu.inflate(contextualMenuResourceId);
    menu.show();

    // Propagate menu selections back to the presenter
    menu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(final MenuItem menuItem) {
            for (final MenuItemSelectedListener listener : menuItemSelectedListeners) {
                listener.onContextualMenuItemSelected(RecyclerBodyView.this, item, menuItem);
            }

            return true;
        }
    });
}
项目:SmoothRefreshLayout    文件:TestNestedHorizontalViewsActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            onBackPressed();
            return true;
        case Menu.FIRST:
            if (mRefreshLayout.isEnableCheckFingerInsideAnotherDirectionView()) {
                mRefreshLayout.setEnableCheckFingerInsideAnotherDirectionView(false);
                item.setTitle(R.string.enable_check_finger_inside_horizontal_view);
            } else {
                mRefreshLayout.setEnableCheckFingerInsideAnotherDirectionView(true);
                item.setTitle(R.string.disable_check_finger_inside_horizontal_view);
            }
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:app-android    文件:MainActivity.java   
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_lsf) {
        NavigationController.getInstance().navigateToLSF();
    } else if (id == R.id.nav_canteen) {
        NavigationController.getInstance().navigateToCanteen();
    } else if (id == R.id.nav_settings) {
        NavigationController.getInstance().navigateToSettings();
    }  else if (id == R.id.nav_test) {
        startActivity(new Intent(this, VmTestActivity.class));
    }

    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
项目:CoordinatorTabLayout    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        finish();
    }

    switch (item.getItemId()) {
        case R.id.action_about:
            IntentUtils.openUrl(this, "https://github.com/hugeterry/CoordinatorTabLayout");
            break;
        case R.id.action_about_me:
            IntentUtils.openUrl(this, "http://hugeterry.cn/about");
            break;
    }
    return super.onOptionsItemSelected(item);
}
项目:edslider    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
    switch (item.getItemId()){
        case R.id.changeview:
            if (recyclerView.getVisibility() == View.VISIBLE)
            {
                recyclerView.setVisibility(View.GONE);
                layoutTest.setVisibility(View.VISIBLE);
            }
            else
            {
                recyclerView.setVisibility(View.VISIBLE);
                layoutTest.setVisibility(View.GONE);
            }
            break;
    }
    return super.onOptionsItemSelected(item);
}
项目:aos-Video    文件:BrowserAllTvShows.java   
@Override
public boolean onContextItemSelected(MenuItem item) {
    if(item.getItemId() ==  R.string.copy_on_device_multi){
        AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
        Tvshow tvshow = (Tvshow) mBrowserAdapter.getItem(info.position);
        ArrayList<Uri> list = new ArrayList<>();
        Cursor cursor2 = getEpisodeForShowCursor(tvshow.getTvshowId());
        if(cursor2!=null) {
            if (cursor2.getCount() > 0) {
                cursor2.moveToFirst();
                int uriCol = cursor2.getColumnIndex(VideoStore.MediaColumns.DATA);
                do {
                    Uri uri = Uri.parse(cursor2.getString(uriCol));
                    if (!Utils.isLocal(uri))
                        list.add(uri);
                } while (cursor2.moveToNext());
                startDownloadingVideo(list);

            }
        }
        cursor2.close();
        return  true;
    }
    else return super.onContextItemSelected(item);

}
项目:FantaF1    文件:MainActivity.java   
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.n_home) {
        setFragment(new Tab0Home(), getString(R.string.td_main),"");
    } else if (id == R.id.n_news) {
        setFragment(new TabBrowser(), getString(R.string.td_news),"");
    } else if (id == R.id.n_drivers) {
        setFragment(new Tab2Drivers(), getString(R.string.td_drivers),"");
    } else if (id == R.id.n_stats) {
        setFragment(new Tab3Stats(), getString(R.string.td_stats),"");
    } else if (id == R.id.n_guide) {
        setFragment(new TabBrowser(), getString(R.string.td_guide), getString(R.string.link_guide));
    } else if (id == R.id.n_rules) {
        setFragment(new TabBrowser(), getString(R.string.td_rules), getString(R.string.link_rules));
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
项目:Remindy    文件:PlaceActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {

        // Respond to the mToolbar's back/home button
        case android.R.id.home:
            onBackPressed();
            return true;

        case R.id.menu_place_save:
            handleSaveOrUpdatePlace();
            break;

        case R.id.menu_place_delete:
            handleDeletePlace();
            break;
    }
    return super.onOptionsItemSelected(item);
}
项目:JKCloud    文件:OpportunityListActivity.java   
@Override
protected void initViewListener() {
    super.initViewListener();
    fabSpeed.setMenuListener(new SimpleMenuListenerAdapter() {

        @Override
        public boolean onMenuItemSelected(MenuItem menuItem) {
            switch (menuItem.getItemId()) {
                case R.id.action_new:
                    startActivityForResult(new Intent(OpportunityListActivity.this,
                            NewOpportunityActivity.class), ACTION_NEW);
                    break;
                case R.id.action_search:
                    startActivityForResult(new Intent(OpportunityListActivity.this,
                            SearchActivity.class), ACTION_SEARCH);
                    break;
            }
            return super.onMenuItemSelected(menuItem);
        }
    });
}
项目:YZxing    文件:ScannerActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    if (itemId == R.id.scan_from_picture) {
        //先申请权限
        int checked = ContextCompat.checkSelfPermission(ScannerActivity.this
                , Manifest.permission.WRITE_EXTERNAL_STORAGE);
        if (checked == PackageManager.PERMISSION_GRANTED) {
            goPicture();
        } else {
            ActivityCompat.requestPermissions(ScannerActivity.this
                    , new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, PERMISSION_REQUEST_CODE_WRITE_EXTERNAL_STORAGE);
        }
    }
    return true;
}
项目:Android-DFU-App    文件:DfuActivity.java   
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            onBackPressed();
            break;
        case R.id.action_about:
            final AppHelpFragment fragment = AppHelpFragment.getInstance(R.string.dfu_about_text);
            fragment.show(getSupportFragmentManager(), "help_fragment");
            break;
        case R.id.action_settings:
            final Intent intent = new Intent(this, SettingsActivity.class);
            startActivity(intent);
            break;
    }
    return true;
}
项目:diycode    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        openActivity(SettingActivity.class);
        return true;
    } else if (id == R.id.action_notification) {
        if (!mDiycode.isLogin()) {
            openActivity(LoginActivity.class);
        } else {
            openActivity(NotificationActivity.class);
        }
        return true;
    }
    return super.onOptionsItemSelected(item);
}
项目:mobile-grammar    文件:WebViewActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.create_reminder_menu_item) {
        Intent intent = new Intent();

        // mimeType will popup the chooser any  for any implementing application (e.g. the built in calendar or applications such as "Business calendar"
        intent.setType("vnd.android.cursor.item/event");

        // the time the event should start in millis. This example uses now as the start time and ends in 1 hour
        intent.putExtra("beginTime", new Date().getTime());
        intent.putExtra("endTime", new Date().getTime() + DateUtils.HOUR_IN_MILLIS);

        intent.putExtra("title", getString(R.string.text_reminder_about_lesson));
        intent.putExtra("description", getString(R.string.text_reminder_about_lesson) + ":" + lessonName);

        // the action
        intent.setAction(Intent.ACTION_EDIT);
        startActivity(intent);
    }

    return super.onOptionsItemSelected(item);
}
项目:emptyview    文件:SampleActivity.java   
@Override public boolean onOptionsItemSelected(MenuItem item) {
    int itemId = item.getItemId();
    switch (itemId) {
        case R.id.show_progress:
            emptyPresenter.showLoading();
            break;
        case R.id.show_content:
            emptyPresenter.showContent();
            break;
        case R.id.show_error:
            emptyPresenter.showError();
            break;
        case R.id.show_empty:
            emptyPresenter.showEmpty();
            break;
    }
    return super.onOptionsItemSelected(item);
}
项目:Recognize-it    文件:CameraActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    switch (id) {
        case android.R.id.home: {
            finish();
            break;
        }
        case R.id.menu_image_capture: {
            takePicture();
            break;
        }
        case R.id.menu_video_capture: {
            recordVideo();
            break;
        }
    }
    return true;
}
项目:GitHub    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    IBoxingMediaLoader loader;
    switch (id) {
        case R.id.menu_fresco:
            loader = new BoxingFrescoLoader(this);
            break;
        case R.id.menu_glide:
            loader = new BoxingGlideLoader();
            break;
        case R.id.menu_picasso:
            loader = new BoxingPicassoLoader();
            break;
        default:
            loader = new BoxingFrescoLoader(this);
            break;
    }
    BoxingMediaLoader.getInstance().init(loader);
    return super.onOptionsItemSelected(item);
}
项目:BittrexApi    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    final int itemId = item.getItemId();

    switch (itemId) {
        case R.id.action_authentication:
            AuthenticationActivity.startActivity(this);

            return true;
    }

    return super.onOptionsItemSelected(item);
}
项目:AppsTimeline    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.refresh:
            mAdapter.clear();
            process();
            return true;
        case R.id.settings:
            startActivityForResult(new Intent(MainActivity.this, SettingsActivity.class), 1);
            return true;
        case R.id.sort:
            if (DataManager.getInstance().hasPermission(getApplicationContext())) {
                mDialog = new AlertDialog.Builder(this)
                        .setTitle(R.string.sort)
                        .setSingleChoiceItems(R.array.sort, PreferenceManager.getInstance().getInt(PreferenceManager.PREF_LIST_SORT), new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                PreferenceManager.getInstance().putInt(PreferenceManager.PREF_LIST_SORT, i);
                                process();
                                mDialog.dismiss();
                            }
                        })
                        .create();
                mDialog.show();
                return true;
            } else {
                return false;
            }
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:DAPNETApp    文件:MapFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item){
    item.setChecked(!item.isChecked());
    if (ewOverlay==null||dwOverlay==null||epOverlay==null||dpOverlay==null){
        config();
    }
    if(menu.getItem(2).isChecked()){
        ewOverlay.setEnabled(menu.getItem(0).isChecked());
        ewOverlay.setFocusItemsOnTap(menu.getItem(0).isChecked());

        dwOverlay.setEnabled(menu.getItem(1).isChecked());
        ewOverlay.setFocusItemsOnTap(menu.getItem(1).isChecked());
    }else {
        //Disable Online&&Offline WiderangeOverlay
        ewOverlay.setEnabled(false);
        ewOverlay.setFocusItemsOnTap(false);
        dwOverlay.setEnabled(false);
        dwOverlay.setFocusItemsOnTap(false);
    }
    if(menu.getItem(3).isChecked()){
        epOverlay.setEnabled(menu.getItem(0).isChecked());
        epOverlay.setFocusItemsOnTap(menu.getItem(0).isChecked());
        dpOverlay.setEnabled(menu.getItem(1).isChecked());
        epOverlay.setFocusItemsOnTap(menu.getItem(1).isChecked());
    }else {
        //Disable Online&&Offline PersOverlay
        epOverlay.setEnabled(false);
        epOverlay.setFocusItemsOnTap(false);
        dpOverlay.setEnabled(false);
        dpOverlay.setFocusItemsOnTap(false);
    }
    map.invalidate();
    InfoWindow.closeAllInfoWindowsOn(map);

    return true;

}
项目:boohee_v5.6    文件:SportCourseActivity.java   
public boolean onOptionsItemSelected(MenuItem item) {
    if (WheelUtils.isFastDoubleClick()) {
        return true;
    }
    switch (item.getItemId()) {
        case R.id.action_download_manager:
            DownloadManageActivity.startActivity(this);
            return true;
        case R.id.action_course_history:
            MobclickAgent.onEvent(this.activity, Event.BINGO_VIEWCOURSEHISTORY);
            SportCourseHistoryActivity.comeOnBaby(this);
            return true;
        case R.id.action_change_course:
            MobclickAgent.onEvent(this.activity, Event.BINGO_CLICKCHANGECOURSE);
            SportCourseChangeActivity.comeOnBaby(this);
            return true;
        case R.id.action_change_reset:
            resetCourseDialog();
            return true;
        case R.id.action_course_introduce:
            MobclickAgent.onEvent(this.activity, Event.BINGO_VIEWCOURSEDOC);
            if (TextUtils.isEmpty(this.mIntroduceURL)) {
                return true;
            }
            BrowserActivity.comeOnBaby(this, "", this.mIntroduceURL);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:MuslimMateAndroid    文件:SelectPositionActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            // app icon in action bar clicked; goto parent activity.
            this.finish();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:TriMeshKit    文件:MainSurfaceActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}
项目:GitHub    文件:MainActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();

    //noinspection SimplifiableIfStatement
    if (id == R.id.action_settings) {
        return true;
    }

    return super.onOptionsItemSelected(item);
}
项目:FindX    文件:Sign_up.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    switch (item.getItemId()) {



        case R.id.info: {
            AlertDialog.Builder alertadd = new AlertDialog.Builder(
                    Sign_up.this);
            LayoutInflater factory = LayoutInflater.from(Sign_up.this);

            final View view = factory.inflate(R.layout.dialog_main, null);

            ImageView image = (ImageView) view.findViewById(R.id.imageView);
            image.setImageResource(R.drawable.mylocation_help);

            alertadd.setView(view);


            alertadd.setPositiveButton("ok", new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dlg, int sumthin) {

                }
            });
            alertDialog = alertadd.create();
            alertDialog.show();
            return super.onOptionsItemSelected(item);

        }

        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:AndroidthingsStudy    文件:Beam.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_settings:
            Intent intent = new Intent(Settings.ACTION_NFCSHARING_SETTINGS);
            startActivity(intent);
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:PopCorn    文件:MainActivity.java   
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);

    final MenuItem searchMenuItem = menu.findItem(R.id.action_search);
    final SearchView searchView = (SearchView) searchMenuItem.getActionView();
    searchView.setQueryHint(getResources().getString(R.string.search_movies_tv_shows_people));

    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
        @Override
        public boolean onQueryTextSubmit(String query) {
            if (!NetworkConnection.isConnected(MainActivity.this)) {
                Toast.makeText(MainActivity.this, R.string.no_network, Toast.LENGTH_SHORT).show();
                return true;
            }
            Intent intent = new Intent(MainActivity.this, SearchActivity.class);
            intent.putExtra(Constant.QUERY, query);
            startActivity(intent);
            searchMenuItem.collapseActionView();
            return true;
        }

        @Override
        public boolean onQueryTextChange(String newText) {
            return false;
        }
    });

    return true;
}
项目:boohee_v5.6    文件:CollectionActivity.java   
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case 1:
            if (getString(R.string.g6).equals(item.getTitle())) {
                item.setTitle(R.string.g7);
                this.mAdapter.setEdit(true);
                this.rippleLayout.setVisibility(8);
                this.viewOperate.setVisibility(0);
                this.viewOperate.startAnimation(AnimationUtils.loadAnimation(this, R.anim.o));
                return true;
            }
            item.setTitle(R.string.g6);
            this.mAdapter.setEdit(false);
            this.viewOperate.animate().alphaBy(1.0f).alpha(0.0f).setDuration(300).setListener
                    (new AnimatorListenerAdapter() {
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    CollectionActivity.this.viewOperate.setVisibility(8);
                    CollectionActivity.this.rippleLayout.setVisibility(0);
                    CollectionActivity.this.viewOperate.setAlpha(1.0f);
                }
            }).start();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
项目:OSchina_resources_android    文件:BrowserFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.public_menu_shared:
            showSharedDialog();
            break;
    }
    return true;
}
项目:editor-sql    文件:SqlCreateTableActivity.java   
@Override
    protected void initToolBar() {
        super.initToolBar();
        mToolbar.setSubtitle(getIntent().getStringExtra(DB_NAME));
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (mNewColumnFieldList == null || mNewColumnFieldList.size() == 0) {
                    showExitTipDialog();
                } else {
                    finish();
                }
            }
        });
        mToolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {

                switch (item.getItemId()) {
                    case R.id.action_column_edit:
                        addColumnToTab(mNewColumnFieldList.get(mClickPosition), false);
                        break;

                    case R.id.action_column_delete:
//                        if (Utils.isFunNeedBuy(SqlCreateTableActivity.this)) {
//                            return true;
//                        }

                        showSureDeleteDialog();
                        break;

                }
                return true;
            }
        });
        initToolBarButton();
    }
项目:buildAPKsSamples    文件:Notepadv3.java   
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item) {
    switch(item.getItemId()) {
        case INSERT_ID:
            createNote();
            return true;
    }

    return super.onMenuItemSelected(featureId, item);
}
项目:School1-Android    文件:SchoolLoginActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home)
        onBackPressed();
    else
        return super.onOptionsItemSelected(item);

    return true;
}
项目:USay    文件:TouTiaoFragment.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case R.id.xiandu:
            Intent intent = new Intent(getActivity(), WebViewXianDuActivity.class);
            getActivity().startActivity(intent);
            break;
        default:
            break;
    }
    return true;
}
项目:C500Companion    文件:SettingsActivity.java   
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();
    if (id == android.R.id.home) {
        startActivity(new Intent(getActivity(), SettingsActivity.class));
        return true;
    }
    return super.onOptionsItemSelected(item);
}