Commit 575c7865 by 罗翻

自定义lrecyclerview和coreAdapter

parent 25a593b2
Showing with 847 additions and 258 deletions
...@@ -24,7 +24,6 @@ public class Constants { ...@@ -24,7 +24,6 @@ public class Constants {
public static final String BASE_URL = "http://47.94.101.239:3112"; public static final String BASE_URL = "http://47.94.101.239:3112";
public final static String UP_PHOTO = "/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply"; public final static String UP_PHOTO = "/file/uploadMore?targetPath=test/sp/mobile/android/business/checkApply";
public final static String WEB_SOP = "http://47.94.101.239:9004/#/sop"; public final static String WEB_SOP = "http://47.94.101.239:9004/#/sop";
// public final static String WEB_SOP = "http://192.168.1.117:8080/#/sop";
/**************************正式环境*******************************/ /**************************正式环境*******************************/
// public static final int DEBUGLEVEL = LogUtils.LEVEL_OFF; // public static final int DEBUGLEVEL = LogUtils.LEVEL_OFF;
...@@ -85,7 +84,7 @@ public class Constants { ...@@ -85,7 +84,7 @@ public class Constants {
/***********************其他配置**********************************/ /***********************其他配置**********************************/
public final static int PAGESIZE = 5; public final static int PAGESIZE = 10;
//相册选择照片删除时传递的key //相册选择照片删除时传递的key
public final static String BUNDLE_KEY_ID = "BUNDLE_KEY_ID"; public final static String BUNDLE_KEY_ID = "BUNDLE_KEY_ID";
//通用的工程师id //通用的工程师id
...@@ -115,6 +114,7 @@ public class Constants { ...@@ -115,6 +114,7 @@ public class Constants {
public final static String SECOND_INDEX = "dump_second_index"; public final static String SECOND_INDEX = "dump_second_index";
//环信message //环信message
public final static String HX_MESSAGE = "hx_message"; public final static String HX_MESSAGE = "hx_message";
public static final int FLAG_MULTI_VH = 0x000001;
//订单状态 //订单状态
public final static int WATING_ORDER = 1; public final static int WATING_ORDER = 1;
public final static int APPOIMENT_ORDER = 2; public final static int APPOIMENT_ORDER = 2;
......
...@@ -142,7 +142,7 @@ public class Api { ...@@ -142,7 +142,7 @@ public class Api {
.header("token", token) .header("token", token)
.build(); .build();
} }
Log.d("request_header", request.headers().toString()); // Log.d("request_header", request.headers().toString());
return chain.proceed(request); return chain.proceed(request);
} }
......
...@@ -6,10 +6,10 @@ import android.util.Log; ...@@ -6,10 +6,10 @@ import android.util.Log;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
import com.dayu.bigfish.api.APIException; import com.dayu.bigfish.api.APIException;
import com.dayu.bigfish.ui.LoginActivity;
import com.dayu.bigfish.ui.views.CustomDialog;
import com.dayu.bigfish.utils.ProgressUtil; import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.managers.UserManager; import com.dayu.bigfish.utils.managers.UserManager;
import com.dayu.bigfish.ui.LoginActivity;
import com.dayu.bigfish.ui.views.CustomDialog;
import com.hyphenate.chat.EMClient; import com.hyphenate.chat.EMClient;
import io.reactivex.Observer; import io.reactivex.Observer;
......
package com.dayu.bigfish.base.adapter; package com.dayu.bigfish.base;
import android.databinding.ViewDataBinding; import android.databinding.ViewDataBinding;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
...@@ -6,10 +6,10 @@ import android.support.v7.widget.RecyclerView; ...@@ -6,10 +6,10 @@ import android.support.v7.widget.RecyclerView;
/** /**
* Created by luofan on 2017/12/9. * Created by luofan on 2017/12/9.
*/ */
public class BaseViewHolder<T extends ViewDataBinding> extends RecyclerView.ViewHolder { public class BaseViewHolder<B extends ViewDataBinding> extends RecyclerView.ViewHolder {
public final T mBind; public final B mBind;
public BaseViewHolder(T t) { public BaseViewHolder(B t) {
super(t.getRoot()); super(t.getRoot());
mBind = t; mBind = t;
} }
......
package com.dayu.bigfish.base.adapter; package com.dayu.bigfish.base;
import android.content.Context; import android.content.Context;
import android.databinding.DataBindingUtil; import android.databinding.DataBindingUtil;
...@@ -10,7 +10,7 @@ import android.view.ViewGroup; ...@@ -10,7 +10,7 @@ import android.view.ViewGroup;
import com.dayu.bigfish.BR; import com.dayu.bigfish.BR;
import com.dayu.bigfish.Constants; import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BasePageBean; import com.dayu.bigfish.ui.listener.OnItemClickListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -19,7 +19,7 @@ import java.util.List; ...@@ -19,7 +19,7 @@ import java.util.List;
* Created by luofan on 2017/12/9. * Created by luofan on 2017/12/9.
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
private boolean needHint = false; private boolean needHint = false;
private TypeSelector<M> mTypeSelector; private TypeSelector<M> mTypeSelector;
private List<M> mItemList = new ArrayList<>(); private List<M> mItemList = new ArrayList<>();
...@@ -27,11 +27,13 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { ...@@ -27,11 +27,13 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> {
private List<Item> mHeadTypeDatas = new ArrayList<>(); private List<Item> mHeadTypeDatas = new ArrayList<>();
private List<Item> mFootTypeDatas = new ArrayList<>(); private List<Item> mFootTypeDatas = new ArrayList<>();
private int viewType; private int viewType;
private int mFooterViewType = R.layout.recycler_foot; private int mFooterViewType = R.layout.lrecycler_foot;
protected Context mContext; protected Context mContext;
private int mTotalPage; private int mTotalPage;
private int mPage = 1; private int mPage = 1;
public boolean isLoadFial = false; public boolean isLoadFial = false;
private OnItemClickListener mOnItemClickListener;
private BasePresenter mPresenter;
@Override @Override
public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
...@@ -39,8 +41,10 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { ...@@ -39,8 +41,10 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> {
return new BaseViewHolder(DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), viewType, parent, false)); return new BaseViewHolder(DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()), viewType, parent, false));
} }
public CoreAdapter() { public CoreAdapter(boolean needFoot) {
mFootTypeDatas.add(new Item(mFooterViewType, true)); if (needFoot) {
mFootTypeDatas.add(new Item(mFooterViewType, true));
}
} }
@Override @Override
...@@ -59,10 +63,18 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { ...@@ -59,10 +63,18 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> {
if (needHint) { if (needHint) {
holder.itemView.setTag(item); holder.itemView.setTag(item);
} }
if (mPresenter != null) {
holder.mBind.setVariable(BR.presenter, mPresenter);
}
holder.mBind.setVariable(BR.item, item); holder.mBind.setVariable(BR.item, item);
holder.mBind.executePendingBindings(); holder.mBind.executePendingBindings();
if (item != null && !(item instanceof Boolean)) { if (item != null && !(item instanceof Boolean)) {
onBind(holder, position, (M) item); onBind(holder, position, (M) item);
holder.mBind.getRoot().setOnClickListener(v -> {
if (mOnItemClickListener != null) {
mOnItemClickListener.OnItemClick(item, holder.mBind, position);
}
});
} }
} }
} }
...@@ -120,7 +132,7 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { ...@@ -120,7 +132,7 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> {
} }
} }
public void addData(BasePageBean<M> data) { public void addPageData(BasePageBean<M> data) {
if (data == null) { if (data == null) {
isHasMore = false; isHasMore = false;
notifyDataSetChanged(); notifyDataSetChanged();
...@@ -137,7 +149,7 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { ...@@ -137,7 +149,7 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> {
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void setNewData(BasePageBean<M> data) { public void setPageData(BasePageBean<M> data) {
mPage = 1; mPage = 1;
mTotalPage = data.getTotalPages(); mTotalPage = data.getTotalPages();
if (mPage >= mTotalPage) { if (mPage >= mTotalPage) {
...@@ -149,11 +161,20 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { ...@@ -149,11 +161,20 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> {
notifyDataSetChanged(); notifyDataSetChanged();
} }
public void setData(List<M> data) {
this.mItemList = data;
notifyDataSetChanged();
}
@Override @Override
public int getItemCount() { public int getItemCount() {
return mItemList.size() + mHeadTypeDatas.size() + mFootTypeDatas.size(); return mItemList.size() + mHeadTypeDatas.size() + mFootTypeDatas.size();
} }
public void setPresenter(BasePresenter presenter) {
mPresenter = presenter;
}
public class Item { public class Item {
int type; int type;
Object data; Object data;
...@@ -166,4 +187,13 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> { ...@@ -166,4 +187,13 @@ public class CoreAdapter<M> extends RecyclerView.Adapter<BaseViewHolder> {
protected void onBind(BaseViewHolder holder, int position, M item) { protected void onBind(BaseViewHolder holder, int position, M item) {
} }
public void setOnItemClickListener(OnItemClickListener<M, B> listener) {
mOnItemClickListener = listener;
}
public Context getContext() {
return mContext;
}
} }
\ No newline at end of file
package com.dayu.bigfish.base.adapter; package com.dayu.bigfish.base;
/** /**
* Created by luofan on 2017/12/9. * Created by luofan on 2017/12/9.
......
...@@ -99,13 +99,13 @@ public class OrderDetail { ...@@ -99,13 +99,13 @@ public class OrderDetail {
private String appointmentTime; private String appointmentTime;
private String comment; private String comment;
private String confirmDoorTime; private String confirmDoorTime;
private Object confirmDoorComment; private String confirmDoorComment;
private Object serviceRecordComment; private Object serviceRecordComment;
private Object customerCheckComment; private Object customerCheckComment;
private Integer isPay; private Integer isPay;
private Object payType; private Object payType;
private Integer doorPrice; private Integer doorPrice;
private Object doorPriceComment; private String doorPriceComment;
private Integer servicePrice; private Integer servicePrice;
private Object servicePriceComment; private Object servicePriceComment;
private Integer materialCost; private Integer materialCost;
...@@ -399,11 +399,11 @@ public class OrderDetail { ...@@ -399,11 +399,11 @@ public class OrderDetail {
this.confirmDoorTime = confirmDoorTime; this.confirmDoorTime = confirmDoorTime;
} }
public Object getConfirmDoorComment() { public String getConfirmDoorComment() {
return confirmDoorComment; return confirmDoorComment;
} }
public void setConfirmDoorComment(Object confirmDoorComment) { public void setConfirmDoorComment(String confirmDoorComment) {
this.confirmDoorComment = confirmDoorComment; this.confirmDoorComment = confirmDoorComment;
} }
...@@ -447,11 +447,11 @@ public class OrderDetail { ...@@ -447,11 +447,11 @@ public class OrderDetail {
this.doorPrice = doorPrice; this.doorPrice = doorPrice;
} }
public Object getDoorPriceComment() { public String getDoorPriceComment() {
return doorPriceComment; return doorPriceComment;
} }
public void setDoorPriceComment(Object doorPriceComment) { public void setDoorPriceComment(String doorPriceComment) {
this.doorPriceComment = doorPriceComment; this.doorPriceComment = doorPriceComment;
} }
......
...@@ -24,12 +24,7 @@ public class AccountBalancePresenter extends AccountBalanceContract.Presenter { ...@@ -24,12 +24,7 @@ public class AccountBalancePresenter extends AccountBalanceContract.Presenter {
public void accept(BasePageBean<AccountBalance> accountBalanceBasePageBean) throws Exception { public void accept(BasePageBean<AccountBalance> accountBalanceBasePageBean) throws Exception {
mView.getBalanceSuccess(accountBalanceBasePageBean); mView.getBalanceSuccess(accountBalanceBasePageBean);
} }
}, new Consumer<Throwable>() { }, throwable -> mView.getBalanceError()));
@Override
public void accept(Throwable throwable) throws Exception {
mView.getBalanceError();
}
}));
} }
@Override @Override
......
...@@ -9,8 +9,6 @@ import com.app.annotation.apt.InstanceFactory; ...@@ -9,8 +9,6 @@ import com.app.annotation.apt.InstanceFactory;
@InstanceFactory @InstanceFactory
public class HomeMessagePresenter extends HomeMessageContract.Presenter { public class HomeMessagePresenter extends HomeMessageContract.Presenter {
@Override @Override
public void onAttached() { public void onAttached() {
......
...@@ -20,8 +20,40 @@ public interface messageContract { ...@@ -20,8 +20,40 @@ public interface messageContract {
} }
abstract class Presenter extends BasePresenter<View> { abstract class Presenter extends BasePresenter<View> {
/**
* 获取换新消息.
*
* @param hxUserId
* @param category 1:系统消息,2:大鱼通知.
* @param page
* @param pageSize
*/
public abstract void getHxMessage(String hxUserId, int category, int page, int pageSize); public abstract void getHxMessage(String hxUserId, int category, int page, int pageSize);
public abstract void readMessage(int id,int read); /**
* 阅读信息
*
* @param id messageId.
* @param read 默认1.
*/
public abstract void readMessage(int id, int read);
/**
* 格式化时间.
*
* @param time
* @param srcPattern
* @param pattern
* @return
*/
public abstract String FomartTime(String time, String srcPattern, String pattern);
/**
* 阅读信息并跳转.
*
* @param message
* @param view
*/
public abstract void readAndDump(NewMessage message, android.view.View view);
} }
} }
package com.dayu.bigfish.presenter.message; package com.dayu.bigfish.presenter.message;
import android.content.Intent;
import android.view.View;
import com.app.annotation.apt.InstanceFactory; import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory; import com.apt.ApiFactory;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BasePageBean; import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.NewMessage; import com.dayu.bigfish.bean.NewMessage;
import com.dayu.bigfish.ui.SystemMesDetailActivity;
import com.dayu.bigfish.utils.UtilsDate;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.text.ParseException;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import static com.dayu.bigfish.utils.UtilsDate.LONG_TIME_FORMAT_TWO;
/** /**
* Created by luofan on 2017/11/8. * Created by luofan on 2017/11/8.
*/ */
...@@ -30,12 +41,7 @@ public class messagePresenter extends messageContract.Presenter { ...@@ -30,12 +41,7 @@ public class messagePresenter extends messageContract.Presenter {
public void accept(BasePageBean<NewMessage> messageBasePageBean) throws Exception { public void accept(BasePageBean<NewMessage> messageBasePageBean) throws Exception {
mView.getHxMessageSuccess(messageBasePageBean); mView.getHxMessageSuccess(messageBasePageBean);
} }
}, new Consumer<Throwable>() { }, throwable -> mView.getHxMessageFail()));
@Override
public void accept(Throwable throwable) throws Exception {
mView.getHxMessageFail();
}
}));
} }
@Override @Override
...@@ -56,4 +62,34 @@ public class messagePresenter extends messageContract.Presenter { ...@@ -56,4 +62,34 @@ public class messagePresenter extends messageContract.Presenter {
})); }));
} }
@Override
public String FomartTime(String time, String srcPattern, String pattern) {
try {
if (pattern.equals(LONG_TIME_FORMAT_TWO)) {
return UtilsDate.changeFormat(time, srcPattern, pattern);
}
if (UtilsDate.IsToday(time)) {
return mActivity.getString(R.string.today);
} else if (UtilsDate.IsNextday(time)) {
return mActivity.getString(R.string.tomorrow);
} else {
return UtilsDate.changeFormat(time, srcPattern, pattern);
}
} catch (ParseException e) {
e.printStackTrace();
return "";
}
}
@Override
public void readAndDump(NewMessage message, View view) {
if (message.getRead() == 0) {
readMessage(message.getId(), 1);
view.setVisibility(View.GONE);
}
Intent intent = new Intent(mActivity, SystemMesDetailActivity.class);
intent.putExtra(Constants.HX_MESSAGE, message);
intent.putExtra("category", message.getCategory());
mActivity.startActivity(intent);
}
} }
...@@ -17,6 +17,7 @@ public interface OrderDetailContract { ...@@ -17,6 +17,7 @@ public interface OrderDetailContract {
* 备注过长,显示查看更多. * 备注过长,显示查看更多.
*/ */
void lookMore(); void lookMore();
} }
abstract class Presenter extends BasePresenter<View> { abstract class Presenter extends BasePresenter<View> {
...@@ -26,5 +27,10 @@ public interface OrderDetailContract { ...@@ -26,5 +27,10 @@ public interface OrderDetailContract {
* 备注过长,显示查看更多. * 备注过长,显示查看更多.
*/ */
public abstract void lookMore(); public abstract void lookMore();
/**
* 获取订单状态.
*/
public abstract String getStaus(int staus);
} }
} }
...@@ -2,6 +2,7 @@ package com.dayu.bigfish.presenter.orderdetail; ...@@ -2,6 +2,7 @@ package com.dayu.bigfish.presenter.orderdetail;
import com.app.annotation.apt.InstanceFactory; import com.app.annotation.apt.InstanceFactory;
import com.apt.ApiFactory; import com.apt.ApiFactory;
import com.dayu.bigfish.R;
import com.dayu.bigfish.bean.OrderDetail; import com.dayu.bigfish.bean.OrderDetail;
import io.reactivex.functions.Consumer; import io.reactivex.functions.Consumer;
...@@ -32,5 +33,24 @@ public class OrderDetailPresenter extends OrderDetailContract.Presenter { ...@@ -32,5 +33,24 @@ public class OrderDetailPresenter extends OrderDetailContract.Presenter {
mView.lookMore(); mView.lookMore();
} }
@Override
public String getStaus(int staus) {
if (staus == 1) {
return mActivity.getString(R.string.not_receive_order);
} else if (staus == 2) {
return mActivity.getString(R.string.not_appointment_already);
} else if (staus == 3) {
return mActivity.getString(R.string.appointment_already);
} else if (staus == 4) {
return mActivity.getString(R.string.order_doing);
} else if (staus == 5) {
return mActivity.getString(R.string.finish_order);
} else if (staus == 6) {
return mActivity.getString(R.string.cancle_order);
} else if (staus == 7) {
return mActivity.getString(R.string.order_close);
} else {
return null;
}
}
} }
...@@ -28,6 +28,7 @@ public class WorksRecordPresenter extends WroksRecordContract.Presenter { ...@@ -28,6 +28,7 @@ public class WorksRecordPresenter extends WroksRecordContract.Presenter {
}, throwable -> mView.getWorkRecordFail())); }, throwable -> mView.getWorkRecordFail()));
} }
@Override @Override
public void hideSearch() { public void hideSearch() {
mView.hideSearch(); mView.hideSearch();
...@@ -37,4 +38,5 @@ public class WorksRecordPresenter extends WroksRecordContract.Presenter { ...@@ -37,4 +38,5 @@ public class WorksRecordPresenter extends WroksRecordContract.Presenter {
public void showSearch() { public void showSearch() {
mView.showSearch(); mView.showSearch();
} }
} }
...@@ -59,6 +59,7 @@ public class AccountBalanceActivity extends BaseBingdActivity<AccountBalancePres ...@@ -59,6 +59,7 @@ public class AccountBalanceActivity extends BaseBingdActivity<AccountBalancePres
mBind.swipeRefersh.setOnRefreshListener(this); mBind.swipeRefersh.setOnRefreshListener(this);
mAdapter.setOnLoadMoreListener(this, mBind.rlBalance); mAdapter.setOnLoadMoreListener(this, mBind.rlBalance);
mAdapter.setEnableLoadMore(false); mAdapter.setEnableLoadMore(false);
} }
@Override @Override
......
...@@ -102,7 +102,6 @@ public class ReceivingActivity extends BaseBingdActivity<ReceivingPresenter, Act ...@@ -102,7 +102,6 @@ public class ReceivingActivity extends BaseBingdActivity<ReceivingPresenter, Act
mAdapter.loadMoreEnd(); mAdapter.loadMoreEnd();
} else { } else {
mAdapter.loadMoreComplete(); mAdapter.loadMoreComplete();
mPage += 1;
} }
mPage += 1; mPage += 1;
if (orders.getData().size() == 0) { if (orders.getData().size() == 0) {
......
...@@ -27,7 +27,7 @@ import static com.dayu.bigfish.utils.UtilsDate.SHORT_DATE_FORMAT; ...@@ -27,7 +27,7 @@ import static com.dayu.bigfish.utils.UtilsDate.SHORT_DATE_FORMAT;
public class SystemMesDetailActivity extends DataBindingActivity<ActivityMessageDetailBinding> { public class SystemMesDetailActivity extends DataBindingActivity<ActivityMessageDetailBinding> {
private NewMessage message; private NewMessage message;
private int mState; private int mCategory;
@Override @Override
public int getLayoutId() { public int getLayoutId() {
...@@ -38,7 +38,7 @@ public class SystemMesDetailActivity extends DataBindingActivity<ActivityMessage ...@@ -38,7 +38,7 @@ public class SystemMesDetailActivity extends DataBindingActivity<ActivityMessage
public void initView() { public void initView() {
mBind.tvTitle.setText(getString(R.string.message_dayu_detail)); mBind.tvTitle.setText(getString(R.string.message_dayu_detail));
message = (NewMessage) getIntent().getSerializableExtra(Constants.HX_MESSAGE); message = (NewMessage) getIntent().getSerializableExtra(Constants.HX_MESSAGE);
mState = getIntent().getIntExtra("state", 0); mCategory = getIntent().getIntExtra("category", 1);
String time = null; String time = null;
try { try {
String dateMD = UtilsDate.changeFormat(message.getCreateTime(), FORMAT_ONE, SHORT_DATE_FORMAT); String dateMD = UtilsDate.changeFormat(message.getCreateTime(), FORMAT_ONE, SHORT_DATE_FORMAT);
...@@ -54,7 +54,7 @@ public class SystemMesDetailActivity extends DataBindingActivity<ActivityMessage ...@@ -54,7 +54,7 @@ public class SystemMesDetailActivity extends DataBindingActivity<ActivityMessage
mBind.tvMessageTitle.setText(message.getTitle()); mBind.tvMessageTitle.setText(message.getTitle());
mBind.tvMessageTime.setText(time); mBind.tvMessageTime.setText(time);
mBind.tvMessageContent.setText("\u3000" + "\u3000" + message.getContent()); mBind.tvMessageContent.setText("\u3000" + "\u3000" + message.getContent());
if (mState == 1) { if (mCategory == 2) {
mBind.tvMessageCheck.setVisibility(View.GONE); mBind.tvMessageCheck.setVisibility(View.GONE);
} else { } else {
mBind.tvMessageCheck.setVisibility(View.VISIBLE); mBind.tvMessageCheck.setVisibility(View.VISIBLE);
......
...@@ -6,10 +6,9 @@ import android.support.v4.app.Fragment; ...@@ -6,10 +6,9 @@ import android.support.v4.app.Fragment;
import android.view.View; import android.view.View;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseBingFragment; import com.dayu.bigfish.base.DataBindingFragment;
import com.dayu.bigfish.databinding.FragmentMessageBinding; import com.dayu.bigfish.databinding.FragmentMessageBinding;
import com.dayu.bigfish.presenter.homemessage.HomeMessageContract; import com.dayu.bigfish.presenter.homemessage.HomeMessageContract;
import com.dayu.bigfish.presenter.homemessage.HomeMessagePresenter;
import com.dayu.bigfish.ui.adapter.FragmentOrderAdapter; import com.dayu.bigfish.ui.adapter.FragmentOrderAdapter;
import com.dayu.bigfish.utils.TabLayoutUtils; import com.dayu.bigfish.utils.TabLayoutUtils;
...@@ -20,7 +19,7 @@ import java.util.List; ...@@ -20,7 +19,7 @@ import java.util.List;
* Created by luofan on 2017/11/20. * Created by luofan on 2017/11/20.
*/ */
public class HomeMessageTabFragment extends BaseBingFragment<HomeMessagePresenter, FragmentMessageBinding> public class HomeMessageTabFragment extends DataBindingFragment<FragmentMessageBinding>
implements HomeMessageContract.View { implements HomeMessageContract.View {
private List<Fragment> list; private List<Fragment> list;
private FragmentOrderAdapter fragmentAdapter; private FragmentOrderAdapter fragmentAdapter;
...@@ -51,11 +50,19 @@ public class HomeMessageTabFragment extends BaseBingFragment<HomeMessagePresente ...@@ -51,11 +50,19 @@ public class HomeMessageTabFragment extends BaseBingFragment<HomeMessagePresente
public void initData() { public void initData() {
list = new ArrayList<>(); list = new ArrayList<>();
list.add(new SystemMessageFragment()); Bundle bundle = new Bundle();
list.add(new BigFishMessageFragment()); bundle.putInt("category", 1);
Bundle secondBundle = new Bundle();
secondBundle.putInt("category", 2);
MessageFragment systemMessageFragment = MessageFragment.newInstance();
MessageFragment dayuMessageFragment = MessageFragment.newInstance();
systemMessageFragment.setArguments(bundle);
dayuMessageFragment.setArguments(secondBundle);
list.add(systemMessageFragment);
list.add(dayuMessageFragment);
fragmentAdapter = new FragmentOrderAdapter(getActivity().getSupportFragmentManager(), list); fragmentAdapter = new FragmentOrderAdapter(getActivity().getSupportFragmentManager(), list);
mBind.vpMessage.setAdapter(fragmentAdapter); mBind.vpMessage.setAdapter(fragmentAdapter);
mBind.tbMessage.setupWithViewPager( mBind.vpMessage); mBind.tbMessage.setupWithViewPager(mBind.vpMessage);
mBind.tbMessage.removeAllTabs(); mBind.tbMessage.removeAllTabs();
mBind.tbMessage.addTab(mBind.tbMessage.newTab().setText(mActivity.getString(R.string.message_system))); mBind.tbMessage.addTab(mBind.tbMessage.newTab().setText(mActivity.getString(R.string.message_system)));
mBind.tbMessage.addTab(mBind.tbMessage.newTab().setText(mActivity.getString(R.string.message_dayu))); mBind.tbMessage.addTab(mBind.tbMessage.newTab().setText(mActivity.getString(R.string.message_dayu)));
......
...@@ -12,9 +12,6 @@ import android.view.ViewGroup; ...@@ -12,9 +12,6 @@ import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.dayu.bigfish.Constants; import com.dayu.bigfish.Constants;
import com.dayu.bigfish.MyApplication; import com.dayu.bigfish.MyApplication;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
...@@ -44,7 +41,7 @@ public class HomePersonFragment extends BaseBingFragment<HomeFourPresenter, Frag ...@@ -44,7 +41,7 @@ public class HomePersonFragment extends BaseBingFragment<HomeFourPresenter, Frag
implements HomeFourContract.View { implements HomeFourContract.View {
private int userId; private int userId;
private int siteId; private int siteId;
private String mHeaderUrl; private static String mHeaderUrl;
private String mUserName; private String mUserName;
private String mUserPhone; private String mUserPhone;
private String mScore; private String mScore;
...@@ -69,15 +66,8 @@ public class HomePersonFragment extends BaseBingFragment<HomeFourPresenter, Frag ...@@ -69,15 +66,8 @@ public class HomePersonFragment extends BaseBingFragment<HomeFourPresenter, Frag
mBind.tvAllAchivement.setTypeface(tf); mBind.tvAllAchivement.setTypeface(tf);
mBind.tvOrderRecord.setTypeface(tf); mBind.tvOrderRecord.setTypeface(tf);
mHeaderUrl = GetUserInfo.getUserHead(mActivity); mHeaderUrl = GetUserInfo.getUserHead(mActivity);
if (TextUtils.isEmpty(mHeaderUrl)) { if (!TextUtils.isEmpty(mHeaderUrl)){
mBind.ivHeader.setImageResource(R.mipmap.user_head); mBind.setImgurl(mHeaderUrl);
} else {
RequestOptions options = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL);
Glide.with(this)
.load(mHeaderUrl)
.apply(options)
.into(mBind.ivHeader);
} }
return view; return view;
} }
...@@ -115,14 +105,14 @@ public class HomePersonFragment extends BaseBingFragment<HomeFourPresenter, Frag ...@@ -115,14 +105,14 @@ public class HomePersonFragment extends BaseBingFragment<HomeFourPresenter, Frag
private void showAlertDialog() { private void showAlertDialog() {
CustomDialog dialog = new CustomDialog(mActivity, R.style.custom_dialog2, mActivity.getString(R.string.not_set_account) CustomDialog dialog = new CustomDialog(mActivity, R.style.custom_dialog2, mActivity.getString(R.string.not_set_account)
, (dialog1, confirm) -> { , (dialog1, confirm) -> {
if (confirm) { if (confirm) {
Intent intent = new Intent(mActivity, WithdrawalsActivity.class); Intent intent = new Intent(mActivity, WithdrawalsActivity.class);
startActivity(intent); startActivity(intent);
dialog1.dismiss(); dialog1.dismiss();
} else { } else {
} }
dialog1.dismiss(); dialog1.dismiss();
}); });
dialog.setTitle(mActivity.getString(R.string.notice)) dialog.setTitle(mActivity.getString(R.string.notice))
.setNegativeButton(mActivity.getString(R.string.not_set_account)) .setNegativeButton(mActivity.getString(R.string.not_set_account))
.setPositiveButton(mActivity.getString(R.string.go_set_up)); .setPositiveButton(mActivity.getString(R.string.go_set_up));
......
package com.dayu.bigfish.ui.fragment;
import android.os.Bundle;
import android.view.View;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseBingFragment;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.bean.NewMessage;
import com.dayu.bigfish.databinding.LrecyclerViewBinding;
import com.dayu.bigfish.presenter.message.messageContract;
import com.dayu.bigfish.presenter.message.messagePresenter;
import com.dayu.bigfish.utils.GetUserInfo;
import com.dayu.bigfish.utils.ProgressUtil;
/**
* 系统工单状态通知
* on 2017/10/11.
*/
public class MessageFragment extends BaseBingFragment<messagePresenter, LrecyclerViewBinding>
implements messageContract.View {
private String hxUserId;
private int mPage = 1;
private int mPageSize = Constants.PAGESIZE;
private int mCategory = 1;
public static MessageFragment newInstance() {
Bundle args = new Bundle();
MessageFragment fragment = new MessageFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public View initView(View view) {
mCategory = getArguments().getInt("category", 1);
if (mCategory == 1) {
initData();
}
return view;
}
@Override
public int getLayoutId() {
return R.layout.lrecycler_view;
}
@Override
protected void lazyLoad() {
if (mCategory == 2) {
initData();
}
}
public void initData() {
hxUserId = GetUserInfo.getHxUserId(mActivity);
ProgressUtil.startLoad(mActivity);
mPresenter.getHxMessage(hxUserId, mCategory, mPage, mPageSize);
initListener();
}
private void initListener() {
mBind.lRecycle.setPresenter(mPresenter);
mBind.lRecycle.setRefreshListener(() -> {
mPage = 1;
mPresenter.getHxMessage(hxUserId, mCategory, mPage, mPageSize);
});
mBind.lRecycle.setOnLoadMoreListener(
() -> mPresenter.getHxMessage(hxUserId, mCategory, mPage, mPageSize));
}
@Override
public void getHxMessageSuccess(BasePageBean<NewMessage> message) {
mPage++;
mBind.lRecycle.setPageData(message);
}
@Override
public void getHxMessageFail() {
mBind.lRecycle.setDataFail();
}
@Override
public void readMessageSuccess() {
}
}
...@@ -5,13 +5,13 @@ import android.view.View; ...@@ -5,13 +5,13 @@ import android.view.View;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseBingFragment; import com.dayu.bigfish.base.BaseBingFragment;
import com.dayu.bigfish.base.CoreAdapter;
import com.dayu.bigfish.bean.OrderDetail; import com.dayu.bigfish.bean.OrderDetail;
import com.dayu.bigfish.databinding.FragmentOrderDatailsBinding; import com.dayu.bigfish.databinding.FragmentOrderDatailsBinding;
import com.dayu.bigfish.presenter.orderdetail.OrderDetailContract; import com.dayu.bigfish.presenter.orderdetail.OrderDetailContract;
import com.dayu.bigfish.presenter.orderdetail.OrderDetailPresenter; import com.dayu.bigfish.presenter.orderdetail.OrderDetailPresenter;
import com.dayu.bigfish.ui.adapter.AccessoriesAdapter;
import com.dayu.bigfish.utils.ProgressUtil; import com.dayu.bigfish.utils.ProgressUtil;
import com.dayu.bigfish.utils.UIUtils;
/** /**
* 工单记录的Fragment * 工单记录的Fragment
...@@ -22,9 +22,8 @@ public class OrderDatailsFragment extends BaseBingFragment<OrderDetailPresenter, ...@@ -22,9 +22,8 @@ public class OrderDatailsFragment extends BaseBingFragment<OrderDetailPresenter,
implements OrderDetailContract.View { implements OrderDetailContract.View {
private int orderId; private int orderId;
private int mOrderStaus;
private boolean mFlag = true; private boolean mFlag = true;
private AccessoriesAdapter mAdapter; private CoreAdapter mAdapter;
@Override @Override
public View initView(View view) { public View initView(View view) {
...@@ -53,32 +52,12 @@ public class OrderDatailsFragment extends BaseBingFragment<OrderDetailPresenter, ...@@ -53,32 +52,12 @@ public class OrderDatailsFragment extends BaseBingFragment<OrderDetailPresenter,
} }
public void initDataView(OrderDetail dataBean) { public void initDataView(OrderDetail dataBean) {
mOrderStaus = dataBean.getStatus();
if (mOrderStaus == 1) {
mBind.tvOrderState.setText(mActivity.getString(R.string.not_receive_order));
} else if (mOrderStaus == 2) {
mBind.tvOrderState.setText(mActivity.getString(R.string.not_appointment_already));
} else if (mOrderStaus == 3) {
mBind.tvOrderState.setText(mActivity.getString(R.string.appointment_already));
} else if (mOrderStaus == 4) {
mBind.tvOrderState.setText(mActivity.getString(R.string.order_doing));
} else if (mOrderStaus == 5) {
mBind.tvOrderState.setText(mActivity.getString(R.string.finish_order));
} else if (mOrderStaus == 6) {
mBind.tvOrderState.setText(mActivity.getString(R.string.cancle_order));
} else if (mOrderStaus == 7) {
mBind.tvOrderState.setText(mActivity.getString(R.string.order_close));
}
if (UIUtils.isOverFlowed(mBind.tvOrderRmark)) {
mBind.tvLookMore.setVisibility(View.VISIBLE);
} else {
mBind.tvLookMore.setVisibility(View.GONE);
}
if (dataBean.getAccessories() != null && dataBean.getAccessories().size() != 0) { if (dataBean.getAccessories() != null && dataBean.getAccessories().size() != 0) {
mAdapter = new AccessoriesAdapter(R.layout.item_accessories_layout); mAdapter = new CoreAdapter<String, FragmentOrderDatailsBinding>(false);
mBind.rlAccessories.setLayoutManager(new LinearLayoutManager(mActivity)); mBind.rlAccessories.setLayoutManager(new LinearLayoutManager(mActivity));
mAdapter.setViewType(R.layout.item_accessories_layout);
mBind.rlAccessories.setAdapter(mAdapter); mBind.rlAccessories.setAdapter(mAdapter);
mAdapter.setNewData(dataBean.getAccessories()); mAdapter.setData(dataBean.getAccessories());
} }
} }
......
...@@ -26,7 +26,7 @@ import com.dayu.bigfish.utils.ProgressUtil; ...@@ -26,7 +26,7 @@ import com.dayu.bigfish.utils.ProgressUtil;
* on 2017/10/11. * on 2017/10/11.
*/ */
public class SystemMessageFragment extends BaseBingFragment<messagePresenter,FragmentMessageSystemBinding> public class SystemMessageFragment extends BaseBingFragment<messagePresenter, FragmentMessageSystemBinding>
implements messageContract.View, SwipeRefreshLayout.OnRefreshListener, BaseQuickAdapter.RequestLoadMoreListener { implements messageContract.View, SwipeRefreshLayout.OnRefreshListener, BaseQuickAdapter.RequestLoadMoreListener {
private SystemMessageAdapter mAdapter; private SystemMessageAdapter mAdapter;
private String hxUserId; private String hxUserId;
...@@ -76,7 +76,6 @@ public class SystemMessageFragment extends BaseBingFragment<messagePresenter,Fra ...@@ -76,7 +76,6 @@ public class SystemMessageFragment extends BaseBingFragment<messagePresenter,Fra
mBind.spRefersh.setOnRefreshListener(this); mBind.spRefersh.setOnRefreshListener(this);
mAdapter.setOnLoadMoreListener(this, mBind.rlMessage); mAdapter.setOnLoadMoreListener(this, mBind.rlMessage);
mAdapter.setEnableLoadMore(false); mAdapter.setEnableLoadMore(false);
mAdapter.disableLoadMoreIfNotFullPage(mBind.rlMessage);
initListener(); initListener();
} }
......
package com.dayu.bigfish.ui.listener;
/**
* Created by luofan on 2017/12/10.
*/
public interface OnItemClickListener<M,B> {
void OnItemClick(M item,B bind, int position);
}
package com.dayu.bigfish.ui.listener;
/**
* Created by luofan on 2017/12/8.
*/
public interface OnRefreshListener {
void refresh();
}
package com.dayu.bigfish.ui.listener;
/**
* Created by luofan on 2017/12/8.
*/
public interface onLoadMoreListener {
void onLoadMore();
}
package com.dayu.bigfish.base.adapter; package com.dayu.bigfish.ui.views;
import android.content.Context; import android.content.Context;
import android.content.res.TypedArray; import android.content.res.TypedArray;
...@@ -16,15 +16,48 @@ import android.widget.LinearLayout; ...@@ -16,15 +16,48 @@ import android.widget.LinearLayout;
import com.dayu.bigfish.R; import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BasePageBean; import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.CoreAdapter;
import com.dayu.bigfish.ui.listener.OnItemClickListener;
import com.dayu.bigfish.ui.listener.OnRefreshListener; import com.dayu.bigfish.ui.listener.OnRefreshListener;
import com.dayu.bigfish.ui.listener.onLoadMoreListener; import com.dayu.bigfish.ui.listener.onLoadMoreListener;
import com.dayu.bigfish.utils.ProgressUtil;
import java.util.List;
/** /**
* Created by luofan on 2017/12/9. * Created by luofan on 2017/12/9.
*/ */
public class LRecyclerView<M> extends FrameLayout { public class LRecyclerView<M, B> extends FrameLayout {
private boolean isHasHeadView = false, isHasFootView = false, isEmpty = false, isReverse = false, needHint = false, needCoreAdapter = false; /**
* 是否需要头布局.
*/
private boolean isHasHeadView = false;
/**
* 是否需要翻转.
*/
private boolean isReverse = false;
/**
* 是否需要延迟.
*/
private boolean needHint = false;
/**
* 是否需要使用默认adapter.
*/
private boolean needCoreAdapter = false;
/**
* 是否需要脚布局.
*/
private boolean isNeedFoot = true;
/**
* 是否s是刷新状态.
*/
private boolean isRefresh = true;
/**
* 是否处在空布局状态.
*/
private boolean isEmpty = false;
private int headType, footType; private int headType, footType;
private SwipeRefreshLayout swipeRefresh; private SwipeRefreshLayout swipeRefresh;
private RecyclerView recyclerview; private RecyclerView recyclerview;
...@@ -32,9 +65,8 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -32,9 +65,8 @@ public class LRecyclerView<M> extends FrameLayout {
private OnRefreshListener mRefreshListener; private OnRefreshListener mRefreshListener;
private onLoadMoreListener mLoadMoreListener; private onLoadMoreListener mLoadMoreListener;
private LinearLayoutManager mLayoutManager; private LinearLayoutManager mLayoutManager;
public CoreAdapter<M> mCommAdapter; public CoreAdapter<M, B> mCoreAdapter;
private int itemType; private int itemType;
private boolean isRefresh = true;
public LRecyclerView(@NonNull Context context) { public LRecyclerView(@NonNull Context context) {
super(context); super(context);
...@@ -53,31 +85,34 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -53,31 +85,34 @@ public class LRecyclerView<M> extends FrameLayout {
private void init(Context context, AttributeSet attrs) { private void init(Context context, AttributeSet attrs) {
//初始化参数 //初始化参数
TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.TRecyclerView); TypedArray ta = getContext().obtainStyledAttributes(attrs, R.styleable.LRecyclerView);
headType = ta.getResourceId(R.styleable.TRecyclerView_headType, 0); headType = ta.getResourceId(R.styleable.LRecyclerView_headType, 0);
itemType = ta.getResourceId(R.styleable.TRecyclerView_itemType, 0); itemType = ta.getResourceId(R.styleable.LRecyclerView_itemType, 0);
footType = ta.getResourceId(R.styleable.TRecyclerView_footType, 0); footType = ta.getResourceId(R.styleable.LRecyclerView_footType, 0);
isReverse = ta.getBoolean(R.styleable.TRecyclerView_isReverse, false); isReverse = ta.getBoolean(R.styleable.LRecyclerView_isReverse, false);
needCoreAdapter = ta.getBoolean(R.styleable.TRecyclerView_needCoreAdapter, false); isNeedFoot = ta.getBoolean(R.styleable.LRecyclerView_needFoot, true);
if (!needHint) needHint = ta.getBoolean(R.styleable.TRecyclerView_needHint, false); needCoreAdapter = ta.getBoolean(R.styleable.LRecyclerView_needCoreAdapter, false);
boolean isRefreshable = ta.getBoolean(R.styleable.TRecyclerView_isRefreshable, true); if (!needHint) needHint = ta.getBoolean(R.styleable.LRecyclerView_needHint, false);
boolean isRefreshable = ta.getBoolean(R.styleable.LRecyclerView_isRefreshable, true);
ta.recycle(); ta.recycle();
//初始化recycleview //初始化recycleview
View layout = inflate(context, R.layout.layout_list_recyclerview, this); View layout = inflate(context, R.layout.lrecycle_layout, this);
swipeRefresh = (SwipeRefreshLayout) layout.findViewById(R.id.swiperefresh); swipeRefresh = (SwipeRefreshLayout) layout.findViewById(R.id.swiperefresh);
recyclerview = (RecyclerView) layout.findViewById(R.id.recyclerview); recyclerview = (RecyclerView) layout.findViewById(R.id.recyclerview);
ll_emptyView = (LinearLayout) layout.findViewById(R.id.ll_emptyview); ll_emptyView = (LinearLayout) layout.findViewById(R.id.ll_emptyview);
swipeRefresh.setColorSchemeResources(android.R.color.holo_blue_bright); // swipeRefresh.setColorSchemeResources(R.color.cl_receiving_order_item_data);
mLayoutManager = new LinearLayoutManager(context); mLayoutManager = new LinearLayoutManager(context);
mLayoutManager.setAutoMeasureEnabled(true);
recyclerview.setLayoutManager(mLayoutManager); recyclerview.setLayoutManager(mLayoutManager);
recyclerview.setItemAnimator(new DefaultItemAnimator()); recyclerview.setItemAnimator(new DefaultItemAnimator());
swipeRefresh.setEnabled(isRefreshable); swipeRefresh.setEnabled(isRefreshable);
if (needCoreAdapter) { if (needCoreAdapter) {
if (itemType != 0) { if (itemType != 0) {
mCommAdapter = new CoreAdapter<>(); mCoreAdapter = new CoreAdapter<>(isNeedFoot);
setViewType(itemType); setViewType(itemType);
recyclerview.setAdapter(mCommAdapter); recyclerview.setAdapter(mCoreAdapter);
} else {
throw new RuntimeException("提示:需要先传入itemtype");
} }
} }
if (isReverse) { if (isReverse) {
...@@ -89,9 +124,7 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -89,9 +124,7 @@ public class LRecyclerView<M> extends FrameLayout {
Refresh(); Refresh();
}); });
ll_emptyView.setOnClickListener((view -> { ll_emptyView.setOnClickListener((view -> {
isEmpty = false; ProgressUtil.startLoad(mCoreAdapter.getContext());
ll_emptyView.setVisibility(View.GONE);
swipeRefresh.setVisibility(View.VISIBLE);
Refresh(); Refresh();
})); }));
recyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() { recyclerview.addOnScrollListener(new RecyclerView.OnScrollListener() {
...@@ -103,10 +136,10 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -103,10 +136,10 @@ public class LRecyclerView<M> extends FrameLayout {
if (recyclerview.getAdapter() != null if (recyclerview.getAdapter() != null
&& newState == RecyclerView.SCROLL_STATE_IDLE && newState == RecyclerView.SCROLL_STATE_IDLE
&& lastVisibleItem + 1 == recyclerview.getAdapter().getItemCount() && lastVisibleItem + 1 == recyclerview.getAdapter().getItemCount()
&& mCommAdapter.isHasMore) { && mCoreAdapter.isHasMore) {
if (mLoadMoreListener != null) { if (mLoadMoreListener != null && isNeedFoot) {
mCommAdapter.isLoadFial = false; mCoreAdapter.isLoadFial = false;
mCommAdapter.notifyDataSetChanged(); mCoreAdapter.notifyDataSetChanged();
isRefresh = false; isRefresh = false;
mLoadMoreListener.onLoadMore(); mLoadMoreListener.onLoadMore();
} }
...@@ -121,28 +154,27 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -121,28 +154,27 @@ public class LRecyclerView<M> extends FrameLayout {
}); });
} }
public void setAdapter(CoreAdapter<M> adapter) { public void setAdapter(CoreAdapter<M, B> adapter) {
mCommAdapter = adapter; mCoreAdapter = adapter;
if (itemType != 0) { if (itemType != 0) {
setViewType(itemType); setViewType(itemType);
} }
recyclerview.setAdapter(mCommAdapter); recyclerview.setAdapter(mCoreAdapter);
} }
public LRecyclerView setFootData(Object data) { public LRecyclerView setFootData(Object data) {
isHasFootView = footType != 0; this.mCoreAdapter.addFooterViewType(footType, data);
this.mCommAdapter.addFooterViewType(footType, data);
return this; return this;
} }
public LRecyclerView setHeadData(Object data) { public LRecyclerView setHeadData(Object data) {
isHasHeadView = headType != 0; isHasHeadView = headType != 0;
this.mCommAdapter.addHeadViewType(headType, data); this.mCoreAdapter.addHeadViewType(headType, data);
return this; return this;
} }
public void setEmpty() { public void setEmpty() {
if ((!isHasHeadView || isReverse && !isHasFootView) && !isEmpty) { if ((!isHasHeadView || isReverse) && !isEmpty) {
isEmpty = true; isEmpty = true;
ll_emptyView.setVisibility(View.VISIBLE); ll_emptyView.setVisibility(View.VISIBLE);
swipeRefresh.setVisibility(View.GONE); swipeRefresh.setVisibility(View.GONE);
...@@ -156,37 +188,61 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -156,37 +188,61 @@ public class LRecyclerView<M> extends FrameLayout {
} }
} }
public void setNewData(BasePageBean<M> data) { /**
* 普通数据.
*
* @param data
*/
public void setData(List<M> data) {
if (data == null || (data != null && data.size() == 0)) {
setEmpty();
return;
}
reSetEmpty();
if (isReverse) {
recyclerview.scrollToPosition(mCoreAdapter.getItemCount() - data.size() - 2);
}
mCoreAdapter.setData(data);
}
/**
* 分页数据.
*
* @param data
*/
public void setPageData(BasePageBean<M> data) {
mCoreAdapter.isLoadFial = false;
swipeRefresh.setRefreshing(false);
if (isRefresh) { if (isRefresh) {
if (data == null) { if (data == null || (data != null && data.getData().size() == 0)) {
setEmpty(); setEmpty();
return; return;
} }
mCommAdapter.isLoadFial = false;
reSetEmpty(); reSetEmpty();
swipeRefresh.setRefreshing(false); if (isReverse) {
if (data != null && data.getData().size() == 0) { recyclerview.scrollToPosition(mCoreAdapter.getItemCount() - data.getData().size() - 2);
setEmpty();
} else if (isReverse) {
recyclerview.scrollToPosition(mCommAdapter.getItemCount() - data.getData().size() - 2);
} }
mCommAdapter.setNewData(data); mCoreAdapter.setPageData(data);
} else { } else {
mCommAdapter.isLoadFial = false; mCoreAdapter.addPageData(data);
swipeRefresh.setRefreshing(false);
mCommAdapter.addData(data);
} }
} }
/**
* 数据加载失败.
*/
public void setDataFail() { public void setDataFail() {
if (isRefresh) { if (isRefresh) {
setEmpty(); setEmpty();
} else { } else {
mCommAdapter.isLoadFial = true; mCoreAdapter.isLoadFial = true;
mCommAdapter.notifyDataSetChanged(); mCoreAdapter.notifyDataSetChanged();
} }
} }
/**
* 刷新.
*/
public void Refresh() { public void Refresh() {
if (mRefreshListener != null) { if (mRefreshListener != null) {
isRefresh = true; isRefresh = true;
...@@ -194,8 +250,13 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -194,8 +250,13 @@ public class LRecyclerView<M> extends FrameLayout {
} }
} }
/**
* 设置adpaterItem.
*
* @param type
*/
public void setViewType(@LayoutRes int type) { public void setViewType(@LayoutRes int type) {
mCommAdapter.setViewType(type); mCoreAdapter.setViewType(type);
} }
public void setRefreshListener(OnRefreshListener listener) { public void setRefreshListener(OnRefreshListener listener) {
...@@ -206,5 +267,11 @@ public class LRecyclerView<M> extends FrameLayout { ...@@ -206,5 +267,11 @@ public class LRecyclerView<M> extends FrameLayout {
mLoadMoreListener = listener; mLoadMoreListener = listener;
} }
public void setOnItemClickListener(OnItemClickListener<M, B> listener) {
mCoreAdapter.setOnItemClickListener(listener);
}
public void setPresenter(BasePresenter presenter) {
mCoreAdapter.setPresenter(presenter);
}
} }
package com.dayu.bigfish.utils; package com.dayu.bigfish.utils;
import android.content.Context; import android.content.Context;
import android.databinding.BindingAdapter;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -34,6 +35,23 @@ public class GlideImageLoader { ...@@ -34,6 +35,23 @@ public class GlideImageLoader {
.apply(options) .apply(options)
.into(view); .into(view);
} }
/**
* databing加载图片.
* @param view
* @param url
*/
@BindingAdapter({"imageUrl"})
public static void loadImage(ImageView view, String url) {
RequestOptions options = new RequestOptions()
.diskCacheStrategy(DiskCacheStrategy.ALL);
Glide.with(view.getContext())
.load(url)
.apply(options)
.into(view);
}
/* *//** /* *//**
* 下载图片转换圆角 * 下载图片转换圆角
* @param mContext * @param mContext
......
...@@ -2,14 +2,11 @@ package com.dayu.bigfish.utils; ...@@ -2,14 +2,11 @@ package com.dayu.bigfish.utils;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.support.v4.content.SharedPreferencesCompat;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Map; import java.util.Map;
import static android.R.attr.key;
/** /**
* SharedPreferences的工具类 * SharedPreferences的工具类
*/ */
......
...@@ -5,8 +5,6 @@ import android.os.Looper; ...@@ -5,8 +5,6 @@ import android.os.Looper;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.widget.Toast; import android.widget.Toast;
import org.w3c.dom.Text;
/** /**
* 吐司工具类 * 吐司工具类
* on 2017/8/22. * on 2017/8/22.
......
...@@ -2,7 +2,9 @@ package com.dayu.bigfish.utils; ...@@ -2,7 +2,9 @@ package com.dayu.bigfish.utils;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.databinding.BindingConversion;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.Typeface;
import android.widget.TextView; import android.widget.TextView;
import com.dayu.bigfish.MyApplication; import com.dayu.bigfish.MyApplication;
...@@ -90,5 +92,14 @@ public class UIUtils { ...@@ -90,5 +92,14 @@ public class UIUtils {
} }
} }
@BindingConversion
public static Typeface convertStringToFace(String s) {
try {
return Typeface.createFromAsset(MyApplication.getContext().getAssets(), s);
} catch (Exception e) {
throw e;
}
}
} }
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360">
<shape
android:innerRadiusRatio="2.5"
android:shape="ring"
android:thicknessRatio="10"
android:useLevel="false">
<gradient
android:centerColor="?attr/colorPrimary"
android:centerY="0.50"
android:endColor="?attr/colorWhite"
android:startColor="?attr/colorPrimaryDark"
android:type="sweep"
android:useLevel="false" />
</shape>
</rotate>
\ No newline at end of file
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
<data> <data>
<import type="com.dayu.bigfish.presenter.orderdetail.OrderDetailPresenter"/> <import type="android.view.View"/>
<import type="com.dayu.bigfish.bean.OrderDetail"/> <import type="android.text.TextUtils"/>
<import type="android.view.View"/> <import type="com.dayu.bigfish.utils.UIUtils"/>
<variable <variable
name="presenter" name="presenter"
type="OrderDetailPresenter"/> type="com.dayu.bigfish.presenter.orderdetail.OrderDetailPresenter"/>
<variable <variable
name="item" name="item"
type="OrderDetail"/> type="com.dayu.bigfish.bean.OrderDetail"/>
</data> </data>
<ScrollView <ScrollView
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/text_one" android:layout_toRightOf="@id/text_one"
android:text='@{(item.orderNum == null || item.orderNum == "")?(@string/no_data):item.orderNum}' android:text='@{!TextUtils.isEmpty(item.orderNum)?item.orderNum:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/text_two" android:layout_toRightOf="@id/text_two"
android:text="未预约" android:text='@{presenter.getStaus(item.status)}'
android:textColor="@color/cl_tab_read" android:textColor="@color/cl_tab_read"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/tv_serve" android:layout_toRightOf="@id/tv_serve"
android:text='@{(item.spuName == null || item.spuName == "")?(@string/no_data):item.spuName}' android:text='@{!TextUtils.isEmpty(item.spuName)?item.spuName:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/text_three" android:layout_toRightOf="@id/text_three"
android:text='@{(item.categoryName == null || item.categoryName == "")?(@string/no_data):item.categoryName}' android:text='@{!TextUtils.isEmpty(item.categoryName)?item.categoryName:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -154,7 +154,7 @@ ...@@ -154,7 +154,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/text_foure" android:layout_toRightOf="@id/text_foure"
android:text='@{(item.providerName == null || item.providerName == "")?(@string/no_data):item.providerName}' android:text='@{!TextUtils.isEmpty(item.providerName)?item.providerName:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -176,7 +176,7 @@ ...@@ -176,7 +176,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/text_foure" android:layout_toRightOf="@id/text_foure"
android:text='@{(item.confirmDoorTime == null || item.confirmDoorTime == "")?(@string/no_data):item.confirmDoorTime}' android:text='@{!TextUtils.isEmpty(item.confirmDoorTime)?item.confirmDoorTime:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -210,7 +210,7 @@ ...@@ -210,7 +210,7 @@
android:gravity="center_vertical" android:gravity="center_vertical"
android:maxEms="500" android:maxEms="500"
android:maxLines="2" android:maxLines="2"
android:text='@{(item.comment == null || item.comment == "")?(@string/no_data):item.comment}' android:text='@{!TextUtils.isEmpty(item.comment)?item.comment:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="13.3sp"/> android:textSize="13.3sp"/>
...@@ -224,7 +224,7 @@ ...@@ -224,7 +224,7 @@
android:text="查看更多" android:text="查看更多"
android:textColor="@color/cl_receiving_order_item_data" android:textColor="@color/cl_receiving_order_item_data"
android:textSize="13.3sp" android:textSize="13.3sp"
android:visibility="gone"/> android:visibility="@{UIUtils.isOverFlowed(tvOrderRmark)?View.VISIBLE:View.GONE}"/>
</RelativeLayout> </RelativeLayout>
...@@ -319,7 +319,7 @@ ...@@ -319,7 +319,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/two_text_three" android:layout_toRightOf="@id/two_text_three"
android:text='@{(item.customerName == null || item.customerName == "")?(@string/no_data):item.customerName}' android:text='@{!TextUtils.isEmpty(item.customerName)?item.customerName:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -342,7 +342,7 @@ ...@@ -342,7 +342,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/two_text_four" android:layout_toRightOf="@id/two_text_four"
android:text='@{(item.customerMobile == null || item.customerMobile == "")?(@string/no_data):item.customerMobile}' android:text='@{!TextUtils.isEmpty(item.customerMobile)?item.customerMobile:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -388,7 +388,7 @@ ...@@ -388,7 +388,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/text_foure" android:layout_toRightOf="@id/text_foure"
android:text='@{(item.appointmentTime == null || item.appointmentTime == "")?(@string/no_data):item.appointmentTime}' android:text='@{!TextUtils.isEmpty(item.appointmentTime)?item.appointmentTime:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -432,7 +432,7 @@ ...@@ -432,7 +432,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/three_text_two" android:layout_toRightOf="@id/three_text_two"
android:text='@{(item.brandName == null || item.brandName == "")?(@string/no_data):item.brandName}' android:text='@{!TextUtils.isEmpty(item.brandName)?item.brandName:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -455,7 +455,7 @@ ...@@ -455,7 +455,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/three_two_two" android:layout_toRightOf="@id/three_two_two"
android:text='@{(item.productModel == null || item.productModel == "")?(@string/no_data):item.productModel}' android:text='@{!TextUtils.isEmpty(item.productModel)?item.productModel:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -501,7 +501,7 @@ ...@@ -501,7 +501,7 @@
android:layout_marginLeft="@dimen/dp_10" android:layout_marginLeft="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_13" android:layout_marginTop="@dimen/dp_13"
android:layout_toRightOf="@id/three_four_four" android:layout_toRightOf="@id/three_four_four"
android:text='@{(item.sn == null || item.sn == "")?(@string/no_data):item.sn}' android:text='@{!TextUtils.isEmpty(item.sn)?item.sn:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
...@@ -669,7 +669,7 @@ ...@@ -669,7 +669,7 @@
android:layout_toRightOf="@id/four_text_ten" android:layout_toRightOf="@id/four_text_ten"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:text='@{(item.doorPriceComment == null || item.doorPriceComment == "")?(@string/no_data):item.doorPriceComment}' android:text='@{!TextUtils.isEmpty(item.doorPriceComment)?item.doorPriceComment:@string/no_data}'
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"/> android:textSize="@dimen/sp_13.3"/>
</RelativeLayout> </RelativeLayout>
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
<variable <variable
name="presenter" name="presenter"
type="HomeFourPresenter"/> type="HomeFourPresenter"/>
<variable
name="imgurl"
type="String"/>
</data> </data>
<RelativeLayout <RelativeLayout
...@@ -32,8 +36,8 @@ ...@@ -32,8 +36,8 @@
<ImageView <ImageView
android:id="@+id/iv_setting" android:id="@+id/iv_setting"
style="@style/title_right_image" style="@style/title_right_image"
android:src="@mipmap/person_setting"
android:onClick="@{()->presenter.dumpToSetting()}" android:onClick="@{()->presenter.dumpToSetting()}"
android:src="@mipmap/person_setting"
/> />
</RelativeLayout> </RelativeLayout>
...@@ -56,6 +60,7 @@ ...@@ -56,6 +60,7 @@
<com.dayu.bigfish.ui.views.CircleImageView <com.dayu.bigfish.ui.views.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/iv_header" android:id="@+id/iv_header"
imageUrl="@{imgurl}"
android:layout_width="@dimen/size_login_mlcircleimageview_width" android:layout_width="@dimen/size_login_mlcircleimageview_width"
android:layout_height="@dimen/size_login_mlcircleimageview_height" android:layout_height="@dimen/size_login_mlcircleimageview_height"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
...@@ -200,8 +205,8 @@ ...@@ -200,8 +205,8 @@
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_marginLeft="@dimen/dp_13.3" android:layout_marginLeft="@dimen/dp_13.3"
android:onClick="@{()->presenter.dumpToAccount()}"
android:background="@drawable/personal_center_selector" android:background="@drawable/personal_center_selector"
android:onClick="@{()->presenter.dumpToAccount()}"
> >
<TextView <TextView
...@@ -302,8 +307,8 @@ ...@@ -302,8 +307,8 @@
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="100dp" android:layout_height="100dp"
android:layout_marginLeft="@dimen/dp_13.3" android:layout_marginLeft="@dimen/dp_13.3"
android:onClick="@{()->presenter.dumpToOrderRecord()}" android:background="@drawable/personal_center_selector"
android:background="@drawable/personal_center_selector"> android:onClick="@{()->presenter.dumpToOrderRecord()}">
<TextView <TextView
android:id="@+id/text_gongdan" android:id="@+id/text_gongdan"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <layout>
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView <data>
android:id="@+id/tv_accessories_name"
android:layout_width="wrap_content" <variable
android:layout_height="wrap_content" name="item"
android:layout_marginBottom="5dp" type="com.dayu.bigfish.bean.OrderDetail.accessories"/>
android:text="122233ed" </data>
android:textColor="@color/cl_receiving_order_item_data"
android:textSize="@dimen/sp_13.3" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
/> android:layout_width="match_parent"
</LinearLayout> android:layout_height="wrap_content"
\ No newline at end of file android:orientation="vertical">
<TextView
android:id="@+id/tv_accessories_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text="@{item.name}"
android:textColor="@color/cl_receiving_order_item_data"
android:textSize="@dimen/sp_13.3"
/>
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<import type="android.view.View"/>
<import type="com.dayu.bigfish.utils.UtilsDate"/>
<variable
name="item"
type="com.dayu.bigfish.bean.NewMessage"/>
<variable
name="presenter"
type="com.dayu.bigfish.presenter.message.messagePresenter"/>
</data>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/item"
android:layout_width="@dimen/dp_333"
android:layout_height="@dimen/dp_80"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/item_shape"
android:onClick="@{()->presenter.readAndDump(item,readState)}">
<TextView
android:id="@+id/line_textView"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginLeft="89dp"
android:background="@color/line_color"
/>
<TextView
android:id="@+id/message_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/line_textView"
android:layout_marginRight="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_18"
android:text="@{presenter.FomartTime(item.createTime,UtilsDate.FORMAT_ONE, UtilsDate.SHORT_DATE_FORMAT)}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_12"
android:typeface="@{@string/tv_fonts}"
/>
<TextView
android:id="@+id/message_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@id/line_textView"
android:layout_marginRight="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_34"
android:text="@{presenter.FomartTime(item.createTime,UtilsDate.FORMAT_ONE, UtilsDate.LONG_TIME_FORMAT_TWO)}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="24sp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@id/line_textView"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_16"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<TextView
android:id="@+id/message_text_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:text="@{item.title}"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"
/>
<TextView
android:id="@+id/read_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_21.3"
android:layout_toRightOf="@id/message_text_content"
android:text="未读"
android:textColor="@color/cl_tab_read"
android:textSize="@dimen/sp_10"
android:visibility='@{item.read ==1?View.GONE:View.VISIBLE}'
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swiperefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="@null"
android:scrollbars="none"/>
</android.support.v4.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/ll_emptyview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f3f3f3"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:id="@+id/iv_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@mipmap/yu"
/>
<TextView
android:id="@+id/tv_empty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/iv_empty"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dp_13"
android:text="暂无数据"
android:textColor="@color/cl_selector_hui"
android:textSize="@dimen/sp_13.3"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<import type="android.view.View"/>
<variable
name="item"
type="Boolean"/>
</data>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progressbar"
style="@android:style/Widget.ProgressBar.Small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@anim/progress_round"
android:visibility="@{item == null?View.GONE:(item?View.VISIBLE:View.GONE)}"/>
<TextView
android:id="@+id/tv_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:clickable="@{item == null?true:false}"
android:text='@{item !=null? (item?"正在加载" :"没有更多数据"):"加载失败(再次上拉试试~)"}'
/>
</LinearLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/l_recycle"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:itemType="@layout/item_message_layout"
android:background="#f5f5f5"
app:needCoreAdapter="true"
/>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <layout>
android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:orientation="vertical">
<RelativeLayout <data>
android:id="@+id/item"
android:layout_width="@dimen/dp_333"
android:layout_height="@dimen/dp_80"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="@drawable/item_shape">
<TextView <variable
android:id="@+id/line_textView" name="item"
android:layout_width="1dp" type="com.dayu.bigfish.bean.NewMessage"/>
android:layout_height="match_parent" </data>
android:layout_marginLeft="89dp"
android:background="@color/line_color"
/>
<TextView <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/message_date" android:layout_width="match_parent"
android:layout_width="wrap_content" android:layout_height="@dimen/dp_80"
android:layout_height="wrap_content" android:orientation="vertical">
android:layout_alignRight="@id/line_textView"
android:layout_marginRight="@dimen/dp_12"
android:layout_marginTop="@dimen/dp_18"
android:text="08-10"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_12"
/>
<TextView <RelativeLayout
android:id="@+id/message_time" android:id="@+id/item"
android:layout_width="wrap_content" android:layout_width="@dimen/dp_333"
android:layout_height="wrap_content" android:layout_height="@dimen/dp_80"
android:layout_alignRight="@id/line_textView" android:layout_centerHorizontal="true"
android:layout_marginRight="@dimen/dp_12" android:layout_marginTop="5dp"
android:layout_marginTop="@dimen/dp_34" android:background="@drawable/item_shape">
android:text="18:72"
android:textColor="@color/cl_home_title_text_color"
android:textSize="24sp"
/>
<LinearLayout <TextView
android:layout_width="match_parent" android:id="@+id/line_textView"
android:layout_height="match_parent" android:layout_width="1dp"
android:layout_alignLeft="@id/line_textView" android:layout_height="match_parent"
android:layout_centerVertical="true" android:layout_marginLeft="89dp"
android:layout_marginLeft="@dimen/dp_16" android:background="@color/line_color"
android:gravity="center_vertical" />
android:orientation="horizontal"
>
<TextView <TextView
android:id="@+id/message_text_content" android:id="@+id/message_date"
android:layout_width="0dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_alignRight="@id/line_textView"
android:ellipsize="end" android:layout_marginRight="@dimen/dp_12"
android:maxLines="2" android:layout_marginTop="@dimen/dp_18"
android:text="08-10"
android:textColor="@color/cl_home_title_text_color" android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3" android:textSize="@dimen/sp_12"
/> />
<TextView <TextView
android:id="@+id/read_state" android:id="@+id/message_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_alignRight="@id/line_textView"
android:layout_centerVertical="true" android:layout_marginRight="@dimen/dp_12"
android:layout_marginRight="@dimen/dp_21.3" android:layout_marginTop="@dimen/dp_34"
android:layout_toRightOf="@id/message_text_content" android:text="18:72"
android:text="@string/not_read" android:textColor="@color/cl_home_title_text_color"
android:textColor="@color/cl_tab_read" android:textSize="24sp"
android:textSize="@dimen/sp_10"
/> />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignLeft="@id/line_textView"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_16"
android:gravity="center_vertical"
android:orientation="horizontal"
>
<TextView
android:id="@+id/message_text_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/sp_13.3"
/>
<TextView
android:id="@+id/read_state"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/dp_21.3"
android:layout_toRightOf="@id/message_text_content"
android:text="@string/not_read"
android:textColor="@color/cl_tab_read"
android:textSize="@dimen/sp_10"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </layout>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="LRecyclerView">
<attr name="isReverse" format="boolean"/>
<attr name="isRefreshable" format="boolean"/>
<attr name="needCoreAdapter" format="boolean"/>
<attr name="needFoot" format="boolean"/>
<attr name="needHint" format="boolean"/>
<attr name="itemType" format="reference"/>
<attr name="headType" format="reference"/>
<attr name="footType" format="reference"/>
</declare-styleable>
<attr name="backgroundCard" format="color"/>
<attr name="textColor" format="color"/>
<attr name="textColorBg" format="color"/>
<attr name="themeType" format="string"/>
<attr name="themeIcon" format="reference"/>
<attr name="colorWhite" format="color"/>
</resources>
\ No newline at end of file
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<string name="tv_dayu">大鱼师傅</string> <string name="tv_dayu">大鱼师傅</string>
<string name="tv_start_page_text">©&#160;2017&#160;大鱼智能&#160;版权所有</string> <string name="tv_start_page_text">©&#160;2017&#160;大鱼智能&#160;版权所有</string>
<string name="tv_login_title">大鱼工程师</string> <string name="tv_login_title">大鱼工程师</string>
<string name="tv_fonts">fonts/DIN Alternate Bold.ttf</string>
<string name="tv_login_register_text">暂不接受个人用户注册</string> <string name="tv_login_register_text">暂不接受个人用户注册</string>
<string name="tv_login_button_text">&#160;</string> <string name="tv_login_button_text">&#160;</string>
<string name="tv_login_register_button_text">获取验证码</string> <string name="tv_login_register_button_text">获取验证码</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment