Showing
23 changed files
with
122 additions
and
60 deletions
No preview for this file type
| @@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
| 25 | </value> | 25 | </value> |
| 26 | </option> | 26 | </option> |
| 27 | </component> | 27 | </component> |
| 28 | - <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | 28 | + <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> |
| 29 | <output url="file://$PROJECT_DIR$/build/classes" /> | 29 | <output url="file://$PROJECT_DIR$/build/classes" /> |
| 30 | </component> | 30 | </component> |
| 31 | <component name="ProjectType"> | 31 | <component name="ProjectType"> |
.idea/vcs.xml
0 → 100644
| @@ -6,8 +6,8 @@ android { | @@ -6,8 +6,8 @@ android { | ||
| 6 | applicationId "com.naji.xiaotao" | 6 | applicationId "com.naji.xiaotao" |
| 7 | minSdkVersion 15 | 7 | minSdkVersion 15 |
| 8 | targetSdkVersion 27 | 8 | targetSdkVersion 27 |
| 9 | - versionCode 4 | ||
| 10 | - versionName "1.0.4" | 9 | + versionCode 6 |
| 10 | + versionName "1.0.6" | ||
| 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" |
| 12 | 12 | ||
| 13 | ndk { | 13 | ndk { |
| @@ -19,3 +19,7 @@ | @@ -19,3 +19,7 @@ | ||
| 19 | # If you keep the line number information, uncomment this to | 19 | # If you keep the line number information, uncomment this to |
| 20 | # hide the original source file name. | 20 | # hide the original source file name. |
| 21 | #-renamesourcefileattribute SourceFile | 21 | #-renamesourcefileattribute SourceFile |
| 22 | + | ||
| 23 | +-dontwarn com.tencent.bugly.** | ||
| 24 | +-keep public class com.tencent.bugly.**{*;} | ||
| 25 | + |
| 1 | -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":4,"versionName":"1.0.4","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] | ||
| 1 | +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":6,"versionName":"1.0.6","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] |
app/release/v1.0.5.apk
0 → 100644
No preview for this file type
app/release/v1.0.6.apk
0 → 100644
No preview for this file type
| @@ -31,9 +31,9 @@ | @@ -31,9 +31,9 @@ | ||
| 31 | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> | 31 | <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> |
| 32 | <uses-permission android:name="android.permission.GET_TASKS" /> | 32 | <uses-permission android:name="android.permission.GET_TASKS" /> |
| 33 | <uses-permission android:name="android.permission.VIBRATE" /> | 33 | <uses-permission android:name="android.permission.VIBRATE" /> |
| 34 | - | ||
| 35 | <uses-permission android:name="android.permission.READ_LOGS" /> | 34 | <uses-permission android:name="android.permission.READ_LOGS" /> |
| 36 | 35 | ||
| 36 | + | ||
| 37 | <application | 37 | <application |
| 38 | android:name=".App" | 38 | android:name=".App" |
| 39 | android:allowBackup="true" | 39 | android:allowBackup="true" |
| @@ -42,7 +42,7 @@ | @@ -42,7 +42,7 @@ | ||
| 42 | android:roundIcon="@mipmap/ic_launcher" | 42 | android:roundIcon="@mipmap/ic_launcher" |
| 43 | android:supportsRtl="true" | 43 | android:supportsRtl="true" |
| 44 | android:theme="@style/AppTheme" | 44 | android:theme="@style/AppTheme" |
| 45 | - > | 45 | + tools:ignore="ExtraText"> |
| 46 | <activity android:name=".login.ui.LoginActivity" | 46 | <activity android:name=".login.ui.LoginActivity" |
| 47 | android:screenOrientation="portrait" | 47 | android:screenOrientation="portrait" |
| 48 | > | 48 | > |
| @@ -113,8 +113,6 @@ | @@ -113,8 +113,6 @@ | ||
| 113 | android:launchMode="singleTask" | 113 | android:launchMode="singleTask" |
| 114 | /> | 114 | /> |
| 115 | 115 | ||
| 116 | - | ||
| 117 | - | ||
| 118 | <!--版本更新--> | 116 | <!--版本更新--> |
| 119 | <provider | 117 | <provider |
| 120 | android:name="android.support.v4.content.FileProvider" | 118 | android:name="android.support.v4.content.FileProvider" |
| 1 | package com.naji.xiaotao; | 1 | package com.naji.xiaotao; |
| 2 | 2 | ||
| 3 | -import android.app.Activity; | ||
| 4 | -import android.content.Context; | ||
| 5 | - | ||
| 6 | -import com.githang.statusbar.StatusBarCompat; | ||
| 7 | import com.naji.xiaotao.login.ui.LoginActivity; | 3 | import com.naji.xiaotao.login.ui.LoginActivity; |
| 8 | import com.naji.xiaotao.tangshi.ui.TangShiActivity; | 4 | import com.naji.xiaotao.tangshi.ui.TangShiActivity; |
| 9 | import com.raizlabs.android.dbflow.config.FlowManager; | 5 | import com.raizlabs.android.dbflow.config.FlowManager; |
| @@ -22,6 +18,7 @@ public class App extends BaseApplication { | @@ -22,6 +18,7 @@ public class App extends BaseApplication { | ||
| 22 | super.onCreate(); | 18 | super.onCreate(); |
| 23 | Bugly.init(getApplicationContext(), "493c3c1046", false); | 19 | Bugly.init(getApplicationContext(), "493c3c1046", false); |
| 24 | Beta.canShowUpgradeActs.add(TangShiActivity.class); | 20 | Beta.canShowUpgradeActs.add(TangShiActivity.class); |
| 21 | + Beta.autoDownloadOnWifi=true; | ||
| 25 | //初始化DbFlow | 22 | //初始化DbFlow |
| 26 | FlowManager.init(this); | 23 | FlowManager.init(this); |
| 27 | //初始化极光推送 | 24 | //初始化极光推送 |
| @@ -38,6 +38,9 @@ public class CartCookbookDetail implements Parcelable { | @@ -38,6 +38,9 @@ public class CartCookbookDetail implements Parcelable { | ||
| 38 | private String retire_reason;//退菜原因 | 38 | private String retire_reason;//退菜原因 |
| 39 | private String open_name;//操作员 | 39 | private String open_name;//操作员 |
| 40 | 40 | ||
| 41 | + private int groupIndex;//分组的index | ||
| 42 | + private int groupInnerIndex;//组内index | ||
| 43 | + | ||
| 41 | public String getCount() { | 44 | public String getCount() { |
| 42 | return count; | 45 | return count; |
| 43 | } | 46 | } |
| @@ -278,6 +281,22 @@ public class CartCookbookDetail implements Parcelable { | @@ -278,6 +281,22 @@ public class CartCookbookDetail implements Parcelable { | ||
| 278 | this.open_name = open_name; | 281 | this.open_name = open_name; |
| 279 | } | 282 | } |
| 280 | 283 | ||
| 284 | + public int getGroupIndex() { | ||
| 285 | + return groupIndex; | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + public void setGroupIndex(int groupIndex) { | ||
| 289 | + this.groupIndex = groupIndex; | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + public int getGroupInnerIndex() { | ||
| 293 | + return groupInnerIndex; | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + public void setGroupInnerIndex(int groupInnerIndex) { | ||
| 297 | + this.groupInnerIndex = groupInnerIndex; | ||
| 298 | + } | ||
| 299 | + | ||
| 281 | @Override | 300 | @Override |
| 282 | public int describeContents() { | 301 | public int describeContents() { |
| 283 | return 0; | 302 | return 0; |
| @@ -315,6 +334,8 @@ public class CartCookbookDetail implements Parcelable { | @@ -315,6 +334,8 @@ public class CartCookbookDetail implements Parcelable { | ||
| 315 | dest.writeInt(this.size); | 334 | dest.writeInt(this.size); |
| 316 | dest.writeString(this.retire_reason); | 335 | dest.writeString(this.retire_reason); |
| 317 | dest.writeString(this.open_name); | 336 | dest.writeString(this.open_name); |
| 337 | + dest.writeInt(this.groupIndex); | ||
| 338 | + dest.writeInt(this.groupInnerIndex); | ||
| 318 | } | 339 | } |
| 319 | 340 | ||
| 320 | public CartCookbookDetail() { | 341 | public CartCookbookDetail() { |
| @@ -351,6 +372,8 @@ public class CartCookbookDetail implements Parcelable { | @@ -351,6 +372,8 @@ public class CartCookbookDetail implements Parcelable { | ||
| 351 | this.size = in.readInt(); | 372 | this.size = in.readInt(); |
| 352 | this.retire_reason = in.readString(); | 373 | this.retire_reason = in.readString(); |
| 353 | this.open_name = in.readString(); | 374 | this.open_name = in.readString(); |
| 375 | + this.groupIndex = in.readInt(); | ||
| 376 | + this.groupInnerIndex = in.readInt(); | ||
| 354 | } | 377 | } |
| 355 | 378 | ||
| 356 | public static final Creator<CartCookbookDetail> CREATOR = new Creator<CartCookbookDetail>() { | 379 | public static final Creator<CartCookbookDetail> CREATOR = new Creator<CartCookbookDetail>() { |
| @@ -84,6 +84,8 @@ public class CartViewModel extends BaseViewModel{ | @@ -84,6 +84,8 @@ public class CartViewModel extends BaseViewModel{ | ||
| 84 | 84 | ||
| 85 | private ArrayList<CartCookbook> cLists=new ArrayList<>(); | 85 | private ArrayList<CartCookbook> cLists=new ArrayList<>(); |
| 86 | 86 | ||
| 87 | + | ||
| 88 | + | ||
| 87 | private OnRequestFocusListener onRequestFocusListener; | 89 | private OnRequestFocusListener onRequestFocusListener; |
| 88 | 90 | ||
| 89 | 91 | ||
| @@ -154,10 +156,13 @@ public class CartViewModel extends BaseViewModel{ | @@ -154,10 +156,13 @@ public class CartViewModel extends BaseViewModel{ | ||
| 154 | observableList.get(titleIndex).title.set(cartItemViewModel.entity.getClass_name()+"("+(size-1)+")"); | 156 | observableList.get(titleIndex).title.set(cartItemViewModel.entity.getClass_name()+"("+(size-1)+")"); |
| 155 | observableList.get(titleIndex).entity.setSize(--size); | 157 | observableList.get(titleIndex).entity.setSize(--size); |
| 156 | KLog.d("titleIndex:"+titleIndex+"size:"+size); | 158 | KLog.d("titleIndex:"+titleIndex+"size:"+size); |
| 159 | + int groupIndex=cartItemViewModel.entity.getGroupIndex(); | ||
| 157 | if(size==0){//只剩标题,删除标题 | 160 | if(size==0){//只剩标题,删除标题 |
| 158 | - observableList.remove(titleIndex); | 161 | + cLists.remove(groupIndex); |
| 162 | + }else{ | ||
| 163 | + cLists.get(groupIndex).getList().remove(cartItemViewModel.entity.getGroupInnerIndex()); | ||
| 159 | } | 164 | } |
| 160 | - observableList.remove(cartItemViewModel); | 165 | + initCookbookList(); |
| 161 | } | 166 | } |
| 162 | }); | 167 | }); |
| 163 | } | 168 | } |
| @@ -325,6 +330,8 @@ public class CartViewModel extends BaseViewModel{ | @@ -325,6 +330,8 @@ public class CartViewModel extends BaseViewModel{ | ||
| 325 | CartCookbookDetail content=cLists.get(i).getList().get(j); | 330 | CartCookbookDetail content=cLists.get(i).getList().get(j); |
| 326 | content.setTitleName(cLists.get(i).getClass_name()+"("+cLists.get(i).getList().size()+")"); | 331 | content.setTitleName(cLists.get(i).getClass_name()+"("+cLists.get(i).getList().size()+")"); |
| 327 | content.setTag(String.valueOf(titleIndex)); | 332 | content.setTag(String.valueOf(titleIndex)); |
| 333 | + content.setGroupIndex(i); | ||
| 334 | + content.setGroupIndex(j); | ||
| 328 | observableList.add(new CartItemViewModel(context,content,orderid,fromSource,isWaitingSure)); | 335 | observableList.add(new CartItemViewModel(context,content,orderid,fromSource,isWaitingSure)); |
| 329 | } | 336 | } |
| 330 | tag++; | 337 | tag++; |
| @@ -196,6 +196,9 @@ public class ClassifyDetailAdapter extends RvAdapter<CookbookDetailEntity> { | @@ -196,6 +196,9 @@ public class ClassifyDetailAdapter extends RvAdapter<CookbookDetailEntity> { | ||
| 196 | params.put("sellerid",SPUtils.getInstance("user_info").getString("sellerid")); | 196 | params.put("sellerid",SPUtils.getInstance("user_info").getString("sellerid")); |
| 197 | params.put("orderid",orderid); | 197 | params.put("orderid",orderid); |
| 198 | params.put("cookbookid",sortBean.getId()); | 198 | params.put("cookbookid",sortBean.getId()); |
| 199 | + if(!TextUtils.isEmpty(fromSource)||isWaitingSure){//2已加入购物车未下单菜品 | ||
| 200 | + params.put("status","2"); | ||
| 201 | + } | ||
| 199 | RetrofitClient.getInstance().create(CookbookApiService.class) | 202 | RetrofitClient.getInstance().create(CookbookApiService.class) |
| 200 | .getCookbookSelBySpecsId(params) | 203 | .getCookbookSelBySpecsId(params) |
| 201 | .compose(RxUtils.schedulersTransformer()) | 204 | .compose(RxUtils.schedulersTransformer()) |
| @@ -78,11 +78,11 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{ | @@ -78,11 +78,11 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{ | ||
| 78 | }else if(!TextUtils.isEmpty(reduceBean.getPtitle())){ | 78 | }else if(!TextUtils.isEmpty(reduceBean.getPtitle())){ |
| 79 | cookbookTv.setText(reduceBean.getPtitle()); | 79 | cookbookTv.setText(reduceBean.getPtitle()); |
| 80 | } | 80 | } |
| 81 | - countTv.setText(reduceBean.getPractNum()); | 81 | + countTv.setText(reduceBean.getFoodNum()); |
| 82 | addBn.setOnClickListener(new View.OnClickListener() { | 82 | addBn.setOnClickListener(new View.OnClickListener() { |
| 83 | @Override | 83 | @Override |
| 84 | public void onClick(View view) { | 84 | public void onClick(View view) { |
| 85 | - if(!TextUtils.isEmpty(clear_num)&&Integer.parseInt(list.get(position).getPractNum())==Integer.parseInt(clear_num)){ | 85 | + if(!TextUtils.isEmpty(clear_num)&&Integer.parseInt(list.get(position).getFoodNum())==Integer.parseInt(clear_num)){ |
| 86 | ToastUtils.showShort("菜品沽清不足"); | 86 | ToastUtils.showShort("菜品沽清不足"); |
| 87 | return; | 87 | return; |
| 88 | } | 88 | } |
| @@ -128,8 +128,8 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{ | @@ -128,8 +128,8 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{ | ||
| 128 | @Override | 128 | @Override |
| 129 | public void accept(BaseResponse<List<ResultEntity>> baseResponse) throws Exception { | 129 | public void accept(BaseResponse<List<ResultEntity>> baseResponse) throws Exception { |
| 130 | if(baseResponse.getRet()==200){ | 130 | if(baseResponse.getRet()==200){ |
| 131 | - list.get(pos).setPractNum((Integer.parseInt(list.get(pos).getPractNum())+1)+""); | ||
| 132 | - countTv.setText(list.get(pos).getPractNum()); | 131 | + list.get(pos).setFoodNum((Integer.parseInt(list.get(pos).getFoodNum())+1)+""); |
| 132 | + countTv.setText(list.get(pos).getFoodNum()); | ||
| 133 | if(reduceListener!=null){ | 133 | if(reduceListener!=null){ |
| 134 | reduceListener.onAddSuccess(position,bean); | 134 | reduceListener.onAddSuccess(position,bean); |
| 135 | } | 135 | } |
| @@ -176,8 +176,8 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{ | @@ -176,8 +176,8 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{ | ||
| 176 | @Override | 176 | @Override |
| 177 | public void accept(BaseResponse<List<ResultEntity>> baseResponse) throws Exception { | 177 | public void accept(BaseResponse<List<ResultEntity>> baseResponse) throws Exception { |
| 178 | if(baseResponse.getRet()==200){ | 178 | if(baseResponse.getRet()==200){ |
| 179 | - list.get(pos).setPractNum((Integer.parseInt(list.get(pos).getPractNum())-1)+""); | ||
| 180 | - if(Integer.parseInt(list.get(pos).getPractNum())==0){ | 179 | + list.get(pos).setFoodNum((Integer.parseInt(list.get(pos).getFoodNum())-1)+""); |
| 180 | + if(Integer.parseInt(list.get(pos).getFoodNum())==0){ | ||
| 181 | list.remove(pos); | 181 | list.remove(pos); |
| 182 | if(list.size()<=0){ | 182 | if(list.size()<=0){ |
| 183 | 183 |
| @@ -172,9 +172,8 @@ public class SelectFragmentDialog extends DialogFragment{ | @@ -172,9 +172,8 @@ public class SelectFragmentDialog extends DialogFragment{ | ||
| 172 | super.onStart(); | 172 | super.onStart(); |
| 173 | getDialog().setCanceledOnTouchOutside(false); | 173 | getDialog().setCanceledOnTouchOutside(false); |
| 174 | Window window=getDialog().getWindow(); | 174 | Window window=getDialog().getWindow(); |
| 175 | - WindowManager.LayoutParams lp=window.getAttributes(); | ||
| 176 | DisplayMetrics dm=new DisplayMetrics(); | 175 | DisplayMetrics dm=new DisplayMetrics(); |
| 177 | window.getWindowManager().getDefaultDisplay().getMetrics(dm); | 176 | window.getWindowManager().getDefaultDisplay().getMetrics(dm); |
| 178 | - window.setLayout((int) (dm.widthPixels*0.9),ViewGroup.LayoutParams.WRAP_CONTENT); | 177 | + window.setLayout((int) (dm.widthPixels*0.99),ViewGroup.LayoutParams.WRAP_CONTENT); |
| 179 | } | 178 | } |
| 180 | } | 179 | } |
| 1 | package com.naji.xiaotao.history.ui; | 1 | package com.naji.xiaotao.history.ui; |
| 2 | 2 | ||
| 3 | +import android.content.Context; | ||
| 3 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 4 | import android.support.design.widget.TabLayout; | 5 | import android.support.design.widget.TabLayout; |
| 6 | +import android.view.KeyEvent; | ||
| 7 | +import android.view.inputmethod.EditorInfo; | ||
| 8 | +import android.view.inputmethod.InputMethodManager; | ||
| 9 | +import android.widget.TextView; | ||
| 5 | 10 | ||
| 6 | import com.naji.xiaotao.R; | 11 | import com.naji.xiaotao.R; |
| 7 | import com.naji.xiaotao.BR; | 12 | import com.naji.xiaotao.BR; |
| @@ -11,6 +16,15 @@ import com.naji.xiaotao.history.vm.HistoryViewModel; | @@ -11,6 +16,15 @@ import com.naji.xiaotao.history.vm.HistoryViewModel; | ||
| 11 | import me.goldze.mvvmhabit.base.BaseActivity; | 16 | import me.goldze.mvvmhabit.base.BaseActivity; |
| 12 | 17 | ||
| 13 | public class HistoryActivity extends BaseActivity<ActivityHistoryBinding,HistoryViewModel>{ | 18 | public class HistoryActivity extends BaseActivity<ActivityHistoryBinding,HistoryViewModel>{ |
| 19 | + | ||
| 20 | + private InputMethodManager imm; | ||
| 21 | + | ||
| 22 | + @Override | ||
| 23 | + protected void onCreate(Bundle savedInstanceState) { | ||
| 24 | + super.onCreate(savedInstanceState); | ||
| 25 | + imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); | ||
| 26 | + } | ||
| 27 | + | ||
| 14 | @Override | 28 | @Override |
| 15 | public int initContentView(Bundle savedInstanceState) { | 29 | public int initContentView(Bundle savedInstanceState) { |
| 16 | return R.layout.activity_history; | 30 | return R.layout.activity_history; |
| @@ -38,5 +52,15 @@ public class HistoryActivity extends BaseActivity<ActivityHistoryBinding,History | @@ -38,5 +52,15 @@ public class HistoryActivity extends BaseActivity<ActivityHistoryBinding,History | ||
| 38 | @Override | 52 | @Override |
| 39 | public void initViewObservable() { | 53 | public void initViewObservable() { |
| 40 | super.initViewObservable(); | 54 | super.initViewObservable(); |
| 55 | + binding.searchEdt.setOnEditorActionListener(new TextView.OnEditorActionListener() { | ||
| 56 | + @Override | ||
| 57 | + public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) { | ||
| 58 | + if(actionId== EditorInfo.IME_ACTION_SEARCH){ | ||
| 59 | + imm.hideSoftInputFromWindow(binding.searchEdt.getWindowToken(),0); | ||
| 60 | + viewModel.initList(); | ||
| 61 | + } | ||
| 62 | + return true; | ||
| 63 | + } | ||
| 64 | + }); | ||
| 41 | } | 65 | } |
| 42 | } | 66 | } |
| @@ -13,6 +13,7 @@ import com.naji.xiaotao.R; | @@ -13,6 +13,7 @@ import com.naji.xiaotao.R; | ||
| 13 | import com.naji.xiaotao.history.entity.HistoryEntity; | 13 | import com.naji.xiaotao.history.entity.HistoryEntity; |
| 14 | import com.naji.xiaotao.history.entity.HistoryOuter; | 14 | import com.naji.xiaotao.history.entity.HistoryOuter; |
| 15 | import com.naji.xiaotao.history.service.HistoryApiService; | 15 | import com.naji.xiaotao.history.service.HistoryApiService; |
| 16 | +import com.naji.xiaotao.history.ui.HistoryActivity; | ||
| 16 | import com.naji.xiaotao.http.RetrofitClient; | 17 | import com.naji.xiaotao.http.RetrofitClient; |
| 17 | import com.naji.xiaotao.tangshi.vm.TangShiItemViewModel; | 18 | import com.naji.xiaotao.tangshi.vm.TangShiItemViewModel; |
| 18 | 19 | ||
| @@ -39,7 +40,7 @@ import me.tatarka.bindingcollectionadapter2.OnItemBind; | @@ -39,7 +40,7 @@ import me.tatarka.bindingcollectionadapter2.OnItemBind; | ||
| 39 | 40 | ||
| 40 | public class HistoryViewModel extends BaseViewModel{ | 41 | public class HistoryViewModel extends BaseViewModel{ |
| 41 | 42 | ||
| 42 | - | 43 | + private InputMethodManager imm; |
| 43 | public TitleViewModel titleViewModel; | 44 | public TitleViewModel titleViewModel; |
| 44 | public ObservableInt currentTabIndex=new ObservableInt(0);//当前选中的tab索引 | 45 | public ObservableInt currentTabIndex=new ObservableInt(0);//当前选中的tab索引 |
| 45 | private List<HistoryOuter> todayList=new ArrayList<>();//今天的历史订单数据 | 46 | private List<HistoryOuter> todayList=new ArrayList<>();//今天的历史订单数据 |
| @@ -52,6 +53,7 @@ public class HistoryViewModel extends BaseViewModel{ | @@ -52,6 +53,7 @@ public class HistoryViewModel extends BaseViewModel{ | ||
| 52 | public HistoryViewModel(Context context){ | 53 | public HistoryViewModel(Context context){ |
| 53 | super(context); | 54 | super(context); |
| 54 | titleViewModel=new TitleViewModel(context,"历史订单"); | 55 | titleViewModel=new TitleViewModel(context,"历史订单"); |
| 56 | + imm= (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); | ||
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | @Override | 59 | @Override |
| @@ -145,7 +147,7 @@ public class HistoryViewModel extends BaseViewModel{ | @@ -145,7 +147,7 @@ public class HistoryViewModel extends BaseViewModel{ | ||
| 145 | }); | 147 | }); |
| 146 | 148 | ||
| 147 | //初始化列表数据 | 149 | //初始化列表数据 |
| 148 | - private void initList(){ | 150 | + public void initList(){ |
| 149 | observableList.clear(); | 151 | observableList.clear(); |
| 150 | List<HistoryOuter> outerList=new ArrayList<>(); | 152 | List<HistoryOuter> outerList=new ArrayList<>(); |
| 151 | switch (currentTabIndex.get()){ | 153 | switch (currentTabIndex.get()){ |
| @@ -169,15 +171,21 @@ public class HistoryViewModel extends BaseViewModel{ | @@ -169,15 +171,21 @@ public class HistoryViewModel extends BaseViewModel{ | ||
| 169 | HistoryEntity head=new HistoryEntity(); | 171 | HistoryEntity head=new HistoryEntity(); |
| 170 | head.setTitle(true); | 172 | head.setTitle(true); |
| 171 | head.setTitlename(outer.getDate()); | 173 | head.setTitlename(outer.getDate()); |
| 172 | - observableList.add(new HistoryItemViewModel(context,head)); | 174 | + HistoryItemViewModel headViewModel=new HistoryItemViewModel(context,head); |
| 175 | + observableList.add(headViewModel); | ||
| 176 | + boolean hasList=false; | ||
| 173 | for(HistoryEntity entity:outer.getList()){ | 177 | for(HistoryEntity entity:outer.getList()){ |
| 174 | if(!TextUtils.isEmpty(entity.getRow_num())&&entity.getRow_num().contains(searchText.get())){ | 178 | if(!TextUtils.isEmpty(entity.getRow_num())&&entity.getRow_num().contains(searchText.get())){ |
| 179 | + hasList=true; | ||
| 175 | HistoryEntity content=entity; | 180 | HistoryEntity content=entity; |
| 176 | content.setTitlename(outer.getDate()); | 181 | content.setTitlename(outer.getDate()); |
| 177 | content.setTitle(false); | 182 | content.setTitle(false); |
| 178 | observableList.add(new HistoryItemViewModel(context,content)); | 183 | observableList.add(new HistoryItemViewModel(context,content)); |
| 179 | } | 184 | } |
| 180 | } | 185 | } |
| 186 | + if(!hasList){//标题栏下没有内容 | ||
| 187 | + observableList.remove(headViewModel); | ||
| 188 | + } | ||
| 181 | } | 189 | } |
| 182 | } | 190 | } |
| 183 | 191 | ||
| @@ -185,8 +193,8 @@ public class HistoryViewModel extends BaseViewModel{ | @@ -185,8 +193,8 @@ public class HistoryViewModel extends BaseViewModel{ | ||
| 185 | public BindingCommand onSearchCommand=new BindingCommand(new BindingAction() { | 193 | public BindingCommand onSearchCommand=new BindingCommand(new BindingAction() { |
| 186 | @Override | 194 | @Override |
| 187 | public void call() { | 195 | public void call() { |
| 196 | + imm.hideSoftInputFromWindow(((HistoryActivity)context).getCurrentFocus().getWindowToken(),0); | ||
| 188 | initList(); | 197 | initList(); |
| 189 | - searchText.set(""); | ||
| 190 | } | 198 | } |
| 191 | }); | 199 | }); |
| 192 | 200 |
| @@ -3,6 +3,7 @@ package com.naji.xiaotao.login.ui; | @@ -3,6 +3,7 @@ package com.naji.xiaotao.login.ui; | ||
| 3 | import android.databinding.Observable; | 3 | import android.databinding.Observable; |
| 4 | import android.os.Bundle; | 4 | import android.os.Bundle; |
| 5 | import android.text.Editable; | 5 | import android.text.Editable; |
| 6 | +import android.text.TextUtils; | ||
| 6 | import android.text.TextWatcher; | 7 | import android.text.TextWatcher; |
| 7 | import android.text.method.HideReturnsTransformationMethod; | 8 | import android.text.method.HideReturnsTransformationMethod; |
| 8 | import android.text.method.PasswordTransformationMethod; | 9 | import android.text.method.PasswordTransformationMethod; |
| @@ -14,9 +15,10 @@ import com.naji.xiaotao.databinding.ActivityLoginBinding; | @@ -14,9 +15,10 @@ import com.naji.xiaotao.databinding.ActivityLoginBinding; | ||
| 14 | import com.naji.xiaotao.login.vm.LoginViewModel; | 15 | import com.naji.xiaotao.login.vm.LoginViewModel; |
| 15 | 16 | ||
| 16 | import me.goldze.mvvmhabit.base.BaseActivity; | 17 | import me.goldze.mvvmhabit.base.BaseActivity; |
| 18 | +import me.goldze.mvvmhabit.utils.SPUtils; | ||
| 17 | 19 | ||
| 18 | 20 | ||
| 19 | -public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewModel> implements LoginViewModel.ErrCallback,TextWatcher{ | 21 | +public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewModel> implements TextWatcher{ |
| 20 | 22 | ||
| 21 | @Override | 23 | @Override |
| 22 | public int initContentView(Bundle savedInstanceState) { | 24 | public int initContentView(Bundle savedInstanceState) { |
| @@ -30,7 +32,7 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewMo | @@ -30,7 +32,7 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewMo | ||
| 30 | 32 | ||
| 31 | @Override | 33 | @Override |
| 32 | public LoginViewModel initViewModel() { | 34 | public LoginViewModel initViewModel() { |
| 33 | - return new LoginViewModel(this,this); | 35 | + return new LoginViewModel(this); |
| 34 | } | 36 | } |
| 35 | 37 | ||
| 36 | @Override | 38 | @Override |
| @@ -50,28 +52,24 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewMo | @@ -50,28 +52,24 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewMo | ||
| 50 | } | 52 | } |
| 51 | } | 53 | } |
| 52 | }); | 54 | }); |
| 55 | + viewModel.shanghuNum.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { | ||
| 56 | + @Override | ||
| 57 | + public void onPropertyChanged(Observable sender, int propertyId) { | ||
| 58 | + binding.shanghuEdt.setSelection(viewModel.shanghuNum.get().length()); | ||
| 59 | + } | ||
| 60 | + }); | ||
| 61 | + viewModel.gonghaoNum.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() { | ||
| 62 | + @Override | ||
| 63 | + public void onPropertyChanged(Observable sender, int propertyId) { | ||
| 64 | + binding.gonghaoEdt.setSelection(viewModel.gonghaoNum.get().length()); | ||
| 65 | + } | ||
| 66 | + }); | ||
| 53 | binding.shanghuEdt.addTextChangedListener(this); | 67 | binding.shanghuEdt.addTextChangedListener(this); |
| 54 | binding.gonghaoEdt.addTextChangedListener(this); | 68 | binding.gonghaoEdt.addTextChangedListener(this); |
| 55 | binding.passEdt.addTextChangedListener(this); | 69 | binding.passEdt.addTextChangedListener(this); |
| 56 | } | 70 | } |
| 57 | 71 | ||
| 58 | @Override | 72 | @Override |
| 59 | - public void onErr(int code) { | ||
| 60 | - switch(code){ | ||
| 61 | - case 397://密码错误 | ||
| 62 | - | ||
| 63 | - break; | ||
| 64 | - case 398://工号错误 | ||
| 65 | - | ||
| 66 | - break; | ||
| 67 | - case 399://商户编号错误 | ||
| 68 | - | ||
| 69 | - break; | ||
| 70 | - | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - | ||
| 74 | - @Override | ||
| 75 | public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { | 73 | public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { |
| 76 | 74 | ||
| 77 | } | 75 | } |
| @@ -43,18 +43,12 @@ public class LoginViewModel extends BaseViewModel{ | @@ -43,18 +43,12 @@ public class LoginViewModel extends BaseViewModel{ | ||
| 43 | public ObservableBoolean passVisible=new ObservableBoolean(false);//监听密码显示隐式 | 43 | public ObservableBoolean passVisible=new ObservableBoolean(false);//监听密码显示隐式 |
| 44 | 44 | ||
| 45 | 45 | ||
| 46 | - private ErrCallback errCallback;//错误回调 | ||
| 47 | - | ||
| 48 | - public LoginViewModel(Context context,ErrCallback errCallback){ | 46 | + public LoginViewModel(Context context){ |
| 49 | super(context); | 47 | super(context); |
| 50 | - this.errCallback=errCallback; | ||
| 51 | shanghuNum.set(SPUtils.getInstance("user_info").getString("sellercode")); | 48 | shanghuNum.set(SPUtils.getInstance("user_info").getString("sellercode")); |
| 52 | gonghaoNum.set(SPUtils.getInstance("user_info").getString("account")); | 49 | gonghaoNum.set(SPUtils.getInstance("user_info").getString("account")); |
| 53 | } | 50 | } |
| 54 | 51 | ||
| 55 | - public interface ErrCallback{ | ||
| 56 | - void onErr(int code); | ||
| 57 | - } | ||
| 58 | 52 | ||
| 59 | @Override | 53 | @Override |
| 60 | public void onCreate() { | 54 | public void onCreate() { |
| @@ -40,6 +40,11 @@ public class MessageReceiver extends BroadcastReceiver{ | @@ -40,6 +40,11 @@ public class MessageReceiver extends BroadcastReceiver{ | ||
| 40 | RxBus.getDefault().post("hasorder");//顾客已下单 | 40 | RxBus.getDefault().post("hasorder");//顾客已下单 |
| 41 | return; | 41 | return; |
| 42 | } | 42 | } |
| 43 | + if(message.getMessage_type().equals("5")){//服务员在小程序端审核菜品 | ||
| 44 | + SQLite.delete(Message.class).where(Message_Table.table_id.eq(message.getTable_id()),Message_Table.message_type.eq("2")).execute(); | ||
| 45 | + RxBus.getDefault().post("refresh");//发送给工作台首页一个刷新操作 | ||
| 46 | + return; | ||
| 47 | + } | ||
| 43 | Message message1=SQLite.select().from(Message.class).where(Message_Table.message_type.eq(message.getMessage_type()),Message_Table.table_id.eq(message.getTable_id())).querySingle(); | 48 | Message message1=SQLite.select().from(Message.class).where(Message_Table.message_type.eq(message.getMessage_type()),Message_Table.table_id.eq(message.getTable_id())).querySingle(); |
| 44 | if(message1!=null){//本地数据库已有此类消息 | 49 | if(message1!=null){//本地数据库已有此类消息 |
| 45 | message1.setMessage_id(message.message_id); | 50 | message1.setMessage_id(message.message_id); |
| @@ -56,11 +61,6 @@ public class MessageReceiver extends BroadcastReceiver{ | @@ -56,11 +61,6 @@ public class MessageReceiver extends BroadcastReceiver{ | ||
| 56 | SQLite.delete(Message.class).where(Message_Table.message_id.eq(message.getMessage_id())).execute(); | 61 | SQLite.delete(Message.class).where(Message_Table.message_id.eq(message.getMessage_id())).execute(); |
| 57 | break; | 62 | break; |
| 58 | } | 63 | } |
| 59 | -// List<Message> list=SQLite.select().from(Message.class).queryList(); | ||
| 60 | -// KLog.d("count",list.size()); | ||
| 61 | -// for(Message message2:list){ | ||
| 62 | -// KLog.d("message",message2); | ||
| 63 | -// } | ||
| 64 | RxBus.getDefault().post("refresh");//发送给工作台首页一个刷新操作 | 64 | RxBus.getDefault().post("refresh");//发送给工作台首页一个刷新操作 |
| 65 | break; | 65 | break; |
| 66 | } | 66 | } |
| @@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
| 31 | android:id="@+id/title" | 31 | android:id="@+id/title" |
| 32 | android:layout_width="wrap_content" | 32 | android:layout_width="wrap_content" |
| 33 | android:layout_height="wrap_content" | 33 | android:layout_height="wrap_content" |
| 34 | - android:text="@{titleViewModel.title}" | 34 | + android:text="菜谱" |
| 35 | android:textColor="@color/text0" | 35 | android:textColor="@color/text0" |
| 36 | android:textSize="@dimen/sp_17" | 36 | android:textSize="@dimen/sp_17" |
| 37 | android:layout_toRightOf="@id/back" | 37 | android:layout_toRightOf="@id/back" |
| @@ -48,12 +48,14 @@ | @@ -48,12 +48,14 @@ | ||
| 48 | android:background="@drawable/history_search_border" | 48 | android:background="@drawable/history_search_border" |
| 49 | > | 49 | > |
| 50 | <EditText | 50 | <EditText |
| 51 | + android:id="@+id/search_edt" | ||
| 51 | android:layout_width="0dp" | 52 | android:layout_width="0dp" |
| 52 | android:layout_height="match_parent" | 53 | android:layout_height="match_parent" |
| 53 | android:layout_weight="1" | 54 | android:layout_weight="1" |
| 54 | android:background="@null" | 55 | android:background="@null" |
| 55 | android:gravity="center_vertical" | 56 | android:gravity="center_vertical" |
| 56 | android:inputType="number" | 57 | android:inputType="number" |
| 58 | + android:singleLine="true" | ||
| 57 | android:hint="请输入编号、单号" | 59 | android:hint="请输入编号、单号" |
| 58 | android:text="@={viewModel.searchText}" | 60 | android:text="@={viewModel.searchText}" |
| 59 | android:textColorHint="#aeb1b1" | 61 | android:textColorHint="#aeb1b1" |
| @@ -61,6 +63,8 @@ | @@ -61,6 +63,8 @@ | ||
| 61 | android:textColor="@color/text1" | 63 | android:textColor="@color/text1" |
| 62 | android:paddingLeft="@dimen/dp_12" | 64 | android:paddingLeft="@dimen/dp_12" |
| 63 | binding:textChanged="@{viewModel.onTextChangedCommand}" | 65 | binding:textChanged="@{viewModel.onTextChangedCommand}" |
| 66 | + android:imeOptions="actionSearch" | ||
| 67 | + | ||
| 64 | /> | 68 | /> |
| 65 | <TextView | 69 | <TextView |
| 66 | android:layout_width="@dimen/dp_67" | 70 | android:layout_width="@dimen/dp_67" |
| @@ -63,7 +63,6 @@ | @@ -63,7 +63,6 @@ | ||
| 63 | android:paddingTop="@dimen/dp_5" | 63 | android:paddingTop="@dimen/dp_5" |
| 64 | android:paddingBottom="@dimen/dp_5" | 64 | android:paddingBottom="@dimen/dp_5" |
| 65 | android:inputType="number" | 65 | android:inputType="number" |
| 66 | - android:selection="@{viewModel.shanghuNum.length}" | ||
| 67 | /> | 66 | /> |
| 68 | <ImageView | 67 | <ImageView |
| 69 | android:id="@+id/shanghuErrIcon" | 68 | android:id="@+id/shanghuErrIcon" |
| @@ -112,7 +111,6 @@ | @@ -112,7 +111,6 @@ | ||
| 112 | android:paddingTop="@dimen/dp_5" | 111 | android:paddingTop="@dimen/dp_5" |
| 113 | android:paddingBottom="@dimen/dp_5" | 112 | android:paddingBottom="@dimen/dp_5" |
| 114 | android:inputType="number" | 113 | android:inputType="number" |
| 115 | - android:selection="@{viewModel.gonghaoNum.length}" | ||
| 116 | /> | 114 | /> |
| 117 | <ImageView | 115 | <ImageView |
| 118 | android:id="@+id/gonghaoErrIcon" | 116 | android:id="@+id/gonghaoErrIcon" |
| @@ -161,7 +159,6 @@ | @@ -161,7 +159,6 @@ | ||
| 161 | android:paddingTop="@dimen/dp_5" | 159 | android:paddingTop="@dimen/dp_5" |
| 162 | android:paddingBottom="@dimen/dp_5" | 160 | android:paddingBottom="@dimen/dp_5" |
| 163 | android:inputType="textPassword" | 161 | android:inputType="textPassword" |
| 164 | - android:selection="@{viewModel.password.length}" | ||
| 165 | /> | 162 | /> |
| 166 | <ImageView | 163 | <ImageView |
| 167 | android:id="@+id/passImg" | 164 | android:id="@+id/passImg" |
-
Please register or login to post a comment