hanjing лет назад: 6
Родитель
Сommit
4898cc2678

+ 12 - 1
app/src/main/java/com/sheep/gamegroup/module/home/adapter/AdpHomeList.java

@@ -22,23 +22,34 @@ import java.util.List;
  */
 public class AdpHomeList<T extends IHomeList> extends BaseQuickAdapter<T, BaseViewHolder> {
 
+    private int tileWidth = 0;
 
     public AdpHomeList(int layoutResId, @Nullable List<T> data) {
         super(layoutResId, data);
     }
 
+    public AdpHomeList(int layoutResId, int tileWidth, @Nullable List<T> data) {
+        super(layoutResId, data);
+        this.tileWidth = tileWidth;
+    }
+
     public AdpHomeList(@Nullable List<T> data) {
         super(R.layout.item_my_list_but, data);
     }
 
     @Override
     protected void convert(BaseViewHolder helper, final T item) {
+        if (tileWidth>0) {
+            View tile = helper.getView(R.id.my_item_but);
+            tile.getLayoutParams().width = tileWidth;
+        }
         helper.setText(R.id.my_item_text, item.getTitle());
         View my_item_text2 = helper.getView(R.id.my_item_text2);
         ViewUtil.setVisibility(my_item_text2, item instanceof HomeListEntity);
-        if(item instanceof HomeListEntity) {
+        if (item instanceof HomeListEntity) {
             helper.setText(R.id.my_item_text2, ((HomeListEntity) item).getCustomTag());
         }
         Glide.with(SheepApp.getInstance()).load(item.getIcon()).into((ImageView) helper.getView(R.id.my_item_img));
     }
+
 }

+ 10 - 4
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPersonalCenter.java

@@ -6,6 +6,7 @@ import android.content.Intent;
 import android.graphics.Color;
 import android.graphics.drawable.BitmapDrawable;
 import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
 import android.view.Gravity;
@@ -16,6 +17,7 @@ import android.widget.LinearLayout;
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
+import com.kfzs.duanduan.cardview.ScreenUtil;
 import com.kfzs.duanduan.utils.ApkUtils;
 import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -276,11 +278,12 @@ public class FgtPersonalCenter extends BaseFragment {
 
     //初始化用户中心模块界面
     private void initUserModuleItemView() {
-        GridLayoutManager manager = new GridLayoutManager(SheepApp.getInstance(), 5);
+        LinearLayoutManager manager = new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
         moduleList.setHasFixedSize(true);
         moduleList.setNestedScrollingEnabled(false);
         moduleList.setLayoutManager(manager);
-        AdpHomeList<UserCenterModule> adapter = new AdpHomeList<>(userCenterModuleList);
+        int w = (int) ((ScreenUtil.getScreenWidth(getActivity()) - ScreenUtil.dip2px(getContext(), 10)) / 4.5);
+        AdpHomeList<UserCenterModule> adapter = new AdpHomeList<>(R.layout.item_my_list_but3, w, userCenterModuleList);
         adapter.bindToRecyclerView(moduleList);
         adapter.setOnItemClickListener((adapter1, view, position) -> CommonUtil.getInstance().goNative(SheepApp.getInstance().getCurrentActivity(), ListUtil.getItem(userCenterModuleList, position), "个人中心"));
     }
@@ -466,7 +469,8 @@ public class FgtPersonalCenter extends BaseFragment {
                 });
     }
 
-    @OnClick({R.id.icon_img_iv, R.id.account_detail_layout, R.id.personalcenter_price_layout,
+    @OnClick({R.id.icon_img_iv, R.id.account_detail_layout, R.id.personalcenter_item_price_ic,
+            R.id.personalcenter_item_price_tag, R.id.personalcenter_item_price_tv,
             R.id.account_task_layout, R.id.proxy_service_layout, R.id.feedbook_layout,
             R.id.recommend_friend_layout, R.id.faq_layout,
             R.id.version_layout, R.id.order_layout, R.id.proxy_game_account_layout,
@@ -514,7 +518,9 @@ public class FgtPersonalCenter extends BaseFragment {
             case R.id.be_vip_btn://VIP
                 Jump2View.getInstance().gotoVip(activity);
                 break;
-            case R.id.personalcenter_price_layout://我的资产
+            case R.id.personalcenter_item_price_ic://我的资产
+            case R.id.personalcenter_item_price_tag://我的资产
+            case R.id.personalcenter_item_price_tv://我的资产
                 Jump2View.getInstance().goMyMoney(activity, null);
                 break;
             case R.id.account_task_layout://任务记录

+ 3 - 0
app/src/main/res/layout/fgt_personacenter_item_top.xml

@@ -127,6 +127,7 @@
             android:layout_height="wrap_content"
             android:layout_marginTop="6dp"
             android:text="绵羊号:"
+            android:layout_marginEnd="@dimen/content_padding_10"
             android:textColor="@color/txt_white"
             android:textSize="@dimen/text_size_11"
             app:layout_constraintEnd_toStartOf="@+id/vertical_seperator"
@@ -226,10 +227,12 @@
             android:background="@mipmap/baise">
 
             <ImageView
+                android:id="@+id/personalcenter_item_price_ic"
                 style="@style/style_item_img"
                 android:src="@mipmap/my_assets" />
 
             <TextView
+                android:id="@+id/personalcenter_item_price_tag"
                 style="@style/style_item_label"
                 android:textSize="15sp"
                 android:textColor="#333333"

+ 1 - 3
app/src/main/res/layout/fgt_personalcenter_layout.xml

@@ -37,9 +37,7 @@
                 android:background="@color/white"
                 android:paddingEnd="5dp"
                 android:paddingStart="5dp"
-                tools:layoutManager="android.support.v7.widget.GridLayoutManager"
-                tools:listitem="@layout/item_my_list_but"
-                tools:spanCount="4" />
+                tools:listitem="@layout/item_my_list_but" />
 
         </LinearLayout>
 

+ 39 - 0
app/src/main/res/layout/item_my_list_but3.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/my_item_but"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:paddingTop="10dp"
+    android:paddingBottom="10dp">
+
+    <ImageView
+        android:id="@+id/my_item_img"
+        android:layout_width="match_parent"
+        android:layout_height="47dp"
+        android:scaleType="fitCenter"
+        android:src="@drawable/icon" />
+
+    <TextView
+        android:id="@+id/my_item_text"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/my_item_img"
+        android:layout_marginTop="5dp"
+        android:singleLine="true"
+        android:gravity="center"
+        android:text="试玩赚钱"
+        android:textColor="@color/black_6_3"
+        android:textSize="13sp" />
+    <TextView
+        android:id="@+id/my_item_text2"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:text="可赚151元"
+        android:textColor="#fff02155"
+        android:textSize="10sp"
+        android:layout_below="@id/my_item_text"
+        android:layout_marginTop="3dp"
+        android:singleLine="true"
+        android:gravity="center"
+        />
+</RelativeLayout>

+ 2 - 1
app/src/main/res/layout/x_my_money_act_layout_item.xml

@@ -17,6 +17,8 @@
             android:id="@+id/item_desc"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
+            android:layout_toLeftOf="@+id/my_money_item_recharge_status"
+            android:layout_marginRight="12dp"
             android:layout_weight="1"
             android:orientation="horizontal"
             android:gravity="center_vertical">
@@ -25,7 +27,6 @@
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:gravity="start"
-                android:singleLine="true"
                 android:ellipsize="end"
                 android:text="充值金额100.00元"
                 android:textColor="#282828"