• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ExpandableListContextMenuInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.widget.ExpandableListView.ExpandableListContextMenuInfo的典型用法代码示例。如果您正苦于以下问题:Java ExpandableListContextMenuInfo类的具体用法?Java ExpandableListContextMenuInfo怎么用?Java ExpandableListContextMenuInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ExpandableListContextMenuInfo类属于android.widget.ExpandableListView包,在下文中一共展示了ExpandableListContextMenuInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
	super.onCreateContextMenu(menu, v, menuInfo);

	ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

	int type = ExpandableListView.getPackedPositionType(info.packedPosition);
	int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
	int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

	if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {

		HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
		menu.setHeaderTitle(item.getTitle());

		menu.add(0, MENU_OPEN_IN_TAB, 0, R.string.HistoryListActivity_MenuOpenInTab);
		menu.add(0, MENU_COPY_URL, 0, R.string.BookmarksHistoryActivity_MenuCopyLinkUrl);
		menu.add(0, MENU_SHARE, 0, R.string.Main_MenuShareLinkUrl);
		menu.add(0, MENU_DELETE_FROM_HISTORY, 0, R.string.HistoryListActivity_MenuDelete);
	}
}
 
开发者ID:tommy4711,项目名称:gaeproxy,代码行数:22,代码来源:HistoryListActivity.java


示例2: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
	super.onCreateContextMenu(menu, v, menuInfo);
	
	ExpandableListView.ExpandableListContextMenuInfo info =
		(ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

	int type = ExpandableListView.getPackedPositionType(info.packedPosition);
	int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
	int child =	ExpandableListView.getPackedPositionChild(info.packedPosition);
	
	if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
		
		HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
		menu.setHeaderTitle(item.getTitle());
		
		menu.add(0, MENU_OPEN_IN_TAB, 0, R.string.HistoryListActivity_MenuOpenInTab);
		menu.add(0, MENU_COPY_URL, 0, R.string.BookmarksHistoryActivity_MenuCopyLinkUrl);
		menu.add(0, MENU_SHARE, 0, R.string.Main_MenuShareLinkUrl);
		menu.add(0, MENU_DELETE_FROM_HISTORY, 0, R.string.HistoryListActivity_MenuDelete);
	}
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:23,代码来源:HistoryListActivity.java


示例3: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
		ContextMenuInfo menuInfo) {
	menu.add(Menu.NONE, 0, Menu.NONE, R.string.context_action_shortcut);
	menu.add(Menu.NONE, 1, Menu.NONE, R.string.context_action_launch);
	
	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo)menuInfo;
	ExpandableListView list = (ExpandableListView) getView().findViewById(R.id.expandableListView1);
	
	switch(ExpandableListView.getPackedPositionType(info.packedPosition)) {
	case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
		MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition));
		menu.setHeaderIcon(activity.icon);
		menu.setHeaderTitle(activity.name);
		menu.add(Menu.NONE, 2, Menu.NONE, R.string.context_action_edit);
		break;
	case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
		MyPackageInfo pack = (MyPackageInfo) list.getExpandableListAdapter().getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition));
		menu.setHeaderIcon(pack.icon);
		menu.setHeaderTitle(pack.name);
		break;
	}

	super.onCreateContextMenu(menu, v, menuInfo);
}
 
开发者ID:butzist,项目名称:ActivityLauncher,代码行数:26,代码来源:AllTasksListFragment.java


示例4: onContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
    ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();
    int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    int childPos = ExpandableListView.getPackedPositionChild(info.packedPosition);
    Recording r = (Recording) recAdapter.getChild(groupPos, childPos);

    switch (item.getItemId()) {
        case R.id.action_edit:
            editRecording(r);
            return true;
        case R.id.action_delete:
            deleteRecording(r);
            return true;
        default:
            return super.onContextItemSelected(item);
    }
}
 
开发者ID:MC-Timetracker,项目名称:timetracker,代码行数:19,代码来源:ListRecordingsFragment.java


