當前位置: 首頁>>代碼示例>>Java>>正文


Java OnMenuItemClickListener類代碼示例

本文整理匯總了Java中com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener的典型用法代碼示例。如果您正苦於以下問題:Java OnMenuItemClickListener類的具體用法?Java OnMenuItemClickListener怎麽用?Java OnMenuItemClickListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OnMenuItemClickListener類屬於com.actionbarsherlock.view.MenuItem包,在下文中一共展示了OnMenuItemClickListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的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.MenuItem.OnMenuItemClickListener; //導入依賴的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.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	if (mIsShowSaveButton){
		MenuItem miSave = menu.add("保存");
		miSave.setIcon(R.drawable.head_save);
		miSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
		miSave.setOnMenuItemClickListener(new OnMenuItemClickListener() {
			
			@Override
			public boolean onMenuItemClick(MenuItem item) {
				savePInfo(true);
				return false;
			}
		});
	}
	return super.onCreateOptionsMenu(menu);
}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:18,代碼來源:EditPassengerAty.java

示例4: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
/**
 * Responding to menu items
 */
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	// Inflate the menu; this adds items to the action bar if it is present.
	MenuInflater inflater = getSupportMenuInflater();
	inflater.inflate(R.menu.mainmenu, menu);
	// return true;
	final MenuItem refresh = (MenuItem) menu.findItem(R.id.action_refresh);
	refresh.setOnMenuItemClickListener(new OnMenuItemClickListener() {
		// on selecting show progress spinner for 1s
		public boolean onMenuItemClick(MenuItem item) {
			// item.setActionView(R.layout.progress_action);
			handler.postDelayed(new Runnable() {
				public void run() {
					refresh.setActionView(null);
				}
			}, 1000);
			return false;
		}
	});
	return super.onCreateOptionsMenu(menu);
}
 
開發者ID:bhavyanshu,項目名稱:CheckIt_Android,代碼行數:25,代碼來源:MainActivity.java

示例5: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
/**
 * Responding to menu items
 */
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	// Inflate the menu; this adds items to the action bar if it is present.
	MenuInflater inflater = getSupportMenuInflater();
	inflater.inflate(R.menu.promomenu, menu);
	// return true;
	final MenuItem refresh = (MenuItem) menu.findItem(R.id.action_refresh);
	refresh.setOnMenuItemClickListener(new OnMenuItemClickListener() {
		// on selecting show progress spinner for 1s
		public boolean onMenuItemClick(MenuItem item) {
			// item.setActionView(R.layout.progress_action);
			handler.postDelayed(new Runnable() {
				public void run() {
					refresh.setActionView(null);
				}
			}, 1000);
			return false;
		}
	});
	return super.onCreateOptionsMenu(menu);
}
 
開發者ID:bhavyanshu,項目名稱:CheckIt_Android,代碼行數:25,代碼來源:PromoActivity.java

示例6: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem menuItem = menu.add("delete");
    menuItem.setIcon(R.drawable.action_bar_delete_btn_bg)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM
                    | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    menuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            dialog();
            return true;
        }
    });
    return true;
}
 
開發者ID:jiangerji,項目名稱:danmaku-project,代碼行數:17,代碼來源:HistoryActivity.java

示例7: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    mDeleteMenuItem = menu.add(R.string.delete)
            .setIcon(R.drawable.action_bar_delete_btn_bg)
            .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
    mDeleteMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            mFavAdapter.setMultiChoiceMode(!mInDeleteMode);
            mInDeleteMode = !mInDeleteMode;
            if (mInDeleteMode) {
                showBottomPanel();
            } else {
                hideBottomPanel();
            }
            return true;
        }
    });
    return true;
}
 
開發者ID:jiangerji,項目名稱:danmaku-project,代碼行數:22,代碼來源:FavActivity.java

示例8: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的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

示例9: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
	menu.add(R.string.about)
			.setOnMenuItemClickListener(new OnMenuItemClickListener() {

				@Override
				public boolean onMenuItemClick(
						com.actionbarsherlock.view.MenuItem item) {
					startActivity(new Intent(MainActivity.this,
							AboutActivity.class));
					return true;
				}
			})
			.setShowAsAction(
					com.actionbarsherlock.view.MenuItem.SHOW_AS_ACTION_NEVER);

	return super.onCreateOptionsMenu(menu);
}
 
開發者ID:farnabaz,項目名稱:radiogeek,代碼行數:19,代碼來源:MainActivity.java

示例10: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的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: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
	public boolean onCreateOptionsMenu(Menu menu) {
//		MenuItem miAdd = menu.add("添加乘車人");
//		miAdd.setIcon(R.drawable.head_add);
//		miAdd.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
//		miAdd.setOnMenuItemClickListener(new OnMenuItemClickListener() {
//
//			@Override
//			public boolean onMenuItemClick(MenuItem item) {
//				Intent intent = new Intent(PassengerMangAty.this,
//						EditPassengerAty.class);
//				intent.putExtra(EditPassengerAty.EXTRA_OPERATE, EditPassengerAty.EXTRA_OPERATE_ADD);
//				startActivityForResult(intent, REQUEST_ADD);
//				return false;
//			}
//		});
		MenuItem miSync = menu.add("同步12306乘車人");
		miSync.setIcon(R.drawable.refesh);
		miSync.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
		miSync.setOnMenuItemClickListener(new OnMenuItemClickListener() {

			@Override
			public boolean onMenuItemClick(MenuItem item) {
				//初始化變量
				mNoPInfoAtLocalType = 0;
				mPInfoConflictType = 0;
				syncPassengers();
				return false;
			}
		});
		return super.onCreateOptionsMenu(menu);
	}
 
