com.lidroid.xutils.view.annotation.event.OnClick Java Examples

The following examples show how to use com.lidroid.xutils.view.annotation.event.OnClick. 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: FeedbackActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.save_tv)
private void feedback(View view) {
	String content = mContentET.getText().toString().trim();
	if(Util.isEmpty(content)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.content_null);
		return;
	}
	content = ToolsUtils.Html2Text(content);
	if(Util.isEmpty(content)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.input_invalide);
		return;
	}
	String contact = mContactET.getText().toString();
	if(Util.isNotEmpty(contact)) {  //如果填写了联系方式,则验证格式
		if(!Util.isEmail(contact) && !Util.isPhone(contact)) {
			ToastUtils.showMessage(getApplicationContext(), R.string.contact_invalid);
			return;
		}
	}
	contact = ToolsUtils.Html2Text(contact);
	ProgressDialogUtils.showProgressDialog(this, "提交反馈中...");
	mUserService.feedback(mHandler, content, contact, "");
}
 
Example #2
Source File: CartFragment.java    From ImitateTaobaoApp with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.btn_order)
    public void toOrder(View view) {
//        httpHelper.get(Contants.API.USER_DETAIL, new SpotsCallBack<User>(getContext()) {
//            @Override
//            public void onSuccess(Response response, User user) {
//
//                Log.d(TAG, "onSuccess: ");
//            }
//
//            @Override
//            public void onError(Response response, int code, Exception e) {
//
//                Log.d(TAG, "onError: ");
//            }
//        });

        Intent intent = new Intent(getActivity(), CreateOrderActivity.class);


        startActivity(intent,true);
    }
 
Example #3
Source File: LoginActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.login_btn)
private void login(View view) {
	String phone = mLoginEmail.getText().toString();
	String password = mLoginPassword.getText().toString();
	if(Util.isEmpty(phone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_null);
		return;
	}
	if(Util.isEmpty(password)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.password_null);
		return;
	}
	if(password.length() < 6) {
		ToastUtils.showMessage(getApplicationContext(), R.string.password_short);
		return;
	}
	if(!Util.isPhone(phone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_invalid);
		return;
	}
	ProgressDialogUtils.showProgressDialog(this, getString(R.string.logining));
	mUserService.login(mHandler, phone, password);
}
 
Example #4
Source File: ImageShowActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.save)
private void save(View view) {
	mPhotoView.setDrawingCacheEnabled(true);
	Bitmap bitmap = mPhotoView.getDrawingCache();
	if(bitmap == null) {
		mPhotoView.setDrawingCacheEnabled(false);
		return;
	}
	if (!ToolsUtils.hasSdcard()) {
		ToastUtils.showMessage(getApplicationContext(), "未找到存储卡");
	}
	view.setEnabled(false);
	ToastUtils.showMessage(getApplicationContext(), "图片已保存到sd卡" + SAVE_PATH);
	try {
		ImgUtil.saveBitmapToFile(bitmap, Environment.getExternalStorageDirectory() 
				+ SAVE_PATH + UUID.randomUUID() + ".jpg");
	} catch (IOException e) {
		ToastUtils.showMessage(getApplicationContext(), "保存失败");
	}
	mPhotoView.setDrawingCacheEnabled(false);
}
 
Example #5
Source File: QuShiDetailActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.add_comment_btn)
private void sendComment(View view) {
	ToolsUtils.hideKeyboard(mCommentTV);
	if(App.currentUser == null) {  //用户未登录
		Intent intent = new Intent(this, LoginActivity.class);
		startActivityWithAnimation(intent);
		return;
	}
	String content = mCommentContentET.getText().toString().trim();
	if(Util.isEmpty(content)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.comment_content_null);
		return;
	}
	content = ToolsUtils.Html2Text(content);
	if(Util.isEmpty(content)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.input_invalide);
		return;
	}
	if(mJoke == null) {
		return;
	}
	ProgressDialogUtils.showProgressDialog(this, getString(R.string.commenting));
	mQuShiService.addComment(mHandler, mJokeId, content);
}
 
