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


Java MenuItem类代码示例

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


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

示例1: initListView

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
private void initListView() {
    Menu menu = new Menu(new ColorDrawable(Color.WHITE), true);
    menu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_width) * 3 / 2)
            .setBackground(new ColorDrawable(getResources().getColor(R.color.red_colorPrimary)))
            .setText(getResources().getString(R.string.delete))
            .setTextColor(Color.WHITE)
            .setTextSize((int) getResources().getDimension(R.dimen.txt_small) / 2)
            .build());
    menu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_width) * 3 / 2)
            .setBackground(new ColorDrawable(getResources().getColor(R.color.fab_blue)))
            .setText(getResources().getString(R.string.rename))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize((int) getResources().getDimension(R.dimen.txt_small) / 2)
            .build());
    mListView.setMenu(menu);
    mListView.setAdapter(mCategoryAdapter);
    mListView.setOnSlideListener(this);
    mListView.setOnMenuItemClickListener(this);
    mListView.setOnItemDeleteListener(this);
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:22,代码来源:EditCategoryActivity.java

示例2: onMenuItemClick

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
@Override
public int onMenuItemClick(View v, int itemPosition, int buttonPosition, int direction) {
    toast("onMenuItemClick   itemPosition--->" + itemPosition + "  buttonPosition-->" + buttonPosition + "  direction-->" + direction);
    switch (direction) {
        case MenuItem.DIRECTION_LEFT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_NOTHING;
                case 1:
                    return Menu.ITEM_SCROLL_BACK;
            }
            break;
        case MenuItem.DIRECTION_RIGHT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_SCROLL_BACK;
                case 1:
                    return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
            }
    }
    return Menu.ITEM_NOTHING;
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:23,代码来源:SlideAndDragListViewActivity.java

示例3: initMenu

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
public void initMenu() {
    mMenuList = new ArrayList<>();
    Menu menu0 = new Menu(true, 0);
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.RED))
            .setText("Normal")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(new ColorDrawable(Color.GREEN))
            .setText("Normal")
            .setDirection(MenuItem.DIRECTION_LEFT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    Menu menu1 = new Menu(false, 1);
    Menu menu2 = new Menu(false, 2);
    mMenuList.add(menu0);
    mMenuList.add(menu1);
    mMenuList.add(menu2);
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:24,代码来源:HeaderFooterViewTypeActivity.java

示例4: onMenuItemClick

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
@Override
public int onMenuItemClick(View v, int itemPosition, int buttonPosition, int direction) {
    switch (direction) {
        case MenuItem.DIRECTION_LEFT:
            return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
        case MenuItem.DIRECTION_RIGHT:
            showRenameDialog(itemPosition);
            return Menu.ITEM_SCROLL_BACK;
    }
    return Menu.ITEM_NOTHING;
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:12,代码来源:EditCategoryActivity.java

示例5: onOptionsItemSelected

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            mEditCategoryPresenter.doJob();
            break;
    }
    return true;
}
 
开发者ID:fanwucoder,项目名称:mvpChat,代码行数:10,代码来源:EditCategoryActivity.java

示例6: onMenuItemClick

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
@Override
public int onMenuItemClick(View v, int itemPosition, int buttonPosition, int direction) {
	Log.i("sheldon", "onMenuItemClick   " + itemPosition + "   " + buttonPosition + "   " + direction);
	switch (direction) {
	case MenuItem.DIRECTION_RIGHT:
		switch (buttonPosition) {
		case 0://删除该项
			return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
		}
	}
	return Menu.ITEM_NOTHING;
}
 
开发者ID:cckevincyh,项目名称:C.,代码行数:13,代码来源:AtyList.java

示例7: clickMenuBtn0

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
private int clickMenuBtn0(int buttonPosition, int direction) {
    switch (direction) {
        case MenuItem.DIRECTION_RIGHT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
                case 1:
                    return Menu.ITEM_NOTHING;
                case 2:
                    return Menu.ITEM_SCROLL_BACK;
            }
    }
    return Menu.ITEM_NOTHING;
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:15,代码来源:DifferentMenuActivity.java

示例8: clickMenuBtn1

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
private int clickMenuBtn1(int buttonPosition, int direction) {
    switch (direction) {
        case MenuItem.DIRECTION_LEFT:
            switch (buttonPosition) {
                case 0:
                    return Menu.ITEM_SCROLL_BACK;
                case 1:
                    return Menu.ITEM_DELETE_FROM_BOTTOM_TO_TOP;
            }
            break;
    }
    return Menu.ITEM_NOTHING;
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:14,代码来源:DifferentMenuActivity.java

示例9: initMenu

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
public void initMenu() {
    mMenu = new Menu(true);
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) * 2)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left0))
            .setText("One")
            .setTextColor(Color.GRAY)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left1))
            .setText("Two")
            .setTextColor(Color.BLACK)
            .setTextSize((14))
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) + 30)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right0))
            .setText("Three")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right1))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setIcon(getResources().getDrawable(R.drawable.ic_launcher))
            .build());
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:28,代码来源:SlideAndDragListViewActivity.java

