当前位置: 首页>>代码示例>>Java>>正文


Java MenuItem.getGroupId方法代码示例

本文整理汇总了Java中android.view.MenuItem.getGroupId方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.getGroupId方法的具体用法?Java MenuItem.getGroupId怎么用?Java MenuItem.getGroupId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.MenuItem的用法示例。


在下文中一共展示了MenuItem.getGroupId方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onOptionsItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
  if (item.getItemId() == R.id.media_variations_clear_cache) {
    Fresco.getImagePipeline().clearCaches();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      getActivity().recreate();
    } else {
      Toast.makeText(
          getActivity(),
          R.string.imagepipeline_media_variations_restart_toast,
          Toast.LENGTH_SHORT).show();
      getActivity().finish();
    }
    return true;
  } else if (item.getGroupId() == R.id.media_variations_modes) {
    for (Mode mode : Mode.values()) {
      if (mode.menuItemId == item.getItemId()) {
        setMode(mode);
        break;
      }
    }
    clearMainImageAndBitmapCache();
    item.setChecked(true);
  }

  return super.onOptionsItemSelected(item);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:MediaVariationsFragment.java

示例2: onContextItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
public boolean onContextItemSelected(MenuItem item) {
	if (item.getGroupId() != ConfigUtil.DOWNLOADING_MENU_GROUP_ID) {
		return false;
	}
	
	int selectedPosition = ((AdapterContextMenuInfo) item.getMenuInfo()).position;// 获取点击了第几行
	DownloadInfo downloadInfo = (DownloadInfo) downloadAdapter.getItem(selectedPosition);
	String title = downloadInfo.getTitle();

	// 删除数据库记录
	DataSet.removeDownloadInfo(title);

	File file = new File(Environment.getExternalStorageDirectory()+"/CCDownload", title+".mp4");
	if(file.exists()){
		file.delete();
	}
	
	// 通知service取消下载
	if (!binder.isStop() && binder.exists(title)) {
		binder.cancel(title);
		startWaitStatusDownload();
	}
	
	initData();
	downloadAdapter.notifyDataSetChanged();
	downloadingListView.invalidate();

	if (getUserVisibleHint()) {
		return true;
	}
	
	return false;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:34,代码来源:DownloadingFragment.java

示例3: onContextItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public boolean onContextItemSelected(MenuItem item) {
	if (item.getGroupId() != ConfigUtil.DOWNLOADED_MENU_GROUP_ID) {
		return false;
	}
	
	int selectedPosition = ((AdapterContextMenuInfo) item.getMenuInfo()).position;
	
	Pair<String, Integer> pair = (Pair<String, Integer>)videoListViewAdapter.getItem(selectedPosition);
	
	DataSet.removeDownloadInfo(pair.first);
	
	File file = new File(Environment.getExternalStorageDirectory()+"/"+ConfigUtil.DOWNLOAD_DIR, pair.first+".mp4");
	if(file.exists()){
		file.delete();
	}
	
	initData();
	videoListViewAdapter.notifyDataSetChanged();
	downloadedListView.invalidate();

	if (getUserVisibleHint()) {
		return true;
	}

	return false;
}
 
开发者ID:lbbniu,项目名称:CCDownload,代码行数:29,代码来源:DownloadedFragment.java

示例4: onContextItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
    int id_group = item.getGroupId();

    switch (id_group) {
        case ID_GROUP_TEACHER:
            String name = item.getTitle().toString();
            mView_TeacherName.setText(name);
            break;
    }
    return super.onContextItemSelected(item);
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:13,代码来源:AddEditDetailSubjectActivity.java

示例5: onContextItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
    int id_group = item.getGroupId();

    switch (id_group) {
        case ID_GROUP_SUBJECT:
            changeSubject(item.getItemId());
            break;
    }
    return super.onContextItemSelected(item);
}
 
开发者ID:nhocga1995s,项目名称:MyCalendar,代码行数:12,代码来源:WeekLessonDetailActivity.java

示例6: onActionItemClicked

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, actionMode, menuItem);

    switch (menuItem.getItemId()) {
        case R.id.query_cab_schedule:
            displayScheduleTimestampDialog(R.id.query_cab_schedule, mSelection.getIds());
            break;

        case R.id.query_cab_state:
            /* Add all known states to menu. */
            SubMenu subMenu = menuItem.getSubMenu();
            if (subMenu != null) {
                subMenu.clear();
                for (String str: new NoteStateSpinner(getActivity(), null).getValues()) {
                    subMenu.add(STATE_ITEM_GROUP, Menu.NONE, Menu.NONE, str);
                }
            }
            break;

        default:
            /* Click on one of the state keywords. */
            if (menuItem.getGroupId() == STATE_ITEM_GROUP) {
                if (mListener != null) {
                    mListener.onStateChangeRequest(mSelection.getIds(), menuItem.getTitle().toString());
                }
                return true;
            }

            return false; // Not handled.
    }

    return true; // Handled.
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:35,代码来源:SearchFragment.java

