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


Java MenuInflater类代码示例

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


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

示例1: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    int action = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
    MenuItem delMenu = menu.add(isDigit ? R.string.switch_to_text : R.string.switch_to_digit);
    delMenu.setIcon(
            isDigit ? R.drawable.ic_menu_switch_txt
                    : R.drawable.ic_menu_switch_digit).setShowAsAction( action );
    delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            setTextDialing(isDigit);
            return true;
        }
    });
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:18,代码来源:DialerFragment.java

示例2: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
    MenuItem addContactMenu = menu.add(R.string.menu_add_to_contacts);
    addContactMenu.setIcon(R.drawable.ic_add_contact_holo_dark).setShowAsAction(actionRoom);
    addContactMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            Intent it = ContactsWrapper.getInstance().getAddContactIntent(null, remoteFrom);
            startActivity(it);
            return true;
        }
    });
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:17,代码来源:MessageFragment.java

示例3: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
       menu.add(R.string.add_filter)
               .setIcon(android.R.drawable.ic_menu_add)
               .setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                   @Override
                   public boolean onMenuItemClick(MenuItem item) {
                       onClickAddFilter();
                       return true;
                   }
               })
               .setShowAsAction(
                       MenuItem.SHOW_AS_ACTION_IF_ROOM );

	
	super.onCreateOptionsMenu(menu, inflater);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:18,代码来源:AccountFiltersListFragment.java

示例4: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	MenuInflater inflater = getSupportMenuInflater();
	inflater.inflate(R.menu.results, menu);

	MenuItem menuItem = menu.findItem(R.id.menu_share);

	ShareActionProvider mShareActionProvider = (ShareActionProvider) menuItem.getActionProvider();

	Intent shareIntent = new Intent(Intent.ACTION_SEND);
	shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
	shareIntent.setType("text/plain");

	shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.share_text, score));
	mShareActionProvider.setShareIntent(shareIntent);
	return true;
}
 
开发者ID:tamzi,项目名称:sophia,代码行数:18,代码来源:ResultsActivity.java

示例5: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // Place an action bar item for searching.
    MenuItem item = menu.add("Search");
    item.setIcon(android.R.drawable.ic_menu_search);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    View searchView = SearchViewCompat.newSearchView(getActivity());
    if (searchView != null) {
        SearchViewCompat.setOnQueryTextListener(searchView,
                new OnQueryTextListenerCompat() {
            @Override
            public boolean onQueryTextChange(String newText) {
                // Called when the action bar search text has changed.  Since this
                // is a simple array adapter, we can just have it do the filtering.
                mCurFilter = !TextUtils.isEmpty(newText) ? newText : null;
                mAdapter.getFilter().filter(mCurFilter);
                return true;
            }
        });
        item.setActionView(searchView);
    }
}
 
开发者ID:Mobideck,项目名称:appdeck-android,代码行数:22,代码来源:LoaderCustomSupport.java

示例6: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getSupportMenuInflater();
    inflater.inflate(R.menu.star, menu);
    if (DEBUG_TRANSITIONS) {
        final MenuItem toggleSocial =
                menu.add(mLoaderFragment.getLoadStreamItems() ? "less" : "more");
        toggleSocial.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
        toggleSocial.setOnMenuItemClickListener(new OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem item) {
                mLoaderFragment.toggleLoadStreamItems();
                supportInvalidateOptionsMenu();
                return false;
            }
        });
    }
    return true;
}
 
开发者ID:SilentCircle,项目名称:silent-contacts-android,代码行数:21,代码来源:ScContactDetailActivity.java

示例7: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getSupportMenuInflater();
    final int index = pager.getCurrentItem();
    switch (index) {
        case LOVED_INDEX: {
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            inflater.inflate(R.menu.load_all_menu, menu);
        }
        break;
        case TOP_TRACKS_INDEX: {
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            inflater.inflate(R.menu.to_playlist_menu, menu);
        }
        break;
        case TOP_ARTISTS_INDEX: {
            inflater.inflate(R.menu.empty_menu, menu);
        }
        break;
        case RECENT_INDEX:
            actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
            inflater.inflate(R.menu.to_playlist_menu, menu);
            break;
    }
    return super.onCreateOptionsMenu(menu);
}
 
开发者ID:PavelKorolev,项目名称:liquid-bear-android,代码行数:27,代码来源:UserViewerLastfmActivity.java

