詹子聪 il y a 5 ans
Parent
commit
4918b2d2be

+ 1 - 3
app/build.gradle

@@ -134,9 +134,7 @@ dependencies {
     implementation 'com.alibaba:fastjson:1.2.73'
 
     // 下拉刷新,上拉加载更多
-    implementation  'com.scwang.smart:refresh-layout-kernel:2.0.1'
-    //implementation  'com.scwang.smart:refresh-footer-ball:2.0.1'
-    implementation  'com.scwang.smart:refresh-footer-classics:2.0.1'
+    implementation 'q.rorbin:QRefreshLayout:1.2.4'
 }
 repositories {
     mavenCentral()

+ 0 - 16
app/src/main/java/com/miekir/eden/ui/home/coupon/TemplateAdapter.java

@@ -4,7 +4,6 @@ import android.content.Context;
 import android.content.Intent;
 import android.graphics.drawable.Drawable;
 import android.text.TextUtils;
-import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
 
@@ -17,13 +16,9 @@ import com.bumptech.glide.request.transition.Transition;
 import com.chad.library.adapter.base.BaseQuickAdapter;
 import com.chad.library.adapter.base.BaseViewHolder;
 import com.miekir.common.utils.SizeTool;
-import com.miekir.common.utils.ToastTool;
 import com.miekir.eden.BuildConfig;
 import com.miekir.eden.R;
 import com.miekir.eden.base.ItemLongClickListener;
-import com.miekir.eden.manager.EdenManager;
-import com.miekir.eden.tool.StringTool;
-import com.miekir.eden.tool.SystemTool;
 import com.miekir.eden.ui.home.goods.detail.MeizhiDetailActivity;
 
 import java.util.List;
@@ -81,17 +76,6 @@ public class TemplateAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
 
                     }
                 });
