Commit 99077b03 by 罗翻

将mvp替换成mvvm

parent 6b938fb3
......@@ -53,13 +53,15 @@ android {
assets.srcDirs = ['src/main/assets', 'src/main/assets/']
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
dataBinding {
enabled = true
}
lintOptions {
checkReleaseBuilds false
}
lintOptions {
abortOnError false
......
......@@ -69,7 +69,7 @@ public class MyApplication extends MultiDexApplication {
}
/**
* 使手机设置的字体大小无效.
* 初始化友盟.
*/
private void initUM() {
MobclickAgent.setDebugMode(Constants.UM_DEBUG);
......
......@@ -80,7 +80,7 @@ public class ReceivingPresenter extends ReceivingContract.Presenter {
int num = mTotalRows - 1;
mView.showToast(R.string.receive_order_success);
EventBus.getDefault().post(new SwtichFragment(1));
mDisPosable = Observable.timer(2000, TimeUnit.MILLISECONDS).subscribe(aLong -> {
mDisPosable = Observable.timer(500, TimeUnit.MILLISECONDS).subscribe(aLong -> {
EventBus.getDefault().post(new RefreshReceivingNum(num < 0 ? 0 : num));
EventBus.getDefault().post(new RefreshApoiment(-1));
mDisPosable.dispose();
......
......@@ -83,7 +83,6 @@ public class HomeOrderFragment extends BaseFragment<HomeOrderPresenter, Fragment
mBind.tbHome.setupWithViewPager(mBind.vpHome);
mBind.tbHome.setTabMode(TabLayout.MODE_FIXED);
mBind.vpHome.setOffscreenPageLimit(4);
mBind.vpHome.setCurrentItem(0);
mBind.tbHome.post(() ->
TabLayoutUtils.setIndicator(mBind.tbHome, 15, 15, R.color.cl_order_item_line_bg, mActivity));
mBind.tbHome.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
......@@ -145,6 +144,7 @@ public class HomeOrderFragment extends BaseFragment<HomeOrderPresenter, Fragment
}
});
setTabNum(null,0);
}
......@@ -152,16 +152,16 @@ public class HomeOrderFragment extends BaseFragment<HomeOrderPresenter, Fragment
* 将网络请求到的数据展示到tab上
*/
public void setTabNum(Tab tab, int myTabIndex) {
String[] tabNum = new String[]{tab.getReservation() + "", tab.getPendingservice() + "",
tab.getError() + "", tab.getCanceled() + ""};
if (isFirstAddTab) {
mBind.tbHome.removeAllTabs();
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab(tabNum[0], tabDesc[0])));
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab(tabNum[1], tabDesc[1])));
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab(tabNum[2], tabDesc[2])));
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab(tabNum[3], tabDesc[3])));
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab("0", tabDesc[0])));
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab("0", tabDesc[1])));
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab("0", tabDesc[2])));
mBind.tbHome.addTab(mBind.tbHome.newTab().setCustomView(CreatTab("0", tabDesc[3])));
isFirstAddTab = false;
} else {
String[] tabNum = new String[]{tab.getReservation() + "", tab.getPendingservice() + "",
tab.getError() + "", tab.getCanceled() + ""};
for (int i = 0; i < mBind.tbHome.getTabCount(); i++) {
TextView tv = (TextView) mBind.tbHome.getTabAt(i).getCustomView().findViewById(R.id.tabtext);
TextView tvIcon = (TextView) mBind.tbHome.getTabAt(i).getCustomView().findViewById(R.id.tabicon);
......
......@@ -24,6 +24,9 @@ public class OrderDatailsServeFragment extends DataBindingFragment<FragmentOrder
@Override
public void initView() {
OrderDetail details = (OrderDetail) getArguments().getSerializable(Constants.ORDER_DETAIL);
if (details == null) {
return;
}
for (OrderDetail.RecordBean item : details.getRecord()) {
try {
item.setCreateTime(UtilsDate.changeFormat(item.getCreateTime(), UtilsDate.FORMAT_ONE, UtilsDate.FORMAT_FOURTH));
......
......@@ -45,6 +45,13 @@ public class OrderDateilsFragment extends DataBindingFragment<FragmentOrderDatai
} else {
mBind.tvLookMore.setVisibility(View.GONE);
}
if (dataBean.getIsPay() == null || dataBean.getIsPay() == 1) {
mBind.rlNoCharge.setVisibility(View.VISIBLE);
mBind.rlHaveCharge.setVisibility(View.GONE);
} else {
mBind.rlNoCharge.setVisibility(View.GONE);
mBind.rlHaveCharge.setVisibility(View.VISIBLE);
}
if (dataBean.getAccessories() != null && dataBean.getAccessories().size() != 0) {
mAdapter = new CoreAdapter<String, FragmentOrderDatailsBinding>(false);
mBind.rlAccessories.setLayoutManager(new LinearLayoutManager(mActivity));
......
......@@ -94,6 +94,7 @@ public class LRecyclerView<M, B> extends FrameLayout {
needCoreAdapter = ta.getBoolean(R.styleable.LRecyclerView_needCoreAdapter, false);
isRefreshable = ta.getBoolean(R.styleable.LRecyclerView_isRefreshable, true);
ta.recycle();
//初始化recycleview
View layout = inflate(context, R.layout.lrecycle_layout, this);
swipeRefresh = (SwipeRefreshLayout) layout.findViewById(R.id.swiperefresh);
......@@ -101,6 +102,7 @@ public class LRecyclerView<M, B> extends FrameLayout {
ll_emptyView = (LinearLayout) layout.findViewById(R.id.ll_emptyview);
ll_faileView = (LinearLayout) layout.findViewById(R.id.ll_faileview);
swipeRefresh.setColorSchemeResources(R.color.cl_receiving_order_item_data);
mLayoutManager = new LinearLayoutManager(context);
mLayoutManager.setAutoMeasureEnabled(true);
recyclerview.setLayoutManager(mLayoutManager);
......
<?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">
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<data>
......@@ -11,8 +10,8 @@
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/recyclerView"
setPresenter="@{presenter}"
android:layout_width="match_parent"
android:layout_height="match_parent"
setPresenter="@{presenter}"
android:background="#f5f5f5" />
</layout>
\ No newline at end of file
......@@ -510,8 +510,7 @@
android:id="@+id/rl_have_charge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/line_three"
android:visibility="@{item.isPay ==1?View.GONE:View.VISIBLE}">
android:layout_below="@id/line_three">
<TextView
android:id="@+id/four_text_one"
......@@ -669,8 +668,7 @@
android:id="@+id/rl_no_charge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/line_three"
android:visibility="@{item.isPay ==1?View.VISIBLE:View.GONE}">
android:layout_below="@id/line_three">
<TextView
android:layout_width="wrap_content"
......
......@@ -30,19 +30,14 @@
android:textSize="@dimen/dp_13.3" />
</RelativeLayout>
<RelativeLayout
<android.support.design.widget.TabLayout
android:id="@+id/tb_home"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<android.support.design.widget.TabLayout
android:id="@+id/tb_home"
android:layout_width="match_parent"
android:layout_height="78dp"
app:tabIndicatorColor="@color/cl_tab_line"
app:tabMaxWidth="0dp"
app:tabMode="fixed" />
</RelativeLayout>
android:layout_height="78dp"
app:tabIndicatorColor="@color/cl_tab_line"
app:tabMaxWidth="0dp"
app:tabMode="fixed" />
<ImageView style="@style/card_line" />
......@@ -50,6 +45,6 @@
android:id="@+id/vp_home"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5" />
android:layout_weight="1" />
</LinearLayout>
</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: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>
<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"
<LinearLayout
android:id="@+id/ll_emptyview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="@null"
android:scrollbars="none"/>
</android.support.v4.widget.SwipeRefreshLayout>
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:id="@+id/ll_emptyview"
android:layout_width="match_parent"
android:layout_height="match_parent"
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" />
<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>
<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
android:id="@+id/ll_faileview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:id="@+id/ll_faileview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:visibility="gone"
android:orientation="vertical">
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@mipmap/error" />
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:src="@mipmap/error" />
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="23dp"
android:text="加载出错啦"
android:textColor="#c9c9c9"
android:textSize="17.3sp" />
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="23dp"
android:text="加载出错啦"
android:textColor="#c9c9c9"
android:textSize="17.3sp" />
<TextView
android:id="@+id/retry_btn"
android:layout_width="115dp"
android:layout_height="30dp"
android:layout_marginTop="55dp"
android:gravity="center"
android:paddingBottom="4dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="4dp"
android:text="重新加载"
android:textSize="15.4sp" />
</LinearLayout>
<TextView
android:id="@+id/retry_btn"
android:layout_width="115dp"
android:layout_height="30dp"
android:layout_marginTop="55dp"
android:gravity="center"
android:paddingBottom="4dp"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="4dp"
android:text="重新加载"
android:textSize="15.4sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
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