Commit c336d9f4320837f96c70161e58bf3417c7cb9eee

Authored by gaiyaguang
1 parent 7706db63

v1.0.6

... ... @@ -25,7 +25,7 @@
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
... ...
... ... @@ -6,8 +6,8 @@ android {
applicationId "com.naji.xiaotao"
minSdkVersion 15
targetSdkVersion 27
versionCode 4
versionName "1.0.4"
versionCode 6
versionName "1.0.6"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
... ...
... ... @@ -19,3 +19,7 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-dontwarn com.tencent.bugly.**
-keep public class com.tencent.bugly.**{*;}
... ...
[{"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":{}}]
\ No newline at end of file
[{"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":{}}]
\ No newline at end of file
... ...
No preview for this file type
No preview for this file type
... ... @@ -31,9 +31,9 @@
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_LOGS" />
<application
android:name=".App"
android:allowBackup="true"
... ... @@ -42,7 +42,7 @@
android:roundIcon="@mipmap/ic_launcher"
android:supportsRtl="true"
android:theme="@style/AppTheme"
>
tools:ignore="ExtraText">
<activity android:name=".login.ui.LoginActivity"
android:screenOrientation="portrait"
>
... ... @@ -113,8 +113,6 @@
android:launchMode="singleTask"
/>
<!--版本更新-->
<provider
android:name="android.support.v4.content.FileProvider"
... ...
package com.naji.xiaotao;
import android.app.Activity;
import android.content.Context;
import com.githang.statusbar.StatusBarCompat;
import com.naji.xiaotao.login.ui.LoginActivity;
import com.naji.xiaotao.tangshi.ui.TangShiActivity;
import com.raizlabs.android.dbflow.config.FlowManager;
... ... @@ -22,6 +18,7 @@ public class App extends BaseApplication {
super.onCreate();
Bugly.init(getApplicationContext(), "493c3c1046", false);
Beta.canShowUpgradeActs.add(TangShiActivity.class);
Beta.autoDownloadOnWifi=true;
//初始化DbFlow
FlowManager.init(this);
//初始化极光推送
... ...
... ... @@ -38,6 +38,9 @@ public class CartCookbookDetail implements Parcelable {
private String retire_reason;//退菜原因
private String open_name;//操作员
private int groupIndex;//分组的index
private int groupInnerIndex;//组内index
public String getCount() {
return count;
}
... ... @@ -278,6 +281,22 @@ public class CartCookbookDetail implements Parcelable {
this.open_name = open_name;
}
public int getGroupIndex() {
return groupIndex;
}
public void setGroupIndex(int groupIndex) {
this.groupIndex = groupIndex;
}
public int getGroupInnerIndex() {
return groupInnerIndex;
}
public void setGroupInnerIndex(int groupInnerIndex) {
this.groupInnerIndex = groupInnerIndex;
}
@Override
public int describeContents() {
return 0;
... ... @@ -315,6 +334,8 @@ public class CartCookbookDetail implements Parcelable {
dest.writeInt(this.size);
dest.writeString(this.retire_reason);
dest.writeString(this.open_name);
dest.writeInt(this.groupIndex);
dest.writeInt(this.groupInnerIndex);
}
public CartCookbookDetail() {
... ... @@ -351,6 +372,8 @@ public class CartCookbookDetail implements Parcelable {
this.size = in.readInt();
this.retire_reason = in.readString();
this.open_name = in.readString();
this.groupIndex = in.readInt();
this.groupInnerIndex = in.readInt();
}
public static final Creator<CartCookbookDetail> CREATOR = new Creator<CartCookbookDetail>() {
... ...
... ... @@ -84,6 +84,8 @@ public class CartViewModel extends BaseViewModel{
private ArrayList<CartCookbook> cLists=new ArrayList<>();
private OnRequestFocusListener onRequestFocusListener;
... ... @@ -154,10 +156,13 @@ public class CartViewModel extends BaseViewModel{
observableList.get(titleIndex).title.set(cartItemViewModel.entity.getClass_name()+"("+(size-1)+")");
observableList.get(titleIndex).entity.setSize(--size);
KLog.d("titleIndex:"+titleIndex+"size:"+size);
int groupIndex=cartItemViewModel.entity.getGroupIndex();
if(size==0){//只剩标题,删除标题
observableList.remove(titleIndex);
cLists.remove(groupIndex);
}else{
cLists.get(groupIndex).getList().remove(cartItemViewModel.entity.getGroupInnerIndex());
}
observableList.remove(cartItemViewModel);
initCookbookList();
}
});
}
... ... @@ -325,6 +330,8 @@ public class CartViewModel extends BaseViewModel{
CartCookbookDetail content=cLists.get(i).getList().get(j);
content.setTitleName(cLists.get(i).getClass_name()+"("+cLists.get(i).getList().size()+")");
content.setTag(String.valueOf(titleIndex));
content.setGroupIndex(i);
content.setGroupIndex(j);
observableList.add(new CartItemViewModel(context,content,orderid,fromSource,isWaitingSure));
}
tag++;
... ...
... ... @@ -196,6 +196,9 @@ public class ClassifyDetailAdapter extends RvAdapter<CookbookDetailEntity> {
params.put("sellerid",SPUtils.getInstance("user_info").getString("sellerid"));
params.put("orderid",orderid);
params.put("cookbookid",sortBean.getId());
if(!TextUtils.isEmpty(fromSource)||isWaitingSure){//2已加入购物车未下单菜品
params.put("status","2");
}
RetrofitClient.getInstance().create(CookbookApiService.class)
.getCookbookSelBySpecsId(params)
.compose(RxUtils.schedulersTransformer())
... ...
... ... @@ -78,11 +78,11 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{
}else if(!TextUtils.isEmpty(reduceBean.getPtitle())){
cookbookTv.setText(reduceBean.getPtitle());
}
countTv.setText(reduceBean.getPractNum());
countTv.setText(reduceBean.getFoodNum());
addBn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!TextUtils.isEmpty(clear_num)&&Integer.parseInt(list.get(position).getPractNum())==Integer.parseInt(clear_num)){
if(!TextUtils.isEmpty(clear_num)&&Integer.parseInt(list.get(position).getFoodNum())==Integer.parseInt(clear_num)){
ToastUtils.showShort("菜品沽清不足");
return;
}
... ... @@ -128,8 +128,8 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{
@Override
public void accept(BaseResponse<List<ResultEntity>> baseResponse) throws Exception {
if(baseResponse.getRet()==200){
list.get(pos).setPractNum((Integer.parseInt(list.get(pos).getPractNum())+1)+"");
countTv.setText(list.get(pos).getPractNum());
list.get(pos).setFoodNum((Integer.parseInt(list.get(pos).getFoodNum())+1)+"");
countTv.setText(list.get(pos).getFoodNum());
if(reduceListener!=null){
reduceListener.onAddSuccess(position,bean);
}
... ... @@ -176,8 +176,8 @@ public class ReduceAdapter extends RvAdapter<ReduceBean>{
@Override
public void accept(BaseResponse<List<ResultEntity>> baseResponse) throws Exception {
if(baseResponse.getRet()==200){
list.get(pos).setPractNum((Integer.parseInt(list.get(pos).getPractNum())-1)+"");
if(Integer.parseInt(list.get(pos).getPractNum())==0){
list.get(pos).setFoodNum((Integer.parseInt(list.get(pos).getFoodNum())-1)+"");
if(Integer.parseInt(list.get(pos).getFoodNum())==0){
list.remove(pos);
if(list.size()<=0){
... ...
... ... @@ -172,9 +172,8 @@ public class SelectFragmentDialog extends DialogFragment{
super.onStart();
getDialog().setCanceledOnTouchOutside(false);
Window window=getDialog().getWindow();
WindowManager.LayoutParams lp=window.getAttributes();
DisplayMetrics dm=new DisplayMetrics();
window.getWindowManager().getDefaultDisplay().getMetrics(dm);
window.setLayout((int) (dm.widthPixels*0.9),ViewGroup.LayoutParams.WRAP_CONTENT);
window.setLayout((int) (dm.widthPixels*0.99),ViewGroup.LayoutParams.WRAP_CONTENT);
}
}
... ...
package com.naji.xiaotao.history.ui;
import android.content.Context;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import com.naji.xiaotao.R;
import com.naji.xiaotao.BR;
... ... @@ -11,6 +16,15 @@ import com.naji.xiaotao.history.vm.HistoryViewModel;
import me.goldze.mvvmhabit.base.BaseActivity;
public class HistoryActivity extends BaseActivity<ActivityHistoryBinding,HistoryViewModel>{
private InputMethodManager imm;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
imm= (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
}
@Override
public int initContentView(Bundle savedInstanceState) {
return R.layout.activity_history;
... ... @@ -38,5 +52,15 @@ public class HistoryActivity extends BaseActivity<ActivityHistoryBinding,History
@Override
public void initViewObservable() {
super.initViewObservable();
binding.searchEdt.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if(actionId== EditorInfo.IME_ACTION_SEARCH){
imm.hideSoftInputFromWindow(binding.searchEdt.getWindowToken(),0);
viewModel.initList();
}
return true;
}
});
}
}
... ...
... ... @@ -13,6 +13,7 @@ import com.naji.xiaotao.R;
import com.naji.xiaotao.history.entity.HistoryEntity;
import com.naji.xiaotao.history.entity.HistoryOuter;
import com.naji.xiaotao.history.service.HistoryApiService;
import com.naji.xiaotao.history.ui.HistoryActivity;
import com.naji.xiaotao.http.RetrofitClient;
import com.naji.xiaotao.tangshi.vm.TangShiItemViewModel;
... ... @@ -39,7 +40,7 @@ import me.tatarka.bindingcollectionadapter2.OnItemBind;
public class HistoryViewModel extends BaseViewModel{
private InputMethodManager imm;
public TitleViewModel titleViewModel;
public ObservableInt currentTabIndex=new ObservableInt(0);//当前选中的tab索引
private List<HistoryOuter> todayList=new ArrayList<>();//今天的历史订单数据
... ... @@ -52,6 +53,7 @@ public class HistoryViewModel extends BaseViewModel{
public HistoryViewModel(Context context){
super(context);
titleViewModel=new TitleViewModel(context,"历史订单");
imm= (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
}
@Override
... ... @@ -145,7 +147,7 @@ public class HistoryViewModel extends BaseViewModel{
});
//初始化列表数据
private void initList(){
public void initList(){
observableList.clear();
List<HistoryOuter> outerList=new ArrayList<>();
switch (currentTabIndex.get()){
... ... @@ -169,15 +171,21 @@ public class HistoryViewModel extends BaseViewModel{
HistoryEntity head=new HistoryEntity();
head.setTitle(true);
head.setTitlename(outer.getDate());
observableList.add(new HistoryItemViewModel(context,head));
HistoryItemViewModel headViewModel=new HistoryItemViewModel(context,head);
observableList.add(headViewModel);
boolean hasList=false;
for(HistoryEntity entity:outer.getList()){
if(!TextUtils.isEmpty(entity.getRow_num())&&entity.getRow_num().contains(searchText.get())){
hasList=true;
HistoryEntity content=entity;
content.setTitlename(outer.getDate());
content.setTitle(false);
observableList.add(new HistoryItemViewModel(context,content));
}
}
if(!hasList){//标题栏下没有内容
observableList.remove(headViewModel);
}
}
}
... ... @@ -185,8 +193,8 @@ public class HistoryViewModel extends BaseViewModel{
public BindingCommand onSearchCommand=new BindingCommand(new BindingAction() {
@Override
public void call() {
imm.hideSoftInputFromWindow(((HistoryActivity)context).getCurrentFocus().getWindowToken(),0);
initList();
searchText.set("");
}
});
... ...
... ... @@ -3,6 +3,7 @@ package com.naji.xiaotao.login.ui;
import android.databinding.Observable;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.text.method.HideReturnsTransformationMethod;
import android.text.method.PasswordTransformationMethod;
... ... @@ -14,9 +15,10 @@ import com.naji.xiaotao.databinding.ActivityLoginBinding;
import com.naji.xiaotao.login.vm.LoginViewModel;
import me.goldze.mvvmhabit.base.BaseActivity;
import me.goldze.mvvmhabit.utils.SPUtils;
public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewModel> implements LoginViewModel.ErrCallback,TextWatcher{
public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewModel> implements TextWatcher{
@Override
public int initContentView(Bundle savedInstanceState) {
... ... @@ -30,7 +32,7 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewMo
@Override
public LoginViewModel initViewModel() {
return new LoginViewModel(this,this);
return new LoginViewModel(this);
}
@Override
... ... @@ -50,28 +52,24 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding,LoginViewMo
}
}
});
viewModel.shanghuNum.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
binding.shanghuEdt.setSelection(viewModel.shanghuNum.get().length());
}
});
viewModel.gonghaoNum.addOnPropertyChangedCallback(new Observable.OnPropertyChangedCallback() {
@Override
public void onPropertyChanged(Observable sender, int propertyId) {
binding.gonghaoEdt.setSelection(viewModel.gonghaoNum.get().length());
}
});
binding.shanghuEdt.addTextChangedListener(this);
binding.gonghaoEdt.addTextChangedListener(this);
binding.passEdt.addTextChangedListener(this);
}
@Override
public void onErr(int code) {
switch(code){
case 397://密码错误
break;
case 398://工号错误
break;
case 399://商户编号错误
break;
}
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
... ...
... ... @@ -43,18 +43,12 @@ public class LoginViewModel extends BaseViewModel{
public ObservableBoolean passVisible=new ObservableBoolean(false);//监听密码显示隐式
private ErrCallback errCallback;//错误回调
public LoginViewModel(Context context,ErrCallback errCallback){
public LoginViewModel(Context context){
super(context);
this.errCallback=errCallback;
shanghuNum.set(SPUtils.getInstance("user_info").getString("sellercode"));
gonghaoNum.set(SPUtils.getInstance("user_info").getString("account"));
}
public interface ErrCallback{
void onErr(int code);
}
@Override
public void onCreate() {
... ...
... ... @@ -40,6 +40,11 @@ public class MessageReceiver extends BroadcastReceiver{
RxBus.getDefault().post("hasorder");//顾客已下单
return;
}
if(message.getMessage_type().equals("5")){//服务员在小程序端审核菜品
SQLite.delete(Message.class).where(Message_Table.table_id.eq(message.getTable_id()),Message_Table.message_type.eq("2")).execute();
RxBus.getDefault().post("refresh");//发送给工作台首页一个刷新操作
return;
}
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();
if(message1!=null){//本地数据库已有此类消息
message1.setMessage_id(message.message_id);
... ... @@ -56,11 +61,6 @@ public class MessageReceiver extends BroadcastReceiver{
SQLite.delete(Message.class).where(Message_Table.message_id.eq(message.getMessage_id())).execute();
break;
}
// List<Message> list=SQLite.select().from(Message.class).queryList();
// KLog.d("count",list.size());
// for(Message message2:list){
// KLog.d("message",message2);
// }
RxBus.getDefault().post("refresh");//发送给工作台首页一个刷新操作
break;
}
... ...
... ... @@ -31,7 +31,7 @@
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@{titleViewModel.title}"
android:text="菜谱"
android:textColor="@color/text0"
android:textSize="@dimen/sp_17"
android:layout_toRightOf="@id/back"
... ...
... ... @@ -48,12 +48,14 @@
android:background="@drawable/history_search_border"
>
<EditText
android:id="@+id/search_edt"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:gravity="center_vertical"
android:inputType="number"
android:singleLine="true"
android:hint="请输入编号、单号"
android:text="@={viewModel.searchText}"
android:textColorHint="#aeb1b1"
... ... @@ -61,6 +63,8 @@
android:textColor="@color/text1"
android:paddingLeft="@dimen/dp_12"
binding:textChanged="@{viewModel.onTextChangedCommand}"
android:imeOptions="actionSearch"
/>
<TextView
android:layout_width="@dimen/dp_67"
... ...
... ... @@ -63,7 +63,6 @@
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:inputType="number"
android:selection="@{viewModel.shanghuNum.length}"
/>
<ImageView
android:id="@+id/shanghuErrIcon"
... ... @@ -112,7 +111,6 @@
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:inputType="number"
android:selection="@{viewModel.gonghaoNum.length}"
/>
<ImageView
android:id="@+id/gonghaoErrIcon"
... ... @@ -161,7 +159,6 @@
android:paddingTop="@dimen/dp_5"
android:paddingBottom="@dimen/dp_5"
android:inputType="textPassword"
android:selection="@{viewModel.password.length}"
/>
<ImageView
android:id="@+id/passImg"
... ...