Java Code Examples for android.view.View.getId()

The following are Jave code examples for showing how to use getId() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: cleanarchitecture-unidirectional   File: LoginActivity.java   Source Code and License Vote up 7 votes
@OnClick({R.id.btnEmail, R.id.btnFacebook, R.id.btnTwitter, R.id.btnGoogle})
void onClick(View view) {
    switch (view.getId()) {
        case R.id.btnEmail: {
            router.toEmailLogin();
            break;
        }
        case R.id.btnFacebook: {
            // TODO fb login
            break;
        }
        case R.id.btnGoogle: {
            final Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(apiClient);
            startActivityForResult(signInIntent, RC_GOOGLE_SIGNIN);

            break;
        }
        case R.id.btnTwitter: {
            // TODO twitter login
            break;
        }
        default: {
            break;
        }
    }
}
 
Example 2
Project: cwac-crossport   File: CoordinatorLayout.java   Source Code and License Vote up 7 votes
@Override
protected void onRestoreInstanceState(Parcelable state) {
  if (!(state instanceof SavedState)) {
    super.onRestoreInstanceState(state);
    return;
  }

  final SavedState ss = (SavedState) state;
  super.onRestoreInstanceState(ss.getSuperState());

  final SparseArray<Parcelable> behaviorStates = ss.behaviorStates;

  for (int i = 0, count = getChildCount(); i < count; i++) {
    final View child = getChildAt(i);
    final int childId = child.getId();
    final LayoutParams lp = getResolvedLayoutParams(child);
    final Behavior b = lp.getBehavior();

    if (childId != NO_ID && b != null) {
      Parcelable savedState = behaviorStates.get(childId);
      if (savedState != null) {
        b.onRestoreInstanceState(this, child, savedState);
      }
    }
  }
}
 
Example 3
Project: humaniq-android   File: TransferCoinsFragment.java   Source Code and License Vote up 7 votes
@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.buttonTransfer:
            if (isValidTransferCash())
                new AccountService(this).isExist(editTextToWallet.getText().toString(), REQUEST_IS_EXIST);
            break;

        case R.id.buttonScanQR:
            openQRScanner();
            break;

        case R.id.buttonClear:
            clearInputWallet(view);
            break;

        default:
            break;
    }
}
 
Example 4
Project: perfectTune   File: SignInActivity.java   Source Code and License Vote up 7 votes
@Override
public void onClick(View view) {
    switch (view.getId()) {
        case R.id.sign_in_button:
            Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
            startActivityForResult(signInIntent, 1);
            break;
        case R.id.sign_out_button:
            Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(
                    new ResultCallback<Status>() {
                        @Override
                        public void onResult(Status status) {
                            Log.w("credentials","Status: "+ status.getStatus());
                            Log.w("credentials","StatusMessage: "+ status.getStatusMessage());
                        }
                    });
            break;
    }
}
 
Example 5
Project: Mobike   File: SelectDialog.java   Source Code and License Vote up 7 votes
@Override
public void onClick(View v) {

    //        dialogOnclickInterface = (IDialogOnclickInterface) context;
    switch (v.getId()) {
        //            case R.id.confirm:
        ////                dialogOnclickInterface.confirmOnclick();
        ////                turnGPSOn(getContext());
        //                Intent intent = new Intent(
        //                        Settings.ACTION_LOCATION_SOURCE_SETTINGS);
        //                context.startActivity(intent);
        //              cancel();
        //                break;

        default:
            break;
    }
}
 
Example 6
Project: OSchina_resources_android   File: SignUpFragment.java   Source Code and License Vote up 7 votes
@OnClick({R.id.btn_sign_up, R.id.btn_cancel})
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.btn_sign_up:
            switch (mType) {
                case 1:
                    InvitationActivity.show(mContext, mInvitationImg);
                    break;
                case 2:
                    mPresenter.signUp(mDetail.getId());
                    break;
            }
            break;
        case R.id.btn_cancel:
            DialogHelper.getConfirmDialog(mContext, "", "是否确认取消?", "是", "否", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    mPresenter.cancelApply(mDetail.getId());
                }
            }).show();
            break;
    }
}
 
