Commit 925595f36eb6e60398001ea03e4b39d877627c07

Authored by 谷俊
1 parent 796eae6b

ugc列表页面添加扩展属性

app/src/main/java/com/cnlive/gundam/main/model/ActiveExInfo.java 0 → 100644
  1 +package com.cnlive.gundam.main.model;
  2 +
  3 +/**
  4 + * Created by gujun on 2017/6/29.
  5 + */
  6 +
  7 +public class ActiveExInfo {
  8 +
  9 + private String name ;
  10 + private String iconUrl;
  11 +
  12 + public ActiveExInfo(String name, String iconUrl) {
  13 + this.name = name;
  14 + this.iconUrl = iconUrl;
  15 + }
  16 +
  17 + public String getName() {
  18 + return name;
  19 + }
  20 +
  21 + public void setName(String name) {
  22 + this.name = name;
  23 + }
  24 +
  25 + public String getIconUrl() {
  26 + return iconUrl;
  27 + }
  28 +
  29 + public void setIconUrl(String iconUrl) {
  30 + this.iconUrl = iconUrl;
  31 + }
  32 +
  33 + @Override
  34 + public String toString() {
  35 + return "ActiveExInfo{" +
  36 + "name='" + name + '\'' +
  37 + ", iconUrl='" + iconUrl + '\'' +
  38 + '}';
  39 + }
  40 +}
