zengjiebin лет назад: 7
Родитель
Сommit
65a056bf3c

+ 17 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserEntity.java

@@ -4,12 +4,16 @@ import android.text.TextUtils;
 
 import com.sheep.gamegroup.util.BinaryUtils;
 import com.sheep.gamegroup.util.TestUtil;
+import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.share.ShareLinkConfig;
+import com.sheep.gamegroup.util.string.SpannableSb;
+import com.sheep.jiuyan.samllsheep.R;
 
 import org.xutils.db.annotation.Column;
 import org.xutils.db.annotation.Table;
 
 import java.io.Serializable;
+import java.util.Locale;
 
 /**
  * Created by ljy on 2018/3/17.
@@ -52,6 +56,7 @@ public class UserEntity implements Serializable {
     private int create_time_line;//1:小绵羊3.0之前的用户(注:以后如果再次有这种区分之前用户的需求就陆续加一)
     private int bind_flag;//绑定表示 二进制形式 从低到高 第一位手机号 第二位QQ号 第三位微信
     private int level;//用户等级 0:普通用户     1:VIP用户
+    private int vip_time;//用户vip期限
 
     public int getPackage_cate() {
         return package_cate;
@@ -309,6 +314,14 @@ public class UserEntity implements Serializable {
         this.level = level;
     }
 
+    public int getVip_time() {
+        return vip_time;
+    }
+
+    public void setVip_time(int vip_time) {
+        this.vip_time = vip_time;
+    }
+
     public int getMust_bind_mobile() {
         return must_bind_mobile;
     }
@@ -406,4 +419,8 @@ public class UserEntity implements Serializable {
     public boolean isVIP(){
         return level >= LEVEL_VIP;
     }
+    public CharSequence getVIPInfo(){
+        String info = String.format(Locale.CHINA, "(%s到期)", TimeUtil.TimeStamp2Date(vip_time, "yyyy/MM/dd"));
+        return new SpannableSb().append("VIP").append(info, R.dimen.text_size_10).getSsb();
+    }
 }

+ 3 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtPersonalCenter.java

@@ -115,6 +115,8 @@ public class FgtPersonalCenter extends BaseFragment {
     View fgt_pc_item_vip_ll;
     @BindView(R.id.vip_flag_view)
     View vipFlagView;
+    @BindView(R.id.vip_flag_view_tv)
+    TextView vip_flag_view_tv;
 
     public UserEntity userEntity;
     private String faqUrl;
@@ -296,6 +298,7 @@ public class FgtPersonalCenter extends BaseFragment {
         sheepNumTv.setText(String.format(Locale.CHINA, "绵羊号:%s", userEntity.getInvitation_code()));
         GlideImageLoader.setAvatar(iconImgIv, userEntity.getAvatar(), Color.argb(128, 255, 255, 255));
         ViewUtil.setVisibility(vipFlagView, userEntity.isVIP());
+        ViewUtil.setText(vip_flag_view_tv, userEntity.getVIPInfo());
         ViewUtil.setVisibility(fgt_pc_item_vip_v, !userEntity.isVIP());
         ViewUtil.setVisibility(fgt_pc_item_vip_ll, !userEntity.isVIP());
     }

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

@@ -121,6 +121,7 @@
                 android:layout_width="12dp"
                 android:layout_height="12dp" />
             <TextView
+                android:id="@+id/vip_flag_view_tv"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
                 android:layout_marginLeft="5dp"