示例10: onOptionsItemSelected

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(android.view.MenuItem item) {
    switch (item.getItemId()) {
        case R.id.menu_drag:
            if (item.getTitle().toString().startsWith("Enable")) {
                mListView.setOnDragDropListener(this);
                item.setTitle("Disable Drag");
            } else {
                mListView.setOnDragDropListener((SlideAndDragListView.OnDragDropListener) null);
                item.setTitle("Enable Drag");
            }
            break;
        case R.id.menu_item_click:
            if (item.getTitle().toString().startsWith("Enable")) {
                mListView.setOnItemClickListener(this);
                item.setTitle("Disable Item Click");
            } else {
                mListView.setOnItemClickListener(null);
                item.setTitle("Enable Item Click");
            }
            break;
        case R.id.menu_item_long_click:
            if (item.getTitle().toString().startsWith("Enable")) {
                mListView.setOnItemLongClickListener(this);
                item.setTitle("Disable Item Long Click");
            } else {
                mListView.setOnItemLongClickListener(null);
                item.setTitle("Enable Item Long Click");
            }
            break;
        case R.id.menu_item_close_menu:
            mListView.closeSlidedItem();
            break;
        case R.id.menu_item_delete_menu:
            mListView.deleteSlideItem();
            break;
    }
    return true;
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:40,代码来源:SlideAndDragListViewActivity.java

示例11: initMenu

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
public void initMenu() {
    mMenu = new Menu(true);
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) * 2)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left0))
            .setText("One")
            .setTextColor(Color.GRAY)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left1))
            .setText("Two")
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) + 30)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right0))
            .setText("Three")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right1))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setIcon(getResources().getDrawable(R.drawable.ic_launcher))
            .setText("Four")
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:31,代码来源:HeaderFooterActivity.java

示例12: initMenu

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
public void initMenu() {
    mMenu = new Menu(true);
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) * 2)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left0))
            .setText("One")
            .setTextColor(Color.GRAY)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_left1))
            .setText("Two")
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width) + 30)
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right0))
            .setText("Three")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.BLACK)
            .setTextSize(14)
            .build());
    mMenu.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(Utils.getDrawable(this, R.drawable.btn_right1))
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setIcon(getResources().getDrawable(R.drawable.ic_launcher))
            .build());
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:28,代码来源:ItemDragActivity.java

示例13: initViews

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
	private void initViews(){
		//绑定资源
		etSearch=(EditText) findViewById(R.id.aty_list_et_search);
//		menu=(SatelliteMenu) findViewById(R.id.menu);
		bfButton=(ButtonFloat) findViewById(R.id.buttonFloat);
		biButton=(ButtonIcon) findViewById(R.id.aty_list_btn_buttonIcon);
		mListView=(SlideAndDragListView) findViewById(R.id.aty_list_listview);
		
		
		//初始化监听器
		bfButton.setOnClickListener(this);
		biButton.setOnClickListener(this);
		etSearch.addTextChangedListener(filterTextWatcher);





		//初始化滑动删除部分
		mMenu = new Menu((int) getResources().getDimension(R.dimen.slv_item_height), new ColorDrawable(Color.LTGRAY), false);

		MenuItem builder1 = new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width)*2)
				.setBackground(new ColorDrawable(Color.RED))
				.setText("删除")
				.setDirection(MenuItem.DIRECTION_RIGHT)
				.setTextColor(Color.WHITE)
				.setTextSize((int) getResources().getDimension(R.dimen.txt_size))
				.build();

		mMenu.addItem(builder1);

		//初始化notesList和adapter,notesList从数据库里取
		getAllDataFromDatabase();
		adapter=new MyAdapter(this,notesList);

		mListView.setMenu(mMenu);
		mListView.setAdapter(adapter);
		mListView.setOnSlideListener(this);
		mListView.setOnListItemLongClickListener(this);
		mListView.setOnListItemClickListener(this);
		mListView.setOnMenuItemClickListener(this);
		mListView.setOnItemDeleteListener(this);

	}
 
开发者ID:cckevincyh,项目名称:C.,代码行数:46,代码来源:AtyList.java

示例14: initMenu

import com.yydcdut.sdlv.MenuItem; //导入依赖的package包/类
public void initMenu() {
    mMenuList = new ArrayList<>();
    Menu menu0 = new Menu(true, 0);
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.RED))
            .setText("ViewType 0")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn_width_img))
            .setBackground(new ColorDrawable(Color.GREEN))
            .setText("No Left")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu0.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.GRAY))
            .setText("More")
            .setDirection(MenuItem.DIRECTION_RIGHT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    Menu menu1 = new Menu(false, 1);
    menu1.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.RED))
            .setText("ViewType 1")
            .setDirection(MenuItem.DIRECTION_LEFT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    menu1.addItem(new MenuItem.Builder().setWidth((int) getResources().getDimension(R.dimen.slv_item_bg_btn2_width))
            .setBackground(new ColorDrawable(Color.GRAY))
            .setText("No Right")
            .setDirection(MenuItem.DIRECTION_LEFT)
            .setTextColor(Color.WHITE)
            .setTextSize(10)
            .build());
    Menu menu2 = new Menu(false, 2);
    mMenuList.add(menu0);
    mMenuList.add(menu1);
    mMenuList.add(menu2);
}
 
开发者ID:yydcdut,项目名称:SlideAndDragListView,代码行数:45,代码来源:DifferentMenuActivity.java


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