Commit 9bfadc4c authored by zhang_z's avatar zhang_z

修改扫码逻辑;

parent 3614f2d8
......@@ -36,8 +36,7 @@ import java.util.ArrayList;
import java.util.List;
public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBinding> implements
StoreContract.View {
public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBinding> implements StoreContract.View {
private StoreFragment mStoreFragment = new StoreFragment();
private SearchFragment mSearchFragment = new SearchFragment();
......@@ -165,7 +164,17 @@ public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBin
mViewBinding.setTitleMode(C.TITLE_MODE.SKU);
mViewBinding.etSearch.setText("");
mViewBinding.etSearch.requestFocus();
this.start(mSearchFragment);
this.start(mSearchFragment.setKeyword(""));
}
}
@Override
public void showSearchFragment(String keyword) {
if (!mSearchFragment.isAdded()) {
mViewBinding.setTitleMode(C.TITLE_MODE.SKU);
mViewBinding.etSearch.setText(keyword);
mViewBinding.etSearch.requestFocus();
this.start(mSearchFragment.setKeyword(keyword));
}
}
......@@ -194,28 +203,28 @@ public class StoreActivity extends BaseActivity<StorePresenter, ActivityStoreBin
* @param scaleLarge 放大比例
* @param duration 时间
*/
private void startShakeByPropertyAnim(View view, float scaleSmall, float scaleLarge, long
duration) {
private void startShakeByPropertyAnim(View view, float scaleSmall, float scaleLarge, long duration) {
if (view == null) {
return;
}
//先变小后变大
PropertyValuesHolder scaleXValuesHolder = PropertyValuesHolder.ofKeyframe(View.SCALE_X,
PropertyValuesHolder scaleXValuesHolder = PropertyValuesHolder.ofKeyframe(
View.SCALE_X,
Keyframe.ofFloat(0f, 1.0f),
Keyframe.ofFloat(0.25f, scaleSmall),
Keyframe.ofFloat(0.5f, scaleLarge),
Keyframe.ofFloat(0.75f, scaleLarge),
Keyframe.ofFloat(1.0f, 1.0f)
);
PropertyValuesHolder scaleYValuesHolder = PropertyValuesHolder.ofKeyframe(View.SCALE_Y,
PropertyValuesHolder scaleYValuesHolder = PropertyValuesHolder.ofKeyframe(
View.SCALE_Y,
Keyframe.ofFloat(0f, 1.0f),
Keyframe.ofFloat(0.25f, scaleSmall),
Keyframe.ofFloat(0.5f, scaleLarge),
Keyframe.ofFloat(0.75f, scaleLarge),
Keyframe.ofFloat(1.0f, 1.0f)
);
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(view,
scaleXValuesHolder, scaleYValuesHolder);
ObjectAnimator objectAnimator = ObjectAnimator.ofPropertyValuesHolder(view, scaleXValuesHolder, scaleYValuesHolder);
objectAnimator.setDuration(duration);
objectAnimator.start();
}
......
......@@ -102,6 +102,13 @@ interface StoreContract {
*/
void showSearchFragment();
/**
* 显示搜索页面
*
* @param keyword 搜索内容
*/
void showSearchFragment(String keyword);
/**
* 显示扫码页面
*/
......
......@@ -354,8 +354,7 @@ public class StorePresenter extends StoreContract.Presenter {
.equalTo("skuStatus", 0)
.findAll());
if (ssskus.size() + usskus.size() > 1) {
mView.showSearchFragment();
this.searchSku(barcode);
mView.showSearchFragment(barcode);
} else if (ssskus.size() == 1 && usskus.size() == 0) {
this.clickAddSku(ssskus.get(0), 1);
} else if (ssskus.size() == 0 && usskus.size() == 1) {
......
......@@ -12,6 +12,7 @@ import android.view.animation.LinearInterpolator;
import android.widget.ImageView;
import com.blankj.utilcode.util.ScreenUtils;
import com.blankj.utilcode.util.StringUtils;
import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.R;
import com.xingdata.zzdpos.base.BaseFragment;
......@@ -26,7 +27,9 @@ import java.util.List;
public class SearchFragment extends BaseFragment<StorePresenter, FragmentStoreSearchBinding> {
private SkuAdapter mSkuAdapter;
private List<Saledetail> mSaledetails;
private String mKeyword;
@Override
public int getLayoutId() {
......@@ -52,6 +55,9 @@ public class SearchFragment extends BaseFragment<StorePresenter, FragmentStoreSe
@SuppressLint("InflateParams") View view = getLayoutInflater().inflate(R.layout.view_empty, null);
mSkuAdapter.setEmptyView(view);
mSkuAdapter.isUseEmpty(false);
//init
if (!StringUtils.isEmpty(mKeyword)) mPresenter.searchSku(mKeyword);
}
......@@ -108,6 +114,16 @@ public class SearchFragment extends BaseFragment<StorePresenter, FragmentStoreSe
}
/**
* 设置搜索关键字
*
* @param keyword 关键字
*/
public SearchFragment setKeyword(String keyword) {
this.mKeyword = keyword;
return this;
}
/**
* 点击添加按钮
*
......
......@@ -31,9 +31,8 @@ import java.util.List;
public class StoreFragment extends BaseFragment<StorePresenter, FragmentStoreBinding> {
private SkugrpAdapter mSkugrpAdapter;
private SkuAdapter mSkuAdapter;
private SkugrpAdapter mSkugrpAdapter;
public interface OnCountChangeListener {
void onCountChange(View view, BaseSku sku, int value);
......
package com.xingdata.zzdpos;
public class zxpay {
static {
System.loadLibrary("jsonpay");
}
public static native String jsonpay(String string);
}
......@@ -10,7 +10,11 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/rl_sku"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
</layout>
\ No newline at end of file
......@@ -81,7 +81,7 @@
android:foreground="?android:attr/actionBarItemBackground"
android:padding="@dimen/all_spacing"
android:src="@mipmap/but_reduce"
android:visibility="visible" />
android:visibility="gone" />
<TextView
android:id="@+id/tv_count"
......
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