... ...
app/src/main/java/com/cnlive/gundam/main/model/ActiveInfo.java
... ... @@ -21,13 +21,13 @@ public class ActiveInfo implements Serializable {
21 21 private String endTime;
22 22 private String coverImgUrl;
23 23 private String activityCategory;
24   - private Object extensions;
  24 + private ActiveExInfo extensions;
25 25 private String rates;
26 26  
27 27 public ActiveInfo() {
28 28 }
29 29  
30   - public ActiveInfo(int totalCount, int nextCursor, int preCursor, String activityId, String activityName, int activityStatus, int isHorizontalScreen, String channelId, String createTime, String startTime, String endTime, String coverImgUrl, String activityCategory, Object extensions, String rates) {
  30 + public ActiveInfo(int totalCount, int nextCursor, int preCursor, String activityId, String activityName, int activityStatus, int isHorizontalScreen, String channelId, String createTime, String startTime, String endTime, String coverImgUrl, String activityCategory, ActiveExInfo extensions, String rates) {
31 31 this.totalCount = totalCount;
32 32 this.nextCursor = nextCursor;
33 33 this.preCursor = preCursor;
... ... @@ -149,11 +149,11 @@ public class ActiveInfo implements Serializable {
149 149 this.activityCategory = activityCategory;
150 150 }
151 151  
152   - public Object getExtensions() {
  152 + public ActiveExInfo getExtensions() {
153 153 return extensions;
154 154 }
155 155  
156   - public void setExtensions(Object extensions) {
  156 + public void setExtensions(ActiveExInfo extensions) {
157 157 this.extensions = extensions;
158 158 }
159 159  
... ... @@ -185,4 +185,12 @@ public class ActiveInfo implements Serializable {
185 185 ", rates='" + rates + '\'' +
186 186 '}';
187 187 }
  188 +
  189 + public String getExUrl() {
  190 + return extensions != null ? extensions.getIconUrl() : "";
  191 + }
  192 +
  193 + public String getExNick() {
  194 + return extensions != null ? extensions.getName() : "";
  195 + }
188 196 }
... ...
app/src/main/java/com/cnlive/gundam/main/model/ActivePlayInfo.java
... ... @@ -37,6 +37,7 @@ public class ActivePlayInfo extends ErrorMessage {
37 37 private String activityCategory;
38 38 private String rates;
39 39 private String extViews;
  40 + private ActiveExInfo extensions;
40 41  
41 42 public ActiveModel() {
42 43 }
... ... @@ -137,6 +138,14 @@ public class ActivePlayInfo extends ErrorMessage {
137 138 this.extViews = extViews;
138 139 }
139 140  
  141 + public ActiveExInfo getExtensions() {
  142 + return extensions;
  143 + }
  144 +
  145 + public void setExtensions(ActiveExInfo extensions) {
  146 + this.extensions = extensions;
  147 + }
  148 +
140 149 @Override
141 150 public String toString() {
142 151 return "ActiveModel{" +
... ...
app/src/main/java/com/cnlive/gundam/main/ui/fragment/UGCListFragment.java
... ... @@ -6,6 +6,7 @@ import android.support.annotation.Nullable;
6 6 import android.support.v4.app.Fragment;
7 7 import android.support.v4.widget.SwipeRefreshLayout;
8 8 import android.support.v7.widget.LinearLayoutManager;
  9 +import android.util.Log;
9 10 import android.view.LayoutInflater;
10 11 import android.view.View;
11 12 import android.view.ViewGroup;
... ... @@ -91,6 +92,7 @@ public class UGCListFragment extends Fragment implements SwipeRefreshLayout.OnRe
91 92  
92 93 @Override
93 94 public void onResponse(Call<ActiveListModel> call, Response<ActiveListModel> response) {
  95 + Log.e("11111111111111", "onResponse: "+call.request().toString() );
94 96 binding.contentView.setRefreshing(false);
95 97 if (response.isSuccessful()) {
96 98 ActiveListModel model = response.body();
... ...
app/src/main/res/layout/layout_item_active_video_list.xml
... ... @@ -6,7 +6,8 @@
6 6 <data>
7 7  
8 8 <import type="com.cnlive.gundam.main.model.ActiveInfo" />
9   - <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter.OnAdapterViewClickListener"/>
  9 + <import type="android.view.View"/>
  10 + <import type="com.cnlive.gundam.main.ui.adapter.DataBindingAdapter.OnAdapterViewClickListener" />
10 11  
11 12 <variable
12 13 name="activeInfo"
... ... @@ -14,7 +15,7 @@
14 15  
15 16 <variable
16 17 name="viewClickListner"
17   - type="OnAdapterViewClickListener&lt;ActiveInfo>"/>
  18 + type="OnAdapterViewClickListener&lt;ActiveInfo>" />
18 19  
19 20 </data>
20 21  
... ... @@ -27,7 +28,7 @@
27 28 <ImageView
28 29 android:id="@+id/image"
29 30 android:layout_width="match_parent"
30   - android:layout_height="200dp"
  31 + android:layout_height="300dp"
31 32 android:scaleType="centerCrop"
32 33 app:error="@{@drawable/image_error}"
33 34 app:imageUrl="@{activeInfo.getCoverImgUrl()}" />
... ... @@ -35,27 +36,53 @@
35 36 <TextView
36 37 android:layout_width="wrap_content"
37 38 android:layout_height="wrap_content"
38   - android:text="@{activeInfo.getActivityStatus() == 1 ? @string/ugc_live : @string/ugc_vod}"
39   - android:background="#60494747"
40 39 android:layout_alignParentRight="true"
  40 + android:background="#60494747"
41 41 android:padding="3dp"
  42 + android:text="@{activeInfo.getActivityStatus() == 1 ? @string/ugc_live : @string/ugc_vod}"
42 43 android:textColor="@{activeInfo.getActivityStatus() == 1 ? @android:color/holo_red_light : @android:color/white}"
43   - tools:text="直播"/>
  44 + tools:text="直播" />
44 45  
45 46 <TextView
46 47 android:id="@+id/title"
47 48 android:layout_width="match_parent"
48 49 android:layout_height="wrap_content"
49   - android:layout_below="@+id/image"
  50 + android:layout_alignBottom="@+id/image"
  51 + android:background="#60494747"
50 52 android:padding="10dp"
51 53 android:text="@{activeInfo.getActivityName()}"
52   - android:textColor="@android:color/black"
53   - android:textSize="16sp"/>
  54 + android:textColor="@android:color/white"
  55 + android:textSize="16sp"
  56 + tools:text="title" />
  57 +
  58 + <LinearLayout
  59 + android:id="@+id/exLayout"
  60 + android:layout_width="match_parent"
  61 + android:layout_height="wrap_content"
  62 + android:layout_below="@+id/image"
  63 + android:visibility="@{activeInfo.getExtensions() != null ? View.VISIBLE : View.GONE}">
  64 +
  65 + <ImageView
  66 + android:id="@+id/header"
  67 + android:layout_width="30dp"
  68 + android:layout_height="30dp"
  69 + android:layout_margin="5dp"
  70 + app:error="@{@drawable/image_error}"
  71 + app:imageUrl="@{activeInfo.getExUrl()}"/>
  72 +
  73 + <TextView
  74 + android:layout_width="wrap_content"
  75 + android:layout_height="wrap_content"
  76 + android:layout_gravity="center_vertical"
  77 + android:textColor="@android:color/black"
  78 + android:text="@{activeInfo.getExNick()}"
  79 + tools:text="nick" />
  80 + </LinearLayout>
54 81  
55 82 <View
56 83 android:layout_width="match_parent"
57 84 android:layout_height="8dp"
58   - android:layout_below="@+id/title"
  85 + android:layout_below="@+id/exLayout"
59 86 android:background="@color/list_divider" />
60 87  
61 88 </RelativeLayout>
... ...