Example 7
Project: Viewshot   File: MainActivity.java   Source Code and License Vote up 6 votes
public void save(View view) {
    vibrator.vibrate(60);
    switch (view.getId()) {
        case R.id.jpg:
            Viewshot.of(frameLayout.getRootView()).setOnSaveResultListener(this).toJPG().save();
            break;
        case R.id.png:
            Viewshot.of(frameLayout).setOnSaveResultListener(this).toPNG().save();
            break;
        case R.id.nomedia:
            Viewshot.of(frameLayout).setOnSaveResultListener(this).toNomedia().save();
            break;
    }

}
 
Example 8
Project: MyFire   File: JCVideoPlayerSimple.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View v) {
    if (v.getId() == R.id.fullscreen && currentState == CURRENT_STATE_NORMAL) {
        Toast.makeText(getContext(), "Play video first", Toast.LENGTH_SHORT).show();
        return;
    }
    super.onClick(v);
}
 
Example 9
Project: SmingZZick_App   File: AttackAdaptor.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View v) {
    if (v.getId() == R.id.delete) {
        int position = -1;
        AttackData attackData = (AttackData) v.getTag();
        position = mAttacks.indexOf(attackData);

        if (position != -1) {
            mOnItemDeleteClickListener.onItemDeleteClick(attackData, position);
        }
    } else {
        mOnItemClickListener.onItemClick((AttackData) v.getTag());
    }
}
 
Example 10
Project: EditPhoto   File: CropFragment.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View view) {
    if (ivLoading.isShown()) return;
    if (view.getId() == R.id.ivCancel) {
        back();
    } else if (view.getId() == R.id.ivCheck) {
        saveImage();
    }
}
 
Example 11
Project: Responder-Android   File: SyncOptionsFragment.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View v) 
{
	switch (v.getId()) {
	case R.id.sync_now_button:
		LDLN.initiateSync(mActivity, mActivity);
		break;
	}
}
 
Example 12
Project: GitHub   File: BarStatusAlphaActivity.java   Source Code and License Vote up 6 votes
@Override
public void onWidgetClick(View view) {
    switch (view.getId()) {
        case R.id.btn_set_transparent:
            sbChangeAlpha.setProgress(0);
            break;
    }
}
 
Example 13
Project: CXJPadProject   File: LicenseBar.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.v1:
            openKeyboard(v, resetLicense(0));
            break;
        case R.id.v2:
            openKeyboard(v, resetLicense(1));
            break;
        case R.id.v3:
            openKeyboard(v, resetLicense(2));
            break;
        case R.id.v4:
            openKeyboard(v, resetLicense(3));
            break;
        case R.id.v5:
            openKeyboard(v, resetLicense(4));
            break;
        case R.id.v6:
            openKeyboard(v, resetLicense(5));
            break;
        case R.id.v7:
            openKeyboard(v, resetLicense(6));
            break;
        case R.id.v8:
            toggleElectricalTag();
            openKeyboard(v, resetLicense(7));
            break;
    }
}
 
Example 14
Project: Hitalk   File: ChatRoomLayout.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View v) {
    if (onFlowBarActionListener == null) {
        return;
    }
    switch (v.getId()) {
        case R.id.addFriendBt:
                onFlowBarActionListener.onAddFriend();
            break;
        case R.id.cancelBt:
                onFlowBarActionListener.onCancel();
            break;
    }
}
 
Example 15
Project: exciting-app   File: AutoUpdateDialog.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View v) {
    switch (v.getId()){
        case R.id.tv_start:
            Intent intent = new Intent(mActivity, VersionUpdateService.class);
            intent.putExtra(VersionUpdateService.UPDATE_URL, mVersionResult.getUrl());
            mActivity.startService(intent);
            break;
        case R.id.tv_cancel:
            break;
    }
    dismiss();
}
 
Example 16
Project: Hotspot-master-devp   File: UnderlinePageIndicator.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View v) {
	for (int i = 0; i < mTabViews.size(); i++) {
		TextView textView =  mTabViews.get(i);
           boolean isClickMe = textView.getId() == v.getId() ||
                   (mTabViews2 != null && mTabViews2.get(i).getId() == v.getId());
		if(isClickMe){
			textView.setTextColor(mSelectedTabColor);
			setCurrentItem(i);
		}else{
			textView.setTextColor(mTabViewDefaultColor);
		}
	}
}
 
