| package com.doumee.lib_coremodel.view; | 
|   | 
| import android.content.Context; | 
| import android.util.AttributeSet; | 
| import android.view.Gravity; | 
| import android.widget.TextView; | 
|   | 
| import androidx.annotation.NonNull; | 
|   | 
| import com.scwang.smart.refresh.layout.api.RefreshFooter; | 
| import com.scwang.smart.refresh.layout.api.RefreshLayout; | 
| import com.scwang.smart.refresh.layout.simple.SimpleComponent; | 
| import com.doumee.lib_coremodel.util.RxTimerUtil; | 
|   | 
| public class MyRefreshFooter extends SimpleComponent implements RefreshFooter { | 
|     private TextView textView; | 
|     private RxTimerUtil rxTimerUtil; | 
|   | 
|     public MyRefreshFooter(Context context) { | 
|         this(context,null); | 
|     } | 
|   | 
|     public MyRefreshFooter(Context context, AttributeSet attrs) { | 
|         this(context, attrs, 0); | 
|     } | 
|   | 
|     public MyRefreshFooter(Context context, AttributeSet attrs, int defStyleAttr) { | 
|         super(context, attrs, defStyleAttr); | 
|         initView(context); | 
|     } | 
|   | 
|     private void initView(Context context){ | 
|         textView=new TextView(context); | 
|         textView.setTextColor(0xFF666666); | 
|         textView.setText("加载中..."); | 
|         addView(textView); | 
|         setGravity(Gravity.CENTER); | 
|     } | 
|   | 
|     @Override | 
|     public int onFinish(@NonNull RefreshLayout refreshLayout, boolean success) { | 
|         if(rxTimerUtil==null){ | 
|             rxTimerUtil = new RxTimerUtil(); | 
|         } | 
|         rxTimerUtil.timer(200, new RxTimerUtil.IRxNext() { | 
|             @Override | 
|             public void doNext(long number) { | 
|                 textView.setVisibility(GONE); | 
|             } | 
|         }); | 
|   | 
|         return 200; | 
|     } | 
|   | 
|     @Override | 
|     public void onStartAnimator(@NonNull RefreshLayout layout, int height, int maxDragHeight) { | 
|        textView.setVisibility(VISIBLE); | 
|     } | 
|   | 
|     @Override | 
|     protected void onDetachedFromWindow() { | 
|         super.onDetachedFromWindow(); | 
|         if(rxTimerUtil!=null) { | 
|             rxTimerUtil.cancel(); | 
|         } | 
|     } | 
| } |