Browse Source

增加下拉刷新动画

Pq 2 years ago
parent
commit
85b25bd0a7
39 changed files with 300 additions and 151 deletions
  1. 154 0
      BaseLibrary/src/main/java/com/cooleshow/base/widgets/CustomRefreshHeader.java
  2. 12 0
      BaseLibrary/src/main/res/layout/view_custom_refresh_header_layout.xml
  3. 1 3
      rong_im/common_im_ui/src/main/res/layout/activity_notice.xml
  4. 1 3
      rong_im/common_im_ui/src/main/res/layout/activity_select_score_chat.xml
  5. 0 4
      rong_im/common_im_ui/src/main/res/layout/fragment_contact_list_layout.xml
  6. 1 3
      rong_im/common_im_ui/src/main/res/layout/fragment_contact_room_list.xml
  7. 0 0
      student/src/main/assets/lottie/refresh_anim.json
  8. 27 1
      student/src/main/java/com/cooleshow/student/App.java
  9. 1 3
      student/src/main/res/layout/activity_message_box.xml
  10. 49 52
      student/src/main/res/layout/fragment_course_table_layout.xml
  11. 1 3
      student/src/main/res/layout/fragment_home_layout.xml
  12. 1 3
      student/src/main/res/layout/fragment_homework.xml
  13. 1 3
      student/src/main/res/layout/fragment_live_course_layout.xml
  14. 1 3
      student/src/main/res/layout/fragment_piano_room_course_layout.xml
  15. 1 3
      student/src/main/res/layout/fragment_practice_course_layout.xml
  16. 1 3
      student/src/main/res/layout/fragment_video_course_layout.xml
  17. 0 0
      teacher/src/main/assets/lottie/refresh_anim.json
  18. 27 1
      teacher/src/main/java/com/cooleshow/teacher/App.java
  19. 1 3
      teacher/src/main/res/layout/activity_frozen_amount_layout.xml
  20. 1 3
      teacher/src/main/res/layout/activity_message_box.xml
  21. 1 3
      teacher/src/main/res/layout/activity_mine_income.xml
  22. 1 3
      teacher/src/main/res/layout/activity_pending_amount_layout.xml
  23. 1 3
      teacher/src/main/res/layout/activity_received_comment_layout.xml
  24. 1 3
      teacher/src/main/res/layout/activity_withdrawal_record.xml
  25. 1 3
      teacher/src/main/res/layout/fragment_course_comment_no_reply_layout.xml
  26. 1 3
      teacher/src/main/res/layout/fragment_course_table_layout.xml
  27. 1 3
      teacher/src/main/res/layout/fragment_homework.xml
  28. 1 3
      teacher/src/main/res/layout/fragment_live_course_layout.xml
  29. 1 3
      teacher/src/main/res/layout/fragment_live_course_page_layout.xml
  30. 1 3
      teacher/src/main/res/layout/fragment_live_list_on_layout.xml
  31. 1 3
      teacher/src/main/res/layout/fragment_mine_live_course.xml
  32. 1 3
      teacher/src/main/res/layout/fragment_mine_score.xml
  33. 1 3
      teacher/src/main/res/layout/fragment_mine_video_course.xml
  34. 1 3
      teacher/src/main/res/layout/fragment_piano_room_course_layout.xml
  35. 1 3
      teacher/src/main/res/layout/fragment_sheet_music_page_layout.xml
  36. 1 3
      teacher/src/main/res/layout/fragment_sparring_course_layout.xml
  37. 1 3
      teacher/src/main/res/layout/fragment_sparring_course_page_layout.xml
  38. 1 3
      teacher/src/main/res/layout/fragment_video_course_layout.xml
  39. 1 3
      teacher/src/main/res/layout/fragment_video_course_page_layout.xml

+ 154 - 0
BaseLibrary/src/main/java/com/cooleshow/base/widgets/CustomRefreshHeader.java

