Java Code Examples for com.actionbarsherlock.view.MenuItem#getItemId()

The following examples show how to use com.actionbarsherlock.view.MenuItem#getItemId() . 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: LoginActivity.java    From buddycloud-android with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {

    switch (item.getItemId()) {
       	case android.R.id.home:
       		InputUtils.hideKeyboard(LoginActivity.this);
       		finish();
       		return true;
          	case R.id.menu_signup:
          		InputUtils.hideKeyboard(LoginActivity.this);
          		createAccount();
       		return true;
       	default:
       		return super.onOptionsItemSelected(item);
       }
}
 
Example 2
Source File: ZenMainActivity.java    From zen4android with MIT License 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home:
		toggle();
		break;
	case R.id.zen_new_post:
		if (isLogin()) {
			Intent intent = new Intent(this, ZenPostActivity.class);
			intent.putExtra("fid", mFid);
			intent.putExtra("type", ZenPostActivity.ZEN_TYPE_POST);
			startActivity(intent);

		}
		break;
	case R.id.zen_notification:
		startActivity(new Intent(this, ZenNotificationActivity.class));
		break;
	case R.id.zen_refresh:
		refresh();
		break;
	}
	return true;
}
 
Example 3
Source File: GalleryActivity.java    From MultiChoiceAdapter with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            Intent parentActivityIntent = new Intent(this, HomeActivity.class);
            parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(parentActivityIntent);
            finish();
            return true;
        case R.id.menu_select_all:
            selectAll();
            return true;
        case R.id.menu_reset_list:
            rebuildList(null);
            return true;
    }
    return false;
}
 
Example 4
Source File: AlphabetIndexerActivity.java    From MultiChoiceAdapter with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        Intent parentActivityIntent = new Intent(this, HomeActivity.class);
        parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(parentActivityIntent);
        finish();
        return true;
    case R.id.menu_select_all:
        selectAll();
        return true;
    case R.id.menu_reset_list:
        rebuildList();
        initList(null);
        return true;
    }
    return false;
}
 
Example 5
Source File: page_create.java    From Favorite-Android-Client with Apache License 2.0 6 votes vote down vote up
public boolean onOptionsItemSelected(MenuItem item) {

		switch (item.getItemId()) {
		case android.R.id.home:
			onBackPressed();
			return true;
		case R.id.yes:
		
			if (Globalvariable.okbutton == true) {

			createAct();
				
			}

			return true;

		default:
			return super.onOptionsItemSelected(item);
		}
	}
 
Example 6
Source File: AboutAty.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home:
		this.finish();
		break;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 7
Source File: MonitorMangAty.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home:
		startActivity(new Intent(this, MainActivity.class));
		this.finish();
		break;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 8
Source File: ResultActivity.java    From ContentProviderHelper with MIT License 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
		case android.R.id.home:
			onBackPressed();
			return true;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 9
Source File: ShareActionProvider.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onMenuItemClick(MenuItem item) {
    ActivityChooserModel dataModel = ActivityChooserModel.get(mContext,
            mShareHistoryFileName);
    final int itemId = item.getItemId();
    Intent launchIntent = dataModel.chooseActivity(itemId);
    if (launchIntent != null) {
        mContext.startActivity(launchIntent);
    }
    return true;
}
 
Example 10
Source File: BirdActivity.java    From Moring-Alarm with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home:
		finish();
		return true;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 11
Source File: SettingActivity.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case android.R.id.home:
		finish();
	default:
		return super.onOptionsItemSelected(item);
	}
}
 
Example 12
Source File: AddEditHostActivity.java    From hosts-editor-android with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            Intent intent = new Intent(this, ListHostsActivity.class);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(intent);
            return true;
        case R.id.action_add_rm_comment:
            mFragment.toggleCommentVisibility();
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
 
Example 13
Source File: FindPwdActivity.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch(item.getItemId()){
	case android.R.id.home:
		this.finish();
		break;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 14
Source File: DetailsActivity.java    From Libraries-for-Android-Developers with MIT License 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            // 当左上角标题栏图标被单击时
            finish();
            break;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 15
Source File: BasicUsageActivity.java    From NumericPageIndicator with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        Intent parentActivityIntent = new Intent(this, HomeActivity.class);
        parentActivityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(parentActivityIntent);
        finish();
        return true;
    }
    return false;
}
 
