本文整理汇总了Java中com.baoyz.swipemenulistview.SwipeMenuListView.setMenuCreator方法的典型用法代码示例。如果您正苦于以下问题:Java SwipeMenuListView.setMenuCreator方法的具体用法?Java SwipeMenuListView.setMenuCreator怎么用?Java SwipeMenuListView.setMenuCreator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.baoyz.swipemenulistview.SwipeMenuListView
的用法示例。
在下文中一共展示了SwipeMenuListView.setMenuCreator方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: InitSwipeMenuListView
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
private void InitSwipeMenuListView(){
searchHistoryListview=(SwipeMenuListView)findViewById(R.id.search_history_listview);
SwipeMenuCreator creator=new SwipeMenuCreator(){
public void create(SwipeMenu menu){
SwipeMenuItem deleteItem=new SwipeMenuItem(getApplicationContext());
deleteItem.setBackground(new ColorDrawable(Color.parseColor("#ff3030")));
deleteItem.setIcon(R.drawable.ic_action_discard);
deleteItem.setWidth((int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 45,
getBaseContext().getResources().getDisplayMetrics()));
menu.addMenuItem(deleteItem);
}
};
searchHistoryListview.setMenuCreator(creator);
}
示例2: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Quiz");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0xf4, 0x43,
0x36)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0x28,
0x28, 0x28)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Android Quiz", "IT Quiz", "Tech Debate"};
images = new int[] {R.drawable.android,R.drawable.itquiz,R.drawable.techdebate};
timing = new String[] {"1:00 PM - 6:00 PM, CC3","2:00 PM - 8:00 PM, CC3","9:00 AM - 6:00 PM, CC3"};
intents = new String[]{"AND", "ITQ", "TECDE"};
initList(events_1, images, timing, intents);
}
示例3: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d("hello","maa chuda android studio");
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Coding");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0xf4, 0x43,
0x36)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0x28,
0x28, 0x28)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Alkhwarizm", "Blind War", "C Fresh", "C Hunt", "C Master", "Ex-Machina", "Humble Fool Cup", "Infinitum", "Three Muskeeters"};
images = new int[] {R.drawable.alkhwarizm, R.drawable.blindwar,R.drawable.cfresh,R.drawable.chunt,R.drawable.cmaster,R.drawable.exmachina,R.drawable.humblefool,R.drawable.infinitum, R.drawable.threemuski};
timing = new String[] {"6:00 PM, CC3", "6:00 PM, CC3","2:00 PM - 6:00 PM, CC3","6:00 PM, CC3","6:00 PM, CC3","6:00 PM, CC3","6:00 PM, CC3", "6:00 PM, CC3", "6:00 PM, CC3"};
intents = new String[]{"ALK", "BLI", "CFR", "CHU", "CMA", "EXM", "HUM", "INF", "THR"};
initList(events_1, images, timing, intents);
}
示例4: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Day 1");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0x52, 0xb3,
0xd9)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0xff,
0x00, 0x00)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Aparoksha Inauguration Ceremony", "Hack In The North Opening Ceremony", "Treasure Hunt", "Movie - Steve Jobs (2015)", "Hack In the North", "Blind Wars", "Movie - The Martian (2015)"};
images = new int[] {R.drawable.aparoksha_logo,R.drawable.hackinthenorth,R.drawable.treasurehunt,R.mipmap.ic_launcher,R.drawable.hackinthenorth,R.drawable.blindwar,R.mipmap.ic_launcher };
timing = new String[] {"6.30 PM, Main Audi","9.30 PM, Main Audi","10 PM, CC3","11 PM, Main Audi/LT","12 AM, CC3 3rd Floor","12 AM, CC3 1st Floor","1 AM, Main Audi/LT"};
intents = new String[]{"MAIN1", "HAC", "TRE", "MAIN1", "HAC", "BLI","MAIN1", };
initList(events_1, images, timing, intents);
}
示例5: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Day 4");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0x52, 0xb3,
0xd9)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0xff,
0x00, 0x00)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Pool Master","Flappy Bird","Novita","Three Musketeers","Riddilonics Final Round","C Fresh Finals",
"Android Quiz","Backbone"};
images = new int[] {R.drawable.pool,R.drawable.flappy,R.mipmap.ic_launcher,R.drawable.threemuski,R.drawable.riddlonics,
R.drawable.cfresh,R.drawable.android,R.drawable.backbone};
timing = new String[] {"11 AM - 1 PM, Swimming Pool","12 AM - 1 PM, Tennis Court","1.30 PM - 4.30 PM, Admin Audi",
"1.30 PM - 3.30 PM, CC3","1.30 PM - 3.30 PM, Lab 2311","3.30 PM - 4.30 PM, CC3","3.30 PM - 4.30 PM, CC3 5006","4.30 PM - 6.30 PM"
,"CC3 First Floor Labs"};
intents = new String[]{"POO", "FLA", "MAIN1", "THR", "RID","CFR","AND","BAC" };
initList(events_1, images, timing, intents);
}
示例6: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Development");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0xf4, 0x43,
0x36)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0x28,
0x28, 0x28)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Backbone", "Coldfire", "Eureka", "GIT Hero", "Tri Hacker Cup", "Webkriti"};
images = new int[] {R.drawable.backbone,R.drawable.first,R.drawable.eureka,R.drawable.githero,R.drawable.trihacker,R.drawable.webkrit,R.mipmap.ic_launcher, };
timing = new String[] {"All day","2:00 PM, CC3","4:00 PM, CC3","3:00 PM - 5:00 PM, CC3","6:00 PM, CC3","2:30 PM, CC3"};
intents = new String[]{"BAC", "COL", "EUR", "GIT", "TRI", "WEB" };
initList(events_1, images, timing, intents);
}
示例7: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Games");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0xf4, 0x43,
0x36)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0x28,
0x28, 0x28)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Age of Empires III", "Clash of Clans", "Counter Strike", "FIFA", "Flappy Bird", "Split Second", "Tekken 6"};
images = new int[] {R.drawable.ageofempire,R.drawable.clash,R.drawable.counter,R.drawable.fifa,R.drawable.flappy,R.drawable.splitsecond,R.drawable.tekken6};
timing = new String[] {"1:00 PM, CC3","10:00 AM, CC3","3:00 PM, CC3", "4:00 PM, CC3","All Day", "4:00 PM - 8 PM, CC3", "8:00 PM, CC3"};
intents = new String[]{"AGE", "CLA", "COU", "FIF", "FLA", "SPL", "TEK"};
initList(events_1, images, timing, intents);
}
示例8: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Misc");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0xf4, 0x43,
0x36)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0x28,
0x28, 0x28)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"FB Sharing Contest", "Mr. Googler", "Pencil Sketching", "Tinder Time", "Treasure Hunt", "V Flare", "Qwerty Wars"};
images = new int[] {R.drawable.fbshare,R.drawable.mrgoogler,R.drawable.pencilsketck,R.drawable.tindertime,R.drawable.treasurehunt,R.drawable.vflare, R.drawable.qwertywars};
timing = new String[] {"3:00 PM - 5:00 PM, CC3","1:00 PM - 4:00 PM, CC3","5:00 PM - 8:00 PM, CC3","All Day","3:00 PM - 9:00 PM, CC3", "2:00 PM - 5:00 PM, CC3", "3:00 PM - 7:00 PM, CC3"};
intents = new String[]{"FBS", "MRG", "PEN", "TIN", "TRE", "VFL", "QWE", };
initList(events_1, images, timing, intents);
}
示例9: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/JosefinSans-Regular.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
act_name = (TextView)findViewById(R.id.activity_name);
Typeface tf1 = Typeface.createFromAsset(getAssets(),
"JosefinSans-Regular.ttf");
act_name.setTypeface(tf1);
act_name.setText("Electronics");
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0xf4, 0x43,
0x36)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0x28,
0x28, 0x28)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Black Box", "Bolt", "Pool Runner", "Riddilonics", "Technofault", "Techno Booz", "Wolf of 2311"};
images = new int[] {R.drawable.blackbox,R.drawable.bolt,R.drawable.pool,R.drawable.riddlonics,R.drawable.technofault,R.drawable.technobooz, R.drawable.wolfof};
timing = new String[] {"2:00 PM, CC3","All Day","4:00 PM, CC3","4:45 PM, CC3","6:00 PM, CC3", "6:30 PM, CC3", "All Day"};
intents = new String[]{"BLA", "BOL", "POO", "RID", "TECFA", "TECBO", "WOL" };
initList(events_1, images, timing, intents);
}
示例10: onCreate
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.eventsnow);
toolbar = (Toolbar) findViewById(R.id.app_bar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mList = (SwipeMenuListView) findViewById(R.id.listView);
// step 1. create a MenuCreator
SwipeMenuCreator creator = new SwipeMenuCreator() {
@Override
public void create(SwipeMenu menu) {
// create "open" item
SwipeMenuItem openItem = new SwipeMenuItem(
getApplicationContext());
// set item background
openItem.setBackground(new ColorDrawable(Color.rgb(0x38, 0x8e,
0x3c)));
// set item width
openItem.setWidth(dp2px(90));
// set item title
openItem.setTitle("Open");
// set item title fontsize
openItem.setTitleSize(18);
// set item title font color
openItem.setTitleColor(Color.WHITE);
// add to menu
menu.addMenuItem(openItem);
// create "delete" item
SwipeMenuItem deleteItem = new SwipeMenuItem(
getApplicationContext());
// set item background
deleteItem.setBackground(new ColorDrawable(Color.rgb(0xff,
0x00, 0x00)));
// set item width
deleteItem.setWidth(dp2px(90));
// set a icon
deleteItem.setIcon(R.drawable.ic_settings);
// add to menu
menu.addMenuItem(deleteItem);
}
};
// set creator
mList.setMenuCreator(creator);
mList.setOpenInterpolator(new BounceInterpolator());
mList.setCloseInterpolator(new BounceInterpolator());
//Add events in this array
events_1 = new String[] {"Director's Cut", "Double Trouble", "Innovation", "Bindaas Bol", "Tongues on fire","Kahaani"};
images = new int[] {R.mipmap.ic_launcher,R.mipmap.ic_launcher,R.mipmap.ic_launcher,R.mipmap.ic_launcher,R.mipmap.ic_launcher,R.mipmap.ic_launcher,R.mipmap.ic_launcher, };
timing = new String[] {"All day","Sat, 15:00","Fri, 22:00","Fri, 13:00","Sat, 15:00","All day"};
intents = new String[]{"DES", "DES", "DES", "DES", "DES", "DES", "DES", "DES", "DES", "DES", "DES", };
initList(events_1, images, timing, intents);
}
示例11: onCreateView
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setHasOptionsMenu(true);
final View rootView = inflater.inflate(R.layout.rutas_list_view, container, false);
SwipeMenuListView fotosList = (SwipeMenuListView)rootView.findViewById(R.id.listview);
fotosList.setOnItemClickListener(listadoListener);
fotosList.setMenuCreator(creator);
fotosList.setSwipeDirection(SwipeMenuListView.DIRECTION_RIGHT);
getFotos();
adapter = new FotoAdapter(getActivity(), R.layout.row_ruta, fotos);
fotosList.setAdapter(adapter);
fotosList.setOnMenuItemClickListener(new SwipeMenuListView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(int position, SwipeMenu menu, int index) {
switch (index) {
case 0:
// open
Toast.makeText(getActivity(), "Foto borrada", Toast.LENGTH_SHORT).show();
PhotosDataSource photosDataSource = new PhotosDataSource(getActivity());
photosDataSource.open();
photosDataSource.deletePhotoById(fotos.get(position).getId());
photosDataSource.close();
fotos.remove(position);
adapter.notifyDataSetChanged();
break;
// case 1:
// // delete
// break;
}
// false : close the menu; true : not close the menu
return false;
}
});
return rootView;
}
示例12: onCreateView
import com.baoyz.swipemenulistview.SwipeMenuListView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
setHasOptionsMenu(true);
final View rootView = inflater.inflate(R.layout.rutas_list_view, container, false);
((AppCompatActivity) getActivity()).getSupportActionBar().setTitle("Mis rutas");
SwipeMenuListView rutasList = (SwipeMenuListView)rootView.findViewById(R.id.listview);
rutasList.setOnItemClickListener(listadoListener);
rutasList.setMenuCreator(creator);
rutasList.setSwipeDirection(SwipeMenuListView.DIRECTION_RIGHT);
getRutas();
adapter = new RutaAdapter(getActivity(), R.layout.row_ruta, rutas);
rutasList.setAdapter(adapter);
rutasList.setOnMenuItemClickListener(new SwipeMenuListView.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(int position, SwipeMenu menu, int index) {
switch (index) {
case 0:
// open
Toast.makeText(getActivity(), "Ruta borrada", Toast.LENGTH_SHORT).show();
RutaDataSource rutaDataSource = new RutaDataSource(getActivity());
rutaDataSource.open();
rutaDataSource.deleteRutaById(rutas.get(position).getId());
rutaDataSource.close();
rutas.remove(position);
adapter.notifyDataSetChanged();
break;
// case 1:
// // delete
// break;
}
// false : close the menu; true : not close the menu
return false;
}
});
return rootView;
}