浏览代码

增加老师端首页认证弹窗逻辑

Pq 2 年之前
父节点
当前提交
c513da8649

+ 2 - 0
BaseLibrary/src/main/java/com/cooleshow/base/common/WebConstants.java

@@ -77,6 +77,8 @@ public abstract class WebConstants {
 
     //达人认证
     public static final String TEACHER_CERT = getBaseUrlH5() + "/#/teacherCert";
+    //学位认证,教资认证等
+    public static final String TEACHER_OTHER_CERT = getBaseUrlH5() + "/#/teacherCertUpdate";
     //老师收入
     public static final String TEACHER_INCOME = getBaseUrlH5() + "/#/incomeConsus";
     //音乐人认证

+ 5 - 0
BaseLibrary/src/main/res/drawable/shape_2dc7aa_ring_border_1dp.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="oval">
+    <stroke android:width="1dp" android:color="@color/color_2dc7aa"/>
+</shape>

+ 4 - 0
BaseLibrary/src/main/res/values/colors.xml

@@ -113,6 +113,8 @@
     <color name="color_3591ce">#3591ce</color>
     <color name="color_7f6b3f">#7F6B3F</color>
     <color name="color_eaeaea">#EAEAEA</color>
+    <color name="color_ff0000">#ff0000</color>
+    <color name="color_2455e2">#2455e2</color>
 
     <color name="color_25292e">#25292E</color>
     <color name="color_F8F8F8">#F8F8F8</color>
@@ -134,5 +136,7 @@
     <color name="color_01c1b5">#01C1B5</color>
     <color name="color_FF806F">#FF806F</color>
     <color name="color_25333333">#25333333</color>
+    <color name="color_eeeeee">#EEEEEE</color>
+    <color name="color_4877ff">#4877FF</color>
 
 </resources>

+ 20 - 4
teacher/src/main/java/com/cooleshow/teacher/ui/main/NewHomeFragment.java

@@ -38,6 +38,7 @@ import com.cooleshow.teacher.presenter.main.HomePresenter;
 import com.cooleshow.teacher.widgets.HomeHotAlbumItemDecoration;
 import com.cooleshow.teacher.widgets.HomeHotMusicSheetItemDecoration;
 import com.cooleshow.teacher.widgets.dialog.BadgeDesDialog;
+import com.cooleshow.teacher.widgets.dialog.HomeCertTipDialog;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.youth.banner.adapter.BannerImageAdapter;
 import com.youth.banner.config.BannerConfig;
@@ -72,6 +73,8 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
     private HomeHotMusicSheetAdapter mHomeHotMusicSheetAdapter;
     private ArrayList<HomeMenuBean.BannerBean> mBannerList = new ArrayList<>();
     private BannerImageAdapter mBannerImageAdapter;
+    private String teacherCertTag = "";
+    private String entryStatus = "";//达人认证状态
 
     @Override
     protected void initView(View rootView) {
@@ -404,6 +407,7 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         }
     }
 
+
     public void getTeacherInfoSuccess(TeacherUserInfo teacherUserInfo) {
         if (teacherUserInfo == null) {
             return;
@@ -431,17 +435,19 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
             mViewBinding.ratingBar.setVisibility(View.VISIBLE);
         }
         //徽章
+        this.teacherCertTag = teacherUserInfo.tag;
         handleBadgeUI(teacherUserInfo.tag);
         //VIP
         mViewBinding.ivVip.setImageResource(teacherUserInfo.isVip == 0 ? com.cooleshow.base.R.drawable.icon_vip_enable : com.cooleshow.base.R.drawable.icon_vip_able);
         //入驻状态
+        this.entryStatus = teacherUserInfo.entryStatus;
         if (TextUtils.equals(teacherUserInfo.entryStatus, TeacherInfoConstants.ENTRY_STATUS_DOING)) {
             //入驻审核中
             mViewBinding.ivCert.setClickable(true);
             mViewBinding.ivCert.setImageResource(R.drawable.icon_home_entry_doing);
         } else if (TextUtils.equals(teacherUserInfo.entryStatus, TeacherInfoConstants.ENTRY_STATUS_PASS)) {
             //入驻审核通过
-            mViewBinding.ivCert.setClickable(false);
+            mViewBinding.ivCert.setClickable(true);
             mViewBinding.ivCert.setImageResource(R.drawable.icon_home_cert_complete);
         } else {
             //未通过或者未申请
@@ -522,9 +528,13 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         }
         if (id == R.id.iv_cert) {
             //达人认证
-            ARouter.getInstance().build(RouterPath.WebCenter.ACTIVITY_HTML)
-                    .withString(WebConstants.WEB_URL, WebConstants.TEACHER_CERT)
-                    .navigation();
+            if (TextUtils.equals(entryStatus, TeacherInfoConstants.ENTRY_STATUS_PASS)) {
+                showCertTipDialog();
+            } else {
+                ARouter.getInstance().build(RouterPath.WebCenter.ACTIVITY_HTML)
+                        .withString(WebConstants.WEB_URL, WebConstants.TEACHER_CERT)
+                        .navigation();
+            }
             return;
         }
         if (id == R.id.bg_announcement || id == R.id.bg_announcement2) {
@@ -554,6 +564,12 @@ public class NewHomeFragment extends BaseMVPFragment<FragmentNewHomeLayoutBindin
         }
     }
 