示例8: InCallControls

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
public InCallControls(Context context, AttributeSet attrs, int style) {
    super(context, attrs, style);
    
    if(!isInEditMode()) {
        supportMultipleCalls = SipConfigManager.getPreferenceBooleanValue(getContext(), SipConfigManager.SUPPORT_MULTIPLE_CALLS, false);
    }
    
    final LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
            (int) getResources().getDimension(R.dimen.incall_bottom_bar_height));
    ActionMenuPresenter mActionMenuPresenter = new ActionMenuPresenter(getContext()) {
        public void bindItemView(MenuItemImpl item, MenuView.ItemView itemView) {
            super.bindItemView(item, itemView);
            View actionItemView = (View) itemView;
            actionItemView.setBackgroundResource(R.drawable.btn_compound_background);
        }
    };
    mActionMenuPresenter.setReserveOverflow(true);
    // Full width
    mActionMenuPresenter.setWidthLimit(
            getContext().getResources().getDisplayMetrics().widthPixels, true);
    // We use width limit, no need to limit items.
    mActionMenuPresenter.setItemLimit(20);
    btnMenuBuilder = new MenuBuilder(getContext());
    btnMenuBuilder.setCallback(this);
    MenuInflater inflater = new MenuInflater(getContext());
    inflater.inflate(R.menu.in_call_controls_menu, btnMenuBuilder);
    btnMenuBuilder.addMenuPresenter(mActionMenuPresenter);
    ActionMenuView menuView = (ActionMenuView) mActionMenuPresenter.getMenuView(this);
    menuView.setBackgroundResource(R.drawable.abs__ab_bottom_transparent_dark_holo);
    
    this.addView(menuView, layoutParams);
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:33,代码来源:InCallControls.java

示例9: initControllerView

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
private void initControllerView() {
    photo = (ImageView) findViewById(R.id.contact_photo);
    remoteName = (TextView) findViewById(R.id.contact_name_display_name);
    remoteSipAddress = (TextView) findViewById(R.id.contact_name_sip_address);
    elapsedTime = (Chronometer) findViewById(R.id.elapsedTime);
    callStatusText = (TextView) findViewById(R.id.call_status_text);
    callSecureBar = (ViewGroup) findViewById(R.id.call_secure_bar);
    callSecureText = (TextView) findViewById(R.id.call_secure_text);
    endCallBar = (ViewGroup) findViewById(R.id.end_call_bar);


    View btn;
    btn = findViewById(R.id.endButton);
    btn.setOnClickListener(this);

    btnMenuBuilder = new MenuBuilder(getContext());
    btnMenuBuilder.setCallback(this);
    MenuInflater inflater = new MenuInflater(getContext());
    inflater.inflate(R.menu.in_call_card_menu, btnMenuBuilder);
    
    mActionMenuPresenter = new ActionMenuPresenter(getContext());
    mActionMenuPresenter.setReserveOverflow(true);
    
    btnMenuBuilder.addMenuPresenter(mActionMenuPresenter);
    
    updateMenuView();
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:28,代码来源:InCallCard.java

示例10: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    int actionRoom = getResources().getBoolean(R.bool.menu_in_bar) ? MenuItem.SHOW_AS_ACTION_IF_ROOM : MenuItem.SHOW_AS_ACTION_NEVER;
    MenuItem delMenu = menu.add(R.string.callLog_delete_all);
    delMenu.setIcon(R.drawable.ic_ab_trash_dark).setShowAsAction(actionRoom);
    delMenu.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            deleteAllCalls();
            return true;
        }
    });
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:16,代码来源:CallLogListFragment.java

示例11: onCreateActionMode

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
    MenuInflater inflater = mode.getMenuInflater();
    mode.setTitle("Download");
    inflater.inflate(R.menu.download, menu);
    return true;  //To change body of implemented methods use File | Settings | File Templates.
}
 
开发者ID:Aptoide,项目名称:aptoide-backup-apps,代码行数:8,代码来源:BackedUpCursorAdapter.java

示例12: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {

    MenuItem populateItem = menu.add(Menu.NONE, 1, 0, "Populate");
    populateItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    MenuItem clearItem = menu.add(Menu.NONE, 2, 0, "Clear");
    clearItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    super.onCreateOptionsMenu(menu, inflater);
}
 
开发者ID:Aptoide,项目名称:aptoide-backup-apps,代码行数:11,代码来源:FragmentLogin.java

示例13: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {

	// 메뉴 버튼 구현부분
	MenuInflater inflater = getSupportMenuInflater();
	inflater.inflate(R.menu.accept, menu);
	return true;

}
 
开发者ID:tarksgit,项目名称:Favorite-Android-Client-Example,代码行数:10,代码来源:tarks_account_login.java

示例14: onPrepareOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  MenuInflater inflater = this.getSupportMenuInflater();
  menu.clear();

  if (TextSecurePreferences.isPushRegistered(this)) inflater.inflate(R.menu.push_directory, menu);

  inflater.inflate(R.menu.contact_selection, menu);
  return true;
}
 
开发者ID:Securecom,项目名称:Securecom-Text,代码行数:11,代码来源:PushContactSelectionActivity.java

示例15: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuInflater; //导入依赖的package包/类
@Override
public boolean onCreateOptionsMenu(Menu menu) {

	// 메뉴 버튼 구현부분
	MenuInflater inflater = getSupportMenuInflater();
	inflater.inflate(R.menu.start, menu);
	return true;

}
 
开发者ID:tarksgit,项目名称:SAOSP,代码行数:10,代码来源:welcome.java


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