Example #6
Source File: HttpFragment.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
/**
	 * post请求数据
	 * @param view
	 */
	@OnClick(R.id.post)
	public void post(View view) {
		//这个地址只支持get, 这里只是示范。
		String url = "http://www.weather.com.cn/data/cityinfo/101010100.html"; 
		RequestParams params = new RequestParams();
		/*		//添加请求参数
		params.addBodyParameter(key, value);*/
		
/*		//添加请求头
		params.addHeader(name, value);*/
		http.send(HttpMethod.POST, url, params, new RequestCallBack<String>() {

			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				data.setText(responseInfo.result);
			}

			@Override
			public void onFailure(HttpException error, String msg) {
				Toast.makeText(getActivity(), "访问失败" + msg, Toast.LENGTH_SHORT).show();
			}
			
		});
		
	}
 
Example #7
Source File: HttpFragment.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
/**
	 * get请求数据
	 * @param view
	 */
	@OnClick(R.id.get)
	public void get(View view) {
		String url = "http://www.weather.com.cn/data/cityinfo/101010100.html";
		RequestParams params = new RequestParams();
/*		//添加请求参数
		params.addBodyParameter(key, value);*/
		
/*		//添加请求头
		params.addHeader(name, value);*/
		http.send(HttpMethod.GET, url, params, new RequestCallBack<String>() {

			@Override
			public void onSuccess(ResponseInfo<String> responseInfo) {
				data.setText(responseInfo.result);
			}

			@Override
			public void onFailure(HttpException error, String msg) {
				Toast.makeText(getActivity(), "访问失败" + msg, Toast.LENGTH_SHORT).show();
			}
			
		});
	}
 
Example #8
Source File: ReSetPwdActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
/**
 * 修改密码
 * @param view
 */
@OnClick(R.id.save_btn)
private void savePassword(View view) {
	String password1 = mPassword1.getText().toString().trim();
	String password2 = mPassword2.getText().toString().trim();
	if(Util.isEmpty(password1)) {
		ToastUtils.showMessage(this, R.string.input_pwd_hint);
		return;
	}
	if(password1.length() < 6) {
		ToastUtils.showMessage(this, R.string.password_short);
		return;
	}
	if(Util.isEmpty(password2)) {
		ToastUtils.showMessage(this, R.string.input_pwd_hint1);
		return;
	}
	if(!password1.equals(password2)) {
		ToastUtils.showMessage(this, R.string.input_not_same);
		return;
	}
	ProgressDialogUtils.showProgressDialog(ReSetPwdActivity.this, getString(R.string.doing));
	mUserService.reSetPassword(mPhone, password1, apiCallBack);
}
 
Example #9
Source File: TuDetailActivity.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.add_comment_btn)
private void sendComment(View view) {
	ToolsUtils.hideKeyboard(mCommentTV);
	if(App.currentUser == null) {  //用户未登录
		Intent intent = new Intent(this, LoginActivity.class);
		startActivityWithAnimation(intent);
		return;
	}
	String content = mCommentContentET.getText().toString().trim();
	if(Util.isEmpty(content)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.comment_content_null);
		return;
	}
	content = ToolsUtils.Html2Text(content);
	if(Util.isEmpty(content)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.input_invalide);
		return;
	}
	if(mJoke == null) {
		return;
	}
	ProgressDialogUtils.showProgressDialog(this, getString(R.string.commenting));
	mQuShiService.addComment(mHandler, mJokeId, content);
}
 
Example #10
Source File: FindPwdActivity1.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.next_btn)
private void next(View view) {
	if(Util.isEmpty(mPhone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_null);
		return;
	}
	if(!Util.isPhone(mPhone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_invalid);
		return;
	}
	String code = mCodeET.getText().toString().trim();
	if(Util.isEmpty(code)) {
		ToastUtils.showMessageInCenter(this, "请输入验证码");
		return;
	}
	SMSSDK.submitVerificationCode("86", mPhone, code);
}
 
