智能认证界面,左上角返回键偶现点击无效
J荆无命
发布于 5 年前
124智能认证 U-Verify
SDK集成与升级
在智能认证界面,左上角偶现点击返回键缺无效,debug发现onClick事件没执行。
测试方法:打开智能认证页面,再点左上角返回按钮,再打开智能认证页面,再返回。反复操作,5,6次即可复现。

package com.umeng.uiconfig;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Typeface;
import android.util.TypedValue;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.umeng.R;
import com.umeng.umverify.UMVerifyHelper;
import com.umeng.umverify.listener.UMCustomInterface;
import com.umeng.umverify.view.UMAuthRegisterViewConfig;
import com.umeng.umverify.view.UMAuthUIConfig;
import com.umeng.utils.UmengUtils;
public class CustomUIConfig {
public Context mContext;
public UMVerifyHelper mAuthHelper;
public CustomUIConfig(Context context, UMVerifyHelper authHelper) {
this.mContext = context;
this.mAuthHelper = authHelper;
buildUIConfig();
}
public void buildUIConfig() {
mAuthHelper.removeAuthRegisterXmlConfig();
mAuthHelper.removeAuthRegisterViewConfig();
mAuthHelper.addAuthRegistViewConfig("back_btn", new UMAuthRegisterViewConfig.Builder()
.setView(initBackBtn())
.setRootViewId(UMAuthRegisterViewConfig.RootViewId.ROOT_VIEW_ID_BODY)
.setCustomInterface(new UMCustomInterface() {
@Override
public void onClick(Context context) {
//此处未执行(偶现)
mAuthHelper.quitLoginPage();
}
}).build());
mAuthHelper.addAuthRegistViewConfig("title", new UMAuthRegisterViewConfig.Builder()
.setView(initTitle())
.setRootViewId(UMAuthRegisterViewConfig.RootViewId.ROOT_VIEW_ID_BODY)
.build());
mAuthHelper.addAuthRegistViewConfig("title_des", new UMAuthRegisterViewConfig.Builder()
.setView(initTitleDes())
.setRootViewId(UMAuthRegisterViewConfig.RootViewId.ROOT_VIEW_ID_BODY)
.build());
mAuthHelper.setAuthUIConfig(new UMAuthUIConfig.Builder()
.setLogBtnText(mContext.getResources().getString(R.string.one_login))
.setLogBtnBackgroundDrawable(mContext.getResources().getDrawable(R.drawable.login_bg))
.setLogBtnTextColor(Color.WHITE)
.setSwitchAccText(mContext.getResources().getString(R.string.bind_phonenumber_other))
.setLogoHidden(true)
.setNavHidden(false)
.setNavReturnHidden(false)
.setNavColor(Color.WHITE)
.setNavTextColor(Color.WHITE)
.setAppPrivacyColor(Color.GRAY, Color.parseColor("#EE5555"))
.setCheckedImgDrawable(mContext.getResources().getDrawable(R.drawable.umeng_checkbox_checked))
.setUncheckedImgDrawable(mContext.getResources().getDrawable(R.drawable.umeng_checkbox_normal))
.setNumberColor(Color.WHITE)
.setNumberSize(24)
.setNumberColor(0xff000000).create());
}
private ImageView initBackBtn() {
ImageView pImageView = new ImageView(mContext);
pImageView.setImageResource(R.drawable.arrow_back);
pImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
RelativeLayout.LayoutParams pParams = new RelativeLayout.LayoutParams(UmengUtils.dp2px(mContext, 24), UmengUtils.dp2px(mContext, 24));
pParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
pParams.setMargins(UmengUtils.dp2px(mContext, 20.0F), 0, 0, 0);
pImageView.setLayoutParams(pParams);
return pImageView;
}
private TextView initTitle() {
TextView textView = new TextView(mContext);
textView.setText(R.string.bind_phonenumber);
textView.setTextColor(Color.BLACK);
textView.setTypeface(textView.getTypeface(), Typeface.BOLD);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 32);
RelativeLayout.LayoutParams pParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, UmengUtils.dp2px(mContext, 40));
pParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
pParams.setMargins(UmengUtils.dp2px(mContext, 30.0F), UmengUtils.dp2px(mContext, 50), 0, 0);
textView.setLayoutParams(pParams);
return textView;
}
private TextView initTitleDes() {
TextView textView = new TextView(mContext);
textView.setText(R.string.bind_phonenumber_des);
textView.setTextColor(Color.parseColor("#999999"));
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 14);
RelativeLayout.LayoutParams pParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, UmengUtils.dp2px(mContext, 18));
pParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
pParams.setMargins(UmengUtils.dp2px(mContext, 30.0F), UmengUtils.dp2px(mContext, 100), 0, 0);
textView.setLayoutParams(pParams);
return textView;
}
}
调用方式:
/**
* 智能认证SDK调用
*/
public void startVerify(final Activity activity, final OnUMVerifyTokenGetListener onUMVerifyTokenGetListener) {
this.mOnUMVerifyTokenGetListener = onUMVerifyTokenGetListener;
this.mActivity = activity;
mCustomUIConfig = new CustomUIConfig(activity.getApplicationContext(), mUMVerifyHelper);
mUMVerifyHelper.setAuthListener(mUMTokenResultListener);
mUMVerifyHelper.getLoginToken(activity.getApplicationContext(), 5000);
}