Example 16
Source File: PluginFragment.java    From geoar-app with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case R.id.item_reload:
		PluginLoader.reloadPlugins();
		if (mTabHost.getCurrentTabTag().equals("download")) {
			PluginDownloader.getDataSources(gridAdapterDownload, true);
		}
		return true;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 17
Source File: HuoCheXingAty.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch(item.getItemId()){
	case android.R.id.home:
		this.finish();
		break;
	}
	return super.onOptionsItemSelected(item);
}
 
Example 18
Source File: PrefsLogic.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
public static boolean onMainActivityOptionsItemSelected(MenuItem item, Context ctxt, PreferencesWrapper prefsWrapper) {
    int id = item.getItemId();
    if (id == R.id.audio_test) {
        ctxt.startActivity(new Intent(ctxt, AudioTester.class));
        return true;
    } else if (id == R.id.reset_settings) {
        prefsWrapper.resetAllDefaultValues();
        return true;
    } else if (id == R.id.expert) {
        prefsWrapper.toogleExpertMode();

        return true;
    }
    return false;
}
 
Example 19
Source File: TwoLinesArrayAdapter.java    From MultiChoiceAdapter with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    if (item.getItemId() == R.id.menu_share) {
        Toast.makeText(getContext(), "Share", Toast.LENGTH_SHORT).show();
        return true;
    }
    if (item.getItemId() == R.id.menu_discard) {
        discardSelectedItems();
        return true;
    }
    return false;
}
 
Example 20
Source File: document_write.java    From Favorite-Android-Client with Apache License 2.0 4 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
	switch (item.getItemId()) {
	case 1:
		if (Globalvariable.okbutton == true) {
			// Set ok button disable
			Globalvariable.okbutton = false;
			Global.ButtonEnable(1);
			setSupportProgressBarIndeterminateVisibility(true);
		
			content = content_edittext.getText().toString();

			if (!content.matches("")) {
				PostAct();
			} else {
				setSupportProgressBarIndeterminateVisibility(false);
				Global.Infoalert(this, getString(R.string.alert),
						getString(R.string.no_content),
						getString(R.string.yes));
			}
		}

		return true;

	case 2:
		Intent intent1 = new Intent(document_write.this,
				privacy_category.class);
		intent1.putExtra("status", status);
		startActivityForResult(intent1, 1);

		return true;
	
	case 1001:
		int w,
		h;
		// Intent cameraIntent = new
		// Intent(MediaStore.ACTION_IMAGE_CAPTURE);
		// startActivityForResult(cameraIntent , CAMERA_PIC_REQUEST);

		Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
		File photo;
		try {
			// place where to store camera taken picture
			photo = Global.createTemporaryFile("picture", ".jpg");
			photo.delete();
		} catch (Exception e) {
			Global.toast(getString(R.string.no_storage_error));
			return false;
		}
		mImageUri = Uri.fromFile(photo);
		intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageUri);
		// start camera intent
		this.startActivityForResult(intent, CAMERA_PIC_REQUEST);
		return true;

		
	case 1002:
		Intent i = new Intent(Intent.ACTION_PICK);
		i.setType(android.provider.MediaStore.Images.Media.CONTENT_TYPE);
		i.setData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); // images
		// 결과를 리턴하는 Activity 호출
		startActivityForResult(i, REQ_CODE_PICK_PICTURE);

		return true;
		
	case 1003:
		Intent i1 = new Intent(Intent.ACTION_GET_CONTENT);
		 i1.setType("*/*");
		// 결과를 리턴하는 Activity 호출
		startActivityForResult(i1, FILE_CODE);

		return true;
		
	case 1005:
	attach_exist = false;
	invalidateOptionsMenu();
		return true;

	case android.R.id.home:
		onBackPressed();
		return true;
	default:
		return super.onOptionsItemSelected(item);
	}

}