短信验证功能添加
This commit is contained in:
parent
45531e5e4e
commit
bba6d24298
|
|
@ -1,7 +1,9 @@
|
|||
package com.ifish.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.CountDownTimer;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
|
@ -63,22 +65,21 @@ import cn.smssdk.SMSSDK;
|
|||
import de.greenrobot.event.EventBus;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ClassName: RegisteredActivity
|
||||
* @Description: 注册界面
|
||||
* @author Jacky dada
|
||||
* @date 2015-9-2 下午6:45:16
|
||||
* @author Jacky dada
|
||||
* @ClassName: RegisteredActivity
|
||||
* @Description: 注册界面
|
||||
* @date 2015-9-2 下午6:45:16
|
||||
*/
|
||||
public class RegisteredActivity extends BaseActivityNotAnim{
|
||||
public class RegisteredActivity extends BaseActivityNotAnim {
|
||||
long waitTime = 2000;//2秒退出时间
|
||||
long touchTime = 0;
|
||||
private ImageView title_img;
|
||||
private TextView title_text,title_text_right,tv_country;
|
||||
private TextView title_text, title_text_right, tv_country, tv_changesmscode;
|
||||
private CheckBox ct_check;
|
||||
private Toast toast;
|
||||
private EditText et_phone,et_messge,et_psw;
|
||||
private TextView tv_code;
|
||||
private HttpManager hm=HttpManager.getInstance();
|
||||
private EditText et_phone, et_messge, et_psw;
|
||||
private TextView tv_code, tv_msgcode;
|
||||
private HttpManager hm = HttpManager.getInstance();
|
||||
private int CURRENTDELAYTIME;
|
||||
private final int DELAYTIME = 60;//60S倒数
|
||||
private int disableColor = drawable.tvcode_press_noright_shape;
|
||||
|
|
@ -91,20 +92,26 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
private SPUtil sp;
|
||||
private ConfigUtil cp;
|
||||
private LocationClient mLocationClient;
|
||||
EventHandler eh=null;
|
||||
private final String UnknownHostException="UnknownHostException";
|
||||
EventHandler eh = null;
|
||||
private final String UnknownHostException = "UnknownHostException";
|
||||
private CountryCode countryCode;
|
||||
private TimeCount time;
|
||||
private String smsCode;
|
||||
private Activity act;
|
||||
private boolean isShowSmsCode = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.registered_activity);
|
||||
initTitle("注册","登录");
|
||||
initTitle("注册", "登录");
|
||||
initView();
|
||||
init();
|
||||
initListener();
|
||||
initLocation();//百度定位
|
||||
}
|
||||
private void test(){
|
||||
|
||||
private void test() {
|
||||
findViewById(R.id.iv_test).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
|
@ -114,7 +121,8 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
});
|
||||
|
||||
}
|
||||
private void initLocation(){
|
||||
|
||||
private void initLocation() {
|
||||
LocationClientOption option = new LocationClientOption();
|
||||
option.setLocationMode(LocationMode.Hight_Accuracy);//可选,默认高精度,设置定位模式,高精度,低功耗,仅设备
|
||||
option.setCoorType("gcj02");//可选,默认gcj02,设置返回的定位结果坐标系,
|
||||
|
|
@ -125,15 +133,21 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
option.setIgnoreKillProcess(false);//可选,默认true,定位SDK内部是一个SERVICE,并放到了独立进程,设置是否在stop的时候杀死这个进程,默认不杀死
|
||||
mLocationClient.setLocOption(option);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
act = this;
|
||||
ct_check = (CheckBox) findViewById(R.id.ct_check);
|
||||
tv_code = (TextView) findViewById(R.id.tv_code);
|
||||
tv_msgcode = (TextView) findViewById(R.id.tv_msgcode);
|
||||
et_phone = (EditText) findViewById(R.id.et_phone);
|
||||
et_messge = (EditText) findViewById(R.id.et_messge);
|
||||
et_psw = (EditText) findViewById(R.id.et_psw);
|
||||
tv_country=findMyViewById(R.id.tv_country);
|
||||
}
|
||||
private void initTitle(String title,String right) {
|
||||
tv_changesmscode = (TextView) findViewById(R.id.tv_changesmscode);
|
||||
tv_country = findMyViewById(R.id.tv_country);
|
||||
time = new TimeCount(60000, 1000);
|
||||
}
|
||||
|
||||
private void initTitle(String title, String right) {
|
||||
title_img = (ImageView) findViewById(R.id.title_img);
|
||||
title_img.setVisibility(View.GONE);
|
||||
title_text = (TextView) findViewById(R.id.title_text);
|
||||
|
|
@ -142,12 +156,13 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
title_text_right.setText(right);
|
||||
title_text_right.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
cp=ConfigUtil.getInstance(RegisteredActivity.this);
|
||||
cp = ConfigUtil.getInstance(RegisteredActivity.this);
|
||||
toast = Toast.makeText(this, "", Toast.LENGTH_SHORT);
|
||||
timer = new Timer();
|
||||
mLocationClient = ((BaseApplication)getApplication()).mLocationClient;//定位
|
||||
eh=new EventHandler() {
|
||||
mLocationClient = ((BaseApplication) getApplication()).mLocationClient;//定位
|
||||
eh = new EventHandler() {
|
||||
@Override
|
||||
public void afterEvent(int event, int result, Object data) {
|
||||
Message msg = new Message();
|
||||
|
|
@ -159,10 +174,10 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
};
|
||||
SMSSDK.registerEventHandler(eh);
|
||||
EventBus.getDefault().register(this);
|
||||
showSmsCode();
|
||||
}
|
||||
|
||||
|
||||
Handler mHandler = new Handler(){
|
||||
Handler mHandler = new Handler() {
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
int event = msg.arg1;
|
||||
|
|
@ -172,14 +187,14 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {//提交验证码成功
|
||||
//提交验证码成功 - 去注册
|
||||
doRegistered();
|
||||
}else if (event ==SMSSDK.EVENT_GET_VOICE_VERIFICATION_CODE){
|
||||
} else if (event == SMSSDK.EVENT_GET_VOICE_VERIFICATION_CODE) {
|
||||
ToastUtil.show(getApplicationContext(), "语音验证码已发送 注意接听手机来电");
|
||||
}
|
||||
} else {
|
||||
dismissProgressDialog();
|
||||
if (event == SMSSDK.EVENT_SUBMIT_VERIFICATION_CODE) {
|
||||
//提交验证码失败
|
||||
if (data!=null) {
|
||||
if (data != null) {
|
||||
if (data.toString().contains(UnknownHostException)) {//没有网络
|
||||
ToastUtil.show(getApplicationContext(), Text.ERROR);
|
||||
return;
|
||||
|
|
@ -199,9 +214,9 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
} catch (Exception e) {
|
||||
ToastUtil.show(getApplicationContext(), "获取失败");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
//获取验证码失败
|
||||
if (data!=null) {
|
||||
if (data != null) {
|
||||
if (data.toString().contains(UnknownHostException)) {//没有网络
|
||||
ToastUtil.show(getApplicationContext(), Text.ERROR);
|
||||
//获取验证码失败
|
||||
|
|
@ -240,28 +255,26 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
mLocationClient.stop();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
public void initListener() {
|
||||
findViewById(R.id.tv_code).setOnClickListener(this);
|
||||
findViewById(R.id.tv_msgcode).setOnClickListener(this);
|
||||
findViewById(R.id.bt_submit).setOnClickListener(this);
|
||||
findViewById(R.id.tv_check).setOnClickListener(this);
|
||||
findViewById(R.id.rl_bg).setOnClickListener(this);
|
||||
findViewById(R.id.rl_country).setOnClickListener(this);
|
||||
tv_changesmscode.setOnClickListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param
|
||||
* @Description: 60S短信倒数
|
||||
* @author Jacky dada
|
||||
* @param
|
||||
* @date 2015-9-6 下午8:15:45
|
||||
*/
|
||||
private void startTime() {
|
||||
|
|
@ -273,42 +286,45 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
UIHandler.sendEmptyMessage(7);
|
||||
}
|
||||
};
|
||||
timer.schedule(task,0,1000);
|
||||
timer.schedule(task, 0, 1000);
|
||||
}
|
||||
Handler UIHandler = new Handler(){
|
||||
|
||||
Handler UIHandler = new Handler() {
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
switch (msg.what) {
|
||||
case 7:
|
||||
if(CURRENTDELAYTIME<=0){
|
||||
if (CURRENTDELAYTIME <= 0) {
|
||||
|
||||
task.cancel();
|
||||
tv_code.setClickable(true);
|
||||
tv_code.setText(getResources().getString(R.string.voice_code));
|
||||
tv_code.setBackgroundDrawable(tv_code
|
||||
.isClickable() ? getResources().getDrawable(ebleColor) : getResources().getDrawable(disableColor));
|
||||
}else{
|
||||
} else {
|
||||
CURRENTDELAYTIME--;
|
||||
tv_code.setText(CURRENTDELAYTIME+"\"");
|
||||
tv_code.setText(CURRENTDELAYTIME + "\"");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
;
|
||||
};
|
||||
};
|
||||
Handler loginHandler = new Handler(){
|
||||
Handler loginHandler = new Handler() {
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
/**
|
||||
* 注册后登录成功到主界面 否则则去登录界面 手机号已存SP 自动读取
|
||||
*/
|
||||
if(NetWork.Success==msg.what){
|
||||
if (NetWork.Success == msg.what) {
|
||||
saveInfo();
|
||||
ToastUtil.show(getApplicationContext(), "注册成功");
|
||||
dismissProgressDialog();
|
||||
startActivity(MainTabActivity.class);
|
||||
finish();
|
||||
}else{
|
||||
} else {
|
||||
dismissProgressDialog();
|
||||
ToastUtil.show(getApplicationContext(), "注册成功 请登录");
|
||||
startActivity(LoginActivity.class);
|
||||
|
|
@ -317,12 +333,13 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
}
|
||||
}
|
||||
};
|
||||
private void saveInfo(){
|
||||
|
||||
private void saveInfo() {
|
||||
//登录成功保存个人信息
|
||||
Commons.USER=loginUser;
|
||||
Commons.PHONE_NUM=et_phone.getText().toString();
|
||||
Commons.CODE=MD5Util.GetMD5(et_psw.getText().toString());
|
||||
sp=SPUtil.getInstance(getApplicationContext());
|
||||
Commons.USER = loginUser;
|
||||
Commons.PHONE_NUM = et_phone.getText().toString();
|
||||
Commons.CODE = MD5Util.GetMD5(et_psw.getText().toString());
|
||||
sp = SPUtil.getInstance(getApplicationContext());
|
||||
sp.putBoolean(LoginSPKey.IS_LOGIN, true);
|
||||
sp.putBoolean(LoginSPKey.IS_CAMERA, Commons.IS_CAMERA);
|
||||
sp.putString(LoginSPKey.PHONE_NUM, et_phone.getText().toString());
|
||||
|
|
@ -335,7 +352,8 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
sp.putString(LoginSPKey.P2PVerifyCode2, loginUser.P2PVerifyCode2);
|
||||
sp.putString(LoginSPKey.GeeWeUserId, loginUser.gwellUserID);
|
||||
}
|
||||
Handler regeditHandler = new Handler(){
|
||||
|
||||
Handler regeditHandler = new Handler() {
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
/**
|
||||
* 1:注册成功
|
||||
|
|
@ -348,7 +366,7 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
userLogin();//注册成功就登录请求
|
||||
break;
|
||||
case NetWork.Fail:
|
||||
ToastUtil.show(getApplicationContext(),"注册失败");
|
||||
ToastUtil.show(getApplicationContext(), "注册失败");
|
||||
dismissProgressDialog();
|
||||
break;
|
||||
case NetWork.ERROR:
|
||||
|
|
@ -372,10 +390,11 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
SMSSDK.unregisterEventHandler(eh);
|
||||
if(task != null){
|
||||
if (task != null) {
|
||||
task.cancel();
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
|
|
@ -384,6 +403,7 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
|
@ -394,10 +414,11 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
ActivityManager.getInstance().exit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
// 点击事件
|
||||
Intent i=new Intent();
|
||||
Intent i = new Intent();
|
||||
switch (v.getId()) {
|
||||
case R.id.rl_bg:
|
||||
hideKeyboard();
|
||||
|
|
@ -416,11 +437,11 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
finish();
|
||||
break;
|
||||
case R.id.bt_submit: {//注册
|
||||
if(et_phone.getText().toString().replaceAll(" ","").length()==0){
|
||||
if (et_phone.getText().toString().replaceAll(" ", "").length() == 0) {
|
||||
ToastUtil.show(getApplicationContext(), "请输入手机号");
|
||||
return;
|
||||
}
|
||||
if (et_messge.getText().toString().replaceAll(" ","").length() == 0) {
|
||||
if (et_messge.getText().toString().replaceAll(" ", "").length() == 0) {
|
||||
ToastUtil.show(getApplicationContext(), "请输入短信验证码");
|
||||
return;
|
||||
}
|
||||
|
|
@ -433,20 +454,33 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
return;
|
||||
}
|
||||
hideKeyboard();
|
||||
if (isShowSmsCode) {
|
||||
if (smsCode == null) {
|
||||
ToastUtil.show(getApplicationContext(), "请先获取短信码");
|
||||
return;
|
||||
}
|
||||
if (et_messge.getText().toString().equals(smsCode)) {
|
||||
showProgressDialog();
|
||||
doRegistered();
|
||||
} else {
|
||||
ToastUtil.show(getApplicationContext(), "请输入正确的短信验证码");
|
||||
}
|
||||
} else {
|
||||
showProgressDialog();
|
||||
if (countryCode == null) {
|
||||
countryCode=new CountryCode("86","中国");
|
||||
countryCode = new CountryCode("86", "中国");
|
||||
}
|
||||
SMSSDK.submitVerificationCode(countryCode.countryCode, et_phone.getText().toString(), et_messge.getText().toString());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case R.id.tv_code: {//注册验证码
|
||||
if(et_phone.getText().toString().replaceAll(" ","").length()==0){
|
||||
ToastUtil.show(getApplicationContext(),"请输入手机号");
|
||||
if (et_phone.getText().toString().replaceAll(" ", "").length() == 0) {
|
||||
ToastUtil.show(getApplicationContext(), "请输入手机号");
|
||||
return;
|
||||
}
|
||||
if (countryCode == null) {
|
||||
countryCode=new CountryCode("86","中国");
|
||||
countryCode = new CountryCode("86", "中国");
|
||||
}
|
||||
SMSSDK.getVoiceVerifyCode(countryCode.countryCode, et_phone.getText().toString());
|
||||
mLocationClient.start();//定位SDK start之后会默认发起一次定位请求,开发者无须判断isstart并主动调用request
|
||||
|
|
@ -458,33 +492,73 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
startTime();
|
||||
break;
|
||||
}
|
||||
case R.id.tv_msgcode: {
|
||||
hm.getSecurityCode(new HttpListener<BaseBean<String>>() {
|
||||
@Override
|
||||
public void success(BaseBean<String> baseBean) {
|
||||
if (baseBean.result == 201) {
|
||||
act.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ToastUtil.show(getApplicationContext(), "手机号已被注册 请直接登录");
|
||||
}
|
||||
});
|
||||
} else if (baseBean.result == 100) {
|
||||
smsCode = baseBean.data;
|
||||
time.start();
|
||||
} else {
|
||||
act.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ToastUtil.show(getApplicationContext(), "发送短信失败 请重新获取");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void error(Exception e, String msg) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
|
||||
}
|
||||
}, et_phone.getText().toString());
|
||||
break;
|
||||
}
|
||||
case R.id.rl_country: {//国家代码
|
||||
startActivity(CountryListActivity.class);
|
||||
AnimationUtil.startAnimation(RegisteredActivity.this);
|
||||
break;
|
||||
}
|
||||
|
||||
case R.id.tv_changesmscode: {
|
||||
isShowSmsCode = !isShowSmsCode;
|
||||
showSmsCode();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 国家/地区发生改变
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public void onEventMainThread(CountryCode event) {
|
||||
if (tv_country != null) {
|
||||
tv_country.setText(event.country+" +"+event.countryCode);
|
||||
tv_country.setText(event.country + " +" + event.countryCode);
|
||||
}
|
||||
countryCode=event;
|
||||
countryCode = event;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param
|
||||
* @Description: 注册成功就接着发登录的请求
|
||||
* @author Jacky dada
|
||||
* @param
|
||||
* @date 2015-9-6 下午7:20:42
|
||||
*/
|
||||
private void doRegistered() {
|
||||
|
|
@ -501,55 +575,55 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
|
||||
@Override
|
||||
public void error(Exception e, String msg) {
|
||||
doRegisteredResult=NetWork.ERROR;
|
||||
doRegisteredResult = NetWork.ERROR;
|
||||
}
|
||||
}, et_phone.getText().toString(),et_psw.getText().toString());
|
||||
}, et_phone.getText().toString(), et_psw.getText().toString());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param
|
||||
* @Description: 登录
|
||||
* @author Jacky dada
|
||||
* @param
|
||||
* @date 2015-9-8 下午2:33:05
|
||||
*/
|
||||
private void userLogin() {
|
||||
hm.userLogin(new HttpListener<BaseBean<MyData>>() {
|
||||
@Override
|
||||
public void success(BaseBean<MyData> baseBean) {
|
||||
if(baseBean==null){
|
||||
result=NetWork.ERROR;
|
||||
if (baseBean == null) {
|
||||
result = NetWork.ERROR;
|
||||
return;
|
||||
}
|
||||
result=baseBean.result;
|
||||
if (result==NetWork.Success) {
|
||||
loginUser=baseBean.data.getUser();
|
||||
Commons.USER=loginUser;
|
||||
result = baseBean.result;
|
||||
if (result == NetWork.Success) {
|
||||
loginUser = baseBean.data.getUser();
|
||||
Commons.USER = loginUser;
|
||||
List<Device> device = baseBean.data.getDevice();
|
||||
List<Camera> camera = baseBean.data.camera;
|
||||
List<DeviceCamera> deviceCamera = baseBean.data.deviceCamera;
|
||||
Commons.DEVICE=device;
|
||||
Commons.CAMERA=camera;
|
||||
Commons.INFO=baseBean.data.information;
|
||||
Commons.DeviceCamera=deviceCamera;
|
||||
Commons.SHOP=baseBean.data.shopsInfo;
|
||||
Commons.SHOP2=baseBean.data.shopsInfo2;
|
||||
Commons.USERASSET=baseBean.data.userAsset;
|
||||
Commons.GOLDTASKS=baseBean.data.goldTasks;
|
||||
if (device.size()==0) {
|
||||
Commons.HAVE_DEVICE=false;
|
||||
}else{
|
||||
Commons.HAVE_DEVICE=true;
|
||||
Commons.IS_EventBus=true;
|
||||
Commons.DEVICE = device;
|
||||
Commons.CAMERA = camera;
|
||||
Commons.INFO = baseBean.data.information;
|
||||
Commons.DeviceCamera = deviceCamera;
|
||||
Commons.SHOP = baseBean.data.shopsInfo;
|
||||
Commons.SHOP2 = baseBean.data.shopsInfo2;
|
||||
Commons.USERASSET = baseBean.data.userAsset;
|
||||
Commons.GOLDTASKS = baseBean.data.goldTasks;
|
||||
if (device.size() == 0) {
|
||||
Commons.HAVE_DEVICE = false;
|
||||
} else {
|
||||
Commons.HAVE_DEVICE = true;
|
||||
Commons.IS_EventBus = true;
|
||||
}
|
||||
if (camera.size()==0) {
|
||||
Commons.HAVE_CAMERA=false;
|
||||
}else{
|
||||
Commons.HAVE_CAMERA=true;
|
||||
if (camera.size() == 0) {
|
||||
Commons.HAVE_CAMERA = false;
|
||||
} else {
|
||||
Commons.HAVE_CAMERA = true;
|
||||
}
|
||||
if (!Commons.HAVE_DEVICE&&Commons.HAVE_CAMERA) {//用户没有鱼缸,只有摄像头则默认展示摄像头界面
|
||||
Commons.IS_CAMERA=true;
|
||||
}else{
|
||||
Commons.IS_CAMERA=false;
|
||||
if (!Commons.HAVE_DEVICE && Commons.HAVE_CAMERA) {//用户没有鱼缸,只有摄像头则默认展示摄像头界面
|
||||
Commons.IS_CAMERA = true;
|
||||
} else {
|
||||
Commons.IS_CAMERA = false;
|
||||
}
|
||||
/**
|
||||
* 登录云信
|
||||
|
|
@ -566,7 +640,7 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
@Override
|
||||
public void onFailed(int arg0) {
|
||||
// TODO Auto-generated method stub
|
||||
L.d("yunxin onFailed code="+arg0+" Account="+Commons.USER.getUserId()+" token="+Commons.USER.neteaseToken);
|
||||
L.d("yunxin onFailed code=" + arg0 + " Account=" + Commons.USER.getUserId() + " token=" + Commons.USER.neteaseToken);
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -589,7 +663,7 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
|
||||
@Override
|
||||
public void onComplete(int arg0, CommUser arg1) {
|
||||
L.i("state"+arg0);
|
||||
L.i("state" + arg0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -602,9 +676,44 @@ public class RegisteredActivity extends BaseActivityNotAnim{
|
|||
|
||||
@Override
|
||||
public void error(Exception e, String msg) {
|
||||
result=NetWork.ERROR;
|
||||
result = NetWork.ERROR;
|
||||
}
|
||||
}, et_phone.getText().toString(), MD5Util.GetMD5(et_psw.getText().toString()));
|
||||
}
|
||||
|
||||
class TimeCount extends CountDownTimer {
|
||||
|
||||
public TimeCount(long millisInFuture, long countDownInterval) {
|
||||
super(millisInFuture, countDownInterval);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTick(long millisUntilFinished) {
|
||||
tv_msgcode.setClickable(false);
|
||||
tv_msgcode.setText(millisUntilFinished / 1000 + "\"");
|
||||
tv_msgcode.setBackgroundDrawable(tv_msgcode
|
||||
.isClickable() ? getResources().getDrawable(ebleColor) : getResources().getDrawable(disableColor));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
tv_msgcode.setText("短信验证码");
|
||||
tv_msgcode.setClickable(true);
|
||||
tv_msgcode.setBackgroundDrawable(tv_msgcode
|
||||
.isClickable() ? getResources().getDrawable(ebleColor) : getResources().getDrawable(disableColor));
|
||||
}
|
||||
}
|
||||
|
||||
private void showSmsCode() {
|
||||
if (isShowSmsCode) {
|
||||
tv_code.setVisibility(View.GONE);
|
||||
tv_msgcode.setVisibility(View.VISIBLE);
|
||||
tv_changesmscode.setText("语音验证码");
|
||||
} else {
|
||||
tv_code.setVisibility(View.VISIBLE);
|
||||
tv_msgcode.setVisibility(View.GONE);
|
||||
tv_changesmscode.setText("短信验证码");
|
||||
}
|
||||
}, et_phone.getText().toString(),MD5Util.GetMD5(et_psw.getText().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,219 +1,240 @@
|
|||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rl_bg"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true">
|
||||
|
||||
<include
|
||||
android:id="@+id/in_daohang"
|
||||
layout="@layout/title_layout_haveimg" />
|
||||
|
||||
<ImageView
|
||||
android:layout_below="@+id/in_daohang"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/login_background"
|
||||
android:layout_below="@+id/in_daohang"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
android:src="@drawable/login_background" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="@dimen/login_padding_bottom"
|
||||
android:layout_marginLeft="@dimen/login_padding_left"
|
||||
android:layout_marginRight="15dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_below="@id/in_daohang"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/in_daohang"
|
||||
android:layout_marginLeft="@dimen/login_padding_left"
|
||||
android:layout_marginRight="15dp"
|
||||
android:layout_marginTop="@dimen/login_padding_bottom"
|
||||
android:background="@color/F7F7F7"
|
||||
android:gravity="center_horizontal"
|
||||
>
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_country"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dp"
|
||||
android:background="@drawable/login_edtext_shape_f2"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
>
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/login_edtext_shape_f2">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="11dp"
|
||||
android:text="国家/地区"
|
||||
android:textColor="@color/galy_my"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="18sp"
|
||||
android:layout_marginLeft="11dp"
|
||||
/>
|
||||
android:textSize="18sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_country"
|
||||
android:layout_toRightOf="@+id/tv_tv"
|
||||
android:gravity="right"
|
||||
android:ellipsize="start"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="11dp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="11dp"
|
||||
android:layout_marginRight="11dp"
|
||||
android:layout_toRightOf="@+id/tv_tv"
|
||||
android:ellipsize="start"
|
||||
android:gravity="right"
|
||||
android:singleLine="true"
|
||||
android:text="中国 +86"
|
||||
android:textColor="@color/text_black_my"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="18sp"
|
||||
android:singleLine="true"
|
||||
android:layout_marginLeft="11dp"
|
||||
/>
|
||||
android:textSize="18sp" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<com.ifish.view.ClearEditText
|
||||
android:paddingRight="10dp"
|
||||
android:id="@+id/et_phone"
|
||||
android:layout_below="@id/in_daohang"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_below="@id/in_daohang"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
android:layout_marginTop="@dimen/login_bg_width"
|
||||
android:background="@drawable/login_edtext_shape_f2"
|
||||
android:hint="请输入手机号"
|
||||
android:inputType="number"
|
||||
android:maxLength="11"
|
||||
android:layout_marginTop="@dimen/login_bg_width"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
android:background="@drawable/login_edtext_shape_f2"
|
||||
android:textColor="@color/text_black_my"
|
||||
android:textColorHint="@color/galy_my"
|
||||
android:paddingLeft="10dp"
|
||||
android:hint="请输入手机号"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
<RelativeLayout
|
||||
android:textColor="@color/text_black_my"
|
||||
android:textColorHint="@color/galy_my" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rl_a1"
|
||||
android:layout_below="@id/et_phone"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_marginTop="@dimen/login_bg_width"
|
||||
android:layout_below="@id/et_phone"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
>
|
||||
<TextView
|
||||
android:id="@+id/tv_code"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:padding="10dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/voice_code"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
android:background="@drawable/login_button_noright_select"
|
||||
/>
|
||||
android:layout_marginTop="@dimen/login_bg_width"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/et_messge"
|
||||
android:layout_toLeftOf="@id/tv_code"
|
||||
android:maxLength="4"
|
||||
android:inputType="number"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:textColor="@color/text_black_my"
|
||||
android:textColorHint="@color/galy_my"
|
||||
android:paddingLeft="10dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/login_edtext_noright_shape_f2"
|
||||
android:hint="请输入验证码"
|
||||
android:inputType="number"
|
||||
android:maxLength="4"
|
||||
android:paddingLeft="10dp"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
android:textColor="@color/text_black_my"
|
||||
android:textColorHint="@color/galy_my" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_code"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/login_button_noright_select"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/voice_code"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_msgcode"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/login_button_noright_select"
|
||||
android:gravity="center"
|
||||
android:maxLines="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/sms_code"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="12sp"
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
<com.ifish.view.ClearEditText
|
||||
android:paddingRight="10dp"
|
||||
android:id="@+id/et_psw"
|
||||
android:layout_below="@id/rl_a1"
|
||||
android:layout_marginTop="@dimen/login_bg_width"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
android:background="@drawable/login_edtext_shape_f2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dp"
|
||||
android:layout_below="@id/rl_a1"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
android:layout_marginTop="@dimen/login_bg_width"
|
||||
android:background="@drawable/login_edtext_shape_f2"
|
||||
android:hint="请设置您的密码"
|
||||
android:inputType="textPassword"
|
||||
android:maxLength="16"
|
||||
android:textColor="@color/text_black_my"
|
||||
android:textColorHint="@color/galy_my"
|
||||
android:paddingLeft="10dp"
|
||||
android:hint="请设置您的密码"
|
||||
android:paddingRight="10dp"
|
||||
android:singleLine="true"
|
||||
/>
|
||||
android:textColor="@color/text_black_my"
|
||||
android:textColorHint="@color/galy_my" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/bt_submit"
|
||||
android:layout_below="@id/et_psw"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="45dp"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginTop="30dp"
|
||||
android:layout_below="@id/et_psw"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
android:layout_marginTop="30dp"
|
||||
android:background="@drawable/login_button_select"
|
||||
android:text="注册" />
|
||||
android:text="注册"
|
||||
android:textColor="@color/white" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_below="@id/bt_submit"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/bt_submit"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:layout_marginLeft="@dimen/new_login_bg_width"
|
||||
android:layout_marginRight="@dimen/new_login_bg_width"
|
||||
>
|
||||
android:layout_marginTop="12dp">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/ct_check"
|
||||
android:checked="true"
|
||||
android:layout_centerVertical="true"
|
||||
style="@style/CustomCheckboxTheme"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/CustomCheckboxTheme"
|
||||
/>
|
||||
android:layout_centerVertical="true"
|
||||
android:checked="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_check"
|
||||
android:layout_toRightOf="@id/ct_check"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_toRightOf="@id/ct_check"
|
||||
android:text="我已同意爱鱼奇使用协议"
|
||||
android:textColor="@color/main_tab_grey"
|
||||
android:textSize="13dp"
|
||||
/>
|
||||
android:textSize="13dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_changesmscode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:text="短信验证码"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="13dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_website"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:textColor="@color/main_tab_grey"
|
||||
android:text="@string/app_website"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="@dimen/login_padding_bottom"
|
||||
android:textSize="14sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
android:text="@string/app_website"
|
||||
android:textColor="@color/main_tab_grey"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_appname"
|
||||
android:layout_above="@+id/tv_website"
|
||||
android:textColor="@color/shoplist_text_galy"
|
||||
android:text="@string/app_name"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:textSize="24sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
/>
|
||||
android:layout_above="@+id/tv_website"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/shoplist_text_galy"
|
||||
android:textSize="24sp" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_test"
|
||||
android:layout_above="@+id/tv_appname"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_width="46dp"
|
||||
android:layout_height="46dp"
|
||||
android:src="@drawable/app_icon_alpha"
|
||||
android:layout_above="@+id/tv_appname"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
android:src="@drawable/app_icon_alpha" />
|
||||
</RelativeLayout>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<string name="listview_nonetwork">ヾ(≧O≦)〃\n啊哦 好像没有网络了\n下拉刷新试试吧!</string>
|
||||
<string name="app_website">www.iFish7.com</string>
|
||||
<string name="voice_code">语音验证码</string>
|
||||
<string name="sms_code">短信验证码</string>
|
||||
<string name="iconName">按钮名称</string>
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue