Commit 9bfadc4c authored by zhang_z's avatar zhang_z

修改扫码逻辑;

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