+    private void showCertTipDialog() {
+        HomeCertTipDialog homeCertTipDialog = new HomeCertTipDialog(getContext());
+        homeCertTipDialog.show();
+        homeCertTipDialog.setData(teacherCertTag);
+    }
+
     private void showBadgeDialog() {
         BadgeDesDialog badgeDesDialog = new BadgeDesDialog(getContext());
         badgeDesDialog.show();

+ 102 - 0
teacher/src/main/java/com/cooleshow/teacher/widgets/dialog/HomeCertTipDialog.java

@@ -0,0 +1,102 @@
+package com.cooleshow.teacher.widgets.dialog;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.ProgressBar;
+import android.widget.TextView;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.cooleshow.base.common.WebConstants;
+import com.cooleshow.base.router.RouterPath;
+import com.cooleshow.teacher.R;
+
+import androidx.annotation.NonNull;
+import androidx.constraintlayout.widget.ConstraintLayout;
+import androidx.constraintlayout.widget.ConstraintSet;
+
+/**
+ * Author by pq, Date on 2022/8/24.
+ */
+public class HomeCertTipDialog extends Dialog {
+    public static final String DEGREE = "DEGREE";//学历认证
+    public static final String TEACHER = "TEACHER";//教资认证
+    private ProgressBar mProgress;
+    private ConstraintLayout mCsContent;
+    private ImageView mIvEducationCertStatus;
+    private TextView mTvEducationCertStatus;
+    private ImageView mIvTeachersCertStatus;
+    private TextView mTvTeachersCertStatus;
+    private TextView mTvProgress;
+
+    public HomeCertTipDialog(@NonNull Context context) {
+        super(context, com.cooleshow.base.R.style.BaseDialog);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.dialog_home_cert_tip_layout);
+        mProgress = findViewById(R.id.progress);
+        mCsContent = findViewById(R.id.cs_content);
+        mIvEducationCertStatus = findViewById(R.id.iv_education_cert_status);
+        mTvEducationCertStatus = findViewById(R.id.tv_education_cert_status);
+        mIvTeachersCertStatus = findViewById(R.id.iv_teachers_cert_status);
+        mTvTeachersCertStatus = findViewById(R.id.tv_teachers_cert_status);
+        mTvProgress = findViewById(R.id.tv_progress);
+        findViewById(R.id.iv_close).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                dismiss();
+            }
+        });
+
+        findViewById(R.id.tv_go_cert).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                ARouter.getInstance().build(RouterPath.WebCenter.ACTIVITY_HTML)
+                        .withString(WebConstants.WEB_URL, WebConstants.TEACHER_OTHER_CERT)
+                        .navigation();
+            }
+        });
+    }
+
+    public void setData(String tag) {
+        int certNum = 0;
+        if (tag.contains(DEGREE)) {
+            certNum++;
+            mIvEducationCertStatus.setImageResource(R.drawable.icon_check_select);
+            mTvEducationCertStatus.setText("已认证");
+            mTvEducationCertStatus.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_999999));
+        } else {
+            mIvEducationCertStatus.setImageResource(com.cooleshow.base.R.drawable.shape_2dc7aa_ring_border_1dp);
+            mTvEducationCertStatus.setText("未认证");
+            mTvEducationCertStatus.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_ff0000));
+        }
+        if (tag.contains(TEACHER)) {
+            certNum++;
+            mIvTeachersCertStatus.setImageResource(R.drawable.icon_check_select);
+            mTvTeachersCertStatus.setText("已认证");
+            mTvTeachersCertStatus.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_999999));
+        } else {
+            mIvTeachersCertStatus.setImageResource(com.cooleshow.base.R.drawable.shape_2dc7aa_ring_border_1dp);
+            mTvTeachersCertStatus.setText("未认证");
+            mTvTeachersCertStatus.setTextColor(getContext().getResources().getColor(com.cooleshow.base.R.color.color_ff0000));
+        }
+        setProgress(certNum == 0 ? 80 : certNum == 2 ? 100 : 90);
+    }
+
+    private void setProgress(int progress) {
+        if (mProgress != null) {
+            float value = progress / 100f;
+            mProgress.setProgress(progress);
+            mTvProgress.setText(progress + "%");
+            ConstraintSet set = new ConstraintSet();
+            set.clone(mCsContent);
+            set.setHorizontalBias(R.id.view_help, value);
+            set.applyTo(mCsContent);
+        }
+    }
+}

