Skip to content

Commit 5de002c

Browse files
committed
fix: 优化错误个验错误提示,优化布局,不产生抖动
1 parent 57a9d6f commit 5de002c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

android/src/main/java/com/geyan/activity/ELoginActivity.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public class ELoginActivity extends AppCompatActivity {
3737
public static final String LOGO_INFO = "com.reactnativegeyan.eloginactivity.logo";
3838
public static final String PRIVACY_INFO = "com.reactnativegeyan.eloginactivity.privacy";
3939
private static final String TAG = ELoginActivity.class.getSimpleName();
40-
private boolean isBack = false;
4140
private CheckBox mCheckbox;
4241
private ProgressDialog dialog;
4342
@Override
@@ -47,13 +46,12 @@ public void onCreate(Bundle saveInstanceState) {
4746
ViewUtil.setStatusBarLightMode(true, this);
4847
setContentView(R.layout.activity_elogin);
4948
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
50-
toolbar.setNavigationOnClickListener((v) -> { onBackPressed(); isBack = true; });
49+
toolbar.setNavigationOnClickListener((v) -> { onBackPressed(); });
5150
ImageView imageView = (ImageView) findViewById(R.id.logo_imageview);
5251
String logo = getIntent().getStringExtra(LOGO_INFO);
5352
Glide.with(this).load(logo).into(imageView);
5453
elogin();
5554
}
56-
5755
private void elogin() {
5856
TextView numberTv = findViewById(R.id.number_textview);
5957
TextView sloganTv = findViewById(R.id.slogan_textview);
@@ -108,9 +106,14 @@ public void onSuccess(GYResponse gyResponse) {
108106

109107
@Override
110108
public void onFailed(GYResponse gyResponse) {
111-
// 路由返回时不弹出框
112-
if (!isBack) {
113-
showToast("一键登录失败:" + gyResponse.getMsg());
109+
try {
110+
JSONObject jsonObject = new JSONObject(gyResponse.getMsg());
111+
int errorCode = jsonObject.getInt("errorCode");
112+
if (errorCode != -20301) {
113+
showToast("一键登录失败:" + gyResponse.getMsg());
114+
}
115+
} catch(Exception e) {
116+
e.printStackTrace();
114117
}
115118
hideDialog();
116119
finish();

android/src/main/res/layout/activity_elogin.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
android:layout_width="268dp"
4747
android:layout_height="wrap_content"
4848
android:text="@string/btn_text"
49-
android:layout_centerInParent="true"
5049
android:layout_centerHorizontal="true"
50+
android:layout_below="@id/slogan_textview"
51+
android:layout_marginTop="100dp"
5152
android:background="@drawable/login_btn_normal"
5253
android:textColor="#FFFFFFFF"
5354
android:textSize="15sp"

0 commit comments

Comments
 (0)