package com.im.lost.Provider;

import com.jkxy.bmobdemo2.R;

import android.content.Context;

import android.support.v4.view.ActionProvider;

import android.view.MenuItem;

import android.view.MenuItem.OnMenuItemClickListener;

import android.view.SubMenu;

import android.view.View;

public class PlusActionProvider extends ActionProvider {

private Context context;

public PlusActionProvider(Context context) {

super(context);

this.context = context;

}

@Override

public View onCreateActionView() {

return null;

}

@Override  

public void onPrepareSubMenu(SubMenu subMenu) {

subMenu.clear();

// 加号中添加发现

subMenu.add(context.getString(R.string.plus_found))

.setIcon(R.drawable.ofm_group_chat_icon)

.setOnMenuItemClickListener(new OnMenuItemClickListener() {

@Override

public boolean onMenuItemClick(MenuItem item) {

return true;

}

});

// 加号中添加丢失

subMenu.add(context.getString(R.string.plus_lost))

.setIcon(R.drawable.ofm_group_chat_icon)

.setOnMenuItemClickListener(new OnMenuItemClickListener() {

@Override

public boolean onMenuItemClick(MenuItem item) {

return false;

}

});

//加号中添加朋友

subMenu.add(context.getString(R.string.plus_friend))

.setIcon(R.drawable.ofm_group_chat_icon)

.setOnMenuItemClickListener(new OnMenuItemClickListener() {

@Override

public boolean onMenuItemClick(MenuItem item) {

return false;

}

});

}

public boolean hasSubMenu()

{

return true;

}

}

0 0

共收到0条回复

加入小组与大家一起讨论吧