二进制
teacher/src/main/res/drawable-xhdpi/bg_home_cert_dialog_header.png


二进制
teacher/src/main/res/drawable-xxhdpi/bg_home_cert_dialog_header.png


+ 19 - 0
teacher/src/main/res/drawable/shape_home_cert_progress_drawable.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:id="@android:id/background">
+        <shape>
+            <corners android:radius="4dip" />
+            <solid android:color="@color/color_eeeeee"/>
+
+        </shape>
+    </item>
+    <item android:id="@android:id/progress">
+        <clip>
+            <shape>
+                <corners android:radius="4dip" />
+                <solid android:color="@color/color_4877ff"/>
+            </shape>
+        </clip>
+    </item>
+</layer-list>

+ 200 - 0
teacher/src/main/res/layout/dialog_home_cert_tip_layout.xml

@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:id="@+id/cs_content"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="25dp"
+        android:background="@drawable/bg_white_10dp"
+        android:paddingBottom="20dp"
+        app:layout_constraintTop_toTopOf="parent">
+
+        <ImageView
+            android:id="@+id/iv_name_cert_status"
+            android:layout_width="16dp"
+            android:layout_height="16dp"
+            android:layout_marginTop="96dp"
+            android:src="@drawable/icon_check_select"
+            app:layout_constraintHorizontal_chainStyle="packed"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toLeftOf="@+id/tv_name_cert_title"
+            app:layout_constraintTop_toTopOf="parent" />
+
+        <TextView
+            android:id="@+id/tv_name_cert_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="17dp"
+            android:includeFontPadding="false"
+            android:text="实名认证"
+            android:textColor="@color/color_333333"
+            android:textSize="@dimen/sp_16"
+            android:textStyle="bold"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_name_cert_status"
+            app:layout_constraintLeft_toRightOf="@+id/iv_name_cert_status"
+            app:layout_constraintRight_toLeftOf="@+id/tv_name_cert_status"
+            app:layout_constraintTop_toTopOf="@+id/iv_name_cert_status" />
+
+        <TextView
+            android:id="@+id/tv_name_cert_status"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="48dp"
+            android:text="已认证"
+            android:textColor="@color/color_999999"
+            android:textSize="@dimen/sp_12"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_name_cert_status"
+            app:layout_constraintLeft_toRightOf="@+id/tv_name_cert_title"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toTopOf="@+id/iv_name_cert_status" />
+
+
+        <ImageView
+            android:id="@+id/iv_education_cert_status"
+            android:layout_width="16dp"
+            android:layout_height="16dp"
+            android:layout_marginTop="32dp"
+            android:src="@drawable/shape_2dc7aa_ring_border_1dp"
+            app:layout_constraintHorizontal_chainStyle="packed"
+            app:layout_constraintLeft_toLeftOf="@+id/iv_name_cert_status"
+            app:layout_constraintTop_toBottomOf="@+id/iv_name_cert_status" />
+
+        <TextView
+            android:id="@+id/tv_education_cert_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:includeFontPadding="false"
+            android:text="学历认证"
+            android:textColor="@color/color_333333"
+            android:textSize="@dimen/sp_16"
+            android:textStyle="bold"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_education_cert_status"
+            app:layout_constraintLeft_toLeftOf="@+id/tv_name_cert_title"
+            app:layout_constraintRight_toRightOf="@+id/tv_name_cert_title"
+            app:layout_constraintTop_toTopOf="@+id/iv_education_cert_status" />
+
+        <TextView
+            android:id="@+id/tv_education_cert_status"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="未认证"
+            android:textColor="@color/color_ff0000"
+            android:textSize="@dimen/sp_12"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_education_cert_status"
+            app:layout_constraintLeft_toLeftOf="@+id/tv_name_cert_status"
+            app:layout_constraintRight_toRightOf="@+id/tv_name_cert_status"
+            app:layout_constraintTop_toTopOf="@+id/iv_education_cert_status" />
+
+        <ImageView
+            android:id="@+id/iv_teachers_cert_status"
+            android:layout_width="16dp"
+            android:layout_height="16dp"
+            android:layout_marginTop="32dp"
+            android:src="@drawable/shape_2dc7aa_ring_border_1dp"
+            app:layout_constraintHorizontal_chainStyle="packed"
+            app:layout_constraintLeft_toLeftOf="@+id/iv_education_cert_status"
+            app:layout_constraintTop_toBottomOf="@+id/iv_education_cert_status" />
+
+        <TextView
+            android:id="@+id/tv_teachers_cert_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:includeFontPadding="false"
+            android:text="师资认证"
+            android:textColor="@color/color_333333"
+            android:textSize="@dimen/sp_16"
+            android:textStyle="bold"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_teachers_cert_status"
+            app:layout_constraintLeft_toLeftOf="@+id/tv_name_cert_title"
+            app:layout_constraintRight_toRightOf="@+id/tv_name_cert_title"
+            app:layout_constraintTop_toTopOf="@+id/iv_teachers_cert_status" />
+
+        <TextView
+            android:id="@+id/tv_teachers_cert_status"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="未认证"
+            android:textColor="@color/color_ff0000"
+            android:textSize="@dimen/sp_12"
+            app:layout_constraintBottom_toBottomOf="@+id/iv_teachers_cert_status"
+            app:layout_constraintLeft_toLeftOf="@+id/tv_name_cert_status"
+            app:layout_constraintRight_toRightOf="@+id/tv_name_cert_status"
+            app:layout_constraintTop_toTopOf="@+id/iv_teachers_cert_status" />
+
+
+        <TextView
+            android:id="@+id/tv_progress"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="8dp"
+            android:background="@drawable/shape_2dc7aa_24dp"
+            android:paddingStart="5dp"
+            android:paddingEnd="5dp"
+            android:text="80%"
+            android:textColor="@color/color_2455e2"
+            app:layout_constraintBottom_toTopOf="@+id/progress"
+            app:layout_constraintLeft_toLeftOf="@+id/view_help"
+            app:layout_constraintRight_toRightOf="@+id/view_help" />
+
+        <View
+            android:id="@+id/view_help"
+            android:layout_width="1px"
+            android:layout_height="1px"
+            app:layout_constraintBottom_toTopOf="@+id/progress"
+            app:layout_constraintHorizontal_bias="0.8"
+            app:layout_constraintLeft_toLeftOf="@+id/progress"
+            app:layout_constraintRight_toRightOf="@+id/progress" />
+
+        <ProgressBar
+            android:id="@+id/progress"
+            style="@style/Widget.AppCompat.ProgressBar.Horizontal"
+            android:layout_width="match_parent"
+            android:layout_height="8dp"
+            android:layout_marginStart="34dp"
+            android:layout_marginTop="46dp"
+            android:layout_marginEnd="34dp"
+            android:max="100"
+            android:progress="80"
+            android:progressDrawable="@drawable/shape_home_cert_progress_drawable"
+            app:layout_constraintTop_toBottomOf="@+id/iv_teachers_cert_status" />
+
+        <TextView
+            android:id="@+id/tv_go_cert"
+            android:layout_width="190dp"
+            android:layout_height="42dp"
+            android:layout_marginTop="26dp"
+            android:background="@drawable/shape_2dc7aa_24dp"
+            android:gravity="center"
+            android:text="去认证"
+            android:textColor="@color/white"
+            android:textSize="@dimen/sp_16"
+            app:layout_constraintLeft_toLeftOf="parent"
+            app:layout_constraintRight_toRightOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/progress" />
+
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+    <ImageView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:src="@drawable/bg_home_cert_dialog_header"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <ImageView
+        android:id="@+id/iv_close"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="18dp"
+        android:src="@drawable/icon_close_dialog_white"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toBottomOf="@+id/cs_content" />
+
+</androidx.constraintlayout.widget.ConstraintLayout>