示例5: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override  
  public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {

  	super.onCreateContextMenu(menu, v, menuInfo);
  	
  	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;

  	String aHeaderTitle = "";
  	
switch (ExpandableListView.getPackedPositionType(info.packedPosition))
{
case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
	aHeaderTitle = (String) this.listAdapter.getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition)).toString();			
	break;
case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
	aHeaderTitle = (String) this.listAdapter.getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition)).toString();
	break;
default:
	break;
}
  	
  	menu.setHeaderTitle(aHeaderTitle.toString());  
  	menu.add(0, CONTEXT_MENU_EDIT, 0, this.getString(R.string.edit));  
  	menu.add(0, CONTEXT_MENU_DELETE, 0, this.getString(R.string.delete));  
  }
 
开发者ID:daniffig,项目名称:dv-quiz,代码行数:26,代码来源:MainActivity.java


示例6: onContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();

	int type = ExpandableListView.getPackedPositionType(info.packedPosition);

	if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
		int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
		int child = ExpandableListView.getPackedPositionChild(info.packedPosition);

		HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);

		switch (menuItem.getItemId()) {
		case MENU_OPEN_IN_TAB:
			doNavigateToUrl(item.getUrl(), true);
			break;
		case MENU_COPY_URL:
			ApplicationUtils.copyTextToClipboard(this, item.getUrl(),
					getString(R.string.Commons_UrlCopyToastMessage));
			break;
		case MENU_SHARE:
			ApplicationUtils.sharePage(this, item.getTitle(), item.getUrl());
			break;
		case MENU_DELETE_FROM_HISTORY:
			BookmarksProviderWrapper.deleteHistoryRecord(getContentResolver(), item.getId());
			fillData();
			break;
		default:
			break;
		}
	}

	return super.onContextItemSelected(menuItem);
}
 
开发者ID:tommy4711,项目名称:gaeproxy,代码行数:35,代码来源:HistoryListActivity.java


示例7: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see android.app.Activity#onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    if (menuInfo instanceof ExpandableListContextMenuInfo) {
        final ExpandableListContextMenuInfo cmi = (ExpandableListContextMenuInfo) menuInfo;
        final int type = ExpandableListView.getPackedPositionType(cmi.packedPosition);
        final int groupPosition = ExpandableListView.getPackedPositionGroup(cmi.packedPosition);
        final int childPosition = ExpandableListView.getPackedPositionChild(cmi.packedPosition);
        // System.out.println("OPDSActivity.onCreateContextMenu(): " + type + ", " + groupPosition + ", "
        // + childPosition);
        switch (type) {
            case ExpandableListView.PACKED_POSITION_TYPE_NULL:
                onCreateContextMenu(menu);
                return;
            case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
                final Entry entry = getController().adapter.getGroup(groupPosition);
                if (entry instanceof Feed) {
                    onCreateFeedContextMenu(menu, (Feed) entry);
                } else if (entry instanceof Book) {
                    onCreateBookContextMenu(menu, (Book) entry);
                }
                return;
            case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
                final Entry group = getController().adapter.getGroup(groupPosition);
                final Object child = getController().adapter.getChild(groupPosition, childPosition);
                if (child instanceof Link) {
                    onCreateLinkContextMenu(menu, (Book) group, (Link) child);
                } else if (child instanceof Feed) {
                    onCreateFacetContextMenu(menu, (Feed) group, (Feed) child);
                }
                return;
        }
    }
    onCreateContextMenu(menu);
}
 
开发者ID:Git-tl,项目名称:appcan-plugin-pdfreader-android,代码行数:40,代码来源:OPDSActivity.java