@@ -0,0 +1,154 @@
+package com.cooleshow.base.widgets;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.FrameLayout;
+
+import com.airbnb.lottie.LottieAnimationView;
+import com.cooleshow.base.R;
+import com.cooleshow.base.utils.LogUtils;
+import com.scwang.smart.refresh.layout.api.RefreshHeader;
+import com.scwang.smart.refresh.layout.api.RefreshKernel;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.constant.RefreshState;
+import com.scwang.smart.refresh.layout.constant.SpinnerStyle;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+/**
+ * Author by pq, Date on 2022/7/29.
+ */
+public class CustomRefreshHeader extends FrameLayout implements RefreshHeader {
+
+    private LottieAnimationView mViewAnim;
+
+    public CustomRefreshHeader(@NonNull Context context) {
+        this(context, null);
+    }
+
+    public CustomRefreshHeader(@NonNull Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, -1);
+    }
+
+    public CustomRefreshHeader(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        init();
+    }
+
+    private void init() {
+        LayoutInflater.from(getContext()).inflate(R.layout.view_custom_refresh_header_layout, this);
+        mViewAnim = findViewById(R.id.view_anim);
+        mViewAnim.setAnimation("lottie/refresh_anim.json");
+        mViewAnim.loop(true);
+        mViewAnim.setVisibility(View.GONE);
+    }
+
+    @NonNull
+    @Override
+    public View getView() {
+        return this;
+    }
+
+    @NonNull
+    @Override
+    public SpinnerStyle getSpinnerStyle() {
+        return SpinnerStyle.Translate;
+    }
+
+    @Override
+    public void setPrimaryColors(int... colors) {
+
+    }
+
+    @Override
+    public void onInitialized(@NonNull RefreshKernel kernel, int height, int maxDragHeight) {
+
+    }
+
+    @Override
+    public void onMoving(boolean isDragging, float percent, int offset, int height, int maxDragHeight) {
+        LogUtils.i("pq", "onMoving isDragging:" + isDragging + "\npercent:" + percent + "\noffset:" + offset
+                + "\nheight:" + height + "\nmaxDragHeight:" + maxDragHeight);
+    }
+
+    @Override
+    public void onReleased(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) {
+        LogUtils.i("pq", "onReleased height:" + height + "\nmaxDragHeight:" + maxDragHeight);
+    }
+
+    @Override
+    public void onStartAnimator(@NonNull RefreshLayout refreshLayout, int height, int maxDragHeight) {
+
+    }
+
+    @Override
+    public int onFinish(@NonNull RefreshLayout refreshLayout, boolean success) {
+        if (mViewAnim != null) {
+            mViewAnim.cancelAnimation();
+            mViewAnim.clearAnimation();
+        }
+        LogUtils.i("pq", "onFinish");
+        return 500;//延迟500毫秒之后再弹回;
+    }
+
+    @Override
+    public void onHorizontalDrag(float percentX, int offsetX, int offsetMax) {
+
+    }
+
+    @Override
+    public boolean isSupportHorizontalDrag() {
+        return false;
+    }
+
+    @Override
+    public void onStateChanged(@NonNull RefreshLayout refreshLayout, @NonNull RefreshState oldState, @NonNull RefreshState newState) {
+        switch (newState) {
+            case None:
+                LogUtils.i("pq", "None");
+                mViewAnim.setFrame(0);
+                mViewAnim.setProgress(0);
+                break;
+            case PullDownToRefresh:
+                LogUtils.i("pq", "PullDownToRefresh");
+                playAnim();
+                mViewAnim.setVisibility(View.VISIBLE);
+                break;
+            case PullDownCanceled:
+                if (mViewAnim != null) {
+                    clearAnim();
+                }
+                LogUtils.i("pq", "PullDownCanceled");
+                break;
+            case ReleaseToRefresh:
+                LogUtils.i("pq", "ReleaseToRefresh");
+                mViewAnim.setVisibility(View.VISIBLE);
+                break;
+            case Refreshing:
+                LogUtils.i("pq", "Refreshing");
+                break;
+            case RefreshReleased:
+                LogUtils.i("pq", "RefreshReleased");
+                break;
+            case RefreshFinish:
+                LogUtils.i("pq", "RefreshFinish");
+                break;
+        }
+    }
+
+    private void playAnim() {
+        if (mViewAnim != null) {
+            mViewAnim.playAnimation();
+        }
+    }
+
+    private void clearAnim() {
+        if (mViewAnim != null) {
+            mViewAnim.cancelAnimation();
+            mViewAnim.clearAnimation();
+        }
+    }
+}

