詹子聪 5 lat temu
rodzic
commit
11990d47ff

+ 18 - 1
app/src/main/java/com/itant/shibei/ui/home/coupon/TemplateAdapter.java

@@ -42,8 +42,11 @@ public class TemplateAdapter extends BaseQuickAdapter<CouponBean, BaseViewHolder
     @Override
     protected void convert(@NonNull BaseViewHolder holder, CouponBean couponBean) {
         ImageView iv_template = holder.getView(R.id.iv_template);
+        // 解决图片错乱
+        iv_template.setTag(R.id.aciv_goods, couponBean.coverUrl);
         if (couponBean.isCoverUrlLocal) {
             int resourceId = Integer.parseInt(couponBean.coverUrl);
+            iv_template.setScaleType(ImageView.ScaleType.CENTER_CROP);
             iv_template.setImageResource(resourceId);
             //Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(), resourceId);
             // 圆角
@@ -66,7 +69,21 @@ public class TemplateAdapter extends BaseQuickAdapter<CouponBean, BaseViewHolder
                         @Override
                         public void onResourceReady(Drawable resource, Transition<? super Drawable> transition) {
                             //iv_template.setScaleType(ImageView.ScaleType.CENTER_CROP);
-                            iv_template.setImageDrawable(resource);
+                            //iv_template.setImageDrawable(resource);
+
+                            String coverUrl = null;
+                            try {
+                                coverUrl = (String) iv_template.getTag(R.id.aciv_goods);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                            if (TextUtils.isEmpty(coverUrl) || !TextUtils.equals(coverUrl, couponBean.coverUrl)) {
+                                iv_template.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
+                                iv_template.setImageResource(R.mipmap.logo_gray);
+                            } else {
+                                iv_template.setScaleType(ImageView.ScaleType.CENTER_CROP);
+                                iv_template.setImageDrawable(resource);
+                            }
                         }
                     });
         }

+ 3 - 4
app/src/main/java/com/itant/shibei/ui/home/coupon/TemplateFragment.java

@@ -15,7 +15,6 @@ import com.itant.shibei.base.ITopActionListener;
 import com.itant.shibei.tool.DataTool;
 import com.itant.shibei.ui.function.FunctionFragment;
 import com.itant.shibei.ui.mine.coupon.AddCouponActivity;
-import com.itant.shibei.widget.DividerItemDecoration;
 import com.itant.shibei.widget.bottomlistener.OnRcvScrollListener;
 import com.miekir.common.utils.ToastTool;
 import com.miekir.mvp.presenter.InjectPresenter;
@@ -68,9 +67,9 @@ public class TemplateFragment extends BaseMVPFragment implements ITemplateView<C
         LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
         rv_template.setLayoutManager(layoutManager);
 
-        int dividerWidth = (int) getResources().getDimension(R.dimen.padding_full_width);
-        DividerItemDecoration decoration = new DividerItemDecoration(dividerWidth);
-        rv_template.addItemDecoration(decoration);
+        //int dividerWidth = (int) getResources().getDimension(R.dimen.padding_full_width);
+        //DividerItemDecoration decoration = new DividerItemDecoration(dividerWidth);
+        //rv_template.addItemDecoration(decoration);
         mAdapter = new TemplateAdapter(getActivity(), mCouponBeanList);
         mAdapter.setCouponLongClickListener(this::showAdminDialog);
         rv_template.setAdapter(mAdapter);

+ 1 - 1
app/src/main/res/drawable/shape_gray_stroke_solid.xml

@@ -2,5 +2,5 @@
 <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle">
     <solid android:color="@color/gray_divider_light" />
-    <stroke android:color="@color/black_theme" android:width="@dimen/width_stroke" />
+    <stroke android:color="@color/black" android:width="@dimen/width_stroke" />
 </shape>

+ 2 - 2
app/src/main/res/layout/fragment_about.xml

@@ -29,7 +29,7 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:src="@drawable/ic_launcher"
-            android:tint="@color/black_text_comfortable" />
+            android:tint="@color/black_theme" />
 
         <TextView
             android:id="@+id/tv_title"
