Commit 99077b03 by 罗翻

将mvp替换成mvvm

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