com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener Java Examples

The following examples show how to use com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DialerFragment.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@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;
        }
    });
}
 
Example #2
Source File: MessageFragment.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@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;
        }
    });
}
 
Example #3
Source File: EditPassengerAty.java    From Huochexing12306 with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #4
Source File: CallLogListFragment.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
@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;
        }
    });
}
 
Example #5
Source File: PassengerMangAty.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
@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);
	}
 
Example #6
Source File: DialerFragment.java    From CSipSimple with GNU General Public License v3.0 4 votes vote down vote up
@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;
}