示例8: onContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem menuItem) {
	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuItem.getMenuInfo();
	
	int type = ExpandableListView.getPackedPositionType(info.packedPosition);
	
	if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
		int group = ExpandableListView.getPackedPositionGroup(info.packedPosition);
		int child =	ExpandableListView.getPackedPositionChild(info.packedPosition);
		
		HistoryItem item = (HistoryItem) getExpandableListAdapter().getChild(group, child);
		
		switch (menuItem.getItemId()) {
		case MENU_OPEN_IN_TAB:
			doNavigateToUrl(item.getUrl(), true);
			break;
		case MENU_COPY_URL:
			ApplicationUtils.copyTextToClipboard(this, item.getUrl(), getString(R.string.Commons_UrlCopyToastMessage));
			break;
		case MENU_SHARE:
			ApplicationUtils.sharePage(this, item.getTitle(), item.getUrl());
			break;
		case MENU_DELETE_FROM_HISTORY:
			BookmarksProviderWrapper.deleteHistoryRecord(getContentResolver(), item.getId());
			fillData();
			break;
		default:
			break;
		}
	}
	
	return super.onContextItemSelected(menuItem);
}
 
开发者ID:mashiwoo,项目名称:zirco-browser,代码行数:34,代码来源:HistoryListActivity.java


示例9: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

    //only show context menu for child items (recordings not dates)
    int type = ExpandableListView.getPackedPositionType(info.packedPosition);
    if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
        MenuInflater inflater = getActivity().getMenuInflater();
        inflater.inflate(R.menu.list_recordings_context, menu);
    }
}
 
开发者ID:MC-Timetracker,项目名称:timetracker,代码行数:14,代码来源:ListRecordingsFragment.java


示例10: onContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
    ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();
    int groupPos = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    int childPos = ExpandableListView.getPackedPositionChild(info.packedPosition);
    int type = ExpandableListView.getPackedPositionType(info.packedPosition);

    long taskId;
    if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
        taskId = listHeader.get(groupPos).getId();
    } else {
        taskId = listItems.get(listHeader.get(groupPos)).get(childPos).getId();
    }


    switch (item.getItemId()) {
        case R.id.action_edit:
            editTask(taskId);
            return true;
        case R.id.action_delete:
            deleteTask(taskId);
            return true;
        case R.id.action_statistics:
            statisticsTask(taskId);
            return true;
        default:
            return super.onContextItemSelected(item);
    }
}
 
开发者ID:MC-Timetracker,项目名称:timetracker,代码行数:30,代码来源:ListTasksFragment.java


示例11: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public void onCreateContextMenu(ContextMenu menu, View v,
                                ContextMenu.ContextMenuInfo menuInfo) {
    ExpandableListView.ExpandableListContextMenuInfo info;

    try {
        info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
    } catch (ClassCastException e) {
        Log.e(TAG, "bad menuinfo: ", e);
        return;
    }

    long packedPosition = info.packedPosition;
    boolean isChild = isChild(packedPosition);

    // get the entry name for the item
    String menuName;
    if (isChild) {
        getMenuInflater().inflate(R.menu.roster_item_contextmenu, menu);
        menuName = String.format("%s (%s)",
                                 getPackedItemRow(packedPosition, RosterConstants.ALIAS),
                                 getPackedItemRow(packedPosition, RosterConstants.JID));
    } else {
        menuName = getPackedItemRow(packedPosition, RosterConstants.GROUP);
        if (menuName.equals(""))
            return; // no options for default menu
        getMenuInflater().inflate(R.menu.roster_group_contextmenu, menu);
    }

    menu.setHeaderTitle(getString(R.string.roster_contextmenu_title, menuName));
}
 
开发者ID:ufo22940268,项目名称:maven-yaxim,代码行数:32,代码来源:MainWindow.java


示例12: onCreateContextMenu

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void onCreateContextMenu(ContextMenu menu, View v,
		ContextMenuInfo menuInfo) {
	ExpandableListView.ExpandableListContextMenuInfo info = (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;

	int type = ExpandableListView
			.getPackedPositionType(info.packedPosition);
	if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
		new MenuInflater(getContext()).inflate(R.menu.workspace_browser, menu);
	}
}
 