Example #11
Source File: FindPwdActivity1.java    From QiQuYing with Apache License 2.0 6 votes vote down vote up
@OnClick(R.id.send_btn)
private void sendSmsCode(View view) {
	mPhone = mPhoneET.getText().toString();
	if(Util.isEmpty(mPhone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_null);
		return;
	}
	if(!Util.isPhone(mPhone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_invalid);
		return;
	}
	if(App.smsCodeRecodeFindPwd != null && App.smsCodeRecodeFindPwd.containsKey(mPhone)) {
		long time = App.smsCodeRecodeFindPwd.get(mPhone);
		int interval = (int)((System.currentTimeMillis() - time) / 1000);
		int left = 60 - interval;
		if(left > 10) {
			mTime = left;
			String hintTest = String.format(mHint, mTime);
	        mSendBtn.setText(hintTest);
	        mSendBtn.setEnabled(false);
	        countDown();
			return;
		}
	}
	showSendSmsDialog();
}
 
Example #12
Source File: CheckCodeActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.check_code_btn)
private void check(View view) {
	String code = mCodeEt.getText().toString().trim();
	if(Util.isEmpty(code)) {
		ToastUtils.showMessageInCenter(this, "请输入验证码");
		return;
	}
	ProgressDialogUtils.showProgressDialog(CheckCodeActivity.this, getString(R.string.registing));
	SMSSDK.submitVerificationCode("86", mPhone, code);
}
 
Example #13
Source File: AllJokeActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.refresh)
private void refresh(View view) {
	if(mRefreshAnimation == null) {
		mRefreshAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.progress_anim);
	}
	AllFragment allFragment = (AllFragment)mFragments.get(mViewPager.getCurrentItem());
	if(allFragment.isRefresh()) {
		return;
	}
	view.startAnimation(mRefreshAnimation);
	allFragment.refresh();
}
 
Example #14
Source File: UserCenterActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * 我的收藏
 * @param view
 */
@OnClick(R.id.mycollect_layout)
private void toMyCollect(View view) {
	Intent intent = new Intent(this, MyCollectActivity.class);
	startActivityWithAnimation(intent);
	App.isStartOtherActivity = true;
}
 
Example #15
Source File: UserCenterActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * 反馈
 * @param view
 */
@OnClick(R.id.feedback_layout)
private void toFeedback(View view) {
	Intent intent = new Intent(this, FeedbackActivity.class);
	startActivityWithAnimation(intent);
	App.isStartOtherActivity = true;
}
 
Example #16
Source File: UserCenterActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * 关于奇趣营
 * @param view
 */
@OnClick(R.id.about_layout)
private void toAbout(View view) {
	Intent intent = new Intent(this, AboutActivity.class);
	startActivityWithAnimation(intent);
	App.isStartOtherActivity = true;
}
 
Example #17
Source File: UserCenterActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * 广点通应用推荐
 * @param view
 */
@OnClick(R.id.apptuijian_layout)
private void gdtAppWallAd(View view) {
	GdtAppwall wall =
            new GdtAppwall(this, Constants.GDT_APPId, Constants.GDT_APPWallPosId, Constants.TESTAD);
    wall.doShowAppWall();
}
 
Example #18
Source File: UserDataActivity.java    From ToDoList with Apache License 2.0 5 votes vote down vote up
@OnClick({R.id.takePic, R.id.takeGallery})
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.takePic:
            mCameradialog.cancel();
            autoObtainCameraPermission();
            break;
        case R.id.takeGallery:
            mCameradialog.cancel();
            autoObtainStoragePermission();
            break;
        default:
    }
}
 
Example #19
Source File: UserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.user_sex_biglayout)
private void setSex(View view) {
	if (mSexDialog == null) {
		createSexDialog();
	}
	mSexDialog.show();
}
 
Example #20
Source File: UserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.user_portrait_biglayout)
private void setPortrait(View view) {
	if (mPortraitDialog == null) {
		createPortraitDialog();
	}
	mPortraitDialog.show();
}
 
Example #21
Source File: UserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * 注销当前账号
 * @param view
 */
@OnClick(R.id.login_out_btn)
private void loginOut(View view) {
	App.currentUser = null;
	spUtil.remove("user");
	finishWithAnimation();
}
 
Example #22
Source File: QuTuActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.refresh)
private void refresh(View view) {
	if(mRefreshAnimation == null) {
		mRefreshAnimation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.progress_anim);
	}
	QuTuFragment quTuFragment = (QuTuFragment)mFragments.get(mViewPager.getCurrentItem());
	if(quTuFragment.isRefresh()) {
		return;
	}
	view.startAnimation(mRefreshAnimation);
	quTuFragment.refresh();
}
 
