Commit ce16b6fc authored by 陈前's avatar 陈前

补货折叠

parent 02541204
......@@ -4,6 +4,7 @@ package com.xingdata.zzdpos.ui.manage.replenishment.fragment;
import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.renderscript.ScriptGroup;
import android.support.design.widget.AppBarLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.text.InputType;
import android.view.KeyEvent;
......@@ -46,6 +47,13 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
private Psb mPsb;
private long sumPrice;
private boolean isAdd = true;
private CollapsingToolbarLayoutState state;
private enum CollapsingToolbarLayoutState {
EXPANDED,
COLLAPSED,
INTERNEDIATE
}
@Override
public int getLayoutId() {
......@@ -57,7 +65,7 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
mViewBinding.edTitle.setHint(R.string.inventory_add_et_hint);
mViewBinding.edTitle.setText("");
initCartBar();
initRecycycler();
initOnClickListener();
......@@ -65,7 +73,7 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
new android.os.Handler().postDelayed(new Runnable() {
@Override
public void run() {
mViewBinding.recyclerView.scrollToPosition(0);
mViewBinding.recyclerView.scrollToPosition(0);
}
}, 1);
}
......@@ -319,4 +327,38 @@ public class ReplenishmentDetailFragment extends BaseFragment<ReplenishmentPrese
mPresenter.changeTitle(getResources().getString(R.string.replenishment_meun), false);
return super.onBackPressedSupport();
}
public void initCartBar() {
mViewBinding.setIsShowBar(false);
mViewBinding.appBar.addOnOffsetChangedListener(new AppBarLayout
.OnOffsetChangedListener() {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
if (verticalOffset == 0) {
if (state != CollapsingToolbarLayoutState.EXPANDED) {
mViewBinding.setIsShowBar(false);
state = CollapsingToolbarLayoutState.EXPANDED;//修改状态标记为展开
}
} else if (Math.abs(verticalOffset) >= appBarLayout.getTotalScrollRange()) {
if (state != CollapsingToolbarLayoutState.COLLAPSED) {
mViewBinding.setIsShowBar(true);
state = CollapsingToolbarLayoutState.COLLAPSED;//修改状态标记为折叠
}
} else {
if (state != CollapsingToolbarLayoutState.INTERNEDIATE) {
if (state == CollapsingToolbarLayoutState.COLLAPSED) {
mViewBinding.setIsShowBar(false);
}
state = CollapsingToolbarLayoutState.INTERNEDIATE;//修改状态标记为中间
}
}
}
});
}
}
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 to comment