@@ -37,7 +37,7 @@
             android:layout_height="wrap_content"
             android:layout_marginStart="@dimen/margin_ss"
             android:text="拾贝"
-            android:textColor="@color/black_text_comfortable"
+            android:textColor="@color/black_theme"
             android:textSize="@dimen/text_normal_p"
             android:textStyle="bold" />
     </LinearLayout>

+ 5 - 5
app/src/main/res/layout/fragment_tool.xml

@@ -41,7 +41,7 @@
                 android:layout_height="wrap_content"
                 android:text="电脑装机模板"
                 android:textSize="@dimen/text_normal_p"
-                android:textColor="@color/black_text_comfortable"
+                android:textColor="@color/black_theme"
                 android:textStyle="bold"/>
 
             <TextView
@@ -78,7 +78,7 @@
                 android:layout_height="wrap_content"
                 android:text="搞笑表情包"
                 android:textSize="@dimen/text_normal_p"
-                android:textColor="@color/black_text_comfortable"
+                android:textColor="@color/black_theme"
                 android:textStyle="bold"/>
 
             <TextView
@@ -115,7 +115,7 @@
                 android:layout_height="wrap_content"
                 android:text="GetJson微服务"
                 android:textSize="@dimen/text_normal_p"
-                android:textColor="@color/black_text_comfortable"
+                android:textColor="@color/black_theme"
                 android:textStyle="bold"/>
 
             <TextView
@@ -152,7 +152,7 @@
                 android:layout_height="wrap_content"
                 android:text="天气API"
                 android:textSize="@dimen/text_normal_p"
-                android:textColor="@color/black_text_comfortable"
+                android:textColor="@color/black_theme"
                 android:textStyle="bold"/>
 
             <TextView
@@ -189,7 +189,7 @@
                 android:layout_height="wrap_content"
                 android:text="黄历API"
                 android:textSize="@dimen/text_normal_p"
-                android:textColor="@color/black_text_comfortable"
+                android:textColor="@color/black_theme"
                 android:textStyle="bold"/>
 
             <TextView

+ 27 - 29
app/src/main/res/layout/item_template.xml

@@ -1,40 +1,38 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/rl_template"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:background="@color/gray_divider_light"
-    android:foreground="@drawable/selectable_item_background"
-    android:padding="@dimen/width_stroke"
-    android:layout_marginStart="@dimen/margin_s"
-    android:layout_marginEnd="@dimen/margin_s"
-    android:layout_marginTop="@dimen/margin_sss">
+    android:orientation="vertical">
 
-    <RelativeLayout
+    <include layout="@layout/view_divider_common"/>
+    <FrameLayout
+        android:id="@+id/rl_template"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content">
-        <ImageView
-            android:id="@+id/iv_template"
-            android:layout_width="match_parent"
-            android:layout_height="@dimen/height_cover"
-            android:src="@mipmap/logo_gray"
-            android:scaleType="centerCrop" />
+        android:layout_height="wrap_content"
+        android:layout_marginTop="@dimen/margin_s"
+        android:background="@color/white"
+        android:foreground="@drawable/selectable_item_background">
 
-        <TextView
-            android:id="@+id/tv_template"
-            android:layout_below="@+id/iv_template"
+        <LinearLayout
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_gravity="bottom"
-            android:background="@color/black_light_transparent"
-            android:gravity="center"
-            android:paddingTop="@dimen/margin_ss"
-            android:paddingBottom="@dimen/margin_ss"
-            android:textColor="@color/white_slight"
-            android:textSize="@dimen/text_s"
-            android:layout_alignParentBottom="true"/>
-    </RelativeLayout>
+            android:orientation="vertical">
+
+            <ImageView
+                android:id="@+id/iv_template"
+                android:layout_width="match_parent"
+                android:layout_height="@dimen/height_cover"
+                android:src="@mipmap/logo_gray" />
 
+            <TextView
+                android:id="@+id/tv_template"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:padding="@dimen/margin_s"
+                android:textColor="@color/black_theme" />
+        </LinearLayout>
+    </FrameLayout>
 
+    <include layout="@layout/view_divider_common"/>
+</LinearLayout>
 
-</FrameLayout>