Commit 029dc97d by 宁斌

1、餐台模式新增自定义食品 2、在onTrimMemory,onLowMemory方法内部清除内存缓存

parent cffe4c2a
......@@ -11,6 +11,7 @@ import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.database.bean.FoodCombo;
import com.gingersoft.gsa.cloud.database.bean.FoodModifier;
import com.gingersoft.gsa.cloud.database.bean.Modifier;
import com.gingersoft.gsa.cloud.order.commodity.OrderDetail;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.response.BaseOrderResponse;
import com.jess.arms.base.DefaultAdapter;
......@@ -108,6 +109,7 @@ public interface MealStandContract {
void setModifierTop(int Margins);
void setCustomFoodDialog(int customType, OrderDetail foodItem);
}
//Model层定义接口,外部只需关心Model返回的数据,无需关心内部细节,即是否使用缓存
......
......@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.table.mvp.model;
import android.app.Application;
import com.gingersoft.gsa.cloud.common.bean.BaseResult;
import com.gingersoft.gsa.cloud.common.logan.LoganManager;
import com.gingersoft.gsa.cloud.database.bean.ComboItem;
import com.gingersoft.gsa.cloud.database.bean.Discount;
import com.gingersoft.gsa.cloud.database.bean.Food;
......@@ -27,13 +28,19 @@ import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;
import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import io.reactivex.Observable;
import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;
import io.reactivex.functions.Action;
import io.reactivex.functions.Consumer;
import io.reactivex.functions.Function;
import okhttp3.RequestBody;
import retrofit2.Retrofit;
/**
......@@ -91,7 +98,7 @@ public class MealStandModel extends BaseModel implements MealStandContract.Model
@Override
public List<Modifier> queryDB_ModifierList(long fid, int mode) {
ModifierDaoUtils daoUtils = new ModifierDaoUtils(mApplication);
return MealStyleUtils.assemblyModifiersColor(daoUtils.queryModifiersByFid(fid, mode)) ;
return MealStyleUtils.assemblyModifiersColor(daoUtils.queryModifiersByFid(fid, mode));
}
@Override
......
......@@ -27,15 +27,17 @@ public class MealConditionFilterUtils {
* @return
*/
public static List<Food> foodConditionFilter(List<Food> foodList, int summary) {
String strSummary = String.valueOf(summary);
List<Food> newFoodList = new ArrayList<>();
for (Food food : foodList) {
String foodSummary = food.getFoodSummary();
if (!TextUtils.isEmpty(foodSummary)) {
String[] summarys = foodSummary.split(",");
for (String item : summarys) {
if (item.equals(strSummary)) {
newFoodList.add(food);
if (foodList == null || foodList.size() > 0) {
String strSummary = String.valueOf(summary);
for (Food food : foodList) {
String foodSummary = food.getFoodSummary();
if (!TextUtils.isEmpty(foodSummary)) {
String[] summarys = foodSummary.split(",");
for (String item : summarys) {
if (item.equals(strSummary)) {
newFoodList.add(food);
}
}
}
}
......@@ -51,15 +53,17 @@ public class MealConditionFilterUtils {
* @return
*/
public static List<ComboItem> comboConditionFilter(List<ComboItem> comboItemList, int summary) {
String strSummary = String.valueOf(summary);
List<ComboItem> newComboItemList = new ArrayList<>();
for (ComboItem comboItem : comboItemList) {
String foodSummary = comboItem.getFoodSummary();
if (!TextUtils.isEmpty(foodSummary)) {
String[] summarys = foodSummary.split(",");
for (String item : summarys) {
if (item.equals(strSummary)) {
newComboItemList.add(comboItem);
if (newComboItemList == null || newComboItemList.size() > 0) {
String strSummary = String.valueOf(summary);
for (ComboItem comboItem : comboItemList) {
String foodSummary = comboItem.getFoodSummary();
if (!TextUtils.isEmpty(foodSummary)) {
String[] summarys = foodSummary.split(",");
for (String item : summarys) {
if (item.equals(strSummary)) {
newComboItemList.add(comboItem);
}
}
}
}
......
......@@ -212,13 +212,16 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
public void initMealData() {
long startTime = System.currentTimeMillis();
List<Food> foodGroupList = mModel.queryDB_FoodGroupList(BaseOrder.orderType);
long endTime = System.currentTimeMillis();
LoganManager.w_tableMode(TAG, "queryDB_FoodGroupList執行時間-》" + (endTime - startTime));
if (foodGroupList != null && foodGroupList.size() > 0) {
// for (Food foodGroup: foodGroupList) {
// foodGroup.setColorBean(foodGroup.getColorBean());
// }
mFoodGroupList.addAll(foodGroupList);
Food defalutFoodGroup = getDefalutFoodGroup(mFoodGroupList);
......@@ -327,8 +330,13 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
changedMealByParentId(datasBean.getId());
} else {
mCurrentOrderDetailBean = OrderDetail.foodTransOrderDetails(datasBean, 1);
//加載套餐食品
loadComboData(mCurrentOrderDetailBean, false);
if (datasBean.getCustomType() == null) {
//自定義食品
mRootView.setCustomFoodDialog(Food.CUSTOM_TYPE_100, mCurrentOrderDetailBean);
} else {
//加載套餐食品
loadComboData(mCurrentOrderDetailBean, false);
}
}
}
});
......@@ -418,7 +426,6 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
});
}
private void addFoodItemBefore(OrderDetail datasBean) {
int addPosition = addFoodItem(datasBean);
//这里主食品作为选中主体
......@@ -561,7 +568,6 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
}
}
@Override
public void onError(Throwable e) {
}
......@@ -584,19 +590,22 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
if (IActivity.getCurrentViewMode() != MealConstant.fine_ViewMode && isSelectedMeal || autoMod) {
mRootView.showViewModeVisibility(MealConstant.combo_ViewMode);
}
if (!RvMealClicked) {
//新增食品
addFoodItemBefore(mCurrentOrderDetailBean);
//更新沽清食品數量
updateFoodSoldoutCtrData();
//更新賬單金額
updateBillInfo();
}
updateOrderFoodNumber();
toAddFoodItem(mCurrentOrderDetailBean);
}
});
}
public void toAddFoodItem(OrderDetail foodItem) {
if (!RvMealClicked) {
//新增食品
addFoodItemBefore(foodItem);
//更新沽清食品數量
updateFoodSoldoutCtrData();
//更新賬單金額
updateBillInfo();
}
updateOrderFoodNumber();
}
/**
* 裁減掉已超出的細項
......@@ -1185,12 +1194,33 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
}
public void changedMealByParentId(long parentId) {
long startTime = System.currentTimeMillis();
List<Food> foodList = mModel.queryDB_FoodList(parentId, BaseOrder.orderType);
long endTime = System.currentTimeMillis();
LoganManager.w_tableMode(TAG, "queryDB_FoodList執行時間-》" + (endTime - startTime));
mFoodAdapter.resetSelect(-1, null);
if (foodList != null) {
updateFoodData(foodList, parentId);
}
mRootView.showViewModeVisibility(MealConstant.food_ViewMode, MealConstant.food_group_ViewMode);
// .subscribeOn(Schedulers.io())
// .subscribeOn(AndroidSchedulers.mainThread())
// .observeOn(AndroidSchedulers.mainThread())
// .compose(RxLifecycleUtils.bindToLifecycle(mRootView))
// .subscribe(new ErrorHandleSubscriber<List<Food>>(mErrorHandler) {
//
// @Override
// public void onNext(@NonNull List<Food> foodList) {
// mFoodAdapter.resetSelect(-1, null);
// if (foodList != null) {
// updateFoodData(foodList, parentId);
// }
// mRootView.showViewModeVisibility(MealConstant.food_ViewMode, MealConstant.food_group_ViewMode);
// }
// });
}
/**
......@@ -1821,10 +1851,6 @@ public class MealStandPresenter extends BaseOrderPresenter<MealStandContract.Mod
* @param parentId
*/
private void updateFoodData(List<Food> foodList, long parentId) {
for (Food food : foodList) {
ColorBean colorBean = food.getColorBean();
int i = 0;
}
setTopId(foodList, parentId);
setFoodComboListStatus(foodList);
mFoodList.clear();
......
......@@ -6,15 +6,19 @@ import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.SystemClock;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.DisplayMetrics;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.Chronometer;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.ImageView;
......@@ -65,12 +69,14 @@ import com.gingersoft.gsa.cloud.table.di.component.DaggerMealStandComponent;
import com.gingersoft.gsa.cloud.table.mvp.contract.MealStandContract;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.SoldoutCtrFood;
import com.gingersoft.gsa.cloud.table.mvp.model.bean.event.InitTableEvent;
import com.gingersoft.gsa.cloud.table.mvp.model.constant.OrderConentActionConstant;
import com.gingersoft.gsa.cloud.table.mvp.presenter.MealStandPresenter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.BaseFragmentAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.FoodGroupAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.adapter.meal.SelectMealAdapter;
import com.gingersoft.gsa.cloud.table.mvp.ui.fragment.FineItemAllFragment;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.ChooseNumberDialog;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.CustomFoodDialog;
import com.gingersoft.gsa.cloud.table.mvp.ui.widget.UseMemberDialog;
import com.gingersoft.gsa.cloud.ui.recylcler.Indicator.PagerConfig;
import com.gingersoft.gsa.cloud.ui.recylcler.Indicator.PagerGridLayoutManager;
......@@ -86,8 +92,12 @@ import com.jess.arms.base.BaseFragmentActivity;
import com.jess.arms.base.DefaultAdapter;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.lxj.xpopup.util.KeyboardUtils;
import com.qmuiteam.qmui.alpha.QMUIAlphaTextView;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
import org.simple.eventbus.EventBus;
......@@ -1401,6 +1411,20 @@ public class MealStandActivity extends BaseFragmentActivity<MealStandPresenter>
}
@Override
public void setCustomFoodDialog(int customType, OrderDetail foodItem) {
new CustomFoodDialog(mContext, customType)
.create(R.style.MyEditDialogTheme)
.setOnEditListener((dialog, name, money) -> {
dialog.dismiss();
foodItem.setProductName(name);
foodItem.setUnit_price(Double.parseDouble(money));
foodItem.setPrice(foodItem.getUnit_price());
mPresenter.toAddFoodItem(foodItem);
})
.show();
}
@Override
public void showBtnMealModifyRestoreVisibility(boolean show) {
btn_meal_modify_restore.setVisibility(show ? View.VISIBLE : View.GONE);
}
......
package com.gingersoft.gsa.cloud.table.mvp.ui.widget;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.MessageQueue;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.gingersoft.gsa.cloud.app.GsaCloudApplication;
import com.gingersoft.gsa.cloud.common.utils.LanguageUtils;
import com.gingersoft.gsa.cloud.database.bean.Food;
import com.gingersoft.gsa.cloud.table.R;
import com.jess.arms.utils.ArmsUtils;
import com.lxj.xpopup.util.KeyboardUtils;
import com.qmuiteam.qmui.layout.QMUILinearLayout;
import com.qmuiteam.qmui.util.QMUIDisplayHelper;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton;
/**
* @作者: bin
* @創建時間: 2021-03-11 17:38
* @更新時間: 2021-03-11 17:38
* @描述:
*/
public class CustomFoodDialog {
private Context mContext;
private QMUIDialog customDialog;
private EditText ed_name, ed_money;
private int mRadius;
//0:value焦点、1:money焦点
private int currFocus = 0;
//0:清除、1:返回
private int clearOrReturn = 1;
private int mCustomType;
public CustomFoodDialog(Context context, int customType) {
this.mContext = context;
this.mCustomType = customType;
mRadius = QMUIDisplayHelper.dp2px(mContext, 8);
}
public CustomFoodDialog create(int style) {
customDialog = new QMUIDialog.CustomDialogBuilder(mContext)
.setLayout(R.layout.meal_dialog_custom_food)
.create(style);
buildViews();
return this;
}
public void show() {
if (customDialog != null) {
customDialog.show();
}
}
private void buildViews() {
QMUILinearLayout llContainer = customDialog.findViewById(R.id.lLayout_bg);
ViewStub vs_name = customDialog.findViewById(R.id.vs_name);
ViewStub vs_money = customDialog.findViewById(R.id.vs_money);
QMUIRoundButton btn_ok = customDialog.findViewById(R.id.btn_ok);
QMUIRoundButton btn_clear_or_return = customDialog.findViewById(R.id.btn_clear_or_return);
float mShadowAlpha = 0.25f;
int mShadowElevationDp = 14;
llContainer.setRadiusAndShadow(mRadius, QMUIDisplayHelper.dp2px(mContext, mShadowElevationDp), mShadowAlpha);
llContainer.setLayoutParams(new ConstraintLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
if (mCustomType == Food.CUSTOM_TYPE_101) {
vs_name.inflate();
TextView tv_name = customDialog.findViewById(R.id.tv_name);
ed_name = customDialog.findViewById(R.id.ed_name);
tv_name.setText("名稱");
setOnFocusChangeListener(ed_name);
addTextChangedListener(ed_name, btn_clear_or_return);
} else if (mCustomType == Food.CUSTOM_TYPE_102) {
vs_money.inflate();
TextView tv_money = customDialog.findViewById(R.id.tv_money);
ed_money = customDialog.findViewById(R.id.et_money);
tv_money.setText("金額");
setOnFocusChangeListener(ed_money);
addTextChangedListener(ed_money, btn_clear_or_return);
} else {
vs_name.inflate();
vs_money.inflate();
TextView tv_name = customDialog.findViewById(R.id.tv_name);
TextView tv_money = customDialog.findViewById(R.id.tv_money);
ed_name = customDialog.findViewById(R.id.ed_name);
ed_money = customDialog.findViewById(R.id.et_money);
tv_name.setText("名稱");
tv_money.setText("金額");
setOnFocusChangeListener(ed_name);
setOnFocusChangeListener(ed_money);
addTextChangedListener(ed_name, btn_clear_or_return);
addTextChangedListener(ed_money, btn_clear_or_return);
}
btn_ok.setOnClickListener((view) -> {
if (ed_name != null) {
KeyboardUtils.hideSoftInput(ed_name);
}
if (ed_money != null) {
KeyboardUtils.hideSoftInput(ed_money);
}
String name = getTvNameText();
String money = getTvMoneyText();
if (onEditListener != null) {
onEditListener.onInput(customDialog,name, money);
}
});
btn_clear_or_return.setOnClickListener((view) -> {
if (clearOrReturn == 1) {
customDialog.cancel();
} else {
//检查焦点
String s;
switch (currFocus) {
case 0:
s = ed_name.getText().toString();
if (s.length() > 0) {
s = s.substring(0, s.length() - 1);
ed_name.setText(s);
ed_name.setSelection(s.length());
}
break;
case 1:
s = ed_money.getText().toString();
if (s.length() > 0) {
s = s.substring(0, s.length() - 1);
ed_money.setText(s);
ed_money.setSelection(s.length());
}
break;
}
}
});
}
private void setOnFocusChangeListener(EditText editText) {
editText.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
if (editText.getId() == R.id.ed_name) {
currFocus = 0;
} else {
currFocus = 1;
}
}
});
}
private void addTextChangedListener(EditText editText, Button btn_clear_or_return) {
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (s.length() > 0) {
clearOrReturn = 0;
} else {
clearOrReturn = 1;
}
}
@Override
public void afterTextChanged(Editable s) {
if (clearOrReturn == 0) {
btn_clear_or_return.setText(LanguageUtils.get_language_system(GsaCloudApplication.getAppContext(), "Meal.funcMoney.clear", "clear"));
} else {
btn_clear_or_return.setText(LanguageUtils.get_language_system(GsaCloudApplication.getAppContext(), "Return", "return"));
}
}
});
}
private String getTvNameText() {
return ed_name != null ? ed_name.getText().toString() : null;
}
private String getTvMoneyText() {
return ed_money != null ? ed_money.getText().toString() : null;
}
private OnEditListener onEditListener;
public CustomFoodDialog setOnEditListener(OnEditListener onEditListener) {
this.onEditListener = onEditListener;
return this;
}
public interface OnEditListener {
void onInput(Dialog dialog,String name, String money);
}
}
<?xml version="1.0" encoding="utf-8"?>
<com.qmuiteam.qmui.layout.QMUILinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/lLayout_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/theme_white_color"
android:orientation="vertical"
android:padding="@dimen/normal_space">
<TextView
android:layout_width="match_parent"
android:layout_height="@dimen/head_height"
android:gravity="center"
android:text="自定義食品"
android:textColor="@color/theme_text_color"
android:textSize="@dimen/sp_18" />
<ViewStub
android:id="@+id/vs_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout="@layout/meal_layout_custom_food_name" />
<ViewStub
android:id="@+id/vs_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout="@layout/meal_layout_custom_food_money" />
<LinearLayout
android:id="@+id/btns"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/normal_space">
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_ok"
android:layout_width="0dp"
android:layout_height="@dimen/button_height"
android:layout_marginRight="@dimen/normal_space5"
android:layout_weight="1"
android:gravity="center"
android:text="確認"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/text_size_default"
app:qmui_backgroundColor="@color/theme_color"
app:qmui_radius="@dimen/dp_5" />
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_clear_or_return"
android:layout_width="0dp"
android:layout_height="@dimen/button_height"
android:layout_marginRight="@dimen/normal_space5"
android:layout_weight="1"
android:gravity="center"
android:text="返回"
android:textColor="@color/theme_black"
android:textSize="@dimen/text_size_default"
app:qmui_backgroundColor="@color/theme_hint_color"
app:qmui_borderColor="@color/theme_hint_color"
app:qmui_radius="@dimen/dp_5" />
</LinearLayout>
</com.qmuiteam.qmui.layout.QMUILinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_money"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_money"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/et_money"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/normal_space"
android:layout_weight="1"
android:background="@null"
android:hint="請輸入金額"
android:inputType="numberDecimal"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/normal_color"
android:textColorHint="@color/hint_color"
android:textSize="@dimen/sp_16"
app:met_autoValidate="true"
app:met_baseColor="@color/theme_black"
app:met_clearButton="true"
app:met_floatingLabel="highlight"
app:met_iconPadding="2dp"
app:met_primaryColor="@color/theme_color"
app:met_singleLineEllipsis="false" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView"
android:textColor="@color/black"
android:textSize="@dimen/sp_16" />
<com.rengwuxian.materialedittext.MaterialEditText
android:id="@+id/ed_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:hint="請輸入名稱"
android:layout_margin="@dimen/normal_space"
android:paddingLeft="@dimen/dp_10"
android:paddingRight="@dimen/dp_10"
android:singleLine="true"
android:textColor="@color/normal_color"
android:textColorHint="@color/hint_color"
android:textSize="@dimen/sp_16"
app:met_autoValidate="true"
app:met_clearButton="true"
app:met_floatingLabel="highlight"
app:met_iconPadding="2dp"
app:met_baseColor="@color/theme_black"
app:met_primaryColor="@color/theme_color"
app:met_singleLineEllipsis="false"/>
</LinearLayout>
\ No newline at end of file
......@@ -21,7 +21,7 @@ ext {
rxlifecycle2SdkVersion : "2.2.1",
espressoSdkVersion : "3.0.1",
fragmentationVersion : "1.3.8",
canarySdkVersion : "1.5.4",
canarySdkVersion : "2.2",
]
buildType = [
......@@ -126,7 +126,7 @@ ext {
"timber" : "com.jakewharton.timber:timber:4.6.0",
"logger" : "com.orhanobut:logger:2.1.1",
"canary-debug" : "com.squareup.leakcanary:leakcanary-android:${version["canarySdkVersion"]}",
"canary-release" : "com.squareup.leakcanary:leakcanary-android-no-op:${version["canarySdkVersion"]}",
"canary-release" : "com.squareup.leakcanary:leakcanary-android-no-op:1.6.3",
"umeng-analytics" : "com.umeng.analytics:analytics:6.0.1",
// QMUI
"qmui" : "com.qmuiteam:qmui:2.0.0-alpha03",
......
......@@ -27,6 +27,8 @@ import com.jess.arms.base.BaseApplication;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.di.component.DaggerAppComponent;
import com.jess.arms.di.module.GlobalConfigModule;
import com.jess.arms.http.imageloader.glide.GlideArms;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.integration.ConfigModule;
import com.jess.arms.integration.ManifestParser;
import com.jess.arms.utils.ArmsUtils;
......@@ -258,6 +260,13 @@ public class AppDelegate implements App, AppLifecycles {
//系统正运行与低内存的状态并且你的进程正处于 LRU 列表中最容易被杀掉的位置, 你应该释放任何不影响你的 App 恢复状态的资源
//低于 API 14 的 App 可以使用 onLowMemory 回调
// case TRIM_MEMORY_COMPLETE:
//在 App 被置换到后台的时候,清理图片请求框架的内存缓存
if (level == TRIM_MEMORY_UI_HIDDEN) {
mAppComponent.imageLoader().clear(mApplication,
ImageConfigImpl.builder().isClearMemory(true).build());
}
//交给 Glide 处理内存情况
GlideArms.get(mApplication).trimMemory(level);
}
@Override
......@@ -274,6 +283,8 @@ public class AppDelegate implements App, AppLifecycles {
@Override
public void onLowMemory() {
//系统正运行与低内存的状态并且你的进程正处于 LRU 列表中最容易被杀掉的位置, 你应该释放任何不影响你的 App 恢复状态的资源
mAppComponent.imageLoader().clear(mApplication,
ImageConfigImpl.builder().isClearMemory(true).build());
}
}
......
......@@ -6,6 +6,7 @@
<item name="QMUITopBarStyle">@style/QDTopBar</item>
<!-- TabItem theme -->
<item name="QMUITabSegmentStyle">@style/QMUITabSegmentStyle</item>
</style>
<style name="MyCheckbox_style">
......
......@@ -51,7 +51,7 @@ android {
/**
* 版本号
*/
schemaVersion 23
schemaVersion 24
/**
* greendao输出dao的数据库操作实体类文件夹(相对路径 包名+自定义路径名称,包将创建于包名的直接路径下)
*/
......@@ -82,4 +82,9 @@ dependencies {
// 數據庫
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'org.greenrobot:greendao-generator:3.2.2'
//rx
api rootProject.ext.dependencies["rxjava2"]
api(rootProject.ext.dependencies["rxandroid2"]) {
exclude module: 'rxjava'
}
}
......@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
* Master of DAO (schema version 23): knows all DAOs.
* Master of DAO (schema version 24): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
public static final int SCHEMA_VERSION = 23;
public static final int SCHEMA_VERSION = 24;
/** Creates underlying database table using DAOs. */
public static void createAllTables(Database db, boolean ifNotExists) {
......
......@@ -13,6 +13,8 @@ import org.greenrobot.greendao.query.QueryBuilder;
import java.util.List;
import io.reactivex.Observable;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
......@@ -206,7 +208,6 @@ public class FoodDaoUtils {
public List<Food> queryFoodByQueryBuilder(long parentId, int foodSummary) {
QueryBuilder<Food> queryBuilder = mManager.getDaoSession().queryBuilder(Food.class);
long currentTime = System.currentTimeMillis();
// queryBuilder.join(ColorBeanDao.Properties.AndroidColor, Food.class, FoodDao.Properties.ColorId);
queryBuilder.where(queryBuilder.and(
FoodDao.Properties.ParentId.eq(parentId),
......
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