開發者ID:SShineTeam,項目名稱:Huochexing12306,代碼行數:33,代碼來源:PassengerMangAty.java

示例12: onCreateOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    mCommit = menu.add("提交")
            .setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
    mCommit.setEnabled(false);
    mCommit.setOnMenuItemClickListener(new OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            publishFeedback();
            return true;
        }
    });
    return true;
}
 
開發者ID:jiangerji,項目名稱:danmaku-project,代碼行數:16,代碼來源:FeedbackActivity.java

示例13: onPrepareOptionsMenu

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    final MenuItem starredMenuItem = menu.findItem(R.id.menu_star);
    starredMenuItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            // Toggle "starred" state
            // Make sure there is a contact
            if (mLookupUri != null) {
                // Read the current starred value from the UI instead of using the last
                // loaded state. This allows rapid tapping without writing the same
                // value several times
                final boolean isStarred = starredMenuItem.isChecked();

                // To improve responsiveness, swap out the picture (and tag) in the UI already
                ContactDetailDisplayUtils.configureStarredMenuItem(starredMenuItem,
                        mContactData.isDirectoryEntry(), mContactData.isUserProfile(),
                        !isStarred);

                // Now perform the real save
                Intent intent = ScContactSaveService.createSetStarredIntent(
                        ScContactDetailActivity.this, mLookupUri, !isStarred);
                ScContactDetailActivity.this.startService(intent);
            }
            return true;
        }
    });
    // If there is contact data, update the starred state
    if (mContactData != null) {
        ContactDetailDisplayUtils.configureStarredMenuItem(starredMenuItem,
                mContactData.isDirectoryEntry(), mContactData.isUserProfile(),
                mContactData.getStarred());
    }
    return true;
}
 
開發者ID:SilentCircle,項目名稱:silent-contacts-android,代碼行數:36,代碼來源:ScContactDetailActivity.java

示例14: actionBarItemsListeners

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
private void actionBarItemsListeners (Menu menu){

		MenuItem menuLogoff = (MenuItem) menu.findItem(R.id.menu_logoff);
		menuLogoff.setOnMenuItemClickListener(new OnMenuItemClickListener() {
			
			@Override
			public boolean onMenuItemClick(MenuItem item) {
				finish();
				return false;
			}
		});
		
	}
 
開發者ID:mariazevedo88,項目名稱:CakeUI,代碼行數:14,代碼來源:CakeActivity.java

示例15: onCreateView

import com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener; //導入依賴的package包/類
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View v = inflater.inflate(R.layout.dialer_digit, container, false);
    // Store the backgrounds objects that will be in use later
    /*
    Resources r = getResources();
    
    digitsBackground = r.getDrawable(R.drawable.btn_dial_textfield_active);
    digitsEmptyBackground = r.getDrawable(R.drawable.btn_dial_textfield_normal);
    */

    // Store some object that could be useful later
    digits = (DigitsEditText) v.findViewById(R.id.digitsText);
    dialPad = (Dialpad) v.findViewById(R.id.dialPad);
    callBar = (DialerCallBar) v.findViewById(R.id.dialerCallBar);
    autoCompleteList = (ListView) v.findViewById(R.id.autoCompleteList);
    rewriteTextInfo = (TextView) v.findViewById(R.id.rewriteTextInfo);
    
    accountChooserButton = (AccountChooserButton) v.findViewById(R.id.accountChooserButton);
    
    accountChooserFilterItem = accountChooserButton.addExtraMenuItem(R.string.apply_rewrite);
    accountChooserFilterItem.setCheckable(true);
    accountChooserFilterItem.setOnMenuItemClickListener(new OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            setRewritingFeature(!accountChooserFilterItem.isChecked());
            return true;
        }
    });
    setRewritingFeature(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.REWRITE_RULES_DIALER));
    
    dialerLayout = (DialerLayout) v.findViewById(R.id.top_digit_dialer);
    //switchTextView = (ImageButton) v.findViewById(R.id.switchTextView);

    // isTablet = Compatibility.isTabletScreen(getActivity());

    // Digits field setup
    if(savedInstanceState != null) {
        isDigit = savedInstanceState.getBoolean(TEXT_MODE_KEY, isDigit);
    }
    
    digits.setOnEditorActionListener(keyboardActionListener);
    
    // Layout 
    dialerLayout.setForceNoList(mDualPane);
    dialerLayout.setAutoCompleteListVisibiltyChangedListener(this);

    // Account chooser button setup
    accountChooserButton.setShowExternals(true);
    accountChooserButton.setOnAccountChangeListener(accountButtonChangeListener);

    // Dialpad
    dialPad.setOnDialKeyListener(this);

    // We only need to add the autocomplete list if we
    autoCompleteList.setAdapter(autoCompleteAdapter);
    autoCompleteList.setOnItemClickListener(autoCompleteListItemListener);
    autoCompleteList.setFastScrollEnabled(true);

    // Bottom bar setup
    callBar.setOnDialActionListener(this);
    callBar.setVideoEnabled(prefsWrapper.getPreferenceBooleanValue(SipConfigManager.USE_VIDEO));

    //switchTextView.setVisibility(Compatibility.isCompatible(11) ? View.GONE : View.VISIBLE);

    // Init other buttons
    initButtons(v);
    // Ensure that current mode (text/digit) is applied
    setTextDialing(!isDigit, true);
    if(initText != null) {
        digits.setText(initText);
        initText = null;
    }

    // Apply third party theme if any
    applyTheme(v);
    v.setOnKeyListener(this);
    applyTextToAutoComplete();
    return v;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:82,代碼來源:DialerFragment.java


注:本文中的com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。