Commit 6e3859ed059464ff90b1c6cdccc57259c4290d1b
1 parent
a0d1f226
消息页面修改
Showing
6 changed files
with
309 additions
and
60 deletions
app/src/main/java/com/cnlive/goldenline/ui/activity/MyMessageActivity.java
| @@ -2,6 +2,7 @@ package com.cnlive.goldenline.ui.activity; | @@ -2,6 +2,7 @@ package com.cnlive.goldenline.ui.activity; | ||
| 2 | 2 | ||
| 3 | import android.content.Context; | 3 | import android.content.Context; |
| 4 | import android.content.Intent; | 4 | import android.content.Intent; |
| 5 | +import android.databinding.DataBindingUtil; | ||
| 5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 6 | import android.support.annotation.NonNull; | 7 | import android.support.annotation.NonNull; |
| 7 | import android.support.v7.widget.DefaultItemAnimator; | 8 | import android.support.v7.widget.DefaultItemAnimator; |
| @@ -14,6 +15,7 @@ import android.widget.TextView; | @@ -14,6 +15,7 @@ import android.widget.TextView; | ||
| 14 | 15 | ||
| 15 | import com.cnlive.goldenline.R; | 16 | import com.cnlive.goldenline.R; |
| 16 | import com.cnlive.goldenline.api.CmsAPI; | 17 | import com.cnlive.goldenline.api.CmsAPI; |
| 18 | +import com.cnlive.goldenline.databinding.ActivityMyMessageBinding; | ||
| 17 | import com.cnlive.goldenline.model.AnchorItem; | 19 | import com.cnlive.goldenline.model.AnchorItem; |
| 18 | import com.cnlive.goldenline.model.User; | 20 | import com.cnlive.goldenline.model.User; |
| 19 | import com.cnlive.goldenline.model.request.MessageBean; | 21 | import com.cnlive.goldenline.model.request.MessageBean; |
| @@ -21,6 +23,7 @@ import com.cnlive.goldenline.model.request.UserMessageBean; | @@ -21,6 +23,7 @@ import com.cnlive.goldenline.model.request.UserMessageBean; | ||
| 21 | import com.cnlive.goldenline.model.response.ListResponse; | 23 | import com.cnlive.goldenline.model.response.ListResponse; |
| 22 | import com.cnlive.goldenline.ui.activity.act.ActActivity; | 24 | import com.cnlive.goldenline.ui.activity.act.ActActivity; |
| 23 | import com.cnlive.goldenline.ui.activity.act.model.ActWebActivity; | 25 | import com.cnlive.goldenline.ui.activity.act.model.ActWebActivity; |
| 26 | +import com.cnlive.goldenline.ui.adapter.MyMessageAdapter; | ||
| 24 | import com.cnlive.goldenline.ui.adapter.MyMsgAdapter; | 27 | import com.cnlive.goldenline.ui.adapter.MyMsgAdapter; |
| 25 | import com.cnlive.goldenline.ui.base.BaseActivity; | 28 | import com.cnlive.goldenline.ui.base.BaseActivity; |
| 26 | import com.cnlive.goldenline.ui.interfaces.RecyclerViewItemClickListener; | 29 | import com.cnlive.goldenline.ui.interfaces.RecyclerViewItemClickListener; |
| @@ -29,6 +32,7 @@ import com.cnlive.goldenline.ui.widget.pull2refresh.PullToRefreshLayout; | @@ -29,6 +32,7 @@ import com.cnlive.goldenline.ui.widget.pull2refresh.PullToRefreshLayout; | ||
| 29 | import com.cnlive.goldenline.util.RestAdapterUtils; | 32 | import com.cnlive.goldenline.util.RestAdapterUtils; |
| 30 | import com.cnlive.goldenline.util.ToastUtil; | 33 | import com.cnlive.goldenline.util.ToastUtil; |
| 31 | import com.cnlive.goldenline.util.UserService; | 34 | import com.cnlive.goldenline.util.UserService; |
| 35 | +import com.cnlive.goldenline.viewmodel.MyMessageModleView; | ||
| 32 | import com.cnlive.libs.util.data.okhttpUtil.utils.L; | 36 | import com.cnlive.libs.util.data.okhttpUtil.utils.L; |
| 33 | import com.google.gson.Gson; | 37 | import com.google.gson.Gson; |
| 34 | 38 | ||
| @@ -66,7 +70,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -66,7 +70,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 66 | 70 | ||
| 67 | 71 | ||
| 68 | private List<MessageBean> dataList = new ArrayList<>(); | 72 | private List<MessageBean> dataList = new ArrayList<>(); |
| 69 | - private List<MessageBean> addList = new ArrayList<>(); | 73 | + |
| 70 | 74 | ||
| 71 | 75 | ||
| 72 | private MyMsgAdapter adapter; | 76 | private MyMsgAdapter adapter; |
| @@ -85,6 +89,8 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -85,6 +89,8 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 85 | protected void onCreate(Bundle savedInstanceState) { | 89 | protected void onCreate(Bundle savedInstanceState) { |
| 86 | super.onCreate(savedInstanceState); | 90 | super.onCreate(savedInstanceState); |
| 87 | setContentView(R.layout.activity_my_message); | 91 | setContentView(R.layout.activity_my_message); |
| 92 | + | ||
| 93 | + | ||
| 88 | ButterKnife.bind(this); | 94 | ButterKnife.bind(this); |
| 89 | cmsAPI = RestAdapterUtils.getRestAPI(CmsAPI.class); | 95 | cmsAPI = RestAdapterUtils.getRestAPI(CmsAPI.class); |
| 90 | getUserInfo(); | 96 | getUserInfo(); |
| @@ -115,27 +121,38 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -115,27 +121,38 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 115 | 121 | ||
| 116 | 122 | ||
| 117 | List<MessageBean> data = userMessageBean.getRecordList(); | 123 | List<MessageBean> data = userMessageBean.getRecordList(); |
| 118 | - if (data.size() != 0) { | ||
| 119 | - | ||
| 120 | - dataList.addAll(data); | ||
| 121 | - initData(); | ||
| 122 | 124 | ||
| 123 | - } | ||
| 124 | if (userMessageBean.getErrMsg().equals("success")) { | 125 | if (userMessageBean.getErrMsg().equals("success")) { |
| 125 | 126 | ||
| 126 | if (state.equals("init")) { | 127 | if (state.equals("init")) { |
| 127 | pull_to_refresh.refreshFinish(PullToRefreshLayout.SUCCEED); | 128 | pull_to_refresh.refreshFinish(PullToRefreshLayout.SUCCEED); |
| 129 | + if (data.size() != 0) { | ||
| 130 | + | ||
| 131 | + dataList.addAll(data); | ||
| 132 | + initData(); | ||
| 133 | + | ||
| 134 | + } | ||
| 128 | 135 | ||
| 129 | - }else if (state.equals("load")){ | 136 | + } else if (state.equals("load")) { |
| 130 | 137 | ||
| 131 | pull_to_refresh.loadmoreFinish(PullToRefreshLayout.SUCCEED); | 138 | pull_to_refresh.loadmoreFinish(PullToRefreshLayout.SUCCEED); |
| 139 | + if (data.size() != 0) { | ||
| 132 | 140 | ||
| 133 | - }else{ | 141 | + dataList.addAll(data); |
| 142 | + myMessageAdapter.notifyDataSetChanged(); | ||
| 143 | + | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + } else { | ||
| 134 | pull_to_refresh.refreshFinish(PullToRefreshLayout.SUCCEED); | 147 | pull_to_refresh.refreshFinish(PullToRefreshLayout.SUCCEED); |
| 148 | + if (data.size() != 0) { | ||
| 135 | 149 | ||
| 136 | - } | 150 | + dataList.addAll(data); |
| 151 | + initData(); | ||
| 137 | 152 | ||
| 153 | + } | ||
| 138 | 154 | ||
| 155 | + } | ||
| 139 | 156 | ||
| 140 | 157 | ||
| 141 | if (dataList.size() == 0) { | 158 | if (dataList.size() == 0) { |
| @@ -145,7 +162,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -145,7 +162,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 145 | } | 162 | } |
| 146 | 163 | ||
| 147 | 164 | ||
| 148 | - } else if (userMessageBean.getCode()==4) { | 165 | + } else if (userMessageBean.getCode() == 4) { |
| 149 | ToastUtil.showToast(userMessageBean.getErrMsg()); | 166 | ToastUtil.showToast(userMessageBean.getErrMsg()); |
| 150 | pull_to_refresh.refreshFinish(PullToRefreshLayout.SUCCEED); | 167 | pull_to_refresh.refreshFinish(PullToRefreshLayout.SUCCEED); |
| 151 | 168 | ||
| @@ -182,6 +199,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -182,6 +199,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 182 | /** | 199 | /** |
| 183 | * 初始化数据 | 200 | * 初始化数据 |
| 184 | */ | 201 | */ |
| 202 | + MyMessageAdapter myMessageAdapter; | ||
| 185 | private void initData() { | 203 | private void initData() { |
| 186 | 204 | ||
| 187 | 205 | ||
| @@ -190,15 +208,17 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -190,15 +208,17 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 190 | pull_to_refresh.setPullUpEnable(true); | 208 | pull_to_refresh.setPullUpEnable(true); |
| 191 | pull_to_refresh.setPullDownEnable(true); | 209 | pull_to_refresh.setPullDownEnable(true); |
| 192 | button_back.setOnClickListener(this); | 210 | button_back.setOnClickListener(this); |
| 193 | - adapter = new MyMsgAdapter(this ); | 211 | +// adapter = new MyMsgAdapter(this); |
| 212 | + | ||
| 213 | + myMessageAdapter= new MyMessageAdapter(dataList); | ||
| 194 | recycle_msg.setLayoutManager(new LinearLayoutManager(this)); | 214 | recycle_msg.setLayoutManager(new LinearLayoutManager(this)); |
| 195 | 215 | ||
| 196 | recycle_msg.setItemAnimator(new DefaultItemAnimator()); | 216 | recycle_msg.setItemAnimator(new DefaultItemAnimator()); |
| 197 | recycle_msg.setHasFixedSize(true); | 217 | recycle_msg.setHasFixedSize(true); |
| 198 | 218 | ||
| 199 | - adapter.addItems(dataList); | 219 | +// adapter.addItems(dataList); |
| 200 | 220 | ||
| 201 | - recycle_msg.setAdapter(adapter); | 221 | + recycle_msg.setAdapter(myMessageAdapter); |
| 202 | 222 | ||
| 203 | } | 223 | } |
| 204 | 224 | ||
| @@ -223,7 +243,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -223,7 +243,7 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 223 | 243 | ||
| 224 | dataList.clear(); | 244 | dataList.clear(); |
| 225 | getData(1, "refresh"); | 245 | getData(1, "refresh"); |
| 226 | - page=1; | 246 | + page = 1; |
| 227 | initData(); | 247 | initData(); |
| 228 | 248 | ||
| 229 | 249 | ||
| @@ -245,6 +265,5 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | @@ -245,6 +265,5 @@ public class MyMessageActivity extends BaseActivity implements PullToRefreshLayo | ||
| 245 | public void onItemClick(View view, MessageBean messageBean, int position, int eventType) { | 265 | public void onItemClick(View view, MessageBean messageBean, int position, int eventType) { |
| 246 | 266 | ||
| 247 | 267 | ||
| 248 | - | ||
| 249 | } | 268 | } |
| 250 | } | 269 | } |
app/src/main/java/com/cnlive/goldenline/ui/adapter/MyMessageAdapter.java
0 → 100644
| 1 | +package com.cnlive.goldenline.ui.adapter; | ||
| 2 | + | ||
| 3 | +import android.databinding.DataBindingUtil; | ||
| 4 | +import android.support.v7.widget.RecyclerView; | ||
| 5 | +import android.view.LayoutInflater; | ||
| 6 | +import android.view.View; | ||
| 7 | +import android.view.ViewGroup; | ||
| 8 | + | ||
| 9 | +import com.cnlive.goldenline.R; | ||
| 10 | +import com.cnlive.goldenline.databinding.LayoutMsgItem2Binding; | ||
| 11 | +import com.cnlive.goldenline.model.request.MessageBean; | ||
| 12 | +import com.cnlive.goldenline.viewmodel.MyMessageModleView; | ||
| 13 | + | ||
| 14 | +import java.util.List; | ||
| 15 | + | ||
| 16 | +import static android.databinding.DataBindingUtil.inflate; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * 创建:wukuiqing | ||
| 20 | + * <p> | ||
| 21 | + * 时间:2017/5/15 | ||
| 22 | + * <p> | ||
| 23 | + * 描述: | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +public class MyMessageAdapter extends RecyclerView.Adapter<MyMessageAdapter.BindingHolder> { | ||
| 27 | + List<MessageBean> dataList; | ||
| 28 | + | ||
| 29 | + public MyMessageAdapter(List<MessageBean> dataList) { | ||
| 30 | + this.dataList=dataList; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + @Override | ||
| 34 | + public MyMessageAdapter.BindingHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
| 35 | + LayoutMsgItem2Binding item2Binding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), R.layout.layout_msg_item_2, parent, false); | ||
| 36 | + return new BindingHolder(item2Binding); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + @Override | ||
| 40 | + public void onBindViewHolder(MyMessageAdapter.BindingHolder holder, int position) { | ||
| 41 | + MyMessageModleView myMessageModleView= new MyMessageModleView(dataList.get(position)); | ||
| 42 | + | ||
| 43 | + holder.item2Binding.setMsgModleView(myMessageModleView); | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + public int getItemCount() { | ||
| 49 | + return dataList.size(); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + | ||
| 53 | + public class BindingHolder extends RecyclerView.ViewHolder { | ||
| 54 | + LayoutMsgItem2Binding item2Binding; | ||
| 55 | + | ||
| 56 | + public BindingHolder(LayoutMsgItem2Binding item2Binding) { | ||
| 57 | + super(item2Binding.llItem); | ||
| 58 | + | ||
| 59 | + this.item2Binding = item2Binding; | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | +} |
app/src/main/java/com/cnlive/goldenline/util/RestAdapterUtils.java
| @@ -137,7 +137,7 @@ public class RestAdapterUtils { | @@ -137,7 +137,7 @@ public class RestAdapterUtils { | ||
| 137 | client.setReadTimeout(READ_TIMEOUT, TimeUnit.MILLISECONDS); | 137 | client.setReadTimeout(READ_TIMEOUT, TimeUnit.MILLISECONDS); |
| 138 | RestAdapter restAdapter = new RestAdapter.Builder() | 138 | RestAdapter restAdapter = new RestAdapter.Builder() |
| 139 | .setLogLevel(level) | 139 | .setLogLevel(level) |
| 140 | - .setEndpoint(Configs.TEST_PAYCOULD) | 140 | + .setEndpoint(Configs.URL_TEST) |
| 141 | .setClient(new OkClient(client)) | 141 | .setClient(new OkClient(client)) |
| 142 | .build(); | 142 | .build(); |
| 143 | 143 |
app/src/main/java/com/cnlive/goldenline/viewmodel/MyMessageModleView.java
0 → 100644
| 1 | +package com.cnlive.goldenline.viewmodel; | ||
| 2 | + | ||
| 3 | +import android.app.Activity; | ||
| 4 | +import android.databinding.BaseObservable; | ||
| 5 | +import android.databinding.BindingAdapter; | ||
| 6 | +import android.widget.ImageView; | ||
| 7 | + | ||
| 8 | +import com.bumptech.glide.Glide; | ||
| 9 | +import com.cnlive.goldenline.R; | ||
| 10 | +import com.cnlive.goldenline.databinding.ActivityMyMessageBinding; | ||
| 11 | +import com.cnlive.goldenline.model.request.MessageBean; | ||
| 12 | +import com.cnlive.goldenline.ui.adapter.MyMsgAdapter; | ||
| 13 | +import com.cnlive.goldenline.ui.widget.CropCircleTransformation; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * 创建:wukuiqing | ||
| 17 | + * <p> | ||
| 18 | + * 时间:2017/5/11 | ||
| 19 | + * <p> | ||
| 20 | + * 描述: | ||
| 21 | + */ | ||
| 22 | + | ||
| 23 | +public class MyMessageModleView extends BaseObservable{ | ||
| 24 | + MessageBean data; | ||
| 25 | + | ||
| 26 | + public MyMessageModleView(MessageBean data) { | ||
| 27 | + this.data = data; | ||
| 28 | + | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + public String getTitle() { | ||
| 33 | + | ||
| 34 | + return data.getMessageSubTitle(); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + public String getContent() { | ||
| 39 | + | ||
| 40 | + return data.getMessageContent(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + public String getTime() { | ||
| 47 | + | ||
| 48 | + return data.getMessageTime(); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + | ||
| 52 | + public String getImageUrl() { | ||
| 53 | + return data.getMessageUrlImg(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + | ||
| 57 | + @BindingAdapter({"app:imageUrl"}) | ||
| 58 | + public static void loadInternetImage(ImageView imageView, String url) { | ||
| 59 | + Glide.with(imageView.getContext()) | ||
| 60 | + .load(url) | ||
| 61 | + .placeholder(R.mipmap.login_no) | ||
| 62 | + .error(R.mipmap.login_no) | ||
| 63 | + .bitmapTransform(new CropCircleTransformation(imageView.getContext())) | ||
| 64 | + .into(imageView); | ||
| 65 | + | ||
| 66 | + | ||
| 67 | + | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + | ||
| 71 | +} |
app/src/main/res/layout/activity_my_message.xml
| 1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
| 2 | -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 3 | - android:layout_width="match_parent" | ||
| 4 | - android:layout_height="match_parent" | ||
| 5 | - android:orientation="vertical"> | ||
| 6 | 2 | ||
| 7 | - <RelativeLayout | 3 | +<layout xmlns:android="http://schemas.android.com/apk/res/android"> |
| 4 | + | ||
| 5 | + <data> | ||
| 6 | + | ||
| 7 | + <variable | ||
| 8 | + name="myMessageModleView" | ||
| 9 | + type="com.cnlive.goldenline.viewmodel.MyMessageModleView" /> | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + </data> | ||
| 13 | + | ||
| 14 | + <LinearLayout | ||
| 8 | android:layout_width="match_parent" | 15 | android:layout_width="match_parent" |
| 9 | - android:layout_height="45dp" | ||
| 10 | - android:background="@color/colorPrimaryDark"> | ||
| 11 | - | ||
| 12 | - <ImageButton | ||
| 13 | - android:id="@+id/button_back" | ||
| 14 | - android:layout_width="wrap_content" | ||
| 15 | - android:layout_height="wrap_content" | ||
| 16 | - android:layout_centerVertical="true" | ||
| 17 | - android:layout_marginLeft="4dp" | ||
| 18 | - android:background="@mipmap/button_back_white_arror" | ||
| 19 | - android:scaleType="fitXY" /> | ||
| 20 | - | ||
| 21 | - <TextView | ||
| 22 | - android:id="@+id/text_middle_title" | 16 | + android:layout_height="match_parent" |
| 17 | + android:orientation="vertical"> | ||
| 18 | + | ||
| 19 | + <RelativeLayout | ||
| 23 | android:layout_width="match_parent" | 20 | android:layout_width="match_parent" |
| 24 | - android:layout_height="wrap_content" | ||
| 25 | - android:layout_centerInParent="true" | ||
| 26 | - android:gravity="center" | ||
| 27 | - android:text="我的消息" | ||
| 28 | - android:textColor="@color/white" | ||
| 29 | - android:textSize="17sp" /> | ||
| 30 | - </RelativeLayout> | ||
| 31 | - | ||
| 32 | - <RelativeLayout | ||
| 33 | - android:layout_width="match_parent" | ||
| 34 | - android:layout_height="match_parent"> | 21 | + android:layout_height="45dp" |
| 22 | + android:background="@color/colorPrimaryDark"> | ||
| 35 | 23 | ||
| 36 | - <com.cnlive.goldenline.ui.widget.pull2refresh.PullToRefreshLayout | ||
| 37 | - android:id="@+id/pull_to_refresh" | 24 | + <ImageButton |
| 25 | + android:id="@+id/button_back" | ||
| 26 | + android:layout_width="wrap_content" | ||
| 27 | + android:layout_height="wrap_content" | ||
| 28 | + android:layout_centerVertical="true" | ||
| 29 | + android:layout_marginLeft="4dp" | ||
| 30 | + android:background="@mipmap/button_back_white_arror" | ||
| 31 | + android:scaleType="fitXY" /> | ||
| 32 | + | ||
| 33 | + <TextView | ||
| 34 | + android:id="@+id/text_middle_title" | ||
| 35 | + android:layout_width="match_parent" | ||
| 36 | + android:layout_height="wrap_content" | ||
| 37 | + android:layout_centerInParent="true" | ||
| 38 | + android:gravity="center" | ||
| 39 | + android:text="我的消息" | ||
| 40 | + android:textColor="@color/white" | ||
| 41 | + android:textSize="17sp" /> | ||
| 42 | + </RelativeLayout> | ||
| 43 | + | ||
| 44 | + <RelativeLayout | ||
| 38 | android:layout_width="match_parent" | 45 | android:layout_width="match_parent" |
| 39 | android:layout_height="match_parent"> | 46 | android:layout_height="match_parent"> |
| 40 | 47 | ||
| 41 | - <com.cnlive.goldenline.ui.widget.pull2refresh.PullableRecyclerView | ||
| 42 | - android:id="@+id/recycle_msg" | 48 | + <com.cnlive.goldenline.ui.widget.pull2refresh.PullToRefreshLayout |
| 49 | + android:id="@+id/pull_to_refresh" | ||
| 43 | android:layout_width="match_parent" | 50 | android:layout_width="match_parent" |
| 44 | - android:layout_height="match_parent" /> | ||
| 45 | - </com.cnlive.goldenline.ui.widget.pull2refresh.PullToRefreshLayout> | 51 | + android:layout_height="match_parent"> |
| 46 | 52 | ||
| 47 | - <TextView | ||
| 48 | - android:visibility="gone" | ||
| 49 | - android:id="@+id/errorText" | ||
| 50 | - android:layout_width="match_parent" | ||
| 51 | - android:layout_height="match_parent" | ||
| 52 | - android:background="@drawable/my_message_null" /> | 53 | + <com.cnlive.goldenline.ui.widget.pull2refresh.PullableRecyclerView |
| 54 | + android:id="@+id/recycle_msg" | ||
| 55 | + android:layout_width="match_parent" | ||
| 56 | + android:layout_height="match_parent" /> | ||
| 57 | + </com.cnlive.goldenline.ui.widget.pull2refresh.PullToRefreshLayout> | ||
| 58 | + | ||
| 59 | + <TextView | ||
| 60 | + android:id="@+id/errorText" | ||
| 61 | + android:layout_width="match_parent" | ||
| 62 | + android:layout_height="match_parent" | ||
| 63 | + android:background="@drawable/my_message_null" | ||
| 64 | + android:visibility="gone" /> | ||
| 53 | 65 | ||
| 54 | - </RelativeLayout> | 66 | + </RelativeLayout> |
| 55 | 67 | ||
| 56 | -</LinearLayout> | 68 | + </LinearLayout> |
| 69 | +</layout> | ||
| 57 | \ No newline at end of file | 70 | \ No newline at end of file |
app/src/main/res/layout/layout_msg_item_2.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="utf-8"?> | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +<layout xmlns:android="http://schemas.android.com/apk/res/android" | ||
| 5 | + xmlns:app="http://schemas.android.com/apk/res-auto"> | ||
| 6 | + | ||
| 7 | + <data> | ||
| 8 | + <variable | ||
| 9 | + name="msgModleView" | ||
| 10 | + type="com.cnlive.goldenline.viewmodel.MyMessageModleView"/> | ||
| 11 | + | ||
| 12 | + </data> | ||
| 13 | +<LinearLayout | ||
| 14 | + android:layout_width="match_parent" | ||
| 15 | + android:id="@+id/ll_item" | ||
| 16 | + android:layout_height="wrap_content" | ||
| 17 | + android:background="?android:attr/selectableItemBackground" | ||
| 18 | + android:orientation="vertical"> | ||
| 19 | + | ||
| 20 | + <RelativeLayout | ||
| 21 | + android:layout_width="match_parent" | ||
| 22 | + android:layout_height="61dp"> | ||
| 23 | + | ||
| 24 | + <ImageView | ||
| 25 | + android:id="@+id/ima_msg_head" | ||
| 26 | + android:layout_width="46dp" | ||
| 27 | + android:layout_height="46dp" | ||
| 28 | + android:layout_marginLeft="15dp" | ||
| 29 | + android:src="@mipmap/login_no" | ||
| 30 | + app:imageUrl="@{msgModleView.imageUrl}" | ||
| 31 | + | ||
| 32 | + android:layout_alignBottom="@+id/tv_msg_content" | ||
| 33 | + android:layout_alignParentStart="true" | ||
| 34 | + android:layout_marginStart="15dp" /> | ||
| 35 | + | ||
| 36 | + <TextView | ||
| 37 | + android:id="@+id/tv_msg_title" | ||
| 38 | + android:layout_width="wrap_content" | ||
| 39 | + android:layout_height="wrap_content" | ||
| 40 | + android:layout_marginLeft="12dp" | ||
| 41 | + android:layout_marginRight="3dp" | ||
| 42 | + android:layout_marginTop="10dp" | ||
| 43 | + android:layout_toLeftOf="@+id/tv_msg_date" | ||
| 44 | + android:layout_toRightOf="@id/ima_msg_head" | ||
| 45 | + android:ellipsize="end" | ||
| 46 | + android:singleLine="true" | ||
| 47 | + android:text="@{msgModleView.title}" | ||
| 48 | + android:textColor="@color/color_010101" | ||
| 49 | + android:textSize="14sp" /> | ||
| 50 | + | ||
| 51 | + <TextView | ||
| 52 | + android:id="@+id/tv_msg_content" | ||
| 53 | + android:layout_width="wrap_content" | ||
| 54 | + android:layout_height="wrap_content" | ||
| 55 | + android:layout_below="@id/tv_msg_title" | ||
| 56 | + android:layout_marginLeft="12dp" | ||
| 57 | + android:layout_marginTop="6dp" | ||
| 58 | + android:layout_toLeftOf="@+id/tv_msg_date" | ||
| 59 | + android:layout_toRightOf="@id/ima_msg_head" | ||
| 60 | + android:ellipsize="end" | ||
| 61 | + android:singleLine="true" | ||
| 62 | + android:text="@{msgModleView.content}" | ||
| 63 | + android:textColor="@color/color_a5a5a5" | ||
| 64 | + android:textSize="13sp" /> | ||
| 65 | + | ||
| 66 | + <TextView | ||
| 67 | + android:id="@+id/tv_msg_date" | ||
| 68 | + android:layout_width="wrap_content" | ||
| 69 | + android:layout_height="wrap_content" | ||
| 70 | + android:layout_alignParentRight="true" | ||
| 71 | + android:layout_marginRight="16dp" | ||
| 72 | + android:layout_marginTop="15dp" | ||
| 73 | + android:text="@{msgModleView.time}" | ||
| 74 | + android:textColor="@color/color_a5a5a5" | ||
| 75 | + android:textSize="11sp" /> | ||
| 76 | + </RelativeLayout> | ||
| 77 | + | ||
| 78 | + <View | ||
| 79 | + android:layout_width="match_parent" | ||
| 80 | + android:layout_height="1dp" | ||
| 81 | + android:layout_marginLeft="73dp" | ||
| 82 | + android:background="@color/color_ededed" /> | ||
| 83 | +</LinearLayout> | ||
| 84 | +</layout> | ||
| 0 | \ No newline at end of file | 85 | \ No newline at end of file |