Example 17
Project: RootPGPExplorer   File: PreferencesActivity.java   Source Code and License Vote up 6 votes
@Override
public void onClick(View view){
    int id=view.getId();
    boolean value=((Switch)view).isChecked();
    String config=null;
    switch(id){
        case R.id.prefs_askenc_box:      config=ConfigManager.ASK_ENCRYPTION; break;
        case R.id.prefs_autodel_box:     config=ConfigManager.ASK_DEL;break;
        case R.id.prefs_savepass_box:    config=ConfigManager.ASK_KEY_PASS;break;
    }
    ConfigManager.saveConfig(config,value);
}
 
Example 18
Project: xmrwallet   File: NumberPadView.java   Source Code and License Vote up 6 votes
@Override
public boolean onLongClick(final View view) {
    if (view.getId() == R.id.numberPadBackSpace) {
        listener.onClearAll();
        return true;
    }
    return false;
}
 
Example 19
Project: YKCenterDemo-Android   File: AirControlActivity.java   Source Code and License Vote up 5 votes
@Override
public void onClick(View v) {
	
	
	if (Utility.isEmpty(airEvent)) {
		 toast("airEvent is null");
		return;
	}
	
	//空调必须先打开,才能操作其他按键
	if (airEvent.isOff()&& !(v.getId() == R.id.power_btn)) {
		 toast("请先打开空调");
		return;
	}
	
	KeyCode mKeyCode=null;
	switch (v.getId()) {
	case R.id.power_btn:
		mKeyCode = airEvent.getNextValueByCatogery(AirConCatogery.Power);			
		break;
	case R.id.mode_btn:
		mKeyCode = airEvent.getNextValueByCatogery(AirConCatogery.Mode);
		break;
	case R.id.wspeed_btn:
		mKeyCode = airEvent.getNextValueByCatogery(AirConCatogery.Speed);
		break;
	case R.id.tbspeed_btn:
		mKeyCode = airEvent.getNextValueByCatogery(AirConCatogery.WindUp);
		break;
	case R.id.lrwspped_btn:
		mKeyCode = airEvent.getNextValueByCatogery(AirConCatogery.WindLeft);
		break;
	
	case R.id.temp_add_btn:
		if (airEvent.modeHasTemp()) {
			mKeyCode = airEvent.getNextValueByCatogery(AirConCatogery.Temp);	
		}			
		break;
	case R.id.temp_rdc_btn:
		if (airEvent.modeHasTemp()) {
			mKeyCode = airEvent.getForwardValueByCatogery(AirConCatogery.Temp);
		}
		break;
	
	default:
		break;			
	}
	
	if (!Utility.isEmpty(mKeyCode)) {
		driverControl.sendCMD(mKeyCode.getSrcCode());
		onRefreshUI(airEvent.getCurrStatus());
	}
}
 
Example 20
Project: PhotoApp   File: MainActivity.java   Source Code and License Vote up 5 votes
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.image_take_photo:
            if (!PermissionUtil.hasCameraPermission(this)) {
                PermissionUtil.asksCameraPermission(this);
            } else {
                dispatchTakePictureIntent();
            }
            break;

        case R.id.image_zoom_in:
            ImageUtil.handleZoomIn(this.mImageSelected);
            break;

        case R.id.image_zoom_out:
            ImageUtil.handleZoomOut(this.mImageSelected);
            break;

        case R.id.image_rotate_left:
            ImageUtil.handleRotateLeft(this.mImageSelected);
            break;

        case R.id.image_rotate_right:
            ImageUtil.handleRotateRight(this.mImageSelected);
            break;

        case R.id.image_finish:
            toogleControlPanel(false);
            break;

        case R.id.image_remove:
            this.mViewHolder.mRelativePhotoContent.removeView(this.mImageSelected);
            toogleControlPanel(false);
            break;

        case R.id.image_whatsapp:
            SocialUtil.shareImageOnWhats(this, this.mViewHolder.mRelativePhotoContent, v);
            break;

        case R.id.image_facebook:
            Toast.makeText(this, R.string.openning_share, Toast.LENGTH_LONG).show();
            SocialUtil.shareImageOnFace(this, this.mViewHolder.mRelativePhotoContent, v);
            break;

        case R.id.image_twitter:
            SocialUtil.shareImageOnTwitter(this, this.mViewHolder.mRelativePhotoContent, v);
            break;

        case R.id.image_instagram:
            SocialUtil.shareImageOnInsta(this, this.mViewHolder.mRelativePhotoContent, v);
            break;
    }
}