开发者ID:hdweiss,项目名称:codemap,代码行数:11,代码来源:WorkspaceBrowser.java


示例13: handleLongClick

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void handleLongClick(MenuItem item) {
	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item
			.getMenuInfo();

	Log.d("CodeMap", "handlelongclick!");
	int type = ExpandableListView
			.getPackedPositionType(info.packedPosition);
	if (type == ExpandableListView.PACKED_POSITION_TYPE_GROUP) {
		int groupPosition = ExpandableListView
				.getPackedPositionGroup(info.packedPosition);
		String group = adapter.getGroup(groupPosition);
		Toast.makeText(getContext(), "Clicked! " + group, Toast.LENGTH_SHORT).show();
	}
}
 
开发者ID:hdweiss,项目名称:codemap,代码行数:15,代码来源:WorkspaceBrowser.java


示例14: populateList

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void populateList() {
  ExpandableListView listView = (ExpandableListView) findViewById(R.id.channelListView);
  adapter = new ExpandableListChannelAdapter(this);
  listView.setAdapter(adapter);
  
    listView.setOnChildClickListener(this);        
    listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {

    	public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
                    		        		
    		ExpandableListContextMenuInfo elcm = (ExpandableListContextMenuInfo) menuInfo;
    		
    		int type = ExpandableListView.getPackedPositionType(elcm.packedPosition);
    		if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
    			
    			int groupPosition = ExpandableListView.getPackedPositionGroup(elcm.packedPosition);
    			int childPosition = ExpandableListView.getPackedPositionChild(elcm.packedPosition);
    			String channel = adapter.children[groupPosition][childPosition];
    			
    			
    			menu.setHeaderTitle(channel);
                menu.add(0, 0, 0, R.string.ctx_clear);
                if (channel.startsWith("#")){
                  menu.add(0, 1, 0, R.string.ctx_part);
                }
                menu.add(0, 2, 0 , R.string.ctx_close);
                menu.add(0, 3, 0, R.string.ctx_activatespeech);   
                
    		}else{
    			
    			menu.setHeaderTitle(adapter.groupNames[ExpandableListView.getPackedPositionGroup(elcm.packedPosition)]);        			
                menu.add(0, 0, 0, R.string.ctx_viewlog);                    
                menu.add(0, 1, 0, R.string.ctx_clear);
                menu.add(0, 2, 0, R.string.ctx_disconnect);
                menu.add(0, 3, 0, R.string.ctx_close);
                menu.add(0, 4, 0, R.string.ctx_activatespeech);                    
    		}
        }

    });
    
}
 
开发者ID:jarro,项目名称:ircradio,代码行数:43,代码来源:ActChannelList.java


示例15: populateList

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
public void populateList() {
        
  
  ExpandableListView listView = (ExpandableListView) findViewById(R.id.accountListView);
    //ListView listView = new ListView(this);
    
    
                 
    adapter = new ExpandableListORMAccountAdapter(this);
    adapter.setData(ExpandableListORMAccountAdapter.AdapterBundle.getAdapterBundle());
    
    listView.setAdapter(adapter);
    
    listView.setOnChildClickListener(this);
    listView.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {

            	public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
      		
            		ExpandableListContextMenuInfo elcm = (ExpandableListContextMenuInfo) menuInfo;
            		
            		int type = ExpandableListView.getPackedPositionType(elcm.packedPosition);
            		if (type == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
            			
            			int groupPosition = ExpandableListView.getPackedPositionGroup(elcm.packedPosition);
            			int childPosition = ExpandableListView.getPackedPositionChild(elcm.packedPosition);                			
            			                			
            			menu.setHeaderTitle(R.string.ctx_title_channelmenu);
            			menu.add(0, 3, 0, R.string.ctx_viewmessages);
            			menu.add(0, 0, 1, R.string.ctx_part);                                                                                    
                        menu.add(0, 1, 2, R.string.ctx_edit);
                        menu.add(0, 2, 3, R.string.ctx_delete);                               
            		}
            	
            	    else {
            			menu.setHeaderTitle(R.string.ctx_title_servermenu);        			
            			menu.add(0, 0, 0, R.string.ctx_addchannel);
            			menu.add(0, 1, 0, R.string.ctx_connect);                    
                        menu.add(0, 2, 0, R.string.ctx_disconnect);
                        menu.add(0, 3, 0, R.string.ctx_edit);
                        menu.add(0, 4, 0, R.string.ctx_delete);                                                
            		}}
            });
 
}
 
