本文整理汇总了Java中android.support.v7.internal.view.menu.ActionMenuItemView类的典型用法代码示例。如果您正苦于以下问题:Java ActionMenuItemView类的具体用法?Java ActionMenuItemView怎么用?Java ActionMenuItemView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ActionMenuItemView类属于android.support.v7.internal.view.menu包,在下文中一共展示了ActionMenuItemView类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onActivityResult
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode== 1) {
if (resultCode==RESULT_OK){
latitude = data.getDoubleExtra("Latitude",0);
longitude = data.getDoubleExtra("Longitude",0);
Toast.makeText(this, "Posicion activada", Toast.LENGTH_SHORT).show();
if(!locSeleccionat){
((ActionMenuItemView) findViewById(R.id.action_selec_location)).setIcon(getResources().getDrawable(R.drawable.ic_place_green_24dp));
locSeleccionat = true;
}
if(locActivat){
ActionMenuItemView menuItem = ((ActionMenuItemView) findViewById(R.id.action_location));
menuItem.setIcon(getResources().getDrawable(R.drawable.ic_gps_off_white_24dp));
menuItem.setTitle(getResources().getString(R.string.str_activar_loc));
locActivat = false;
}
} else {
// Toast.makeText(this, "Resultat incorrecte", Toast.LENGTH_SHORT).show();
}
}else{
Toast.makeText(this, R.string.msg_activity_no_contr, Toast.LENGTH_SHORT).show();
}
}
示例2: clickedEdit
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
private void clickedEdit() {
List<CommonBean> data = DBHelper.getInstance(this).getAllBeans(DBHelper.DB_TABLE_WISH);
CommonBean commonBean = data.get(ViewPagerSelectedItem);
EditText editText = (EditText) viewList.get(ViewPagerSelectedItem).findViewById(R.id.my_wishes_details_content_editView);
if (!EditableFlag) {
editText.setEnabled(true);
editText.selectAll();
((InputMethodManager)this.getSystemService(INPUT_METHOD_SERVICE)).toggleSoftInputFromWindow(editText.getWindowToken(),InputMethodManager.SHOW_FORCED,0);
((ActionMenuItemView) findViewById(R.id.menu_my_wishes_detail_edit)).setIcon(getResources().getDrawable(R.drawable.ic_done_black_24dp));
EditableFlag = !EditableFlag;
} else {
commonBean.setContent(editText.getText().toString());
commonBean.setPicture(0 + "");
DBHelper.getInstance(this).updateBean(DBHelper.DB_TABLE_WISH, commonBean.getID(), commonBean);
editText.setEnabled(false);
EditableFlag = !EditableFlag;
((ActionMenuItemView) findViewById(R.id.menu_my_wishes_detail_edit)).setIcon(getResources().getDrawable(R.drawable.ic_mode_edit_black_24dp));
Toast.makeText(this, "修改成功", Toast.LENGTH_LONG).show();
}
}
示例3: onPostExecute
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void onPostExecute(VehicleRoutingSolution solution) {
Log.d(TAG, "Calculation finished.");
if (fragment != null) {
Activity activity = fragment.getActivity();
if (activity != null) {
ActionMenuItemView item = (ActionMenuItemView) activity.findViewById(R.id.action_run);
item.setIcon(activity.getResources().getDrawable(R.drawable.ic_play_arrow_white_24dp));
if (toast != null) {
toast.cancel();
}
toast = Toast.makeText(activity, R.string.calculation_finished, Toast.LENGTH_SHORT);
toast.show();
fragment.setVrs(solution);
}
}
}
示例4: bindItemView
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
public final void bindItemView(MenuItemImpl paramMenuItemImpl, MenuView.ItemView paramItemView)
{
paramItemView.initialize$6b732f7b(paramMenuItemImpl);
ActionMenuView localActionMenuView = (ActionMenuView)this.mMenuView;
ActionMenuItemView localActionMenuItemView = (ActionMenuItemView)paramItemView;
localActionMenuItemView.setItemInvoker(localActionMenuView);
if (this.mPopupCallback == null) {
this.mPopupCallback = new ActionMenuPopupCallback((byte)0);
}
localActionMenuItemView.setPopupCallback(this.mPopupCallback);
}
示例5: a
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
public final void a(xp paramxp, yc paramyc)
{
paramyc.a(paramxp, 0);
ActionMenuView localActionMenuView = (ActionMenuView)this.e;
ActionMenuItemView localActionMenuItemView = (ActionMenuItemView)paramyc;
localActionMenuItemView.b = localActionMenuView;
if (this.v == null) {
this.v = new xf(this);
}
localActionMenuItemView.c = this.v;
}
示例6: onOptionsItemSelected
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public boolean onOptionsItemSelected(MenuItem item) {
ActionMenuItemView m = (ActionMenuItemView) getActivity().findViewById(R.id.filter);
Drawable d;
if (item.getGroupId() == R.id.group_tab_file_sort) {
SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(getActivity().getApplicationContext());
SharedPreferences.Editor e = p.edit();
switch (item.getItemId()) {
case R.id.filter_send:
e.putInt("fileTabShow", 1).commit();
presenter.showFiles(1);
d = getIcon(1);
break;
case R.id.filter_received:
e.putInt("fileTabShow", 2).commit();
presenter.showFiles(2);
d = getIcon(2);
break;
default:
e.putInt("fileTabShow", 0).commit();
presenter.showFiles(0);
d = getIcon(0);
break;
}
m.setIcon(d);
}
return super.onOptionsItemSelected(item);
}
示例7: onOptionsItemSelected
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.action_location:
if(!locActivat) {
item.setIcon(getResources().getDrawable(R.drawable.ic_gps_fixed_green_24dp));
item.setTitle(getResources().getString(R.string.str_desactivar_loc));
((ActionMenuItemView) findViewById(R.id.action_selec_location)).setIcon(getResources().getDrawable(R.drawable.ic_place_white_24dp));
locSeleccionat = false;
mGoogleApiClient.connect();
} else {
item.setIcon(getResources().getDrawable(R.drawable.ic_gps_off_white_24dp));
item.setTitle(getResources().getString(R.string.str_activar_loc));
mGoogleApiClient.disconnect();
Toast.makeText(this, "Localización desactivada", Toast.LENGTH_LONG).show();
}
locActivat = !locActivat;
return true;
case R.id.action_photos:
intent = new Intent(getApplicationContext(), UploadToServerActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("item_id", itemId);
intent.putExtras(bundle);
startActivity(intent);
return true;
case R.id.action_selec_location:
intent = new Intent(getApplicationContext(), SelecLocationActivity.class);
startActivityForResult(intent, 1);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
示例8: colorizeToolbar
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
/**
* Use this method to colorize toolbar icons to the desired target color
*
* @param toolbarView toolbar view being colored
* @param toolbarIconsColor the target color of toolbar icons
* @param activity reference to activity needed to register observers
*/
public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor, Activity activity) {
final PorterDuffColorFilter colorFilter
= new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.MULTIPLY);
for (int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
//Step 1 : Changing the color of back button (or open drawer button).
if (v instanceof ImageButton) {
//Action Bar back button
((ImageButton) v).getDrawable().setColorFilter(colorFilter);
}
if (v instanceof ActionMenuView) {
for (int j = 0; j < ((ActionMenuView) v).getChildCount(); j++) {
//Step 2: Changing the color of any ActionMenuViews - icons that
//are not back button, nor text, nor overflow menu icon.
final View innerView = ((ActionMenuView) v).getChildAt(j);
if (innerView instanceof ActionMenuItemView) {
int drawablesCount = ((ActionMenuItemView) innerView).getCompoundDrawables().length;
for (int k = 0; k < drawablesCount; k++) {
if (((ActionMenuItemView) innerView).getCompoundDrawables()[k] != null) {
final int finalK = k;
//Important to set the color filter in seperate thread,
//by adding it to the message queue
//Won't work otherwise.
innerView.post(new Runnable() {
@Override
public void run() {
((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter);
}
});
}
}
}
}
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(toolbarIconsColor);
toolbarView.setSubtitleTextColor(toolbarIconsColor);
//Step 4: Changing the color of the Overflow Menu icon.
setOverflowButtonColor(activity, colorFilter);
}
}
示例9: getActionAddFriend
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
public ActionMenuItemView getActionAddFriend() {
return (ActionMenuItemView) findViewById(R.id.action_addfriend);
}
示例10: colorizeToolbar
import android.support.v7.internal.view.menu.ActionMenuItemView; //导入依赖的package包/类
/**
* Use this method to colorize toolbar icons to the desired target color
* @param toolbarView toolbar view being colored
* @param toolbarIconsColor the target color of toolbar icons
* @param activity reference to activity needed to register observers
*/
public static void colorizeToolbar(Toolbar toolbarView, int toolbarIconsColor, Activity activity) {
toolbarIconsColor = activity.getResources().getColor(toolbarIconsColor);
final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter(toolbarIconsColor, PorterDuff.Mode.MULTIPLY);
for(int i = 0; i < toolbarView.getChildCount(); i++) {
final View v = toolbarView.getChildAt(i);
//Step 1 : Changing the color of back button (or open drawer button).
if(v instanceof ImageButton) {
//Action Bar back button
((ImageButton)v).getDrawable().setColorFilter(colorFilter);
}
if(v instanceof ActionMenuView) {
for(int j = 0; j < ((ActionMenuView)v).getChildCount(); j++) {
//Step 2: Changing the color of any ActionMenuViews - icons that are not back button, nor text, nor overflow menu icon.
//Colorize the ActionViews -> all icons that are NOT: back button | overflow menu
final View innerView = ((ActionMenuView)v).getChildAt(j);
if(innerView instanceof ActionMenuItemView) {
for(int k = 0; k < ((ActionMenuItemView)innerView).getCompoundDrawables().length; k++) {
if(((ActionMenuItemView)innerView).getCompoundDrawables()[k] != null) {
final int finalK = k;
//Important to set the color filter in seperate thread, by adding it to the message queue
//Won't work otherwise.
innerView.post(new Runnable() {
@Override
public void run() {
((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter);
}
});
}
}
}
}
}
//Step 3: Changing the color of title and subtitle.
toolbarView.setTitleTextColor(toolbarIconsColor);
toolbarView.setSubtitleTextColor(toolbarIconsColor);
//Step 4: Changing the color of the Overflow Menu icon.
setOverflowButtonColor(activity, colorFilter);
}
}