Commit 925595f36eb6e60398001ea03e4b39d877627c07
1 parent
796eae6b
ugc列表页面添加扩展属性
Showing
5 changed files
with
100 additions
and
14 deletions
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,13 +21,13 @@ public class ActiveInfo implements Serializable { | ||
| 21 | private String endTime; | 21 | private String endTime; |
| 22 | private String coverImgUrl; | 22 | private String coverImgUrl; |
| 23 | private String activityCategory; | 23 | private String activityCategory; |
| 24 | - private Object extensions; | 24 | + private ActiveExInfo extensions; |
| 25 | private String rates; | 25 | private String rates; |
| 26 | 26 | ||
| 27 | public ActiveInfo() { | 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 | this.totalCount = totalCount; | 31 | this.totalCount = totalCount; |
| 32 | this.nextCursor = nextCursor; | 32 | this.nextCursor = nextCursor; |
| 33 | this.preCursor = preCursor; | 33 | this.preCursor = preCursor; |
| @@ -149,11 +149,11 @@ public class ActiveInfo implements Serializable { | @@ -149,11 +149,11 @@ public class ActiveInfo implements Serializable { | ||
| 149 | this.activityCategory = activityCategory; | 149 | this.activityCategory = activityCategory; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | - public Object getExtensions() { | 152 | + public ActiveExInfo getExtensions() { |
| 153 | return extensions; | 153 | return extensions; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | - public void setExtensions(Object extensions) { | 156 | + public void setExtensions(ActiveExInfo extensions) { |
| 157 | this.extensions = extensions; | 157 | this.extensions = extensions; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| @@ -185,4 +185,12 @@ public class ActiveInfo implements Serializable { | @@ -185,4 +185,12 @@ public class ActiveInfo implements Serializable { | ||
| 185 | ", rates='" + rates + '\'' + | 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,6 +37,7 @@ public class ActivePlayInfo extends ErrorMessage { | ||
| 37 | private String activityCategory; | 37 | private String activityCategory; |
| 38 | private String rates; | 38 | private String rates; |
| 39 | private String extViews; | 39 | private String extViews; |
| 40 | + private ActiveExInfo extensions; | ||
| 40 | 41 | ||
| 41 | public ActiveModel() { | 42 | public ActiveModel() { |
| 42 | } | 43 | } |
| @@ -137,6 +138,14 @@ public class ActivePlayInfo extends ErrorMessage { | @@ -137,6 +138,14 @@ public class ActivePlayInfo extends ErrorMessage { | ||
| 137 | this.extViews = extViews; | 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 | @Override | 149 | @Override |
| 141 | public String toString() { | 150 | public String toString() { |
| 142 | return "ActiveModel{" + | 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 +6,7 @@ import android.support.annotation.Nullable; | ||
| 6 | import android.support.v4.app.Fragment; | 6 | import android.support.v4.app.Fragment; |
| 7 | import android.support.v4.widget.SwipeRefreshLayout; | 7 | import android.support.v4.widget.SwipeRefreshLayout; |
| 8 | import android.support.v7.widget.LinearLayoutManager; | 8 | import android.support.v7.widget.LinearLayoutManager; |
| 9 | +import android.util.Log; | ||
| 9 | import android.view.LayoutInflater; | 10 | import android.view.LayoutInflater; |
| 10 | import android.view.View; | 11 | import android.view.View; |
| 11 | import android.view.ViewGroup; | 12 | import android.view.ViewGroup; |
| @@ -91,6 +92,7 @@ public class UGCListFragment extends Fragment implements SwipeRefreshLayout.OnRe | @@ -91,6 +92,7 @@ public class UGCListFragment extends Fragment implements SwipeRefreshLayout.OnRe | ||
| 91 | 92 | ||
| 92 | @Override | 93 | @Override |
| 93 | public void onResponse(Call<ActiveListModel> call, Response<ActiveListModel> response) { | 94 | public void onResponse(Call<ActiveListModel> call, Response<ActiveListModel> response) { |
| 95 | + Log.e("11111111111111", "onResponse: "+call.request().toString() ); | ||
| 94 | binding.contentView.setRefreshing(false); | 96 | binding.contentView.setRefreshing(false); |
| 95 | if (response.isSuccessful()) { | 97 | if (response.isSuccessful()) { |
| 96 | ActiveListModel model = response.body(); | 98 | ActiveListModel model = response.body(); |
app/src/main/res/layout/layout_item_active_video_list.xml
| @@ -6,7 +6,8 @@ | @@ -6,7 +6,8 @@ | ||
| 6 | <data> | 6 | <data> |
| 7 | 7 | ||
| 8 | <import type="com.cnlive.gundam.main.model.ActiveInfo" /> | 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 | <variable | 12 | <variable |
| 12 | name="activeInfo" | 13 | name="activeInfo" |
| @@ -14,7 +15,7 @@ | @@ -14,7 +15,7 @@ | ||
| 14 | 15 | ||
| 15 | <variable | 16 | <variable |
| 16 | name="viewClickListner" | 17 | name="viewClickListner" |
| 17 | - type="OnAdapterViewClickListener<ActiveInfo>"/> | 18 | + type="OnAdapterViewClickListener<ActiveInfo>" /> |
| 18 | 19 | ||
| 19 | </data> | 20 | </data> |
| 20 | 21 | ||
| @@ -27,7 +28,7 @@ | @@ -27,7 +28,7 @@ | ||
| 27 | <ImageView | 28 | <ImageView |
| 28 | android:id="@+id/image" | 29 | android:id="@+id/image" |
| 29 | android:layout_width="match_parent" | 30 | android:layout_width="match_parent" |
| 30 | - android:layout_height="200dp" | 31 | + android:layout_height="300dp" |
| 31 | android:scaleType="centerCrop" | 32 | android:scaleType="centerCrop" |
| 32 | app:error="@{@drawable/image_error}" | 33 | app:error="@{@drawable/image_error}" |
| 33 | app:imageUrl="@{activeInfo.getCoverImgUrl()}" /> | 34 | app:imageUrl="@{activeInfo.getCoverImgUrl()}" /> |
| @@ -35,27 +36,53 @@ | @@ -35,27 +36,53 @@ | ||
| 35 | <TextView | 36 | <TextView |
| 36 | android:layout_width="wrap_content" | 37 | android:layout_width="wrap_content" |
| 37 | android:layout_height="wrap_content" | 38 | android:layout_height="wrap_content" |
| 38 | - android:text="@{activeInfo.getActivityStatus() == 1 ? @string/ugc_live : @string/ugc_vod}" | ||
| 39 | - android:background="#60494747" | ||
| 40 | android:layout_alignParentRight="true" | 39 | android:layout_alignParentRight="true" |
| 40 | + android:background="#60494747" | ||
| 41 | android:padding="3dp" | 41 | android:padding="3dp" |
| 42 | + android:text="@{activeInfo.getActivityStatus() == 1 ? @string/ugc_live : @string/ugc_vod}" | ||
| 42 | android:textColor="@{activeInfo.getActivityStatus() == 1 ? @android:color/holo_red_light : @android:color/white}" | 43 | android:textColor="@{activeInfo.getActivityStatus() == 1 ? @android:color/holo_red_light : @android:color/white}" |
| 43 | - tools:text="直播"/> | 44 | + tools:text="直播" /> |
| 44 | 45 | ||
| 45 | <TextView | 46 | <TextView |
| 46 | android:id="@+id/title" | 47 | android:id="@+id/title" |
| 47 | android:layout_width="match_parent" | 48 | android:layout_width="match_parent" |
| 48 | android:layout_height="wrap_content" | 49 | android:layout_height="wrap_content" |
| 49 | - android:layout_below="@+id/image" | 50 | + android:layout_alignBottom="@+id/image" |
| 51 | + android:background="#60494747" | ||
| 50 | android:padding="10dp" | 52 | android:padding="10dp" |
| 51 | android:text="@{activeInfo.getActivityName()}" | 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 | <View | 82 | <View |
| 56 | android:layout_width="match_parent" | 83 | android:layout_width="match_parent" |
| 57 | android:layout_height="8dp" | 84 | android:layout_height="8dp" |
| 58 | - android:layout_below="@+id/title" | 85 | + android:layout_below="@+id/exLayout" |
| 59 | android:background="@color/list_divider" /> | 86 | android:background="@color/list_divider" /> |
| 60 | 87 | ||
| 61 | </RelativeLayout> | 88 | </RelativeLayout> |