开发者ID:jarro,项目名称:ircradio,代码行数:45,代码来源:ActAccountList.java


示例16: onContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override
public boolean onContextItemSelected(MenuItem item) {
	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo)item.getMenuInfo();
	ExpandableListView list = (ExpandableListView) getView().findViewById(R.id.expandableListView1);
	
	switch(ExpandableListView.getPackedPositionType(info.packedPosition)) {
	case ExpandableListView.PACKED_POSITION_TYPE_CHILD:
		MyActivityInfo activity = (MyActivityInfo) list.getExpandableListAdapter().getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition));
		switch(item.getItemId()) {
		case 0:
			LauncherIconCreator.createLauncherIcon(getActivity(), activity);
			break;
		case 1:
			LauncherIconCreator.launchActivity(getActivity(), activity.component_name);
			break;
		case 2:
			DialogFragment dialog = new ShortcutEditDialogFragment();
			Bundle args = new Bundle();
			args.putParcelable("activity", activity.component_name);
			dialog.setArguments(args);
			dialog.show(this.getFragmentManager(), "ShortcutEditor");
			break;
		}
		break;

	case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
		MyPackageInfo pack = (MyPackageInfo) list.getExpandableListAdapter().getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition));
		switch(item.getItemId()) {
		case 0:
			LauncherIconCreator.createLauncherIcon(getActivity(), pack);
			break;
		case 1:
			PackageManager pm = getActivity().getPackageManager();
			Intent intent = pm.getLaunchIntentForPackage(pack.package_name);
			Toast.makeText(getActivity(), String.format(getText(R.string.starting_application).toString(), pack.name), Toast.LENGTH_LONG).show();
			getActivity().startActivity(intent);
			break;
		}
	}
	return super.onContextItemSelected(item);
}
 
开发者ID:butzist,项目名称:ActivityLauncher,代码行数:42,代码来源:AllTasksListFragment.java