-
-        iv_template.setOnLongClickListener(new View.OnLongClickListener() {
-            @Override
-            public boolean onLongClick(View v) {
-                if (EdenManager.getInstance().isKwyPhotoReady()) {
-                    SystemTool.copyText(mContext, realUrl);
-                    ToastTool.showShort(StringTool.getString(R.string.resource_copied));
-                }
-                return false;
-            }
-        });
         iv_template.setOnClickListener(v -> {
             // 跳转查看大图界面
             Intent photoIntent = new Intent(mContext, MeizhiDetailActivity.class);

+ 14 - 0
app/src/main/java/com/miekir/eden/ui/home/goods/detail/MeizhiDetailActivity.java

@@ -11,8 +11,12 @@ import android.view.WindowManager;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.load.engine.DiskCacheStrategy;
 import com.bumptech.glide.request.RequestOptions;
+import com.miekir.common.utils.ToastTool;
 import com.miekir.eden.R;
 import com.miekir.eden.base.SwipeBackActivity;
+import com.miekir.eden.manager.EdenManager;
+import com.miekir.eden.tool.StringTool;
+import com.miekir.eden.tool.SystemTool;
 import com.miekir.eden.widget.SwipeBackLayout;
 
 import uk.co.senab.photoview.PhotoView;
@@ -39,6 +43,16 @@ public class MeizhiDetailActivity extends SwipeBackActivity {
         findViewById(R.id.iv_back).setOnClickListener(v -> onBackPressed());
 
         String url = getIntent().getStringExtra(TAG_URL);
+        pv_meizhi.setOnLongClickListener(new View.OnLongClickListener() {
+            @Override
+            public boolean onLongClick(View v) {
+                if (EdenManager.getInstance().isKwyPhotoReady()) {
+                    SystemTool.copyText(MeizhiDetailActivity.this, url);
+                    ToastTool.showShort(StringTool.getString(R.string.resource_copied));
+                }
+                return false;
+            }
+        });
         if (!TextUtils.isEmpty(url)) {
             Glide.with(this)
                     .load(url)

+ 17 - 20
app/src/main/java/com/miekir/eden/ui/home/video/KwyVideoActivity.java

@@ -3,9 +3,7 @@ package com.miekir.eden.ui.home.video;
 import android.app.Activity;
 import android.os.Bundle;
 import android.text.TextUtils;
-import android.view.View;
 
-import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 
 import com.miekir.common.utils.ToastTool;
@@ -16,9 +14,6 @@ import com.miekir.eden.manager.EdenManager;
 import com.miekir.eden.net.RetrofitHelper;
 import com.miekir.eden.tool.StringTool;
 import com.miekir.eden.tool.SystemTool;
-import com.scwang.smart.refresh.layout.SmartRefreshLayout;
-import com.scwang.smart.refresh.layout.api.RefreshLayout;
-import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener;
 
 import cn.jzvd.JZDataSource;
 import cn.jzvd.Jzvd;
@@ -27,6 +22,8 @@ import io.reactivex.Observer;
 import io.reactivex.android.schedulers.AndroidSchedulers;
 import io.reactivex.disposables.Disposable;
 import io.reactivex.schedulers.Schedulers;
+import q.rorbin.qrefreshlayout.QRefreshLayout;
+import q.rorbin.qrefreshlayout.listener.RefreshHandler;
 
 
 /**
@@ -43,7 +40,7 @@ public class KwyVideoActivity extends Activity {
     private String mVideoUrl;
 
     private JzvdStd js_video;
-    private SmartRefreshLayout srl_video;
+    private QRefreshLayout refresh_video;
     private boolean mIsLoading;
 
     @Override
@@ -75,25 +72,25 @@ public class KwyVideoActivity extends Activity {
         JzvdStd.setCurrentJzvd(VideoPlayer.CURRENT_JZVD);
         js_video.setUp(EdenManager.getInstance().getVideoUrl(), mTitle);
         js_video.startVideo();
-        srl_video = findViewById(R.id.srl_video);
-        srl_video.setEnableRefresh(false);
-        srl_video.setOnLoadMoreListener(new OnLoadMoreListener() {
+        refresh_video = findViewById(R.id.refresh_video);
+
+        refresh_video.setLoadMoreEnable(true);
+        refresh_video.setRefreshHandler(new RefreshHandler() {
+            @Override
+            public void onRefresh(QRefreshLayout refresh) {
+                refresh_video.refreshComplete();
+                SystemTool.copyText(KwyVideoActivity.this, mVideoUrl);
+                ToastTool.showShort(StringTool.getString(R.string.resource_copied));
+            }
+
             @Override
-            public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
+            public void onLoadMore(QRefreshLayout refresh) {
                 if (!mIsLoading) {
                     mIsLoading = true;
                     playNextVideo();
                 }
             }
         });
-        srl_video.setOnLongClickListener(new View.OnLongClickListener() {
-            @Override
-            public boolean onLongClick(View v) {
-                SystemTool.copyText(KwyVideoActivity.this, mVideoUrl);
-                ToastTool.showShort(StringTool.getString(R.string.resource_copied));
-                return false;
-            }
-        });
     }
 
     @Override
@@ -135,7 +132,7 @@ public class KwyVideoActivity extends Activity {
                     @Override
                     public void onNext(BaseKwyBean videoBean) {
                         mIsLoading = false;
-                        srl_video.finishLoadMore();
+                        refresh_video.loadMoreComplete();
                         //JzvdStd.startFullscreenDirectly(this, VideoPlayer.class, result, mTitle);
                         if (videoBean != null && !TextUtils.isEmpty(videoBean.getJson())) {
                             mVideoUrl = videoBean.getJson();
@@ -149,7 +146,7 @@ public class KwyVideoActivity extends Activity {
                     @Override
                     public void onError(Throwable e) {
                         mIsLoading = false;
-                        srl_video.finishLoadMore();
+                        refresh_video.loadMoreComplete();
                         ToastTool.showShort(StringTool.getString(R.string.video_get_failed));
                         e.printStackTrace();
                     }

+ 3 - 7
app/src/main/res/layout/activity_video_play.xml

@@ -1,15 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
-<com.scwang.smart.refresh.layout.SmartRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<q.rorbin.qrefreshlayout.QRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:id="@+id/srl_video">
+    android:id="@+id/refresh_video">
 
     <cn.jzvd.JzvdStd
         android:id="@+id/js_video"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
-
-    <com.scwang.smart.refresh.footer.ClassicsFooter
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content" />
-</com.scwang.smart.refresh.layout.SmartRefreshLayout>
+</q.rorbin.qrefreshlayout.QRefreshLayout>

+ 136 - 132
app/src/main/res/layout/fragment_about.xml

@@ -10,155 +10,159 @@
 
 </ScrollView>-->
 
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:paddingTop="@dimen/margin_default"
-    android:id="@+id/ll_about">
-
+    android:layout_height="match_parent">
     <LinearLayout
-        android:layout_width="wrap_content"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="@dimen/margin_ss"
-        android:gravity="center_vertical"
-        android:orientation="horizontal"
-        android:paddingStart="@dimen/margin_default"
-        android:paddingEnd="@dimen/margin_default">
+        android:orientation="vertical"
+        android:paddingTop="@dimen/margin_default"
+        android:id="@+id/ll_about">
 
-        <ImageView
+        <LinearLayout
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:src="@drawable/ic_launcher"
-            android:tint="@color/black_theme"
-            android:visibility="gone"/>
+            android:layout_marginBottom="@dimen/margin_ss"
+            android:gravity="center_vertical"
+            android:orientation="horizontal"
+            android:paddingStart="@dimen/margin_default"
+            android:paddingEnd="@dimen/margin_default">
+
+            <ImageView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:src="@drawable/ic_launcher"
+                android:tint="@color/black_theme"
+                android:visibility="gone"/>
+
+            <TextView
+                android:id="@+id/tv_title"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/app_name"
+                android:textColor="@color/black_theme"
+                android:textSize="@dimen/text_normal_p"
+                android:textStyle="bold" />
+        </LinearLayout>
+
 
         <TextView
-            android:id="@+id/tv_title"
-            android:layout_width="wrap_content"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:text="@string/app_name"
-            android:textColor="@color/black_theme"
-            android:textSize="@dimen/text_normal_p"
-            android:textStyle="bold" />
-    </LinearLayout>
+            android:paddingStart="@dimen/margin_default"
+            android:paddingEnd="@dimen/margin_default"
+            android:text="@string/about_attention"
+            android:textColor="@color/red_2"
+            android:textSize="@dimen/text_normal"
+            android:layout_marginTop="@dimen/margin_s"/>
 
+        <TextView
+            android:id="@+id/tv_desc"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingStart="@dimen/margin_default"
+            android:paddingEnd="@dimen/margin_default"
+            android:text="@string/about_description"
+            android:textColor="@color/black_droid_text"
+            android:textSize="@dimen/text_normal"
+            android:layout_marginTop="@dimen/margin_s"/>
 
-    <TextView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingStart="@dimen/margin_default"
-        android:paddingEnd="@dimen/margin_default"
-        android:text="@string/about_attention"
-        android:textColor="@color/red_2"
-        android:textSize="@dimen/text_normal"
-        android:layout_marginTop="@dimen/margin_s"/>
-
-    <TextView
-        android:id="@+id/tv_desc"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingStart="@dimen/margin_default"
-        android:paddingEnd="@dimen/margin_default"
-        android:text="@string/about_description"
-        android:textColor="@color/black_droid_text"
-        android:textSize="@dimen/text_normal"
-        android:layout_marginTop="@dimen/margin_s"/>
 
+        <LinearLayout
+            android:id="@+id/ll_email"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal"
+            android:paddingStart="@dimen/margin_default"
+            android:paddingEnd="@dimen/margin_default"
+            android:layout_marginTop="@dimen/margin_s"
+            android:gravity="center_vertical"
+            android:visibility="gone">
+            <TextView
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/about_current_account"
+                android:textColor="@color/black_droid_text"
+                android:textSize="@dimen/text_normal" />
+            <TextView
+                android:id="@+id/tv_email"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textColor="@color/black_droid_text"
+                android:textSize="@dimen/text_normal" />
+        </LinearLayout>
 
-    <LinearLayout
-        android:id="@+id/ll_email"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        android:paddingStart="@dimen/margin_default"
-        android:paddingEnd="@dimen/margin_default"
-        android:layout_marginTop="@dimen/margin_s"
-        android:gravity="center_vertical"
-        android:visibility="gone">
         <TextView
+            android:id="@+id/tv_active"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="@string/about_current_account"
-            android:textColor="@color/black_droid_text"
-            android:textSize="@dimen/text_normal" />
+            android:layout_marginTop="@dimen/margin_default"
+            android:layout_marginStart="@dimen/margin_default"
+            android:layout_marginEnd="@dimen/margin_default"
+            android:text="@string/about_upgrade_now"
+            android:textColor="@color/green_logo"
+            android:textSize="@dimen/text_normal_s"
+            android:textStyle="bold"
+            android:background="?attr/selectableItemBackground"/>
+
         <TextView
-            android:id="@+id/tv_email"
+            android:id="@+id/tv_update"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:textColor="@color/black_droid_text"
-            android:textSize="@dimen/text_normal" />
-    </LinearLayout>
+            android:layout_marginStart="@dimen/margin_default"
+            android:layout_marginEnd="@dimen/margin_default"
+            android:layout_marginTop="@dimen/margin_default"
+            android:text="@string/about_check_new"
+            android:textColor="@color/green_logo"
+            android:textSize="@dimen/text_normal_s"
+            android:textStyle="bold"
+            android:background="?attr/selectableItemBackground"/>
 
-    <TextView
-        android:id="@+id/tv_active"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="@dimen/margin_default"
-        android:layout_marginStart="@dimen/margin_default"
-        android:layout_marginEnd="@dimen/margin_default"
-        android:text="@string/about_upgrade_now"
-        android:textColor="@color/green_logo"
-        android:textSize="@dimen/text_normal_s"
-        android:textStyle="bold"
-        android:background="?attr/selectableItemBackground"/>
-
-    <TextView
-        android:id="@+id/tv_update"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="@dimen/margin_default"
-        android:layout_marginEnd="@dimen/margin_default"
-        android:layout_marginTop="@dimen/margin_default"
-        android:text="@string/about_check_new"
-        android:textColor="@color/green_logo"
-        android:textSize="@dimen/text_normal_s"
-        android:textStyle="bold"
-        android:background="?attr/selectableItemBackground"/>
-
-    <TextView
-        android:id="@+id/tv_feedback"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginStart="@dimen/margin_default"
-        android:layout_marginEnd="@dimen/margin_default"
-        android:layout_marginTop="@dimen/margin_default"
-        android:text="@string/about_feedback"
-        android:textColor="@color/green_logo"
-        android:textSize="@dimen/text_normal_s"
-        android:textStyle="bold"
-        android:background="?attr/selectableItemBackground"/>
-
-
-    <TextView
-        android:id="@+id/tv_more"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="@dimen/margin_default"
-        android:layout_marginStart="@dimen/margin_default"
-        android:layout_marginEnd="@dimen/margin_default"
-        android:textColor="@color/green_logo"
-        android:textSize="@dimen/text_normal_s"
-        android:textStyle="bold"
-        android:background="?attr/selectableItemBackground"
-        android:visibility="gone"/>
-
-    <Space
-        android:layout_width="wrap_content"
-        android:layout_height="0dp"
-        android:layout_weight="1"/>
-
-    <!--<include layout="@layout/view_divider" />-->
-
-    <!--隐私政策、用户协议-->
-    <TextView
-        android:id="@+id/tv_protocol"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/height_sliding_tab"
-        android:background="?attr/selectableItemBackground"
-        android:gravity="center"
-        android:text="@string/about_privacy"
-        android:textColor="@color/black_title"
-        android:textSize="@dimen/text_s"
-        android:visibility="gone"/>
-</LinearLayout>
+        <TextView
+            android:id="@+id/tv_feedback"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/margin_default"
+            android:layout_marginEnd="@dimen/margin_default"
+            android:layout_marginTop="@dimen/margin_default"
+            android:text="@string/about_feedback"
+            android:textColor="@color/green_logo"
+            android:textSize="@dimen/text_normal_s"
+            android:textStyle="bold"
+            android:background="?attr/selectableItemBackground"/>
+
+
+        <TextView
+            android:id="@+id/tv_more"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="@dimen/margin_default"
+            android:layout_marginStart="@dimen/margin_default"
+            android:layout_marginEnd="@dimen/margin_default"
+            android:textColor="@color/green_logo"
+            android:textSize="@dimen/text_normal_s"
+            android:textStyle="bold"
+            android:background="?attr/selectableItemBackground"
+            android:visibility="gone"/>
+
+        <Space
+            android:layout_width="wrap_content"
+            android:layout_height="0dp"
+            android:layout_weight="1"/>
+
+        <!--<include layout="@layout/view_divider" />-->
+
+        <!--隐私政策、用户协议-->
+        <TextView
+            android:id="@+id/tv_protocol"
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/height_sliding_tab"
+            android:background="?attr/selectableItemBackground"
+            android:gravity="center"
+            android:text="@string/about_privacy"
+            android:textColor="@color/black_title"
+            android:textSize="@dimen/text_s"
+            android:visibility="gone"/>
+    </LinearLayout>
+</androidx.core.widget.NestedScrollView>

+ 54 - 49
app/src/main/res/layout/fragment_video.xml

@@ -1,62 +1,67 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+
+<androidx.core.widget.NestedScrollView 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.cardview.widget.CardView
-        android:id="@+id/cv_video"
+    android:layout_height="match_parent">
+    <FrameLayout
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:clickable="true"
-        android:focusable="true"
-        android:foreground="?android:attr/selectableItemBackground"
-        app:cardCornerRadius="@dimen/height_indicator"
-        app:cardElevation="@dimen/margin_sss"
-        app:cardUseCompatPadding="true">
-        <!--app:cardUseCompatPadding="true"解决角边阴影问题-->
+        android:layout_height="match_parent">
 
-        <LinearLayout
+        <androidx.cardview.widget.CardView
+            android:id="@+id/cv_video"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:gravity="center_vertical"
-            android:orientation="vertical"
-            android:padding="@dimen/margin_s">
-            <!--标题-->
-            <TextView
-                android:id="@+id/tv_title"
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginBottom="@dimen/margin_s"
-                android:ellipsize="end"
-                android:maxLines="3"
-                android:textColor="@color/black_theme"
-                android:textStyle="bold"
-                android:textSize="@dimen/text_sub_title"
-                android:text="@string/video_beauty"
-                android:visibility="gone"/>
+            android:clickable="true"
+            android:focusable="true"
+            android:foreground="?android:attr/selectableItemBackground"
+            app:cardCornerRadius="@dimen/height_indicator"
+            app:cardElevation="@dimen/margin_sss"
+            app:cardUseCompatPadding="true">
+            <!--app:cardUseCompatPadding="true"解决角边阴影问题-->
 
-            <FrameLayout
-                android:id="@+id/fl_video_play"
+            <LinearLayout
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content">
+                android:layout_height="wrap_content"
+                android:gravity="center_vertical"
+                android:orientation="vertical"
+                android:padding="@dimen/margin_s">
+                <!--标题-->
+                <TextView
+                    android:id="@+id/tv_title"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:layout_marginBottom="@dimen/margin_s"
+                    android:ellipsize="end"
+                    android:maxLines="3"
+                    android:textColor="@color/black_theme"
+                    android:textStyle="bold"
+                    android:textSize="@dimen/text_sub_title"
+                    android:text="@string/video_beauty"
+                    android:visibility="gone"/>
 
-                <com.makeramen.roundedimageview.RoundedImageView
-                    android:id="@+id/aciv_goods"
+                <FrameLayout
+                    android:id="@+id/fl_video_play"
                     android:layout_width="match_parent"
-                    android:layout_height="@dimen/height_cover"
-                    android:scaleType="centerCrop"
-                    android:src="@mipmap/poster_video"
-                    app:riv_corner_radius="4dp" />
+                    android:layout_height="wrap_content">
 
-                <ImageView
-                    android:id="@+id/iv_video_play"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:layout_gravity="center"
-                    android:src="@mipmap/video_play" />
-            </FrameLayout>
+                    <com.makeramen.roundedimageview.RoundedImageView
+                        android:id="@+id/aciv_goods"
+                        android:layout_width="match_parent"
+                        android:layout_height="@dimen/height_cover"
+                        android:scaleType="centerCrop"
+                        android:src="@mipmap/poster_video"
+                        app:riv_corner_radius="4dp" />
+
+                    <ImageView
+                        android:id="@+id/iv_video_play"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_gravity="center"
+                        android:src="@mipmap/video_play" />
+                </FrameLayout>
 
-        </LinearLayout>
-    </androidx.cardview.widget.CardView>
-</FrameLayout>
+            </LinearLayout>
+        </androidx.cardview.widget.CardView>
+    </FrameLayout>
+</androidx.core.widget.NestedScrollView>