+ 12 - 0
BaseLibrary/src/main/res/layout/view_custom_refresh_header_layout.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+    <com.airbnb.lottie.LottieAnimationView
+        android:id="@+id/view_anim"
+        android:layout_width="match_parent"
+        android:layout_height="55dp"
+        app:lottie_autoPlay="true"
+        app:lottie_loop="false" />
+</FrameLayout>

+ 1 - 3
rong_im/common_im_ui/src/main/res/layout/activity_notice.xml

@@ -17,9 +17,7 @@
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toBottomOf="@id/toolbar_include">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
 
         <androidx.recyclerview.widget.RecyclerView

+ 1 - 3
rong_im/common_im_ui/src/main/res/layout/activity_select_score_chat.xml

@@ -60,9 +60,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 0 - 4
rong_im/common_im_ui/src/main/res/layout/fragment_contact_list_layout.xml

@@ -63,10 +63,6 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toBottomOf="@id/view_search_bg">
-
-    <com.scwang.smart.refresh.header.ClassicsHeader
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content" />
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/recyclerView"
         android:layout_width="match_parent"

+ 1 - 3
rong_im/common_im_ui/src/main/res/layout/fragment_contact_room_list.xml

@@ -67,9 +67,7 @@
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toBottomOf="@id/view_search_bg">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

File diff suppressed because it is too large
+ 0 - 0
student/src/main/assets/lottie/refresh_anim.json


+ 27 - 1
student/src/main/java/com/cooleshow/student/App.java

@@ -15,6 +15,7 @@ import com.cooleshow.base.data.net.CommonParamsHelper;
 import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.ProcessUtils;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.base.widgets.CustomRefreshHeader;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.daya.live_teaching.im.IMManager;
 import com.rong.io.live.message.RCChatJoinRoomMessage;
@@ -36,6 +37,13 @@ import com.rong.io.live.message.RCUserSeatApplyMessage;
 import com.rong.io.live.message.RCUserSeatResponseMessage;
 import com.rong.io.live.message.RCUserSeatsCtrlMessage;
 import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
+import com.scwang.smart.refresh.footer.ClassicsFooter;
+import com.scwang.smart.refresh.layout.SmartRefreshLayout;
+import com.scwang.smart.refresh.layout.api.RefreshFooter;
+import com.scwang.smart.refresh.layout.api.RefreshHeader;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator;
+import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator;
 import com.tencent.bugly.crashreport.CrashReport;
 import com.rong.io.live.helper.LiveRTCEngineInitHelper;
 import com.umeng.commonsdk.UMConfigure;
