LoginActivity.java
3.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.cnlive.libs;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.cnlive.libs.user.model.CNUserBuilder;
/**
* 用户登录
*/
public class LoginActivity extends BaseActivity implements View.OnClickListener {
private EditText userName, userPassword;
private Button login;
private TextView register, quickLogin, other, thirdParytLogin;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user);
initView();
}
public void initView() {
userName = (EditText) this.findViewById(R.id.user_name);
userPassword = (EditText) this.findViewById(R.id.password);
login = (Button) findViewById(R.id.login);
login.setOnClickListener(this);
register = (TextView) findViewById(R.id.register_textView);
register.setOnClickListener(this);
quickLogin = (TextView) findViewById(R.id.quick_login_textView);
quickLogin.setOnClickListener(this);
other = (TextView) findViewById(R.id.other_textView);
other.setOnClickListener(this);
thirdParytLogin = (TextView) findViewById(R.id.third_party_login);
thirdParytLogin.setOnClickListener(this);
}
@Override
public void onClick(View view) {
Intent intent;
switch (view.getId()) {
case R.id.quick_login_textView:
intent = new Intent(this, QuickLoginActivity.class);
startActivity(intent);
break;
case R.id.register_textView:
intent = new Intent(this, RegisterActivity.class);
startActivity(intent);
break;
case R.id.other_textView:
intent = new Intent(this, OtherActivity.class);
startActivity(intent);
break;
case R.id.login:
//用户名&密码登录
cnUserBuilder.setUserName(String.valueOf(userName.getText()));//用户名
cnUserBuilder.setPwd(String.valueOf(userPassword.getText()));//密码
// cnUserBuilder.setFrmId("frmId");//渠道ID
cnLiveUser.login();
break;
case R.id.third_party_login:
//第三方登陆
cnUserBuilder.setThirdPartyPlat(1);// 第三方平台编号 [platform : 1:sina weibo 2:qq weibo 3:weixin 4:renren
cnUserBuilder.setThirdPartyId("id");//第三方用户ID
cnUserBuilder.setNickName("nickname");//用户昵称?重复
// cnUserBuilder.setGender("n");//性别,m:男、f:女、n:未知
// cnUserBuilder.setLocation("location");//用户所在地 非必传
// cnUserBuilder.setFaceUrl("faceUrl");//头像
// cnUserBuilder.setFrmId("frmId");//渠道ID
cnLiveUser.thirdPartyLogin();
break;
}
}
}