示例7: onActionItemClicked

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onActionItemClicked(ActionMode actionMode, MenuItem menuItem) {
    if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, actionMode, menuItem);
    TreeSet<Long> selectionIds;
    switch (menuItem.getItemId()) {
        case R.id.query_cab_schedule:
            selectionIds = originalSelectedIds();
            if (!selectionIds.isEmpty()) {
                displayScheduleTimestampDialog(R.id.query_cab_schedule, selectionIds);
            }
            break;

        case R.id.query_cab_state:
            /* Add all known states to menu. */
            SubMenu subMenu = menuItem.getSubMenu();
            if (subMenu != null) {
                subMenu.clear();
                for (String str: new NoteStateSpinner(getActivity(), null).getValues()) {
                    subMenu.add(STATE_ITEM_GROUP, Menu.NONE, Menu.NONE, str);
                }
            }
            break;

        default:
            /* Click on one of the state keywords. */
            if (menuItem.getGroupId() == STATE_ITEM_GROUP) {
                if (mListener != null) {
                    selectionIds = originalSelectedIds();
                    if (!selectionIds.isEmpty()) {
                        mListener.onStateChangeRequest(selectionIds, menuItem.getTitle().toString());
                    }
                }
                return true;
            }

            return false; // Not handled.
    }

    return true; // Handled.
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:41,代码来源:AgendaFragment.java

示例8: setExclusiveItemChecked

import android.view.MenuItem; //导入方法依赖的package包/类
void setExclusiveItemChecked(MenuItem item) {
    int group = item.getGroupId();
    int N = this.mItems.size();
    for (int i = 0; i < N; i++) {
        MenuItem curItem = (MenuItemImpl) this.mItems.get(i);
        if (curItem.getGroupId() == group && curItem.isExclusiveCheckable() && curItem.isCheckable()) {
            curItem.setCheckedInt(curItem == item);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:MenuBuilder.java

示例9: onContextItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
	switch (item.getGroupId()) {
		case R.id.delete:
			deleteItem(item.getItemId());
			return true;
		case R.id.edit:
			Intent i = new Intent(MainActivity.this, AddTestActivity.class);
			i.putExtra(AddTestActivity.ARG_TEST_ID, socTests.get(item.getItemId()).getId());
			startActivity(i);
			return true;
		default:
			return super.onContextItemSelected(item);
	}
}
 
开发者ID:Komdosh,项目名称:SocEltech,代码行数:16,代码来源:MainActivity.java

示例10: onNavigationItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    int loaderId = 0;
    switch(item.getGroupId()){
        case R.id.navgroup_list:
            switch(item.getItemId()){
                case R.id.nav_incomplete:
                    loaderId = 1;
                    break;
                case R.id.nav_expired:
                    loaderId = 2;
                    break;
                case R.id.nav_completed:
                    loaderId = 3;
                    break;
                case R.id.nav_archive:
                    loaderId = 4;
                    break;
                case R.id.nav_deleted:
                    loaderId = 5;
                    break;
            }
            navigationView.setCheckedItem(item.getItemId());
            ToduleListFragment frag = ToduleListFragment.newInstance(loaderId);
            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, frag, "list_frag" + String.valueOf(loaderId))
                    .commit();
            mDrawerLayout.closeDrawer(GravityCompat.START);
            return true;
        case R.id.navgroup_setting:
            switch(item.getItemId()){
                case R.id.nav_label:
                    navigationView.setCheckedItem(item.getItemId());
                    ToduleLabelFragment labelFrag = ToduleLabelFragment.newInstance(false, null);
                    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, labelFrag)
                            .commit();
                    mDrawerLayout.closeDrawer(GravityCompat.START);
                    break;
            }
            return true;
    }
    return true;
}
 
开发者ID:danlls,项目名称:Todule-android,代码行数:47,代码来源:MainActivity.java

示例11: onOptionsItemSelected

import android.view.MenuItem; //导入方法依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home:
		Intent upIntent = NavUtils.getParentActivityIntent(this);
		if (upIntent != null)
			if (NavUtils.shouldUpRecreateTask(this, upIntent))
				TaskStackBuilder.create(this).addNextIntentWithParentStack(upIntent).startActivities();
			else
				NavUtils.navigateUpTo(this, upIntent);
		return true;
	case R.id.menu_usage:
		optionUsage();
		return true;
	case R.id.menu_accounts:
		optionAccounts();
		return true;
	case R.id.menu_applications:
		optionApplications();
		return true;
	case R.id.menu_contacts:
		if (item.getGroupId() != 0) {
			optionContacts(item.getGroupId());
			return true;
		} else
			return false;
	case R.id.menu_whitelists:
		optionWhitelists(null);
		return true;
	case R.id.menu_apply:
		optionTemplate();
		return true;
	case R.id.menu_clear:
		optionClear();
		return true;
	case R.id.menu_export:
		optionExport();
		return true;
	case R.id.menu_import:
		optionImport();
		return true;
	case R.id.menu_submit:
		optionSubmit();
		return true;
	case R.id.menu_fetch:
		optionFetch();
		return true;
	case R.id.menu_settings:
		optionSettings();
		return true;
	case R.id.menu_dump:
		optionDump();
		return true;
	case R.id.menu_legend:
		optionLegend();
		return true;
	case R.id.menu_tutorial:
		optionTutorial();
		return true;
	default:
		return super.onOptionsItemSelected(item);
	}
}
 
开发者ID:ukanth,项目名称:XPrivacy,代码行数:64,代码来源:ActivityApp.java


注:本文中的android.view.MenuItem.getGroupId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。