@@ -64,7 +72,25 @@ import io.rong.push.pushconfig.PushConfig;
  */
 public class App extends BaseApplication {
     public static boolean isRefresh = false;
-
+    //static 代码段可以防止内存泄露
+    static {
+        //设置全局的Header构建器
+        SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
+            @Override
+            public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
+                layout.setPrimaryColorsId(com.cooleshow.base.R.color.colorPrimary, android.R.color.white);//全局设置主题颜色
+                return new CustomRefreshHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header
+            }
+        });
+        //设置全局的Footer构建器
+        SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
+            @Override
+            public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
+                //指定为经典Footer,默认是 BallPulseFooter
+                return new ClassicsFooter(context).setDrawableSize(20);
+            }
+        });
+    }
     @Override
     public void onCreate() {
         super.onCreate();

+ 1 - 3
student/src/main/res/layout/activity_message_box.xml

@@ -185,9 +185,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-            <com.scwang.smart.refresh.header.ClassicsHeader
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+
 
             <androidx.recyclerview.widget.RecyclerView
                 android:id="@+id/recyclerView"

+ 49 - 52
student/src/main/res/layout/fragment_course_table_layout.xml

@@ -2,16 +2,16 @@
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
-    android:background="@color/color_f6f8f9"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:background="@color/color_f6f8f9">
 
     <View
         android:id="@+id/view_status_bar"
         android:layout_width="match_parent"
         android:layout_height="20dp"
-        app:layout_constrainedHeight="true"
         android:background="@color/white"
+        app:layout_constrainedHeight="true"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 
@@ -51,6 +51,7 @@
         android:layout_height="1dp"
         android:background="@color/divide_color2"
         app:layout_constraintTop_toBottomOf="@+id/view_tool_bar_bg" />
+
     <com.scwang.smart.refresh.layout.SmartRefreshLayout
         android:id="@+id/refreshLayout"
         android:layout_width="match_parent"
@@ -58,57 +59,53 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/view_tool_bar_bg">
 
-    <com.scwang.smart.refresh.header.ClassicsHeader
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content" />
-    <com.haibin.calendarview.CalendarLayout
-        android:id="@+id/calendarLayout"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical"
-        app:calendar_content_view_id="@+id/recyclerView"
-        app:default_status="shrink"
-       >
-
-        <com.cooleshow.base.widgets.MyCalenderView
-            android:id="@+id/calendarView"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:paddingStart="@dimen/dp_8"
-            android:paddingEnd="@dimen/dp_8"
-            app:calendar_height="@dimen/dp_56"
-            app:current_day_text_color="@color/colorPrimary"
-            app:current_month_text_color="@color/black_444"
-            app:day_text_size="@dimen/dp_15"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent"
-            app:max_year="2100"
-            app:min_year="1990"
-            app:month_view="com.cooleshow.student.widgets.SimpleMonthView"
-            app:month_view_show_mode="mode_only_current"
-            app:scheme_text_color="@color/color_ff6363"
-            app:scheme_theme_color="@color/white"
-            app:select_mode="single_mode"
-            app:selected_text_color="@color/white"
-            app:selected_theme_color="@color/colorPrimary"
-            app:week_background="@color/white"
-            app:week_bar_height="@dimen/dp_45"
-            app:week_line_background="@color/color_f2f2f2"
-            app:week_start_with="sun"
-            app:week_text_color="@color/gray_777"
-            app:week_text_size="@dimen/dp_16"
-            app:week_view="com.cooleshow.student.widgets.SimpleWeekView"
-            app:year_view_background="@color/white" />
-
-        <androidx.recyclerview.widget.RecyclerView
-            android:id="@+id/recyclerView"
+        <com.haibin.calendarview.CalendarLayout
+            android:id="@+id/calendarLayout"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
-            android:overScrollMode="never"
-            android:background="@color/color_f6f8f9"
-            android:scrollbars="none" />
-    </com.haibin.calendarview.CalendarLayout>
+            android:orientation="vertical"
+            app:calendar_content_view_id="@+id/recyclerView"
+            app:default_status="shrink">
+
+            <com.cooleshow.base.widgets.MyCalenderView
+                android:id="@+id/calendarView"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:paddingStart="@dimen/dp_8"
+                android:paddingEnd="@dimen/dp_8"
+                app:calendar_height="@dimen/dp_56"
+                app:current_day_text_color="@color/colorPrimary"
+                app:current_month_text_color="@color/black_444"
+                app:day_text_size="@dimen/dp_15"
+                app:layout_constraintEnd_toEndOf="parent"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"
+                app:max_year="2100"
+                app:min_year="1990"
+                app:month_view="com.cooleshow.student.widgets.SimpleMonthView"
+                app:month_view_show_mode="mode_only_current"
+                app:scheme_text_color="@color/color_ff6363"
+                app:scheme_theme_color="@color/white"
+                app:select_mode="single_mode"
+                app:selected_text_color="@color/white"
+                app:selected_theme_color="@color/colorPrimary"
+                app:week_background="@color/white"
+                app:week_bar_height="@dimen/dp_45"
+                app:week_line_background="@color/color_f2f2f2"
+                app:week_start_with="sun"
+                app:week_text_color="@color/gray_777"
+                app:week_text_size="@dimen/dp_16"
+                app:week_view="com.cooleshow.student.widgets.SimpleWeekView"
+                app:year_view_background="@color/white" />
+
+            <androidx.recyclerview.widget.RecyclerView
+                android:id="@+id/recyclerView"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="@color/color_f6f8f9"
+                android:overScrollMode="never"
+                android:scrollbars="none" />
+        </com.haibin.calendarview.CalendarLayout>
     </com.scwang.smart.refresh.layout.SmartRefreshLayout>
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 1 - 3
student/src/main/res/layout/fragment_home_layout.xml

@@ -64,9 +64,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.core.widget.NestedScrollView
             android:id="@+id/scroll_layout"

+ 1 - 3
student/src/main/res/layout/fragment_homework.xml

@@ -21,9 +21,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
student/src/main/res/layout/fragment_live_course_layout.xml

@@ -72,9 +72,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_time">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
student/src/main/res/layout/fragment_piano_room_course_layout.xml

@@ -72,9 +72,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_time">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
student/src/main/res/layout/fragment_practice_course_layout.xml

@@ -72,9 +72,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_time">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
student/src/main/res/layout/fragment_video_course_layout.xml

@@ -34,9 +34,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_subject">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

File diff suppressed because it is too large
+ 0 - 0
teacher/src/main/assets/lottie/refresh_anim.json


+ 27 - 1
teacher/src/main/java/com/cooleshow/teacher/App.java

@@ -12,6 +12,7 @@ import com.cooleshow.base.data.net.CommonParamsHelper;
 import com.cooleshow.base.utils.FileUtils;
 import com.cooleshow.base.utils.ProcessUtils;
 import com.cooleshow.base.utils.Utils;
+import com.cooleshow.base.widgets.CustomRefreshHeader;
 import com.cooleshow.usercenter.helper.UserHelper;
 import com.daya.live_teaching.im.IMManager;
 import com.rong.io.live.message.RCChatJoinRoomMessage;
@@ -27,6 +28,13 @@ import com.rong.io.live.message.RCUserSeatApplyMessage;
 import com.rong.io.live.message.RCUserSeatResponseMessage;
 import com.rong.io.live.message.RCUserSeatsCtrlMessage;
 import com.rong.io.live.message.RCUserSyncAddLikeCountMessage;
+import com.scwang.smart.refresh.footer.ClassicsFooter;
+import com.scwang.smart.refresh.layout.SmartRefreshLayout;
+import com.scwang.smart.refresh.layout.api.RefreshFooter;
+import com.scwang.smart.refresh.layout.api.RefreshHeader;
+import com.scwang.smart.refresh.layout.api.RefreshLayout;
+import com.scwang.smart.refresh.layout.listener.DefaultRefreshFooterCreator;
+import com.scwang.smart.refresh.layout.listener.DefaultRefreshHeaderCreator;
 import com.tencent.bugly.crashreport.CrashReport;
 import com.rong.io.live.helper.LiveRTCEngineInitHelper;
 import com.umeng.commonsdk.UMConfigure;
@@ -56,7 +64,25 @@ import io.rong.push.pushconfig.PushConfig;
  */
 public class App extends BaseApplication {
     public static boolean isRefresh = false;
-    private String mRegistrationId;
+    //static 代码段可以防止内存泄露
+    static {
+        //设置全局的Header构建器
+        SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() {
+            @Override
+            public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) {
+                layout.setPrimaryColorsId(com.cooleshow.base.R.color.colorPrimary, android.R.color.white);//全局设置主题颜色
+                return new CustomRefreshHeader(context);//.setTimeFormat(new DynamicTimeFormat("更新于 %s"));//指定为经典Header,默认是 贝塞尔雷达Header
+            }
+        });
+        //设置全局的Footer构建器
+        SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() {
+            @Override
+            public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) {
+                //指定为经典Footer,默认是 BallPulseFooter
+                return new ClassicsFooter(context).setDrawableSize(20);
+            }
+        });
+    }
 
     @Override
     public void onCreate() {

+ 1 - 3
teacher/src/main/res/layout/activity_frozen_amount_layout.xml

@@ -101,9 +101,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/rl_filter">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/activity_message_box.xml

@@ -185,9 +185,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-            <com.scwang.smart.refresh.header.ClassicsHeader
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+
 
             <androidx.recyclerview.widget.RecyclerView
                 android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/activity_mine_income.xml

@@ -191,9 +191,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/activity_pending_amount_layout.xml

@@ -101,9 +101,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/rl_filter">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/activity_received_comment_layout.xml

@@ -87,9 +87,7 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/view_search_bg">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/activity_withdrawal_record.xml

@@ -43,9 +43,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_course_comment_no_reply_layout.xml

@@ -83,9 +83,7 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/view_search_bg">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_course_table_layout.xml

@@ -59,9 +59,7 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/view_tool_bar_bg">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <com.haibin.calendarview.CalendarLayout
             android:id="@+id/calendarLayout"

+ 1 - 3
teacher/src/main/res/layout/fragment_homework.xml

@@ -22,9 +22,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_live_course_layout.xml

@@ -72,9 +72,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_time">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_live_course_page_layout.xml

@@ -46,9 +46,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-            <com.scwang.smart.refresh.header.ClassicsHeader
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+
 
             <androidx.recyclerview.widget.RecyclerView
                 android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_live_list_on_layout.xml

@@ -9,9 +9,7 @@
         android:layout_width="match_parent"
         android:layout_height="match_parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_mine_live_course.xml

@@ -12,9 +12,7 @@
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintTop_toTopOf="parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_mine_score.xml

@@ -48,9 +48,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-            <com.scwang.smart.refresh.header.ClassicsHeader
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+
 
             <androidx.recyclerview.widget.RecyclerView
                 android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_mine_video_course.xml

@@ -12,9 +12,7 @@
         app:layout_constraintTop_toTopOf="parent"
         app:layout_constraintLeft_toLeftOf="parent">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_piano_room_course_layout.xml

@@ -72,9 +72,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_time">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_sheet_music_page_layout.xml

@@ -56,9 +56,7 @@
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/view_upload_bg">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_sparring_course_layout.xml

@@ -72,9 +72,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_time">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_sparring_course_page_layout.xml

@@ -68,9 +68,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-            <com.scwang.smart.refresh.header.ClassicsHeader
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+
 
             <androidx.recyclerview.widget.RecyclerView
                 android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_video_course_layout.xml

@@ -36,9 +36,7 @@
         app:layout_constraintRight_toRightOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/tv_subject">
 
-        <com.scwang.smart.refresh.header.ClassicsHeader
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+
 
         <androidx.recyclerview.widget.RecyclerView
             android:id="@+id/recyclerView"

+ 1 - 3
teacher/src/main/res/layout/fragment_video_course_page_layout.xml

@@ -49,9 +49,7 @@
             android:layout_width="match_parent"
             android:layout_height="match_parent">
 
-            <com.scwang.smart.refresh.header.ClassicsHeader
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+
 
             <androidx.recyclerview.widget.RecyclerView
                 android:layout_marginStart="7dp"

Some files were not shown because too many files changed in this diff