Commit 6b938fb3 by 罗翻

将mvp替换成mvvm

parent d478f62a
Showing with 966 additions and 300 deletions
......@@ -6,7 +6,6 @@
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/apt/apt.iml" filepath="$PROJECT_DIR$/apt/apt.iml" />
<module fileurl="file://$PROJECT_DIR$/dayu.iml" filepath="$PROJECT_DIR$/dayu.iml" />
<module fileurl="file://$PROJECT_DIR$/annotation_lib/lib.iml" filepath="$PROJECT_DIR$/annotation_lib/lib.iml" />
</modules>
</component>
</project>
\ No newline at end of file
......@@ -89,7 +89,6 @@ dependencies {
compile 'com.android.support:multidex:1.0.2'
compile 'com.android.support:design:25.0.0'
compile 'com.android.support:cardview-v7:25.0.0'
//greendao数据库
compile 'org.greenrobot:greendao:3.2.0'
......
......@@ -155,7 +155,7 @@
android:screenOrientation="portrait"
/>
<activity
android:name=".ui.AboutUs"
android:name=".ui.AboutUsActivity"
android:screenOrientation="portrait"
/>
<activity
......
......@@ -24,6 +24,7 @@ public class Constants {
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 WEB_SOP = "http://47.94.101.239:9004/#/sop";
public static final boolean UM_DEBUG = true;
// public final static String WEB_SOP = "http://192.168.1.132:8080/#/sop";
......@@ -32,6 +33,7 @@ public class Constants {
// public static final String BASE_URL = "https://mobile.dayu.ai";
// public final static String UP_PHOTO = "/file/uploadMore?targetPath=online/sp/mobile/android/business/checkApply";
// public final static String WEB_SOP = "https://sop.kf.ai/#/sop";
// public static final boolean UM_DEBUG = false;
/*****************/
public static final String LOGIN_URL = "/check";
//登录时发送验证码的URL
......@@ -122,5 +124,4 @@ public class Constants {
//设置通知提醒按钮状态
public final static String MESSAGE_STATE = "message_state";
}
......@@ -39,6 +39,7 @@ public class InitializeActivity extends AppCompatActivity {
setContentView(R.layout.activity_initialize_main);
mActivity = this;
mPerArr = new String[]{Manifest.permission.READ_PHONE_STATE, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.WRITE_EXTERNAL_STORAGE};
MPermissionUtils.requestPermissionsResult(mActivity, SDK_PERMISSION_REQUEST, mPerArr, new MPermissionUtils.OnPermissionListener() {
@Override
public void onPermissionGranted() {
......
......@@ -4,6 +4,8 @@ import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
import android.os.Bundle;
......@@ -41,7 +43,7 @@ public class MyApplication extends MultiDexApplication {
public void onCreate() {
super.onCreate();
store = new Stack<>();
myApplication =this;
myApplication = this;
registerActivityLifecycleCallbacks(new SwitchBackgroundCallbacks());
IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
......@@ -63,16 +65,30 @@ public class MyApplication extends MultiDexApplication {
//初始化环信
HxManager.getInstance().init(mContext);
MultiDex.install(this);
initTextSize();
}
/**
* 使手机设置的字体大小无效.
*/
private void initUM() {
MobclickAgent.setDebugMode(true);
MobclickAgent.setDebugMode(Constants.UM_DEBUG);
UMConfigure.init(this, UMConfigure.DEVICE_TYPE_PHONE, null);
UMConfigure.setLogEnabled(true);
UMConfigure.setEncryptEnabled(true);
MobclickAgent.setScenarioType(mContext, EScenarioType.E_UM_NORMAL);
}
/**
* 使其系统更改字体大小无效
*/
private void initTextSize() {
Resources res = getResources();
Configuration config = new Configuration();
config.setToDefaults();
res.updateConfiguration(config, res.getDisplayMetrics());
}
private class SwitchBackgroundCallbacks implements Application.ActivityLifecycleCallbacks {
@Override
......@@ -120,9 +136,10 @@ public class MyApplication extends MultiDexApplication {
return store.lastElement();
}
public static MyApplication getAppContext(){
public static MyApplication getAppContext() {
return myApplication;
}
public static Context getContext() {
return mContext;
}
......
package com.dayu.bigfish.base;
import android.databinding.ObservableField;
/**
* Created by luofan on 2017/12/23.
*/
public abstract class BaseListPresenter<V> extends BasePresenter<V> {
/**
* 如果有下拉刷新,子类必须重写此方法.
*/
public void refresh() {
}
/**
* 如果有上拉加载,子类必须重写此方法.
*/
public void loadMore() {
}
/**
* 获取recy数据源.
*
* @return
*/
public abstract ObservableField<Object> getSourceDatas();
}
......@@ -33,8 +33,9 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
private int mPage = 1;
public boolean isLoadFial = false;
private OnItemClickListener mOnItemClickListener;
private BasePresenter mPresenter;
private BaseListPresenter mPresenter;
protected OnChildClickListener mOnChildClickListener;
private List<M> mOldDatas = new ArrayList<>();
@Override
public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
......@@ -144,6 +145,7 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
}
public void setPageData(BasePageBean<M> data) {
mOldDatas = mItemList;
mPage = 1;
mTotalPage = data.getTotalPages();
if (mPage >= mTotalPage) {
......@@ -177,7 +179,7 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
return mItemList.size() + mHeadTypeDatas.size() + mFootTypeDatas.size();
}
public void setPresenter(BasePresenter presenter) {
public void setPresenter(BaseListPresenter presenter) {
mPresenter = presenter;
}
......@@ -191,6 +193,13 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
}
}
/**
* 继承coreadapter需要重写此方法.
*
* @param holder
* @param item
* @param position
*/
protected void onBind(B holder, M item, int position) {
}
......@@ -211,6 +220,7 @@ public class CoreAdapter<M, B> extends RecyclerView.Adapter<BaseViewHolder> {
return mItemList;
}
public Context getContext() {
return mContext;
}
......
......@@ -12,6 +12,9 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.concurrent.TimeUnit;
import io.reactivex.Observable;
import io.reactivex.disposables.CompositeDisposable;
public abstract class DataBindingFragment<B extends ViewDataBinding> extends Fragment {
......@@ -77,7 +80,8 @@ public abstract class DataBindingFragment<B extends ViewDataBinding> extends Fra
super.setUserVisibleHint(isVisibleToUser);
if (getUserVisibleHint()) {
isVisible = true;
onVisible();
//显示加载效果,延时
mDisposable.add(Observable.timer(300, TimeUnit.MILLISECONDS).subscribe(aLong -> onVisible()));
} else {
isVisible = false;
onInvisible();
......@@ -115,7 +119,8 @@ public abstract class DataBindingFragment<B extends ViewDataBinding> extends Fra
lazyLoad();
}
protected abstract void lazyLoad();
protected void lazyLoad() {
}
@Override
public void onDetach() {
......
package com.dayu.bigfish.presenter;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseListPresenter;
/**
* Created by luofan on 2017/12/22.
*/
public abstract class BaseOrderPresenter<V> extends BasePresenter<V> {
public abstract void refresh();
public abstract void loadMore();
public abstract class BaseOrderPresenter<V> extends BaseListPresenter<V> {
public abstract void dumpDetail(int orderId);
......
package com.dayu.bigfish.presenter.accountbalance;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseListPresenter;
import com.dayu.bigfish.base.BaseView;
/**
......@@ -13,7 +13,7 @@ public interface AccountBalanceContract {
}
abstract class Presenter extends BasePresenter<View> {
abstract class Presenter extends BaseListPresenter<View> {
/**
* 获取账户余额列表
*
......@@ -28,9 +28,5 @@ public interface AccountBalanceContract {
*/
public abstract void dumpToWithdrawal();
public abstract void refresh();
public abstract void loadMore();
}
}
......@@ -35,16 +35,23 @@ public class AccountBalancePresenter extends AccountBalanceContract.Presenter {
@Override
public void refresh() {
super.refresh();
mPage = 1;
getAccountBalanceList(mPage, Constants.PAGESIZE, mAccoutId);
}
@Override
public void loadMore() {
super.loadMore();
getAccountBalanceList(mPage, Constants.PAGESIZE, mAccoutId);
}
@Override
public ObservableField<Object> getSourceDatas() {
return datas;
}
@Override
public void getAccountBalanceList(int page, int pageSize, int accountId) {
ApiFactory.getAccountBalanceList(page, pageSize, accountId).subscribe(baseObserver(new Consumer<BasePageBean<AccountBalance>>() {
@Override
......
package com.dayu.bigfish.presenter.message;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.BaseListPresenter;
import com.dayu.bigfish.base.BaseView;
import com.dayu.bigfish.bean.NewMessage;
......@@ -13,7 +13,7 @@ public interface messageContract {
interface View extends BaseView {
}
abstract class Presenter extends BasePresenter<View> {
abstract class Presenter extends BaseListPresenter<View> {
/**
* 获取换新消息.
*
......@@ -24,15 +24,6 @@ public interface messageContract {
*/
public abstract void getHxMessage(String hxUserId, int category, int page, int pageSize);
/**
* 刷新
*/
public abstract void refresh();
/**
* 加载更多.
*/
public abstract void loadMore();
/**
* 阅读信息
......
......@@ -47,16 +47,23 @@ public class messagePresenter extends messageContract.Presenter {
@Override
public void refresh() {
super.refresh();
mPage = 1;
getHxMessage(mHxId, mCategory, mPage, Constants.PAGESIZE);
}
@Override
public void loadMore() {
super.loadMore();
getHxMessage(mHxId, mCategory, mPage, Constants.PAGESIZE);
}
@Override
public ObservableField<Object> getSourceDatas() {
return data;
}
@Override
public void getHxMessage(String hxUserId, int category, int page, int pageSize) {
ApiFactory.getHxMessage(hxUserId, category, page, pageSize).subscribe(baseObserver(new Consumer<BasePageBean<NewMessage>>() {
@Override
......
......@@ -12,6 +12,7 @@ import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.bean.event.RefreshTab;
import com.dayu.bigfish.ui.OrderDetailsActivity;
import com.dayu.bigfish.ui.fragment.OrderThreeTabFragment;
import com.dayu.bigfish.utils.managers.UserManager;
import org.greenrobot.eventbus.EventBus;
......@@ -30,7 +31,7 @@ import okhttp3.RequestBody;
*/
@InstanceFactory
public class OrderDoingPresenter extends orderDoingContract.Presenter {
public ObservableField datas = new ObservableField();
public ObservableField<Object> datas = new ObservableField();
private int mUserId;
private int mSiteId;
private int mState;
......@@ -46,16 +47,28 @@ public class OrderDoingPresenter extends orderDoingContract.Presenter {
@Override
public void refresh() {
super.refresh();
if (mView instanceof OrderThreeTabFragment) {
mView.showDialog();
getErrorOrder();
} else {
mPage = 1;
getOrders(mState, mUserId, mSiteId, mPage, Constants.PAGESIZE);
}
}
@Override
public void loadMore() {
super.loadMore();
getOrders(mState, mUserId, mSiteId, mPage, Constants.PAGESIZE);
}
@Override
public ObservableField<Object> getSourceDatas() {
return datas;
}
@Override
public void getOrders(int state, int userId, int siteId, int page, int pageSize) {
ApiFactory.getOrders(state, userId, siteId, page, pageSize).subscribe(baseObserver(new Consumer<BasePageBean<Order>>() {
@Override
......
......@@ -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(500, TimeUnit.MILLISECONDS).subscribe(aLong -> {
mDisPosable = Observable.timer(2000, TimeUnit.MILLISECONDS).subscribe(aLong -> {
EventBus.getDefault().post(new RefreshReceivingNum(num < 0 ? 0 : num));
EventBus.getDefault().post(new RefreshApoiment(-1));
mDisPosable.dispose();
......@@ -90,6 +90,7 @@ public class ReceivingPresenter extends ReceivingContract.Presenter {
@Override
public void refresh() {
super.refresh();
mPage = 1;
getOrders(Constants.WATING_ORDER, mUserId, mSiteId, mPage, Constants.PAGESIZE);
}
......@@ -100,6 +101,11 @@ public class ReceivingPresenter extends ReceivingContract.Presenter {
}
@Override
public ObservableField<Object> getSourceDatas() {
return datas;
}
@Override
public void dumpDetail(int orderId) {
Intent intent = new Intent(mActivity, OrderDetailsActivity.class);
intent.putExtra("orderId", orderId);
......
......@@ -12,7 +12,7 @@ import com.apt.ApiFactory;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.bean.UserInfo;
import com.dayu.bigfish.ui.AboutUs;
import com.dayu.bigfish.ui.AboutUsActivity;
import com.dayu.bigfish.ui.FeedBackActivity;
import com.dayu.bigfish.ui.LoginActivity;
import com.dayu.bigfish.ui.views.CustomDialog;
......@@ -130,7 +130,7 @@ public class SettingPresenter extends SettingContract.Presenter {
@Override
public void dumpToAboutus() {
startActivity(AboutUs.class);
startActivity(AboutUsActivity.class);
}
@Override
......
......@@ -57,20 +57,6 @@ public class OrderRecordPresenter extends OrderRecordContract.Presenter {
}, throwable -> datas.set(Constants.FAILED)));
}
public void doSearch(String str) {
if (mList == null || TextUtils.isEmpty(str)) {
return;
}
ArrayList<Order> list = new ArrayList<>();
for (Order data : mList) {
if (TextUtils.isEmpty(str) || (data.getCustomerMobile().contains(str) && data.getAnyContacts() == 1)) {
list.add(data);
}
}
datas.set(list);
((OrderRecordActivity) mView).getmAdapter().setLoadMore(false);
}
@Override
public void hideSearch() {
mView.hideSearch();
......@@ -95,10 +81,29 @@ public class OrderRecordPresenter extends OrderRecordContract.Presenter {
}
@Override
public ObservableField<Object> getSourceDatas() {
return datas;
}
@Override
public void dumpDetail(int orderId) {
Intent intent = new Intent(mActivity, OrderDetailsActivity.class);
intent.putExtra("orderId", orderId);
mActivity.startActivity(intent);
}
public void doSearch(String str) {
if (mList == null || TextUtils.isEmpty(str)) {
return;
}
ArrayList<Order> list = new ArrayList<>();
for (Order data : mList) {
if (TextUtils.isEmpty(str) || (data.getCustomerMobile().contains(str) && data.getAnyContacts() == 1)) {
list.add(data);
}
}
datas.set(list);
((OrderRecordActivity) mView).getmAdapter().setLoadMore(false);
}
}
......@@ -9,7 +9,7 @@ import com.dayu.bigfish.base.DataBindingActivity;
* Created by luofan on 2017/12/06.
*/
public class AboutUs extends DataBindingActivity<AboutUsBinding> {
public class AboutUsActivity extends DataBindingActivity<AboutUsBinding> {
@Override
public int getLayoutId() {
......
......@@ -20,7 +20,6 @@ public class AccountBalanceActivity extends BaseActivity<AccountBalancePresenter
@Override
public void initView() {
mBind.rlBalance.setRefreshListener(() -> mPresenter.refresh());
mBind.rlBalance.setOnLoadMoreListener(() -> mPresenter.loadMore());
}
}
......@@ -7,6 +7,7 @@ import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.NotificationCompat;
import android.view.KeyEvent;
import android.view.View;
import android.widget.TextView;
......@@ -118,6 +119,7 @@ public class MainActivity extends BaseActivity<MainPresenter, ActivityMainBindin
/**
* 消息小红点.
*
* @param flag
*/
@Override
......@@ -197,6 +199,16 @@ public class MainActivity extends BaseActivity<MainPresenter, ActivityMainBindin
EventBus.getDefault().unregister(this);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
// 不退出程序,进入后台
moveTaskToBack(true);
return true;
}
return super.onKeyDown(keyCode, event);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void recevieNum(RefreshReceivingNum event) {
mBind.tabOrderNum.setText(event.getTabNum() + "");
......
......@@ -32,13 +32,6 @@ public class OrderRecordActivity extends BaseActivity<OrderRecordPresenter, Acti
mBind.tvTitle.setText(getString(R.string.history_order));
mAdapter = new OrderAdapter(true, R.layout.fragment_orderdoing_item);
mBind.recyclerView.setAdapter(mAdapter);
mBind.recyclerView.setPresenter(mPresenter);
initListener();
}
private void initListener() {
mBind.recyclerView.setRefreshListener(() -> mPresenter.refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> mPresenter.loadMore());
}
@Override
......@@ -63,5 +56,4 @@ public class OrderRecordActivity extends BaseActivity<OrderRecordPresenter, Acti
public OrderAdapter getmAdapter() {
return mAdapter;
}
}
......@@ -3,7 +3,7 @@ package com.dayu.bigfish.ui;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseActivity;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.databinding.ActivityReceivingBinding;
import com.dayu.bigfish.databinding.ActivityCommomRecycleBinding;
import com.dayu.bigfish.presenter.receivingorder.ReceivingContract;
import com.dayu.bigfish.presenter.receivingorder.ReceivingPresenter;
import com.dayu.bigfish.ui.adapter.OrderAdapter;
......@@ -15,14 +15,14 @@ import com.dayu.bigfish.ui.adapter.OrderAdapter;
* Created by yu
*/
public class ReceivingActivity extends BaseActivity<ReceivingPresenter, ActivityReceivingBinding> implements
public class ReceivingActivity extends BaseActivity<ReceivingPresenter, ActivityCommomRecycleBinding> implements
ReceivingContract.View {
private OrderAdapter mAdapter;
@Override
public int getLayoutId() {
return R.layout.activity_receiving;
return R.layout.activity_commom_recycle;
}
@Override
......@@ -30,13 +30,10 @@ public class ReceivingActivity extends BaseActivity<ReceivingPresenter, Activity
mBind.tvTitle.setText(getString(R.string.receive_list));
mAdapter = new OrderAdapter(true, R.layout.fragment_orderdoing_item);
mBind.recyclerView.setAdapter(mAdapter);
mBind.recyclerView.setPresenter(mPresenter);
initListener();
}
private void initListener() {
mBind.recyclerView.setRefreshListener(() -> mPresenter.refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> mPresenter.loadMore());
mAdapter.setOnChildClickListener((view, adapter, position) -> {
if (view.getId() == R.id.item_text_phone) {
Order order = (Order) adapter.getItem(position);
......
......@@ -2,7 +2,7 @@ package com.dayu.bigfish.ui.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;
import java.util.List;
......@@ -11,7 +11,7 @@ import java.util.List;
* Fragment的适配器
*/
public class FragmentAdapter extends FragmentPagerAdapter {
public class FragmentAdapter extends FragmentStatePagerAdapter {
private List<Fragment> list_fragemnts;
public FragmentAdapter(FragmentManager fm, List<Fragment> list_fragemnts) {
......
package com.dayu.bigfish.ui.adapter;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import java.util.List;
/**
* Created by luofan on 17/12/24.
*/
public class FragmentBaseAdapter extends FragmentStatePagerAdapter {
private List<Fragment> mFragments;
private List<String> mTitles;
public static FragmentBaseAdapter newInstance(FragmentManager fm, List<Fragment> fragments, List<String> titles) {
FragmentBaseAdapter mFragmentAdapter = new FragmentBaseAdapter(fm);
mFragmentAdapter.mFragments = fragments;
mFragmentAdapter.mTitles = titles;
return mFragmentAdapter;
}
public FragmentBaseAdapter(FragmentManager fm) {
super(fm);
}
@Override
public Fragment getItem(int position) {
return mFragments.get(position);
}
@Override
public int getCount() {
return mFragments.size();
}
@Override
public CharSequence getPageTitle(int position) {
return mTitles.get(position);
}
}
\ No newline at end of file
......@@ -33,6 +33,6 @@ public class HomeFirstTabFragment extends BaseFragment<HomeFirstPresenter, Fragm
@Override
protected void lazyLoad() {
super.lazyLoad();
}
}
package com.dayu.bigfish.ui.fragment;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.DataBindingFragment;
import com.dayu.bigfish.databinding.FragmentMessageBinding;
import com.dayu.bigfish.ui.adapter.FragmentAdapter;
import com.dayu.bigfish.ui.adapter.FragmentBaseAdapter;
import com.dayu.bigfish.utils.TabLayoutUtils;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Observable;
import io.reactivex.functions.Function;
/**
* Created by luofan on 2017/11/20.
*/
public class HomeMessageTabFragment extends DataBindingFragment<FragmentMessageBinding> {
private List<Fragment> list;
private FragmentAdapter fragmentAdapter;
private int mIndex = -1;
public static HomeMessageTabFragment newInstance() {
......@@ -31,24 +31,16 @@ public class HomeMessageTabFragment extends DataBindingFragment<FragmentMessageB
@Override
public void initView() {
list = new ArrayList<>();
Bundle bundle = new Bundle();
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 FragmentAdapter(getActivity().getSupportFragmentManager(), list);
mBind.vpMessage.setAdapter(fragmentAdapter);
List<String> mTitle = new ArrayList<>();
List<Integer> category = new ArrayList<>();
mTitle.add(mActivity.getString(R.string.message_system));
mTitle.add(mActivity.getString(R.string.message_dayu));
category.add(1);
category.add(2);
Observable.fromIterable(category).map((Function<Integer, Fragment>) MessageFragment::newInstance).toList()
.map(fragments -> FragmentBaseAdapter.newInstance(getActivity().getSupportFragmentManager(), fragments, mTitle))
.subscribe(fragmentBaseAdapter -> mBind.vpMessage.setAdapter(fragmentBaseAdapter));
mBind.tbMessage.setupWithViewPager(mBind.vpMessage);
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_dayu)));
mBind.tbMessage.setTabMode(TabLayout.MODE_FIXED);
TabLayoutUtils.setIndicator(mBind.tbMessage, 60, 60, R.color.cl_receiving_order_item_data, getActivity());
if (mIndex != -1) {
mBind.vpMessage.setCurrentItem(mIndex);
......@@ -61,10 +53,6 @@ public class HomeMessageTabFragment extends DataBindingFragment<FragmentMessageB
return R.layout.fragment_message;
}
@Override
protected void lazyLoad() {
}
public void swtichFragment(int position) {
if (mBind.tbMessage == null || mBind.tbMessage.getTabAt(position) == null) {
return;
......
......@@ -66,9 +66,9 @@ public class HomeOrderFragment extends BaseFragment<HomeOrderPresenter, Fragment
initData();
}
@Override
protected void lazyLoad() {
super.lazyLoad();
mPresenter.getTabNum(0);
}
......
......@@ -65,6 +65,7 @@ public class HomePersonFragment extends BaseFragment<HomePersonPresenter, Fragme
@Override
protected void lazyLoad() {
super.lazyLoad();
ProgressUtil.startLoad(mActivity);
mPresenter.getAllData(userId, siteId);
mPresenter.getAlipayAccount(userId);
......
......@@ -17,8 +17,9 @@ import com.dayu.bigfish.presenter.message.messagePresenter;
public class MessageFragment extends BaseFragment<messagePresenter, LrecyclerViewBinding>
implements messageContract.View {
public static MessageFragment newInstance() {
public static MessageFragment newInstance(Integer category) {
Bundle args = new Bundle();
args.putInt("category", category);
MessageFragment fragment = new MessageFragment();
fragment.setArguments(args);
return fragment;
......@@ -29,14 +30,9 @@ public class MessageFragment extends BaseFragment<messagePresenter, LrecyclerVie
return R.layout.lrecycler_view;
}
@Override
protected void lazyLoad() {
}
@Override
public void initView() {
mBind.lRecycle.setPresenter(mPresenter);
mBind.lRecycle.setRefreshListener(() -> mPresenter.refresh());
mBind.lRecycle.setOnLoadMoreListener(() -> mPresenter.loadMore());
}
}
......@@ -22,10 +22,6 @@ public class OrderDatailsServeFragment extends DataBindingFragment<FragmentOrder
}
@Override
protected void lazyLoad() {
}
@Override
public void initView() {
OrderDetail details = (OrderDetail) getArguments().getSerializable(Constants.ORDER_DETAIL);
for (OrderDetail.RecordBean item : details.getRecord()) {
......
......@@ -37,10 +37,6 @@ public class OrderDateilsFragment extends DataBindingFragment<FragmentOrderDatai
return R.layout.fragment_order_datails;
}
@Override
protected void lazyLoad() {
}
public void initDataView(OrderDetail dataBean) {
mBind.tvOrderState.setText(getStaus(dataBean.getStatus()));
mBind.tvLookMore.setOnClickListener(o -> lookMore());
......
......@@ -4,7 +4,7 @@ import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseFragment;
import com.dayu.bigfish.bean.event.RefreshApoiment;
import com.dayu.bigfish.databinding.CommomRecycleBinding;
import com.dayu.bigfish.databinding.FragmentCommomRecycleBinding;
import com.dayu.bigfish.presenter.orderdoing.OrderDoingPresenter;
import com.dayu.bigfish.presenter.orderdoing.orderDoingContract;
import com.dayu.bigfish.ui.adapter.OrderAdapter;
......@@ -19,33 +19,21 @@ import org.greenrobot.eventbus.ThreadMode;
* 待预约的Fragment
*/
public class OrderFirstTabFragment extends BaseFragment<OrderDoingPresenter, CommomRecycleBinding>
public class OrderFirstTabFragment extends BaseFragment<OrderDoingPresenter, FragmentCommomRecycleBinding>
implements orderDoingContract.View {
private OrderAdapter mAdapter;
@Override
protected void lazyLoad() {
public int getLayoutId() {
return R.layout.fragment_commom_recycle;
}
@Override
public void initView() {
mAdapter = new OrderAdapter(true, R.layout.fragment_orderdoing_item);
mBind.recyclerView.setAdapter(mAdapter);
mBind.recyclerView.setPresenter(mPresenter);
mPresenter.refresh();
initListener();
}
@Override
public int getLayoutId() {
return R.layout.commom_recycle;
}
public void initListener() {
EventBus.getDefault().register(this);
mBind.recyclerView.setRefreshListener(() -> mPresenter.refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> mPresenter.loadMore());
}
@Override
......
package com.dayu.bigfish.ui.fragment;
import android.content.Intent;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseFragment;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.databinding.CommomRecycleBinding;
import com.dayu.bigfish.databinding.FragmentCommomRecycleBinding;
import com.dayu.bigfish.presenter.orderdoing.OrderDoingPresenter;
import com.dayu.bigfish.presenter.orderdoing.orderDoingContract;
import com.dayu.bigfish.ui.OrderDetailsActivity;
import com.dayu.bigfish.ui.adapter.OrderFourTabAdapter;
import com.dayu.bigfish.ui.listener.OnItemClickListener;
/**
......@@ -19,12 +14,13 @@ import com.dayu.bigfish.ui.listener.OnItemClickListener;
* on 2017/8/31.
*/
public class OrderFourTabFragment extends BaseFragment<OrderDoingPresenter, CommomRecycleBinding>
public class OrderFourTabFragment extends BaseFragment<OrderDoingPresenter, FragmentCommomRecycleBinding>
implements orderDoingContract.View {
private OrderFourTabAdapter mAdapter;
@Override
protected void lazyLoad() {
super.lazyLoad();
mPresenter.refresh();
}
......@@ -33,30 +29,17 @@ public class OrderFourTabFragment extends BaseFragment<OrderDoingPresenter, Comm
mAdapter = new OrderFourTabAdapter(true);
mAdapter.setViewType(R.layout.fragment_order_cancle_item);
mBind.recyclerView.setAdapter(mAdapter);
initListener();
}
@Override
public int getLayoutId() {
return R.layout.commom_recycle;
return R.layout.fragment_commom_recycle;
}
public void initListener() {
mBind.recyclerView.setRefreshListener(() -> mPresenter.refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> mPresenter.loadMore());
mBind.recyclerView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void OnItemClick(Object item, Object bind) {
Order order = (Order) item;
Intent intent = new Intent(mActivity, OrderDetailsActivity.class);
intent.putExtra("orderId", order.getId());
startActivity(intent);
}
});
}
@Override
public int getState() {
return Constants.CANCLE_ORDER;
}
}
package com.dayu.bigfish.ui.fragment;
import android.content.Intent;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseFragment;
import com.dayu.bigfish.bean.Order;
import com.dayu.bigfish.bean.event.OrderState;
import com.dayu.bigfish.bean.event.RefreshServe;
import com.dayu.bigfish.databinding.CommomRecycleBinding;
import com.dayu.bigfish.databinding.FragmentCommomRecycleBinding;
import com.dayu.bigfish.presenter.orderdoing.OrderDoingPresenter;
import com.dayu.bigfish.presenter.orderdoing.orderDoingContract;
import com.dayu.bigfish.ui.OrderDetailsActivity;
import com.dayu.bigfish.ui.adapter.OrderAdapter;
import com.dayu.bigfish.utils.ProgressUtil;
......@@ -32,18 +29,19 @@ import static com.dayu.bigfish.ui.fragment.HomeOrderFragment.ORDER_YUYUE;
* on 2017/8/31.
*/
public class OrderSecondTabFragment extends BaseFragment<OrderDoingPresenter, CommomRecycleBinding>
public class OrderSecondTabFragment extends BaseFragment<OrderDoingPresenter, FragmentCommomRecycleBinding>
implements orderDoingContract.View {
private OrderAdapter mAdapter;
private List<Order> mDatas;
@Override
public int getLayoutId() {
return R.layout.commom_recycle;
return R.layout.fragment_commom_recycle;
}
@Override
protected void lazyLoad() {
super.lazyLoad();
mPresenter.refresh();
}
......@@ -53,18 +51,6 @@ public class OrderSecondTabFragment extends BaseFragment<OrderDoingPresenter, Co
mAdapter = new OrderAdapter(true, R.layout.fragment_orderdoing_item);
mAdapter.initPresenter(mPresenter);
mBind.recyclerView.setAdapter(mAdapter);
initListener();
}
public void initListener() {
mBind.recyclerView.setRefreshListener(() -> mPresenter.refresh());
mBind.recyclerView.setOnLoadMoreListener(() -> mPresenter.loadMore());
mAdapter.setOnItemClickListener((item, bind) -> {
Intent intent = new Intent(mActivity, OrderDetailsActivity.class);
intent.putExtra("orderId", item.getId());
startActivity(intent);
});
}
@Override
......@@ -73,8 +59,8 @@ public class OrderSecondTabFragment extends BaseFragment<OrderDoingPresenter, Co
}
@Override
public void onDetach() {
super.onDetach();
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
......
package com.dayu.bigfish.ui.fragment;
import android.content.Intent;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseFragment;
import com.dayu.bigfish.bean.ErrorOrder;
import com.dayu.bigfish.databinding.CommomRecycleBinding;
import com.dayu.bigfish.databinding.FragmentOrderErrorItemBinding;
import com.dayu.bigfish.databinding.FragmentCommomRecycleBinding;
import com.dayu.bigfish.presenter.orderdoing.OrderDoingPresenter;
import com.dayu.bigfish.presenter.orderdoing.orderDoingContract;
import com.dayu.bigfish.ui.OrderDetailsActivity;
import com.dayu.bigfish.ui.adapter.OrderThreeTabAdapter;
import com.dayu.bigfish.ui.listener.OnItemClickListener;
/**
......@@ -19,12 +13,13 @@ import com.dayu.bigfish.ui.listener.OnItemClickListener;
* on 2017/8/31.
*/
public class OrderThreeTabFragment extends BaseFragment<OrderDoingPresenter, CommomRecycleBinding>
public class OrderThreeTabFragment extends BaseFragment<OrderDoingPresenter, FragmentCommomRecycleBinding>
implements orderDoingContract.View {
@Override
protected void lazyLoad() {
mPresenter.getErrorOrder();
super.lazyLoad();
mPresenter.refresh();
}
@Override
......@@ -32,28 +27,17 @@ public class OrderThreeTabFragment extends BaseFragment<OrderDoingPresenter, Com
OrderThreeTabAdapter adapter = new OrderThreeTabAdapter(false);
adapter.setViewType(R.layout.fragment_order_error_item);
mBind.recyclerView.setAdapter(adapter);
initListener();
}
@Override
public int getLayoutId() {
return R.layout.commom_recycle;
return R.layout.fragment_commom_recycle;
}
public void initListener() {
mBind.recyclerView.setRefreshListener(() -> mPresenter.getErrorOrder());
mBind.recyclerView.setOnItemClickListener(new OnItemClickListener<ErrorOrder, FragmentOrderErrorItemBinding>() {
@Override
public void OnItemClick(ErrorOrder item, FragmentOrderErrorItemBinding bind) {
Intent intent = new Intent(mActivity, OrderDetailsActivity.class);
intent.putExtra("orderId", item.getId());
startActivity(intent);
}
});
}
@Override
public int getState() {
return 0;
}
}
......@@ -5,6 +5,7 @@ import android.view.View;
import com.dayu.bigfish.base.CoreAdapter;
/**
* LRecy的子view的点击事件
* Created by luofan on 2017/12/10.
*/
......
......@@ -14,12 +14,14 @@ import android.widget.FrameLayout;
import android.widget.LinearLayout;
import com.dayu.bigfish.R;
import com.dayu.bigfish.base.BaseListPresenter;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.base.BasePresenter;
import com.dayu.bigfish.base.CoreAdapter;
import com.dayu.bigfish.base.TypeSelector;
import com.dayu.bigfish.ui.listener.OnItemClickListener;
import com.dayu.bigfish.ui.listener.OnRefreshListener;
import com.dayu.bigfish.ui.listener.onLoadMoreListener;
import com.dayu.bigfish.utils.ProgressUtil;
import java.util.List;
......@@ -61,6 +63,8 @@ public class LRecyclerView<M, B> extends FrameLayout {
public CoreAdapter<M, B> mCoreAdapter;
private int itemType;
private LinearLayout ll_faileView;
private BaseListPresenter mPresenter;
private boolean isRefreshable;
public LRecyclerView(@NonNull Context context) {
......@@ -88,7 +92,7 @@ public class LRecyclerView<M, B> extends FrameLayout {
isReverse = ta.getBoolean(R.styleable.LRecyclerView_isReverse, false);
isNeedFoot = ta.getBoolean(R.styleable.LRecyclerView_needFoot, true);
needCoreAdapter = ta.getBoolean(R.styleable.LRecyclerView_needCoreAdapter, false);
boolean isRefreshable = ta.getBoolean(R.styleable.LRecyclerView_isRefreshable, true);
isRefreshable = ta.getBoolean(R.styleable.LRecyclerView_isRefreshable, true);
ta.recycle();
//初始化recycleview
View layout = inflate(context, R.layout.lrecycle_layout, this);
......@@ -120,11 +124,11 @@ public class LRecyclerView<M, B> extends FrameLayout {
Refresh();
});
ll_faileView.setOnClickListener(view -> {
// ProgressUtil.startLoad(mCoreAdapter.getContext());
ProgressUtil.startLoad(mCoreAdapter.getContext());
Refresh();
});
ll_emptyView.setOnClickListener(view -> {
// ProgressUtil.startLoad(mCoreAdapter.getContext());
ProgressUtil.startLoad(mCoreAdapter.getContext());
Refresh();
});
......@@ -138,11 +142,11 @@ public class LRecyclerView<M, B> extends FrameLayout {
&& newState == RecyclerView.SCROLL_STATE_IDLE
&& lastVisibleItem + 1 == recyclerview.getAdapter().getItemCount()
&& mCoreAdapter.isHasMore) {
if (mLoadMoreListener != null && isNeedFoot) {
if (mPresenter != null && isNeedFoot) {
mPresenter.loadMore();
mCoreAdapter.isLoadFial = false;
mCoreAdapter.notifyDataSetChanged();
isRefresh = false;
mLoadMoreListener.onLoadMore();
}
}
}
......@@ -174,6 +178,11 @@ public class LRecyclerView<M, B> extends FrameLayout {
return this;
}
public LRecyclerView setTypeSelector(TypeSelector mTypeSelector) {
this.mCoreAdapter.setTypeSelector(mTypeSelector);
return this;
}
public void setEmpty() {
ll_emptyView.setVisibility(View.VISIBLE);
swipeRefresh.setVisibility(View.GONE);
......@@ -254,13 +263,17 @@ public class LRecyclerView<M, B> extends FrameLayout {
* 刷新.
*/
public void Refresh() {
if (mRefreshListener != null) {
reSetEmpty();
if (mPresenter != null) {
mPresenter.refresh();
isRefresh = true;
mRefreshListener.refresh();
}
// if (mRefreshListener != null) {
// isRefresh = true;
// mRefreshListener.refresh();
// }
}
/**
* 设置adpaterItem.
*
......@@ -282,7 +295,8 @@ public class LRecyclerView<M, B> extends FrameLayout {
mCoreAdapter.setOnItemClickListener(listener);
}
public void setPresenter(BasePresenter presenter) {
public void setPresenter(BaseListPresenter presenter) {
mPresenter = presenter;
mCoreAdapter.setPresenter(presenter);
}
......
package com.dayu.bigfish.ui.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
/**
* Created by Jaeger on 16/6/8.
*
* Email: chjie.jaeger@gmail.com
* GitHub: https://github.com/laobie
*/
public class StatusBarView extends View {
public StatusBarView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public StatusBarView(Context context) {
super(context);
}
}
......@@ -2,6 +2,7 @@ package com.dayu.bigfish.utils;
import android.databinding.BindingAdapter;
import android.databinding.BindingConversion;
import android.databinding.Observable;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.widget.ImageView;
......@@ -11,6 +12,7 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.dayu.bigfish.Constants;
import com.dayu.bigfish.MyApplication;
import com.dayu.bigfish.base.BaseListPresenter;
import com.dayu.bigfish.base.BasePageBean;
import com.dayu.bigfish.ui.views.LRecyclerView;
import com.dayu.bigfish.ui.views.SwitchImage;
......@@ -56,13 +58,29 @@ public class BindingUtils {
}
}
/**
* Lrecycleview设置数据源.
* databing加载图片.
*
* @param view
*/
@BindingAdapter({"dataSours"})
public static void setDatas(LRecyclerView view, Object obj) {
@BindingAdapter({"chageButton"})
public static void chageButton(SwitchImage view, boolean flag) {
view.setSwitchButton(flag);
}
/**
* recy设置数据源和presenter.
*
* @param view
*/
@BindingAdapter({"setPresenter"})
public static void setPresenter(LRecyclerView view, BaseListPresenter presenter) {
view.setPresenter(presenter);
presenter.getSourceDatas().addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable observable, int i) {
Object obj = presenter.getSourceDatas().get();
if (obj instanceof BasePageBean) {
view.setPageData((BasePageBean) obj);
} else if (obj instanceof List) {
......@@ -73,14 +91,24 @@ public class BindingUtils {
}
}
}
});
}
/**
* databing加载图片.
* Lrecycleview设置数据源.
*
* @param view
*/
@BindingAdapter({"chageButton"})
public static void chageButton(SwitchImage view, boolean flag) {
view.setSwitchButton(flag);
@BindingAdapter({"dataSours"})
public static void setDatas(LRecyclerView view, Object obj) {
if (obj instanceof BasePageBean) {
view.setPageData((BasePageBean) obj);
} else if (obj instanceof List) {
view.setData((List) obj);
} else if (obj instanceof Integer) {
if ((int) obj == Constants.FAILED) {
view.setDataFail();
}
}
}
}
package com.dayu.bigfish.utils;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.v4.widget.DrawerLayout;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.LinearLayout;
import com.dayu.bigfish.ui.views.StatusBarView;
/**
* Created by Jaeger on 16/2/14.
* <p>
* Email: chjie.jaeger@gmail.com
* GitHub: https://github.com/laobie
*/
public class StatusBarUtil {
public static final int DEFAULT_STATUS_BAR_ALPHA = 112;
/**
* 设置状态栏颜色
*
* @param activity 需要设置的 activity
* @param color 状态栏颜色值
*/
public static void setColor(Activity activity, @ColorInt int color) {
setColor(activity, color, DEFAULT_STATUS_BAR_ALPHA);
}
/**
* 设置状态栏颜色
*
* @param activity 需要设置的activity
* @param color 状态栏颜色值
* @param statusBarAlpha 状态栏透明度
*/
public static void setColor(Activity activity, @ColorInt int color, int statusBarAlpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().setStatusBarColor(calculateStatusColor(color, statusBarAlpha));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
int count = decorView.getChildCount();
if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) {
decorView.getChildAt(count - 1).setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
} else {
StatusBarView statusView = createStatusBarView(activity, color, statusBarAlpha);
decorView.addView(statusView);
}
setRootView(activity);
}
}
/**
* 设置状态栏纯色 不加半透明效果
*
* @param activity 需要设置的 activity
* @param color 状态栏颜色值
*/
public static void setColorNoTranslucent(Activity activity, @ColorInt int color) {
setColor(activity, color, 0);
}
/**
* 设置状态栏颜色(5.0以下无半透明效果,不建议使用)
*
* @param activity 需要设置的 activity
* @param color 状态栏颜色值
*/
@Deprecated
public static void setColorDiff(Activity activity, @ColorInt int color) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// 生成一个状态栏大小的矩形
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
int count = decorView.getChildCount();
if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) {
decorView.getChildAt(count - 1).setBackgroundColor(color);
} else {
StatusBarView statusView = createStatusBarView(activity, color);
decorView.addView(statusView);
}
setRootView(activity);
}
/**
* 使状态栏半透明
* <p>
* 适用于图片作为背景的界面,此时需要图片填充到状态栏
*
* @param activity 需要设置的activity
*/
public static void setTranslucent(Activity activity) {
setTranslucent(activity, DEFAULT_STATUS_BAR_ALPHA);
}
/**
* 使状态栏半透明
* <p>
* 适用于图片作为背景的界面,此时需要图片填充到状态栏
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
*/
public static void setTranslucent(Activity activity, int statusBarAlpha) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
setTransparent(activity);
addTranslucentView(activity, statusBarAlpha);
}
/**
* 针对根布局是 CoordinatorLayout, 使状态栏半透明
* <p>
* 适用于图片作为背景的界面,此时需要图片填充到状态栏
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
*/
public static void setTranslucentForCoordinatorLayout(Activity activity, int statusBarAlpha) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
transparentStatusBar(activity);
addTranslucentView(activity, statusBarAlpha);
}
/**
* 设置状态栏全透明
*
* @param activity 需要设置的activity
*/
public static void setTransparent(Activity activity) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
transparentStatusBar(activity);
setRootView(activity);
}
/**
* 使状态栏透明(5.0以上半透明效果,不建议使用)
* <p>
* 适用于图片作为背景的界面,此时需要图片填充到状态栏
*
* @param activity 需要设置的activity
*/
@Deprecated
public static void setTranslucentDiff(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// 设置状态栏透明
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
setRootView(activity);
}
}
/**
* 为DrawerLayout 布局设置状态栏变色
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
* @param color 状态栏颜色值
*/
public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
setColorForDrawerLayout(activity, drawerLayout, color, DEFAULT_STATUS_BAR_ALPHA);
}
/**
* 为DrawerLayout 布局设置状态栏颜色,纯色
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
* @param color 状态栏颜色值
*/
public static void setColorNoTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
setColorForDrawerLayout(activity, drawerLayout, color, 0);
}
/**
* 为DrawerLayout 布局设置状态栏变色
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
* @param color 状态栏颜色值
* @param statusBarAlpha 状态栏透明度
*/
public static void setColorForDrawerLayout(Activity activity, DrawerLayout drawerLayout, @ColorInt int color,
int statusBarAlpha) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
} else {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
// 生成一个状态栏大小的矩形
// 添加 statusBarView 到布局中
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
if (contentLayout.getChildCount() > 0 && contentLayout.getChildAt(0) instanceof StatusBarView) {
contentLayout.getChildAt(0).setBackgroundColor(calculateStatusColor(color, statusBarAlpha));
} else {
StatusBarView statusBarView = createStatusBarView(activity, color);
contentLayout.addView(statusBarView, 0);
}
// 内容布局不是 LinearLayout 时,设置padding top
if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
contentLayout.getChildAt(1)
.setPadding(contentLayout.getPaddingLeft(), getStatusBarHeight(activity) + contentLayout.getPaddingTop(),
contentLayout.getPaddingRight(), contentLayout.getPaddingBottom());
}
// 设置属性
ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
drawerLayout.setFitsSystemWindows(false);
contentLayout.setFitsSystemWindows(false);
contentLayout.setClipToPadding(true);
drawer.setFitsSystemWindows(false);
addTranslucentView(activity, statusBarAlpha);
}
/**
* 为DrawerLayout 布局设置状态栏变色(5.0以下无半透明效果,不建议使用)
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
* @param color 状态栏颜色值
*/
@Deprecated
public static void setColorForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout, @ColorInt int color) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// 生成一个状态栏大小的矩形
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
if (contentLayout.getChildCount() > 0 && contentLayout.getChildAt(0) instanceof StatusBarView) {
contentLayout.getChildAt(0).setBackgroundColor(calculateStatusColor(color, DEFAULT_STATUS_BAR_ALPHA));
} else {
// 添加 statusBarView 到布局中
StatusBarView statusBarView = createStatusBarView(activity, color);
contentLayout.addView(statusBarView, 0);
}
// 内容布局不是 LinearLayout 时,设置padding top
if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
}
// 设置属性
ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
drawerLayout.setFitsSystemWindows(false);
contentLayout.setFitsSystemWindows(false);
contentLayout.setClipToPadding(true);
drawer.setFitsSystemWindows(false);
}
}
/**
* 为 DrawerLayout 布局设置状态栏透明
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
*/
public static void setTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
setTranslucentForDrawerLayout(activity, drawerLayout, DEFAULT_STATUS_BAR_ALPHA);
}
/**
* 为 DrawerLayout 布局设置状态栏透明
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
*/
public static void setTranslucentForDrawerLayout(Activity activity, DrawerLayout drawerLayout, int statusBarAlpha) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
setTransparentForDrawerLayout(activity, drawerLayout);
addTranslucentView(activity, statusBarAlpha);
}
/**
* 为 DrawerLayout 布局设置状态栏透明
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
*/
public static void setTransparentForDrawerLayout(Activity activity, DrawerLayout drawerLayout) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
} else {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
// 内容布局不是 LinearLayout 时,设置padding top
if (!(contentLayout instanceof LinearLayout) && contentLayout.getChildAt(1) != null) {
contentLayout.getChildAt(1).setPadding(0, getStatusBarHeight(activity), 0, 0);
}
// 设置属性
ViewGroup drawer = (ViewGroup) drawerLayout.getChildAt(1);
drawerLayout.setFitsSystemWindows(false);
contentLayout.setFitsSystemWindows(false);
contentLayout.setClipToPadding(true);
drawer.setFitsSystemWindows(false);
}
/**
* 为 DrawerLayout 布局设置状态栏透明(5.0以上半透明效果,不建议使用)
*
* @param activity 需要设置的activity
* @param drawerLayout DrawerLayout
*/
@Deprecated
public static void setTranslucentForDrawerLayoutDiff(Activity activity, DrawerLayout drawerLayout) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
// 设置状态栏透明
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
// 设置内容布局属性
ViewGroup contentLayout = (ViewGroup) drawerLayout.getChildAt(0);
contentLayout.setFitsSystemWindows(true);
contentLayout.setClipToPadding(true);
// 设置抽屉布局属性
ViewGroup vg = (ViewGroup) drawerLayout.getChildAt(1);
vg.setFitsSystemWindows(false);
// 设置 DrawerLayout 属性
drawerLayout.setFitsSystemWindows(false);
}
}
/**
* 为头部是 ImageView 的界面设置状态栏全透明
*
* @param activity 需要设置的activity
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTransparentForImageView(Activity activity, View needOffsetView) {
setTranslucentForImageView(activity, 0, needOffsetView);
}
/**
* 为头部是 ImageView 的界面设置状态栏透明(使用默认透明度)
*
* @param activity 需要设置的activity
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, View needOffsetView) {
setTranslucentForImageView(activity, DEFAULT_STATUS_BAR_ALPHA, needOffsetView);
}
/**
* 为头部是 ImageView 的界面设置状态栏透明
*
* @param activity 需要设置的activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageView(Activity activity, int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
activity.getWindow()
.getDecorView()
.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
if (activity instanceof TabActivity){
activity.getWindow()//兼容TabActivity
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
} else {
activity.getWindow()
.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
public static void setMargin(Activity activity, View needOffsetView) {
if (needOffsetView != null) {
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
if (layoutParams != null) {
layoutParams.setMargins(0, getStatusBarHeight(activity), 0, 0);
}
}
}
/**
* 为 fragment 头部是 ImageView 的设置状态栏透明
*
* @param activity fragment 对应的 activity
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageViewInFragment(Activity activity, View needOffsetView) {
setTranslucentForImageViewInFragment(activity, DEFAULT_STATUS_BAR_ALPHA, needOffsetView);
}
/**
* 为 fragment 头部是 ImageView 的设置状态栏透明
*
* @param activity fragment 对应的 activity
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTransparentForImageViewInFragment(Activity activity, View needOffsetView) {
setTranslucentForImageViewInFragment(activity, 0, needOffsetView);
}
/**
* 为 fragment 头部是 ImageView 的设置状态栏透明
*
* @param activity fragment 对应的 activity
* @param statusBarAlpha 状态栏透明度
* @param needOffsetView 需要向下偏移的 View
*/
public static void setTranslucentForImageViewInFragment(Activity activity, int statusBarAlpha, View needOffsetView) {
setTranslucentForImageView(activity, statusBarAlpha, needOffsetView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
clearPreviousSetting(activity);
}
}
@TargetApi(Build.VERSION_CODES.KITKAT)
private static void clearPreviousSetting(Activity activity) {
ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
int count = decorView.getChildCount();
if (count > 0 && decorView.getChildAt(count - 1) instanceof StatusBarView) {
decorView.removeViewAt(count - 1);
ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
rootView.setPadding(0, 0, 0, 0);
}
}
/**
* 添加半透明矩形条
*
* @param activity 需要设置的 activity
* @param statusBarAlpha 透明值
*/
private static void addTranslucentView(Activity activity, int statusBarAlpha) {
ViewGroup contentView = (ViewGroup) activity.findViewById(android.R.id.content);
if (contentView.getChildCount() > 1) {
contentView.getChildAt(1).setBackgroundColor(Color.argb(statusBarAlpha, 0, 0, 0));
} else {
contentView.addView(createTranslucentStatusBarView(activity, statusBarAlpha));
}
}
/**
* 生成一个和状态栏大小相同的彩色矩形条
*
* @param activity 需要设置的 activity
* @param color 状态栏颜色值
* @return 状态栏矩形条
*/
private static StatusBarView createStatusBarView(Activity activity, @ColorInt int color) {
// 绘制一个和状态栏一样高的矩形
StatusBarView statusBarView = new StatusBarView(activity);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
statusBarView.setLayoutParams(params);
statusBarView.setBackgroundColor(color);
return statusBarView;
}
/**
* 生成一个和状态栏大小相同的半透明矩形条
*
* @param activity 需要设置的activity
* @param color 状态栏颜色值
* @param alpha 透明值
* @return 状态栏矩形条
*/
private static StatusBarView createStatusBarView(Activity activity, @ColorInt int color, int alpha) {
// 绘制一个和状态栏一样高的矩形
StatusBarView statusBarView = new StatusBarView(activity);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
statusBarView.setLayoutParams(params);
statusBarView.setBackgroundColor(calculateStatusColor(color, alpha));
return statusBarView;
}
/**
* 设置根布局参数
*/
private static void setRootView(Activity activity) {
ViewGroup rootView = (ViewGroup) ((ViewGroup) activity.findViewById(android.R.id.content)).getChildAt(0);
rootView.setFitsSystemWindows(true);
rootView.setClipToPadding(true);
}
/**
* 使状态栏透明
*/
@TargetApi(Build.VERSION_CODES.KITKAT)
private static void transparentStatusBar(Activity activity) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
} else {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}
}
/**
* 创建半透明矩形 View
*
* @param alpha 透明值
* @return 半透明 View
*/
private static StatusBarView createTranslucentStatusBarView(Activity activity, int alpha) {
// 绘制一个和状态栏一样高的矩形
StatusBarView statusBarView = new StatusBarView(activity);
LinearLayout.LayoutParams params =
new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight(activity));
statusBarView.setLayoutParams(params);
statusBarView.setBackgroundColor(Color.argb(alpha, 0, 0, 0));
return statusBarView;
}
/**
* 获取状态栏高度
*
* @param context context
* @return 状态栏高度
*/
public static int getStatusBarHeight(Context context) {
// 获得状态栏高度
int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
return context.getResources().getDimensionPixelSize(resourceId);
}
/**
* 计算状态栏颜色
*
* @param color color值
* @param alpha alpha值
* @return 最终的状态栏颜色
*/
private static int calculateStatusColor(@ColorInt int color, int alpha) {
float a = 1 - alpha / 255f;
int red = color >> 16 & 0xff;
int green = color >> 8 & 0xff;
int blue = color & 0xff;
red = (int) (red * a + 0.5);
green = (int) (green * a + 0.5);
blue = (int) (blue * a + 0.5);
return 0xff << 24 | red << 16 | green << 8 | blue;
}
}
......@@ -63,7 +63,7 @@
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/rl_balance"
dataSours="@{presenter.datas}"
setPresenter="@{presenter}"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:itemType="@layout/item_account_balance_layout"
......
......@@ -5,7 +5,7 @@
<variable
name="presenter"
type="com.dayu.bigfish.presenter.receivingorder.ReceivingPresenter" />
type="com.dayu.bigfish.base.BaseListPresenter" />
</data>
<LinearLayout
......@@ -33,7 +33,7 @@
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/recyclerView"
dataSours="@{presenter.datas}"
setPresenter="@{presenter}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5" />
......
......@@ -91,7 +91,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0"
android:textColor="@color/white"
android:textColor="@color/cl_white"
android:textSize="16.7sp"
/>
......@@ -99,7 +99,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/home_receive_order"
android:textColor="@color/white"
android:textColor="@color/cl_white"
android:textSize="10sp"
/>
</LinearLayout>
......
<?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>
......@@ -97,7 +96,7 @@
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/recyclerView"
dataSours="@{presenter.datas}"
setPresenter="@{presenter}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5" />
......
......@@ -48,7 +48,7 @@
android:gravity="center"
android:onClick="@{()->presenter.dumpToSop()}"
android:text="@string/sop_finish"
android:textColor="@color/white"
android:textColor="@color/cl_white"
android:textSize="13.3sp"
android:visibility="@{item.subStatus == 5?View.VISIBLE:View.GONE}" />
......
<?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>
<variable
name="presenter"
type="com.dayu.bigfish.presenter.orderdoing.OrderDoingPresenter" />
type="com.dayu.bigfish.base.BaseListPresenter" />
</data>
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/recyclerView"
dataSours="@{presenter.datas}"
android:layout_width="match_parent"
android:layout_height="match_parent"
setPresenter="@{presenter}"
android:background="#f5f5f5" />
</layout>
\ No newline at end of file
......@@ -43,7 +43,8 @@
app:tabMode="fixed"
app:tabSelectedTextColor="@color/cl_receiving_order_item_data"
app:tabTextAppearance="@style/TabLayoutTextStyle"
app:tabTextColor="@color/cl_tab_line" />
app:tabTextColor="@color/cl_tab_line"
/>
<ImageView style="@style/card_line" />
......
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="item"
type="com.dayu.bigfish.bean.Order" />
<variable
name="presenter"
type="com.dayu.bigfish.presenter.BaseOrderPresenter" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -9,22 +20,20 @@
android:layout_marginRight="@dimen/dp_13.3"
android:layout_marginTop="5dp"
android:background="@drawable/item_shape"
android:orientation="vertical"
>
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/dp_13.3"
android:layout_weight="1"
android:orientation="horizontal"
>
android:onClick="@{()->presenter.dumpDetail(item.id)}"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:orientation="vertical">
<TextView
android:id="@+id/tv_order_time"
......@@ -35,8 +44,7 @@
android:text="@string/tv_home_tab_one_subscribe_time"
android:textColor="@color/cl_order_item_line_bg"
android:textSize="13.3sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/item_tody"
......@@ -46,7 +54,7 @@
android:layout_marginTop="5.7dp"
android:text="@string/tv_order_item_time"
android:textColor="@color/cl_order_item_line_bg"
android:textSize="@dimen/sp_13.3"/>
android:textSize="@dimen/sp_13.3" />
<TextView
android:id="@+id/item_time"
......@@ -54,9 +62,9 @@
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/tv_order_item_date"
android:typeface="@{@string/tv_fonts}"
android:textColor="@color/cl_order_item_line_bg"
android:textSize="@dimen/size_order_item_data_text"/>
android:textSize="@dimen/size_order_item_data_text"
android:typeface="@{@string/tv_fonts}" />
</LinearLayout>
......@@ -67,20 +75,18 @@
android:layout_marginBottom="13.3dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="@dimen/dp_21.3"
android:background="@color/cl_order_item_line_bg"/>
android:background="@color/cl_order_item_line_bg" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="9.3dp"
android:orientation="vertical"
>
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
......@@ -100,8 +106,7 @@
android:text="@string/tv_order_item_tool_text"
android:textColor="@color/cl_order_item_line_bg"
android:textSize="@dimen/size_login_hint_text"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/text_line"
......@@ -110,7 +115,7 @@
android:layout_marginTop="@dimen/dp_16.7"
android:text=" - "
android:textColor="@color/cl_order_item_line_bg"
android:textStyle="bold"/>
android:textStyle="bold" />
<TextView
android:id="@+id/item_text_weixiu_leixing"
......@@ -123,8 +128,7 @@
android:text="@string/tv_order_item_tool_text_leixing"
android:textColor="@color/cl_order_item_line_bg"
android:textSize="@dimen/size_login_hint_text"
android:textStyle="bold"
/>
android:textStyle="bold" />
</LinearLayout>
<TextView
......@@ -135,8 +139,7 @@
android:layout_marginTop="@dimen/dp_16.7"
android:textColor="@color/cl_order_item_line_bg"
android:textSize="@dimen/size_login_hint_text"
android:visibility="visible"
/>
android:visibility="visible" />
</LinearLayout>
<TextView
......@@ -151,8 +154,7 @@
android:maxLines="2"
android:text="@string/tv_order_item_gps_text"
android:textColor="@color/cl_order_item_line_bg"
android:textSize="@dimen/size_login_hint_text"
/>
android:textSize="@dimen/size_login_hint_text" />
</LinearLayout>
</LinearLayout>
......
......@@ -5,7 +5,11 @@
<variable
name="item"
type="com.dayu.bigfish.bean.ErrorOrder"/>
type="com.dayu.bigfish.bean.ErrorOrder" />
<variable
name="presenter"
type="com.dayu.bigfish.presenter.orderdoing.OrderDoingPresenter" />
</data>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
......@@ -16,22 +20,20 @@
android:layout_marginRight="@dimen/dp_13.3"
android:layout_marginTop="5dp"
android:background="@drawable/item_shape"
android:orientation="vertical"
>
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/dp_13.3"
android:layout_weight="1"
android:orientation="horizontal"
>
android:onClick="@{()->presenter.dumpDetail(item.id)}"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
>
android:orientation="vertical">
<TextView
android:id="@+id/tv_order_time"
......@@ -42,8 +44,7 @@
android:text="@string/tv_home_tab_one_subscribe_time"
android:textColor="#3a3a3a"
android:textSize="13.3sp"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/item_tody"
......@@ -53,7 +54,7 @@
android:layout_marginTop="5.7dp"
android:text="@string/tv_order_item_time"
android:textColor="@color/cl_tab_read"
android:textSize="@dimen/sp_13.3"/>
android:textSize="@dimen/sp_13.3" />
<TextView
android:id="@+id/item_time"
......@@ -61,9 +62,9 @@
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="@string/tv_order_item_date"
android:typeface="@{@string/tv_fonts}"
android:textColor="@color/cl_tab_read"
android:textSize="@dimen/size_order_item_data_text"/>
android:textSize="@dimen/size_order_item_data_text"
android:typeface="@{@string/tv_fonts}" />
</LinearLayout>
......@@ -74,20 +75,18 @@
android:layout_marginBottom="13.3dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="@dimen/dp_21.3"
android:background="@color/cl_order_item_line_bg"/>
android:background="@color/cl_order_item_line_bg" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="9.3dp"
android:orientation="vertical"
>
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
......@@ -107,8 +106,7 @@
android:text="@string/tv_order_item_tool_text"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/size_login_hint_text"
android:textStyle="bold"
/>
android:textStyle="bold" />
<TextView
android:id="@+id/text_line"
......@@ -116,7 +114,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_16.7"
android:text=" - "
android:textStyle="bold"/>
android:textStyle="bold" />
<TextView
android:id="@+id/item_text_weixiu_leixing"
......@@ -129,8 +127,7 @@
android:text="@string/tv_order_item_tool_text_leixing"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/size_login_hint_text"
android:textStyle="bold"
/>
android:textStyle="bold" />
</LinearLayout>
<TextView
......@@ -141,8 +138,7 @@
android:layout_marginTop="@dimen/dp_16.7"
android:textColor="@color/cl_tab_read"
android:textSize="@dimen/size_login_hint_text"
android:visibility="visible"
/>
android:visibility="visible" />
</LinearLayout>
<TextView
......@@ -157,8 +153,7 @@
android:maxLines="2"
android:text="@string/tv_order_item_gps_text"
android:textColor="@color/cl_home_title_text_color"
android:textSize="@dimen/size_login_hint_text"
/>
android:textSize="@dimen/size_login_hint_text" />
</LinearLayout>
</LinearLayout>
......
......@@ -3,16 +3,15 @@
<data>
<import type="android.view.View"/>
<import type="android.view.View" />
<variable
name="item"
type="Boolean"/>
type="Boolean" />
</data>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center"
......@@ -24,7 +23,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@drawable/progressbar"
android:visibility="@{item == null?View.GONE:(item?View.VISIBLE:View.GONE)}"/>
android:visibility="@{item == null?View.GONE:(item?View.VISIBLE:View.GONE)}" />
<TextView
android:id="@+id/tv_state"
......@@ -32,8 +31,7 @@
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:clickable="@{item == null?true:false}"
android:text='@{item !=null? (item?"正在加载" :"没有更多数据"):"加载失败(再次上拉试试~)"}'
/>
android:text='@{item !=null? (item?"正在加载" :"没有更多数据"):"加载失败(再次上拉试试~)"}' />
</LinearLayout>
......
......@@ -6,15 +6,16 @@
<variable
name="presenter"
type="com.dayu.bigfish.presenter.message.messagePresenter" />
type="com.dayu.bigfish.base.BaseListPresenter" />
</data>
<com.dayu.bigfish.ui.views.LRecyclerView
android:id="@+id/l_recycle"
dataSours="@{presenter.data}"
setPresenter="@{presenter}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f5f5f5"
app:itemType="@layout/item_message_layout"
app:needCoreAdapter="true" />
</layout>
\ No newline at end of file
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx1536m
android.enableAapt2=false
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
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