示例17: handleContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
private boolean handleContextItemSelected(MenuItem item, int position) {
    ContextMenuInfo menuInfo = item.getMenuInfo();

    int startPosition;
    int groupPosition;
    List<String> medias;
    int id = item.getItemId();

    boolean useAllItems = id == R.id.audio_list_browser_play_all;
    boolean append = id == R.id.audio_list_browser_append;

    if (ExpandableListContextMenuInfo.class.isInstance(menuInfo)) {
        ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
        groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    }
    else
        groupPosition = position;

    if (id == R.id.audio_list_browser_delete) {
        AlertDialog alertDialog = CommonDialogs.deleteMedia(
                getActivity(),
                mSongsAdapter.getLocations(groupPosition).get(0),
                new VLCRunnable(mSongsAdapter.getItem(groupPosition)) {
                    @Override
                    public void run(Object o) {
                        AudioBrowserListAdapter.ListItem listItem = (AudioBrowserListAdapter.ListItem)o;
                        Media media = listItem.mMediaList.get(0);
                        mMediaLibrary.getMediaItems().remove(media);
                        mSongsAdapter.removeMedia(media);
                        mAlbumsAdapter.removeMedia(media);
                        mAudioController.removeLocation(media.getLocation());
                    }
                });
        alertDialog.show();
        return true;
    }

    if (id == R.id.audio_list_browser_set_song) {
        AudioUtil.setRingtone(mSongsAdapter.getItem(groupPosition).mMediaList.get(0), getActivity());
        return true;
    }

    if (useAllItems) {
        medias = new ArrayList<String>();
        startPosition = mSongsAdapter.getListWithPosition(medias, groupPosition);
    }
    else {
        startPosition = 0;
        switch (mTabHost.getCurrentTab())
        {
            case 0: // albums
                medias = mAlbumsAdapter.getLocations(groupPosition);
                break;
            case 1: // songs
                medias = mSongsAdapter.getLocations(groupPosition);
                break;
            default:
                return true;
        }
    }

    if (append)
        mAudioController.append(medias);
    else
        mAudioController.load(medias, startPosition);

    return super.onContextItemSelected(item);
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:69,代码来源:AudioAlbumsSongsFragment.java


示例18: handleContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
private boolean handleContextItemSelected(MenuItem item, int position) {
    ContextMenuInfo menuInfo = item.getMenuInfo();

    int startPosition;
    int groupPosition;
    List<String> medias;
    int id = item.getItemId();

    boolean useAllItems = id == R.id.audio_list_browser_play_all;
    boolean append = id == R.id.audio_list_browser_append;

    if (ExpandableListContextMenuInfo.class.isInstance(menuInfo)) {
        ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
        groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    }
    else
        groupPosition = position;

    if (id == R.id.audio_list_browser_delete) {
        AlertDialog alertDialog = CommonDialogs.deleteMedia(
                getActivity(),
                mSongsAdapter.getLocations(groupPosition).get(0),
                new VLCRunnable(mSongsAdapter.getItem(groupPosition)) {
                    @Override
                    public void run(Object o) {
                        AudioBrowserListAdapter.ListItem listItem = (AudioBrowserListAdapter.ListItem)o;
                        Media media = listItem.mMediaList.get(0);
                        mMediaLibrary.getMediaItems().remove(media);
                        mAudioController.removeLocation(media.getLocation());
                        updateLists();
                    }
                });
        alertDialog.show();
        return true;
    }

    if (id == R.id.audio_list_browser_set_song) {
        AudioUtil.setRingtone(mSongsAdapter.getItem(groupPosition).mMediaList.get(0), getActivity());
        return true;
    }

    if (useAllItems) {
        medias = new ArrayList<String>();
        startPosition = mSongsAdapter.getListWithPosition(medias, groupPosition);
    }
    else {
        startPosition = 0;
        switch (mFlingViewGroup.getPosition())
        {
            case MODE_SONG:
                medias = mSongsAdapter.getLocations(groupPosition);
                break;
            case MODE_ARTIST:
                medias = mArtistsAdapter.getLocations(groupPosition);
                break;
            case MODE_ALBUM:
                medias = mAlbumsAdapter.getLocations(groupPosition);
                break;
            case MODE_GENRE:
                medias = mGenresAdapter.getLocations(groupPosition);
                break;
            default:
                return true;
        }
    }

    if (append)
        mAudioController.append(medias);
    else
        mAudioController.load(medias, startPosition);

    return super.onContextItemSelected(item);
}
 
开发者ID:smyhvae,项目名称:VlcTest,代码行数:74,代码来源:AudioBrowserFragment.java


示例19: onContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
@Override  
  public boolean onContextItemSelected(MenuItem item) { 

  	ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) item.getMenuInfo();

switch (ExpandableListView.getPackedPositionType(info.packedPosition))
{
case ExpandableListView.PACKED_POSITION_TYPE_GROUP:
	Category selectedCategory = (Category) this.listAdapter.getGroup(ExpandableListView.getPackedPositionGroup(info.packedPosition));
	
	switch (item.getItemId())
	{
	case CONTEXT_MENU_EDIT:
		dvQuizContext.getInstance().setValue("selectedCategory", selectedCategory);
		
		this.startActivityForResult(new Intent(this, CategoryFormActivity.class), dvQuizReference.ADD_NEW_CATEGORY.getReferenceValue());
		
		return true;
	case CONTEXT_MENU_DELETE:
		selectedCategory.delete();
		
		this.redrawListData();
		
		Toast.makeText(MainActivity.this, String.format(this.getString(R.string.info_object_successfully_delete), selectedCategory.toString()), Toast.LENGTH_SHORT).show();
		
		return true;
	}
	
	break;
case ExpandableListView.PACKED_POSITION_TYPE_CHILD:			
	Quiz selectedQuiz = (Quiz) this.listAdapter.getChild(ExpandableListView.getPackedPositionGroup(info.packedPosition), ExpandableListView.getPackedPositionChild(info.packedPosition));
	
	switch (item.getItemId())
	{
	case CONTEXT_MENU_EDIT:
		dvQuizContext.getInstance().setValue("selectedQuiz", selectedQuiz);
		
		this.startActivity(new Intent(this, QuizFormActivity.class));
		return true;
	case CONTEXT_MENU_DELETE:
		selectedQuiz.delete();
		
		this.redrawListData();
		
		Toast.makeText(MainActivity.this, String.format(this.getString(R.string.info_object_successfully_delete), selectedQuiz.toString()), Toast.LENGTH_SHORT).show();

		return true;
	}
	break;
default:
	return false;
}
  	
  	return false;  
  }
 