Example #23
Source File: LoginActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.btn_login_qq)
private void loginByQQ(View view) {
	if(mTencent == null) {
		TencentUtils.initTencent(this, spUtil);
		mTencent = App.mTencent;
	}
	mTencent.login(this, "all", loginListener);
}
 
Example #24
Source File: LoginActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.regist_btn)
private void regist(View view) {
	mPhone = mRegistPhone.getText().toString();
	mPassword = mRegistPassword.getText().toString();
	if(Util.isEmpty(mPhone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_null);
		return;
	}
	if(Util.isEmpty(mPassword)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.password_null);
		return;
	}
	if(mPassword.length() < 6) {
		ToastUtils.showMessage(getApplicationContext(), R.string.password_short);
		return;
	}
	if(!Util.isPhone(mPhone)) {
		ToastUtils.showMessage(getApplicationContext(), R.string.phone_invalid);
		return;
	}
	if(App.smsCodeRecode != null && App.smsCodeRecode.containsKey(mPhone)) {
		long time = App.smsCodeRecode.get(mPhone);
		int interval = (int)((System.currentTimeMillis() - time) / 1000);
		int left = 60 - interval;
		if(left > 10) {
			Intent intent = new Intent(LoginActivity.this, CheckCodeActivity.class);
			intent.putExtra("phone", mPhone);
			intent.putExtra("password", mPassword);
			intent.putExtra("left", left);
			startActivityWithAnimation(intent);
			return;
		}
	}
	/*ProgressDialogUtils.showProgressDialog(this, getString(R.string.registing));
	mUserService.regist(mHandler, phone, password);*/
	showSendSmsDialog();
}
 
Example #25
Source File: CreateUserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.save_tv)
private void save(View view) {
	nickName = mNickET.getText().toString().trim();
	if(Util.isEmpty(nickName)) {
		mNickET.requestFocus();
		ToastUtils.showMessage(getApplicationContext(), R.string.nick_null);
		return;
	}
	nickName = ToolsUtils.Html2Text(nickName);
	if(Util.isEmpty(nickName)) {
		ToastUtils.showMessage(getApplicationContext(), 
				R.string.input_invalide);
		return;
	}
	ToolsUtils.hideKeyboard(mNickET);
	if (App.currentUser == null) {
		finishWithAnimation();
		return;
	}
	try {
		ProgressDialogUtils.showProgressDialog(this, "正在处理中...");
		mUserService.setNickAndSex(mHandler, String.valueOf(App.currentUser.getId()), 
				URLEncoder.encode(nickName, "UTF-8"), String.valueOf(mSexFlag));
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
	}
}
 
Example #26
Source File: CreateUserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * 跳过
 * @param view
 */
@OnClick(R.id.skip_tv)
private void skip(View view) {
	Intent intent = new Intent(this, IndexActivity.class);
	intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_SINGLE_TOP);
	startActivityWithAnimation(intent);
	finishWithAnimation();
}
 
Example #27
Source File: CreateUserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.set_portrait_tv)
private void setPortrait(View view) {
	if (mPortraitDialog == null) {
		createPortraitDialog();
	}
	mPortraitDialog.show();
}
 
Example #28
Source File: CreateUserInfoActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
/**
 * 选择性别
 * @param view
 */
@OnClick(R.id.set_sex_layout)
private void setSex(View view) {
	if (mSexDialog == null) {
		createSexDialog();
	}
	mSexDialog.show();
}
 
Example #29
Source File: QuShiDetailActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.back)
private void back(View view) {
	if(mIsOpenFromPush && !App.isStart) {
		Intent intent = new Intent(this, SplashActivity.class);
		startActivityWithAnimation(intent);
	}
	finishWithAnimation();
}
 
Example #30
Source File: TuDetailActivity.java    From QiQuYing with Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.back)
private void back(View view) {
	if(mIsOpenFromPush && !App.isStart) {
		Intent intent = new Intent(this, SplashActivity.class);
		startActivityWithAnimation(intent);
	}
	finishWithAnimation();
}