TestActivity.java
7.28 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
package com.cnlive.strike.moduleuser;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import com.cnlive.strike.moudle.user.model.UserConst;
import com.cnlive.strike.moudle.user.ui.activity.FirstLoginActivity;
import com.cnlive.strike.moudle.user.ui.activity.LoginActivity;
import com.cnlive.strike.moudle.user.ui.activity.MainTestActivity;
import com.cnlive.strike.moudle.user.ui.activity.PersonalDataActivity;
import com.cnlive.strike.user.auth.UserService;
public class TestActivity extends Activity {
private int eventType;
private boolean isHasOtherUserInfo = false;
private String TAG = "TestActivity";
/************MainActivity 所需要的数据***********/
private String type;
private Uri uri;
private boolean clickAd;
private String sharetype;
private String classifyTagMsg;
/************LoginActivity 所需要的数据***********/
private String tagMsg;
/************修改用户头像 所需要的数据***********/
private String faceUrl;
/************修改用户昵称 所需要的数据***********/
private String nickName;
/************CoinRainAction 所需要的数据***********/
private String taskId;
private String contentId;
private String addtype;
private Boolean isDouyin;
@Override
protected void onCreate(@Nullable @android.support.annotation.Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (null != getIntent().getExtras()) {
eventType = getIntent().getExtras().getInt("eventType");
initAction(eventType);
}
}
private void initAction(int eventType) {
switch (eventType) {
//是新用户
case UserConst.IS_NEW_USER://是新用户
Log.e(TAG, "是新用户");
//TODO 必须设置用户头像
//OpenInstall用户注册统计
// OpenInstall.reportRegister();
//友盟账号登录统计,暂时只有平台登录,后续对接三方登录
// MobclickAgent.onProfileSignIn("CNLive", user.getUid());
isHasOtherUserInfo = getIntent().getExtras().getBoolean("isHasOtherUserInfo");
//判断是否有其他平台数据
if (isHasOtherUserInfo) {
type = getIntent().getExtras().getString("type");
uri = (Uri) getIntent().getExtras().get("uri");
clickAd = getIntent().getExtras().getBoolean(LoginActivity.TAG_CLICK_AD);
sharetype = getIntent().getExtras().getString("sharetype");
classifyTagMsg = getIntent().getExtras().getString("classifyTagMsg");
//直接显示主视图
Intent intent = new Intent(this, MainTestActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("type", type);
intent.putExtra("uri", uri);
intent.putExtra(LoginActivity.TAG_CLICK_AD, clickAd);
intent.putExtra("sharetype", sharetype);
if (!TextUtils.isEmpty(classifyTagMsg)) {
intent.putExtra("classifyTagMsg", classifyTagMsg);
}
startActivity(intent);
} else {
tagMsg = getIntent().getExtras().getString("tagMsg");
clickAd = getIntent().getExtras().getBoolean(LoginActivity.TAG_CLICK_AD);
//没有第三方数据,跳转到设置用户信息的界面
Intent intent = new Intent(this, FirstLoginActivity.class);
intent.putExtra(LoginActivity.TAG_MSG, TextUtils.isEmpty(tagMsg) ? "" : tagMsg);
intent.putExtra(LoginActivity.TAG_CLICK_AD, clickAd);
startActivity(intent);
}
Log.e(TAG, "initAction: ");
finish();
break;
case UserConst.IS_NOT_NEW_USER://不是新用户
//todo
//友盟账号登录统计,暂时只有平台登录,后续对接三方登录
// MobclickAgent.onProfileSignIn("CNLive", user.getUid());
type = getIntent().getExtras().getString("type");
uri = (Uri) getIntent().getExtras().get("uri");
clickAd = getIntent().getExtras().getBoolean(LoginActivity.TAG_CLICK_AD);
sharetype = getIntent().getExtras().getString("sharetype");
classifyTagMsg = getIntent().getExtras().getString("classifyTagMsg");
//直接显示主视图
// Intent intent = new Intent(this, MainTestActivity.class);
// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.putExtra("type", type);
// intent.putExtra("uri", uri);
// intent.putExtra(LoginActivity.TAG_CLICK_AD, clickAd);
// intent.putExtra("sharetype", sharetype);
// if (!TextUtils.isEmpty(classifyTagMsg)) {
// intent.putExtra("classifyTagMsg", classifyTagMsg);
// }
// startActivity(intent);
PersonalDataActivity.startActivity(this);
Log.e(TAG, "不是新用户");
finish();
break;
case UserConst.MODIFY_USER_IMAGE://修改用户头像
Log.e(TAG, "修改用户头像");
faceUrl = getIntent().getExtras().getString("faceUrl");
//todo
// LoginManager.modifyUserImage(UserService.getUid(this), faceUrl);
finish();
break;
case UserConst.USER_INVALID://用户失效
Log.e(TAG, "用户失效");
//todo
// UserOfflineUtil.userInvalid(context);
finish();
case UserConst.MODIFY_USER_NAME://修改用户名称
//todo
Log.e(TAG, "修改用户名称");
nickName = getIntent().getExtras().getString("nickName");
// LoginManager.modifyUserName( UserService.getUid(context), nickName);
finish();
break;
case UserConst.COIN_RAIN_ACTION://下金币
Log.e(TAG, "下金币");
//todo
taskId = getIntent().getExtras().getString("taskId");
contentId = getIntent().getExtras().getString("contentId");
addtype = getIntent().getExtras().getString("addtype");
isDouyin = getIntent().getExtras().getBoolean("isDouyin");
if (TextUtils.isEmpty(taskId)) {
taskId = "";
}
if (TextUtils.isEmpty(contentId)) {
contentId = "";
}
if (TextUtils.isEmpty(addtype)) {
addtype = "";
}
//CoinRainAction.code(activity, UserService.getUid(activity), taskId,contentId, addtype,isDouyin);
break;
}
}
}