开发者ID:daniffig,项目名称:dv-quiz,代码行数:56,代码来源:MainActivity.java


示例20: handleContextItemSelected

import android.widget.ExpandableListView.ExpandableListContextMenuInfo; //导入依赖的package包/类
private boolean handleContextItemSelected(MenuItem item, int position) {
    ContextMenuInfo menuInfo = item.getMenuInfo();

    int startPosition;
    int groupPosition;
    List<String> medias;
    int id = item.getItemId();

    boolean useAllItems = id == R.id.audio_list_browser_play_all;
    boolean append = id == R.id.audio_list_browser_append;

    if (ExpandableListContextMenuInfo.class.isInstance(menuInfo)) {
        ExpandableListContextMenuInfo info = (ExpandableListContextMenuInfo) menuInfo;
        groupPosition = ExpandableListView.getPackedPositionGroup(info.packedPosition);
    }
    else
        groupPosition = position;

    if (id == R.id.audio_list_browser_delete) {
        AlertDialog alertDialog = CommonDialogs.deleteMedia(
                getActivity(),
                mSongsAdapter.getLocations(groupPosition).get(0),
                new VlcRunnable(mSongsAdapter.getItem(groupPosition)) {
                    @Override
                    public void run(Object o) {
                        Media aMedia = (Media) o;
                        mMediaLibrary.getMediaItems().remove(aMedia);
                        updateList();
                    }
                });
        alertDialog.show();
        return true;
    }

    if (id == R.id.audio_list_browser_set_song) {
        //AudioUtil.setRingtone(mSongsAdapter.getItem(groupPosition),getActivity());
        return true;
    }

    if (useAllItems) {
        medias = new ArrayList<String>();
        startPosition = mSongsAdapter.getListWithPosition(medias, groupPosition);
    }
    else {
        startPosition = 0;
        switch (mTabHost.getCurrentTab())
        {
            case 0: // albums
                medias = mAlbumsAdapter.getLocations(groupPosition);
                break;
            case 1: // songs
                medias = mSongsAdapter.getLocations(groupPosition);
                break;
            default:
                return true;
        }
    }

    if (append)
        mAudioController.append(medias);
    else
        mAudioController.load(medias, startPosition);

    return super.onContextItemSelected(item);
}
 
开发者ID:KlepikovMD,项目名称:popcorntime-android-kitkat,代码行数:66,代码来源:AudioAlbumsSongsFragment.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Id类代码示例发布时间:2022-05-21
下一篇:
Java BiomeGenJungle类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap