123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package com.edufound.android.xyyf.config;
- import android.app.Activity;
- import android.content.pm.ActivityInfo;
- import android.os.Build;
- import android.util.Log;
- import android.view.Gravity;
- import android.view.View;
- import android.widget.FrameLayout;
- import android.widget.RelativeLayout;
- import com.edufound.android.xyyf.R;
- import com.edufound.android.xyyf.main.MainView;
- import com.mobile.auth.gatewayauth.AuthRegisterXmlConfig;
- import com.mobile.auth.gatewayauth.AuthUIConfig;
- import com.mobile.auth.gatewayauth.PhoneNumberAuthHelper;
- import com.mobile.auth.gatewayauth.ui.AbstractPnsViewDelegate;
- public class DialogLandConfigNoUI extends BaseUIConfig {
- private int mOldScreenOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT;
- MainView mView;
- public DialogLandConfigNoUI(Activity activity, PhoneNumberAuthHelper authHelper, MainView view) {
- super(activity, authHelper, view);
- mView = view;
- }
- @Override
- public void configAuthPage() {
- mAuthHelper.removeAuthRegisterXmlConfig();
- mAuthHelper.removeAuthRegisterViewConfig();
- int authPageOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
- if (Build.VERSION.SDK_INT == 26) {
- mOldScreenOrientation = mActivity.getRequestedOrientation();
- mActivity.setRequestedOrientation(authPageOrientation);
- authPageOrientation = ActivityInfo.SCREEN_ORIENTATION_BEHIND;
- }
- updateScreenSize(authPageOrientation);
- final int dialogWidth = (int) (mScreenWidthDp * 0.9);
- final int dialogHeight = (int) (mScreenHeightDp * 0.4);
- //sdk默认控件的区域是marginTop50dp
- int designHeight = dialogHeight - 60;
- int unit = designHeight / 10;
- int logBtnHeight = (int) (unit * 1.2);
- final int logBtnOffsetY = unit * 3;
- mAuthHelper.addAuthRegisterXmlConfig(new AuthRegisterXmlConfig.Builder()
- .setLayout(R.layout.custom_land_dialog, new AbstractPnsViewDelegate() {
- @Override
- public void onViewCreated(View view) {
- findViewById(R.id.tv_title).setVisibility(View.VISIBLE);
- findViewById(R.id.btn_close).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- mAuthHelper.quitLoginPage();
- }
- });
- int iconTopMargin = AppUtils.dp2px(getContext(), logBtnOffsetY + 130);
- View iconContainer = findViewById(R.id.container_icon);
- RelativeLayout.LayoutParams iconLayout = (RelativeLayout.LayoutParams) iconContainer.getLayoutParams();
- iconLayout.topMargin = iconTopMargin;
- View phoneNumLogin = findViewById(R.id.changePhoneNumLogin);
- // final FrameLayout changePhoneUi = (FrameLayout) findViewById(R.id.changePhoneFrame);
- // phoneNumLogin.setOnClickListener(new View.OnClickListener() {
- // @Override
- // public void onClick(View v) {
- // Log.e("PhoneNumberAuthDemo", "-----------NOUI---切换手机号登录------------");
- // mAuthHelper.quitLoginPage();
- //
- // }
- // });
- // iconLayout.width = AppUtils.dp2px(getContext(), dialogWidth / 2 - 60);
- }
- }).build());
- mAuthHelper.setAuthUIConfig(new AuthUIConfig.Builder()
- .setNavHidden(true)
- .setCheckboxHidden(true)
- .setLogoHidden(true)
- .setSloganHidden(true)
- .setNavReturnHidden(true)
- .setStatusBarHidden(true)
- .setSwitchAccHidden(true)
- .setLogBtnToastHidden(true)
- .setDialogWidth(dialogWidth)
- .setDialogHeight(dialogHeight)
- .setDialogBottom(false)
- .setNumberSize(0)
- .setPrivacyTextSize(0)
- .create());
- }
- @Override
- public void onResume() {
- super.onResume();
- if (mOldScreenOrientation != mActivity.getRequestedOrientation()) {
- mActivity.setRequestedOrientation(mOldScreenOrientation);
- }
- }
- }
|