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

The following examples show how to use com.lidroid.xutils.view.annotation.event.OnClick. These examples are extracted from open source projects. 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 Project: ImitateTaobaoApp   Source File: CartFragment.java    License: 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 2
Source Project: QiQuYing   Source File: ReSetPwdActivity.java    License: 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 3
Source Project: QiQuYing   Source File: TuDetailActivity.java    License: 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 4
Source Project: QiQuYing   Source File: FindPwdActivity1.java    License: 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 5
Source Project: QiQuYing   Source File: FindPwdActivity1.java    License: 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 6
Source Project: QiQuYing   Source File: FeedbackActivity.java    License: 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 7
Source Project: QiQuYing   Source File: LoginActivity.java    License: 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 8
Source Project: QiQuYing   Source File: QuShiDetailActivity.java    License: 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 9
Source Project: QiQuYing   Source File: ImageShowActivity.java    License: 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 10
Source Project: android-open-project-demo   Source File: HttpFragment.java    License: 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 11
Source Project: android-open-project-demo   Source File: HttpFragment.java    License: 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 12
Source Project: ToDoList   Source File: UserDataActivity.java    License: 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 13
Source Project: QiQuYing   Source File: UpdateNickActivity.java    License: Apache License 2.0 5 votes vote down vote up
@OnClick(R.id.save_tv)
private void updateNick(View view) {
	nickName = mNickET.getText().toString().trim();
	if(Util.isEmpty(nickName)) {
		ToastUtils.showMessage(this, R.string.user_update_nickname_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) {
		if(nickName.equals(App.currentUser.getUserNike())) {
			finishWithAnimation();
			return;
		}
		try {
			ProgressDialogUtils.showProgressDialog(this, "正在处理中...");
			mUserService.setNickAndSex(mHandler, String.valueOf(App.currentUser.getId()), 
					URLEncoder.encode(nickName, "UTF-8"), null);
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}
}
 
Example 14
Source Project: QiQuYing   Source File: QuShiActivity.java    License: 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);
	}
	QuShiFragment quShiFragment = (QuShiFragment)mFragments.get(mViewPager.getCurrentItem());
	if(quShiFragment.isRefresh()) {
		return;
	}
	view.startAnimation(mRefreshAnimation);
	quShiFragment.refresh();
}
 
Example 15
Source Project: QiQuYing   Source File: MeiTuActivity.java    License: 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);
	}
	MeiTuFragment meiTuFragment = (MeiTuFragment)mFragments.get(mViewPager.getCurrentItem());
	if(meiTuFragment.isRefresh()) {
		return;
	}
	view.startAnimation(mRefreshAnimation);
	meiTuFragment.refresh();
}
 
Example 16
Source Project: QiQuYing   Source File: TuDetailActivity.java    License: 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 17
Source Project: QiQuYing   Source File: CreateUserInfoActivity.java    License: 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 18
Source Project: QiQuYing   Source File: CreateUserInfoActivity.java    License: 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 19
Source Project: QiQuYing   Source File: CreateUserInfoActivity.java    License: 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 20
Source Project: QiQuYing   Source File: CreateUserInfoActivity.java    License: 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 21
Source Project: QiQuYing   Source File: AllJokeActivity.java    License: 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 22
Source Project: QiQuYing   Source File: UserCenterActivity.java    License: 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 23
Source Project: QiQuYing   Source File: UserCenterActivity.java    License: 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 24
Source Project: QiQuYing   Source File: UserCenterActivity.java    License: 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 25
Source Project: QiQuYing   Source File: UserCenterActivity.java    License: 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 26
Source Project: QiQuYing   Source File: UserInfoActivity.java    License: 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 27
Source Project: QiQuYing   Source File: UserInfoActivity.java    License: 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 28
Source Project: QiQuYing   Source File: UserInfoActivity.java    License: 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 29
Source Project: QiQuYing   Source File: QuTuActivity.java    License: 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 30
Source Project: QiQuYing   Source File: LoginActivity.java    License: 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);
}