Skip to content

Commit 4130aa5

Browse files
committed
添加微信登录
1 parent 9084e34 commit 4130aa5

12 files changed

Lines changed: 130 additions & 79 deletions

File tree

app/src/enterprise/java/net/coding/program/user/EnterpriseLoginActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void afterTextChanged(Editable s) {
133133
protected void onCreate(Bundle savedInstanceState) {
134134
super.onCreate(savedInstanceState);
135135

136-
// 调用下,防止收到上次登录账号的通知
136+
// 调用下,防止收到上次登录帐号的通知
137137
XGPushManager.registerPush(this, "*");
138138
}
139139

app/src/enterprise/res/layout/activity_enterprise_guide.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
android:layout_marginLeft="45dp"
153153
android:layout_marginRight="45dp"
154154
android:gravity="center"
155-
android:text="企业账号登录"
155+
android:text="企业帐号登录"
156156
android:textColor="@color/white"
157157
android:textSize="17sp"
158158
app:rv_backgroundColor="@color/font_2"

app/src/main/assets/terms.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ <h3 id="toc_2">2、知识产权声明</h3>
332332

333333
<p>本网站,包括(但不仅限于) 文字,内容,软件,录像,音乐,声音,图形,照片,图表,美术设计,图片,名称,标识,商标和/或服务标志(包括已注册和未注册的),以及其他资料(以下简称网站内容)都受到版权法,商标法和一切知识产权公约的保护。未经扣钉网络、用户或相关权利人书面许可, 任何人不得以任何形式进行使用或创造相关衍生作品。本网站内容包括扣钉网络所有或控制下的内容和第三方所有或控制下,并授权扣钉网络使用的内容。所有代码,文章,讨论等一切构成本网站的元素都可能是受版权保护的作品。您同意遵守所有适用本网站的版权保护法律法规,以及所有本网站包含的补充性的版权说明或限制。本网站的内容均由相应的机构/个人上传、维护。对于本站内容的任何使用请遵守内容所附带的授权协议。如不清楚相应的授权协议请询问上传该内容的机构/个人。</p>
334334

335-
<p>任何在 Coding 上注册的账号上传的内容的版权均归上传者所有,上传者承担所有被上传内容的版权责任。扣钉网络有权在其拥有的网站上,展示上传者上传到本网站公共区域的内容。</p>
335+
<p>任何在 Coding 上注册的帐号上传的内容的版权均归上传者所有,上传者承担所有被上传内容的版权责任。扣钉网络有权在其拥有的网站上,展示上传者上传到本网站公共区域的内容。</p>
336336

337337
<h3 id="toc_3">3、个人信息的保护</h3>
338338

app/src/main/java/net/coding/program/LoginActivity.java

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.text.Editable;
1111
import android.text.TextUtils;
1212
import android.text.TextWatcher;
13+
import android.util.TimingLogger;
1314
import android.view.View;
1415
import android.view.ViewGroup;
1516
import android.view.ViewTreeObserver;
@@ -19,8 +20,6 @@
1920
import android.widget.Toast;
2021

2122
import com.fivehundredpx.android.blur.BlurringView;
22-
import com.google.gson.Gson;
23-
import com.google.gson.JsonObject;
2423
import com.loopj.android.http.AsyncHttpClient;
2524
import com.loopj.android.http.AsyncHttpResponseHandler;
2625
import com.loopj.android.http.RequestParams;
@@ -245,17 +244,13 @@ void imageValify() {
245244
}
246245

247246
@Click
248-
void register() {
249-
if (1 == 1) {
250-
251-
// final boolean isauth = UMShareAPI.get(mContext).isAuthorize(mActivity, list.get(position).mPlatform);
252-
// if (isauth) {
253-
// UMShareAPI.get(mContext).deleteOauth(mActivity, list.get(position).mPlatform, authListener);
254-
// } else {
255-
ThirdPlatformLogin.loginByWeixin(this, umAuthListener);
256-
return;
257-
}
247+
void loginWeixin() {
248+
Global.popSoftkeyboard(this, editName, false);
249+
ThirdPlatformLogin.loginByWeixin(this, umAuthListener);
250+
}
258251

252+
@Click
253+
void register() {
259254
Global.popSoftkeyboard(this, editName, false);
260255
PhoneRegisterActivity_.intent(this)
261256
.startForResult(RESULT_CLOSE);
@@ -535,6 +530,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
535530
@Override
536531
public void onStart(SHARE_MEDIA platform) {
537532
//授权开始的回调
533+
showProgressBar(true);
538534
}
539535

540536
@Override
@@ -559,13 +555,14 @@ public void onComplete(SHARE_MEDIA platform, int action, Map<String, String> dat
559555

560556
@Override
561557
public void onError(SHARE_MEDIA platform, int action, Throwable t) {
562-
Toast.makeText(getApplicationContext(), "请求失败", Toast.LENGTH_SHORT).show();
558+
showProgressBar(false);
559+
Toast.makeText(getApplicationContext(), "登录失败", Toast.LENGTH_SHORT).show();
563560
Logger.d(t);
564561
}
565562

566563
@Override
567564
public void onCancel(SHARE_MEDIA platform, int action) {
568-
// Toast.makeText(getApplicationContext(), "Authorize cancel", Toast.LENGTH_SHORT).show();
565+
showProgressBar(false);
569566
}
570567
};
571568

app/src/main/java/net/coding/program/login/PhoneRegisterActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class PhoneRegisterActivity extends BackActivity {
3434

3535
private static final int RESULT_PICK_COUNTRY = 10;
3636

37-
public static CharSequence REGIST_TIP = Global.createGreenHtml("注册 Coding 账号表示您已同意", "《Coding 服务条款》", "");
37+
public static CharSequence REGIST_TIP = Global.createGreenHtml("注册 Coding 帐号表示您已同意", "《Coding 服务条款》", "");
3838

3939
@ViewById
4040
LoginEditText globalKeyEdit, phoneEdit, passwordEdit, phoneCodeEdit, captchaEdit;

app/src/main/java/net/coding/program/login/auth/AuthListActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,16 +169,16 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
169169
private void showCoverDialog(String uriString) {
170170
final AuthInfo item = new AuthInfo(uriString, mClock);
171171
if (mAuthAdapter.containItem(item)) {
172-
Toast.makeText(this, "这个账号已经添加过了", Toast.LENGTH_SHORT).show();
172+
Toast.makeText(this, "这个帐号已经添加过了", Toast.LENGTH_SHORT).show();
173173
} else if (mAuthAdapter.containItemDiffSecrect(item)) {
174-
showDialog("警告", "存在同名账号,确定覆盖?", new DialogInterface.OnClickListener() {
174+
showDialog("警告", "存在同名帐号,确定覆盖?", new DialogInterface.OnClickListener() {
175175
@Override
176176
public void onClick(DialogInterface dialog, int which) {
177177
addAndSave(item);
178178
}
179179
});
180180
} else {
181-
Toast.makeText(this, "成功添加账号", Toast.LENGTH_SHORT).show();
181+
Toast.makeText(this, "成功添加帐号", Toast.LENGTH_SHORT).show();
182182
addAndSave(item);
183183
}
184184
}

app/src/main/java/net/coding/program/message/NotifyListActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,9 @@ public View getView(int position, View convertView, ViewGroup parent) {
247247
holder.detail.setText(GlobalCommon.changeHyperlinkColor(firstLink, CodingColor.font1));
248248
}
249249
}
250-
} else if (data.target_type.equals("User") && titleString.endsWith("重置了你的账号密码。")) {
250+
} else if (data.target_type.equals("User") && titleString.endsWith("重置了你的帐号密码。")) {
251251
holder.name.setVisibility(View.VISIBLE);
252-
holder.name.setText("账号提醒");
252+
holder.name.setText("帐号提醒");
253253
}
254254

255255
if (position == (mData.size() - 1)) {

app/src/main/java/net/coding/program/setting/SettingFragment.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import net.coding.program.common.model.AccountInfo;
2323
import net.coding.program.project.detail.file.FileSaveHelp;
2424
import net.coding.program.push.CodingPush;
25+
import net.coding.program.thirdplatform.ThirdPlatformLogin;
2526

2627
import org.androidannotations.annotations.AfterViews;
2728
import org.androidannotations.annotations.Background;
@@ -158,7 +159,7 @@ void clearCache() {
158159

159160
@Click
160161
void loginOut() {
161-
showDialog(GlobalData.sUserObject.global_key, "退出当前账号?", (dialog, which) -> {
162+
showDialog(GlobalData.sUserObject.global_key, "退出当前帐号?", (dialog, which) -> {
162163
umengEvent(UmengEvent.E_USER_CENTER, "退登_确定退登");
163164
FragmentActivity activity = getActivity();
164165

@@ -169,6 +170,7 @@ void loginOut() {
169170
}
170171

171172
AccountInfo.loginOut(activity);
173+
ThirdPlatformLogin.loginOut(activity);
172174
startActivity(new Intent(activity, CodingCompat.instance().getGuideActivity()));
173175
EventBus.getDefault().post(new EventMessage(EventMessage.Type.loginOut));
174176
activity.finish();
1.78 KB
Loading

app/src/main/res/layout/activity_login.xml

Lines changed: 76 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
android:layout_gravity="center"
2828
app:blurRadius="8"
2929
app:downsampleFactor="16"
30-
app:overlayColor="#99FFFFFF"/>
30+
app:overlayColor="#99FFFFFF" />
3131

3232
<View
3333
android:layout_width="match_parent"
@@ -110,21 +110,21 @@
110110
app:darkness="true" />
111111

112112
<net.coding.program.common.LoginEditText
113-
android:id="@+id/editPassword"
114-
android:layout_width="match_parent"
115-
android:layout_height="wrap_content"
116-
android:layout_marginTop="12dp"
117-
android:background="@drawable/login_edit"
118-
android:hint="密码"
119-
android:imeOptions="actionUnspecified"
120-
android:inputType="textPassword"
121-
android:maxLines="1"
122-
android:lines="1"
123-
android:textColor="@color/font_white"
124-
android:textColorHint="@color/font_white_hint"
125-
android:textCursorDrawable="@null"
126-
android:textSize="18sp"
127-
app:dark="true"/>
113+
android:id="@+id/editPassword"
114+
android:layout_width="match_parent"
115+
android:layout_height="wrap_content"
116+
android:layout_marginTop="12dp"
117+
android:background="@drawable/login_edit"
118+
android:hint="密码"
119+
android:imeOptions="actionUnspecified"
120+
android:inputType="textPassword"
121+
android:lines="1"
122+
android:maxLines="1"
123+
android:textColor="@color/font_white"
124+
android:textColorHint="@color/font_white_hint"
125+
android:textCursorDrawable="@null"
126+
android:textSize="18sp"
127+
app:dark="true" />
128128

129129
<RelativeLayout
130130
android:id="@+id/captchaLayout"
@@ -134,16 +134,16 @@
134134
android:visibility="gone">
135135

136136
<EditText
137-
android:id="@+id/editValify"
138-
android:layout_width="match_parent"
139-
android:layout_height="wrap_content"
140-
android:background="@drawable/login_edit"
141-
android:hint="验证码"
142-
android:lines="1"
143-
android:textColor="@color/font_white"
144-
android:textColorHint="@color/font_white_hint"
145-
android:textCursorDrawable="@null"
146-
android:textSize="18sp"/>
137+
android:id="@+id/editValify"
138+
android:layout_width="match_parent"
139+
android:layout_height="wrap_content"
140+
android:background="@drawable/login_edit"
141+
android:hint="验证码"
142+
android:lines="1"
143+
android:textColor="@color/font_white"
144+
android:textColorHint="@color/font_white_hint"
145+
android:textCursorDrawable="@null"
146+
android:textSize="18sp" />
147147

148148
<ImageView
149149
android:id="@+id/imageValify"
@@ -174,21 +174,21 @@
174174

175175

176176
<net.coding.program.common.LoginEditText
177-
android:id="@+id/edit2FA"
178-
android:layout_width="match_parent"
179-
android:layout_height="wrap_content"
180-
android:layout_marginTop="12dp"
181-
android:background="@drawable/login_edit"
182-
android:hint="输入动态验证码"
183-
android:imeOptions="actionUnspecified"
184-
android:inputType="number"
185-
android:maxLines="1"
186-
android:lines="1"
187-
android:textColor="@color/font_white"
188-
android:textColorHint="@color/font_white_hint"
189-
android:textCursorDrawable="@null"
190-
android:textSize="18sp"
191-
app:dark="true"/>
177+
android:id="@+id/edit2FA"
178+
android:layout_width="match_parent"
179+
android:layout_height="wrap_content"
180+
android:layout_marginTop="12dp"
181+
android:background="@drawable/login_edit"
182+
android:hint="输入动态验证码"
183+
android:imeOptions="actionUnspecified"
184+
android:inputType="number"
185+
android:lines="1"
186+
android:maxLines="1"
187+
android:textColor="@color/font_white"
188+
android:textColorHint="@color/font_white_hint"
189+
android:textCursorDrawable="@null"
190+
android:textSize="18sp"
191+
app:dark="true" />
192192
</LinearLayout>
193193

194194

@@ -210,34 +210,58 @@
210210

211211

212212
<RelativeLayout
213-
214213
android:layout_width="match_parent"
215214
android:layout_height="0dp"
216215
android:layout_weight="1">
217216

218217
<TextView
219-
android:id="@+id/loginFail"
220-
android:layout_width="100dp"
218+
android:layout_width="wrap_content"
221219
android:layout_height="50dp"
222220
android:layout_alignParentTop="true"
223221
android:layout_centerHorizontal="true"
222+
android:drawableLeft="@drawable/ic_login_wexin"
223+
android:drawablePadding="8dp"
224224
android:gravity="center"
225-
android:text="找回密码"
225+
android:id="@+id/loginWeixin"
226+
android:text="使用微信登录"
226227
android:textColor="@color/font_white"
227228
android:textSize="16sp" />
228229

229-
<TextView
230-
android:id="@+id/register"
231-
android:layout_width="80dp"
230+
<LinearLayout
231+
android:layout_width="match_parent"
232232
android:layout_height="50dp"
233233
android:layout_alignParentBottom="true"
234234
android:layout_centerHorizontal="true"
235+
android:layout_gravity="center_horizontal"
235236
android:layout_marginBottom="21dp"
236-
android:gravity="center"
237-
android:text="去注册"
238-
android:textColor="@color/font_white"
239-
android:textSize="16sp" />
237+
android:gravity="center_horizontal"
238+
android:orientation="horizontal">
239+
240+
<TextView
241+
android:id="@+id/loginFail"
242+
android:layout_width="80dp"
243+
android:layout_height="50dp"
244+
android:gravity="center"
245+
android:text="找回密码"
246+
android:textColor="#CCFFFFFF"
247+
android:textSize="16sp" />
240248

249+
<View
250+
android:layout_width="1dp"
251+
android:layout_height="15dp"
252+
android:layout_gravity="center_vertical"
253+
android:background="#CCFFFFFF" />
254+
255+
<TextView
256+
android:id="@+id/register"
257+
android:layout_width="80dp"
258+
android:layout_height="50dp"
259+
android:gravity="center"
260+
android:text="注册帐号"
261+
android:textColor="#CCFFFFFF"
262+
android:textSize="16sp" />
263+
264+
</LinearLayout>
241265

242266
</RelativeLayout>
243267

0 commit comments

Comments
 (0)