當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。