Commit 6e91dc54 by 宁斌

Merge branch 'youhua' into dev

# Conflicts:
#	arms/build.gradle
#	base-module/build.gradle
#	base-module/src/main/java/com/gingersoft/gsa/cloud/base/application/GsaCloudApplication.java
#	base-module/src/main/java/com/gingersoft/gsa/cloud/bean/expandInfo/ExpandInfoSetting.java
#	base-module/src/main/java/com/gingersoft/gsa/cloud/bean/expandInfo/UIStyleExtendedConfiguration.java
#	base-module/src/main/java/com/gingersoft/gsa/cloud/database/bean/Discount.java
#	base-module/src/main/java/com/gingersoft/gsa/cloud/database/greendao/DiscountDao.java
#	config.gradle
#	delivery_pick_module/src/main/java/com/gingersoft/gsa/delivery_pick_mode/mvp/ui/activity/SendOrderActivity.java
#	order-base/src/main/java/com/gingersoft/gsa/cloud/base/order/bean/discount/OrderDiscount.java
#	print-module/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
#	print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintTestActivity.java
#	table-module/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/MealStandModel.java
#	table-module/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/OrderContentModel.java
#	table-module/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/cart/ShoppingCart.java
#	table-module/src/main/java/com/gingersoft/gsa/cloud/table/mvp/model/discount/NomalDiscount.java
#	table-module/src/main/java/com/gingersoft/gsa/cloud/table/mvp/presenter/BaseOrderPresenter.java
#	table-module/src/main/java/com/gingersoft/gsa/cloud/table/mvp/ui/adapter/meal/SelectMealAdapter.java
parents 8366fd1e ce4cd6d7
......@@ -101,7 +101,7 @@ dependencies {
exclude module: 'support-annotations'
}
api rootProject.ext.dependencies['rxerrorhandler2']
api rootProject.ext.dependencies['rxbinding']
api rootProject.ext.dependencies["rxbinding2"]
//network
api(rootProject.ext.dependencies["retrofit"]) {
exclude module: 'okhttp'
......
......@@ -51,16 +51,18 @@ public class BaseApplication extends Application implements App {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
if (mAppDelegate == null)
if (mAppDelegate == null) {
this.mAppDelegate = new AppDelegate(base);
}
this.mAppDelegate.attachBaseContext(base);
}
@Override
public void onCreate() {
super.onCreate();
if (mAppDelegate != null)
if (mAppDelegate != null) {
this.mAppDelegate.onCreate(this);
}
}
/**
......@@ -69,8 +71,9 @@ public class BaseApplication extends Application implements App {
@Override
public void onTerminate() {
super.onTerminate();
if (mAppDelegate != null)
if (mAppDelegate != null) {
this.mAppDelegate.onTerminate(this);
}
}
/**
......
......@@ -3,7 +3,6 @@ apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'kotlin-kapt'
android {
......@@ -47,22 +46,6 @@ android {
proguardFiles 'proguard.cfg'
}
}
greendao {
/**
* 版本号
*/
schemaVersion 21
/**
* greendao输出dao的数据库操作实体类文件夹(相对路径 包名+自定义路径名称,包将创建于包名的直接路径下)
*/
daoPackage 'com.gingersoft.gsa.cloud.database.greendao'
/**
* greenDao实体类包文件夹
*/
targetGenDir 'src/main/java'
generateTests false //设置为true以自动生成单元测试。
}
sourceSets {
main {
......@@ -109,13 +92,12 @@ dependencies {
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.android.support:design:28.0.0'
// 數據庫
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'org.greenrobot:greendao-generator:3.2.2'
implementation 'com.gcssloop.recyclerview:pagerlayoutmanager:2.3.8'
//陰影背景
api 'com.github.lihangleo2:ShadowLayout:2.1.6'
implementation 'org.aspectj:aspectjrt:1.8.9'
//時間選擇控件
api 'com.contrarywind:Android-PickerView:3.2.4'
// implementation 'org.aspectj:aspectjrt:1.8.9'
//商米打印庫
api 'com.sunmi:printerlibrary:1.0.7'
//上下拉刷新
......@@ -124,20 +106,22 @@ dependencies {
api 'com.rengwuxian.materialedittext:library:2.1.4'
//扫码
api 'cn.bingoogolapple:bga-qrcode-zxing:1.3.7'
//加载反馈页管理
api rootProject.ext.dependencies["loadsir"]
//rxjava,rxbinding相關工具類
api 'com.github.xuexiangjys:RxUtil2:1.1.5'
api rootProject.ext.dependencies["permissionx"]
api rootProject.ext.dependencies["design"]
api rootProject.ext.dependencies["appcompat-v7"]
implementation 'cn.bingoogolapple:bga-photopicker:1.2.8@aar'
implementation 'cn.bingoogolapple:bga-baseadapter:1.2.9@aar'
implementation 'cn.bingoogolapple:bga-flowlayout:1.0.0@aar'
//时间选择器
api rootProject.ext.dependencies["pickerview"]
api 'androidx.core:core-ktx:+'
implementation 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
api 'com.github.huangyanbin:SmartTable:2.2.0'
api rootProject.ext.dependencies["permissionx"]
api rootProject.ext.dependencies["design"]
api rootProject.ext.dependencies["appcompat-v7"]
}
repositories {
......
package com.gingersoft.gsa.cloud.aspectj;
import android.view.View;
/**
* Created by Wyh on 2020/2/29.
*/
public class XClickUtil {
/**
* 最近一次点击的时间
*/
private static long mLastClickTime;
/**
* 最近一次点击的控件ID
*/
private static int mLastClickViewId;
/**
* 是否是快速点击
*
* @param v 点击的控件
* @param intervalMillis 时间间期(毫秒)
* @return true:是,false:不是
*/
public static boolean isFastDoubleClick(View v, long intervalMillis) {
int viewId = v.getId();
long time = System.currentTimeMillis();
long timeInterval = Math.abs(time - mLastClickTime);
if (timeInterval < intervalMillis && viewId == mLastClickViewId) {
return true;
} else {
mLastClickTime = time;
mLastClickViewId = viewId;
return false;
}
}
}
package com.gingersoft.gsa.cloud.base.common.bean;
import com.gingersoft.gsa.cloud.database.bean.Food;
import java.util.List;
/**
......
......@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.base.common.bean.PrinterManger;
import com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean;
import java.util.List;
/**
......
package com.gingersoft.gsa.cloud.base.utils;
import android.content.Context;
import com.gingersoft.gsa.cloud.constans.UserConstans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2019-12-29
* 修订历史:2019-12-29
* 描述:
*/
public class UserDataUtils {
//获取登陆token
public static String getLoginToken(Context context) {
return (String) SPUtils.get(context, UserConstans.token, "0");
}
public static String getMemberId(Context context) {
return (String) SPUtils.get(context, UserConstans.memberId, "0");
}
public static String getRestaurantId(Context context) {
return (String) SPUtils.get(context, UserConstans.restaurantId, "");
}
public static void setMemberId(Context context, int memberId) {
SPUtils.put(context, UserConstans.memberId, memberId);
}
public static void setLoginToken(Context context, String token) {
SPUtils.put(context, UserConstans.token, token);
}
public static void setRestaurantId(Context context, int restaurantId) {
SPUtils.put(context, UserConstans.restaurantId, restaurantId);
}
}
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;
import android.os.Vibrator;
import com.gingersoft.gsa.cloud.base.R;
import com.gingersoft.gsa.cloud.constans.AppConstans;
import com.gingersoft.gsa.cloud.base.utils.other.SPUtils;
......@@ -22,8 +23,8 @@ public class VibratorUtils {
public static void pressButtonSound(Context context) {
SoundPool soundPool = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0);
soundPool.load(context, R.raw.beep, 1);
int vibrationProgress = (int) SPUtils.get(context, AppConstans.VIBRATION_PROGRESS,0);
int presssoundProgress = (int) SPUtils.get(context, AppConstans.PRESSSOUND_PROGRESS,0);
int vibrationProgress = (int) SPUtils.get(AppConstans.VIBRATION_PROGRESS, 0);
int presssoundProgress = (int) SPUtils.get(AppConstans.PRESSSOUND_PROGRESS, 0);
try {
Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
if (vibrationProgress > 0) {
......@@ -36,7 +37,7 @@ public class VibratorUtils {
}
}
public void setJumpActivity(Class clazz){
public void setJumpActivity(Class clazz) {
}
}
......@@ -3,6 +3,8 @@ package com.gingersoft.gsa.cloud.base.utils.other;
import android.content.Context;
import android.content.SharedPreferences;
import com.gingersoft.gsa.cloud.base.application.GsaCloudApplication;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
......@@ -24,11 +26,11 @@ public class SPUtils {
*
* @return void 返回类型
*/
public static void put(Context context, String key, Object object) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
public static void put(String key, Object object) {
SharedPreferences sp = GsaCloudApplication.getAppContext().getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
if(object == null) {
if (object == null) {
editor.remove(key);
SharedPreferencesCompat.apply(editor);
return;
......@@ -53,13 +55,12 @@ public class SPUtils {
/**
* 得到保存数据的方法,根据默认值得到保存的数据的具体类型,然后调用相对于的方法获取值
*
* @param context
* @param key
* @param defaultObject
* @return
*/
public static Object get(Context context, String key, Object defaultObject) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
public static Object get(String key, Object defaultObject) {
SharedPreferences sp = GsaCloudApplication.getAppContext().getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
if (defaultObject instanceof String) {
......@@ -80,11 +81,10 @@ public class SPUtils {
/**
* 移除某个key值已经对应的值
*
* @param context
* @param key
*/
public static void remove(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
public static void remove(String key) {
SharedPreferences sp = GsaCloudApplication.getAppContext().getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.remove(key);
......@@ -93,11 +93,9 @@ public class SPUtils {
/**
* 清除所有数据
*
* @param context
*/
public static void clear(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
public static void clear() {
SharedPreferences sp = GsaCloudApplication.getAppContext().getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sp.edit();
editor.clear();
......@@ -107,12 +105,11 @@ public class SPUtils {
/**
* 查询某个key是否已经存在
*
* @param context
* @param key
* @return
*/
public static boolean contains(Context context, String key) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
public static boolean contains(String key) {
SharedPreferences sp = GsaCloudApplication.getAppContext().getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.contains(key);
}
......@@ -120,11 +117,10 @@ public class SPUtils {
/**
* 返回所有的键值对
*
* @param context
* @return
*/
public static Map<String, ?> getAll(Context context) {
SharedPreferences sp = context.getSharedPreferences(FILE_NAME,
public static Map<String, ?> getAll() {
SharedPreferences sp = GsaCloudApplication.getAppContext().getSharedPreferences(FILE_NAME,
Context.MODE_PRIVATE);
return sp.getAll();
}
......
......@@ -94,6 +94,7 @@ public class ExpandInfoSetting {
@Override
public void onNext(String s) {
int i = 1;
}
@Override
......
......@@ -61,7 +61,7 @@ public class UIStyleExtendedConfiguration {
.remark("套餐高度")
.build();
private ExpandInfoSetting discountHeight = ExpandInfoSetting.builder()
.valueInt(80)
.valueInt(90)
.remark("餐牌折扣Item高度")
.build();
private ExpandInfoSetting LayoutQtyHeight = ExpandInfoSetting.builder()
......@@ -84,27 +84,27 @@ public class UIStyleExtendedConfiguration {
.remark("餐牌選中食品字體大小")
.build();
private ExpandInfoSetting foodGroupFontSize = ExpandInfoSetting.builder()
.valueInt(12)
.valueInt(14)
.remark("食品組字體大小")
.build();
private ExpandInfoSetting foodFontSize = ExpandInfoSetting.builder()
.valueInt(12)
.valueInt(14)
.remark("食品字體大小")
.build();
private ExpandInfoSetting comboFontSize = ExpandInfoSetting.builder()
.valueInt(10)
.valueInt(12)
.remark("套餐字體大小")
.build();
private ExpandInfoSetting modFontSize = ExpandInfoSetting.builder()
.valueInt(10)
.valueInt(12)
.remark("細項字體大小")
.build();
private ExpandInfoSetting discountFontSize = ExpandInfoSetting.builder()
.valueInt(12)
.valueInt(16)
.remark("折扣字體大小")
.build();
private ExpandInfoSetting soldoutFoodFlagFontSize = ExpandInfoSetting.builder()
.valueInt(8)
.valueInt(10)
.remark("食品沽清標誌字體大小")
.build();
private ExpandInfoSetting soldoutModFlagFontSize = ExpandInfoSetting.builder()
......@@ -173,14 +173,13 @@ public class UIStyleExtendedConfiguration {
return soldoutModFlagHeight.getValue();
}
public <T> T getBillListFontSizeVaule() {
return billListFontSize.getValue();
}
public <T> T getFoodGroupFontSizeValue() {
return foodGroupFontSize.getValue();
}
public <T> T getBillListFontSizeValue() {
return billListFontSize.getValue();
}
public <T> T getFoodFontSizeValue() {
return foodFontSize.getValue();
}
......
package com.gingersoft.gsa.cloud.constans;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
* 创建日期:2020-06-03
* 修订历史:2020-06-03
* 描述:
*/
public interface HttpsCode {
}
......@@ -115,7 +115,7 @@ public class HttpsConstans {
public static String RICEPON_MEMBER_61177;
public static void init(Context context) {
isFormal = (int) SPUtils.get(context, "isFormal", -1);
isFormal = (int) SPUtils.get("isFormal", -1);
if (isFormal == -1 && BuildConfig.DEBUG) {
//如果沒有手動配置過服務器,並且是DEBUG模式,默認是測試服務器
isFormal = 1;
......
......@@ -9,6 +9,9 @@ package com.gingersoft.gsa.cloud.patterns;
*/
public interface Strategy<T> {
/**具體行為實現方法*/
/**
* 具體行為實現方法
*/
void action(T t);
}
......@@ -141,7 +141,6 @@ public class PrinterUtils {
* and executes a full cut ( cuts the paper completely )
*
* @return bytes for this command
* @return bytes for this command
*/
public static byte[] feedPaperCut() {
return PrintCommands.selectCutModeAndCutPaper(1, 0);
......@@ -441,7 +440,7 @@ public class PrinterUtils {
function.setLable("本機");
orderTopFunctionAdapter.notifyDataSetChanged();
}
SPUtils.put(dialog.getContext(), PrintConstans.DEFAULT_PRINT_METHOD, PrintConstans.LOCAL_PRINT);
SPUtils.put(PrintConstans.DEFAULT_PRINT_METHOD, PrintConstans.LOCAL_PRINT);
dialog.dismiss();
});
hepler.setViewClick(R.id.internet_print, v -> {
......@@ -450,7 +449,7 @@ public class PrinterUtils {
function.setLable("網絡");
orderTopFunctionAdapter.notifyDataSetChanged();
}
SPUtils.put(dialog.getContext(), PrintConstans.DEFAULT_PRINT_METHOD, PrintConstans.IP_PRINT);
SPUtils.put(PrintConstans.DEFAULT_PRINT_METHOD, PrintConstans.IP_PRINT);
dialog.dismiss();
});
}
......
package com.gingersoft.gsa.cloud.ui.loadsir;
import com.gingersoft.gsa.cloud.base.R;
import com.kingja.loadsir.callback.Callback;
/**
* @author : bin
* @create date: 2020-10-27
* @update date: 2020-10-27
* @description:
*/
public class CustomCallback extends Callback {
@Override
protected int onCreateView() {
return R.layout.loadsir_custom;
}
}
package com.gingersoft.gsa.cloud.ui.loadsir;
import com.gingersoft.gsa.cloud.base.R;
import com.kingja.loadsir.callback.Callback;
/**
* @author : bin
* @create date: 2020-10-27
* @update date: 2020-10-27
* @description:
*/
public class EmptyCallback extends Callback {
@Override
protected int onCreateView() {
return R.layout.loadsir_empty;
}
}
package com.gingersoft.gsa.cloud.ui.loadsir;
import com.gingersoft.gsa.cloud.base.R;
import com.kingja.loadsir.callback.Callback;
/**
* @author : bin
* @create date: 2020-10-27
* @update date: 2020-10-27
* @description:
*/
public class ErrorCallback extends Callback {
@Override
protected int onCreateView() {
return R.layout.loadsir_error;
}
}
package com.gingersoft.gsa.cloud.ui.loadsir;
import com.gingersoft.gsa.cloud.base.R;
import com.kingja.loadsir.callback.Callback;
/**
* @author : bin
* @create date: 2020-10-27
* @update date: 2020-10-27
* @description:
*/
public class LoadingCallback extends Callback {
@Override
protected int onCreateView() {
return R.layout.loadsir_loading;
}
}
package com.gingersoft.gsa.cloud.ui.loadsir;
import com.kingja.loadsir.callback.Callback;
import com.kingja.loadsir.core.LoadService;
/**
* @author : bin
* @create date: 2020-10-27
* @update date: 2020-10-27
* @description:
*/
public class LoadsirUtils {
public static void loadState(LoadService loadService, Callback callback){
}
}
package com.gingersoft.gsa.cloud.ui.loadsir;
import com.gingersoft.gsa.cloud.base.R;
import com.kingja.loadsir.callback.Callback;
/**
* @author : bin
* @create date: 2020-10-27
* @update date: 2020-10-27
* @description:
*/
public class TimeoutCallback extends Callback {
@Override
protected int onCreateView() {
return R.layout.loadsir_timeout;
}
}
......@@ -47,7 +47,7 @@ public class OrderPayView extends LinearLayout {
/**
* 服務費金額
*/
private double serviceCharge = 0.0;
private Double serviceCharge = 0.0;
private MemberInfo memberInfo;
......@@ -99,7 +99,7 @@ public class OrderPayView extends LinearLayout {
this.totalAmount = totalAmount;
}
public void setServiceCharge(double serviceCharge) {
public void setServiceCharge(Double serviceCharge) {
this.serviceCharge = serviceCharge;
}
......
......@@ -3,6 +3,7 @@ package com.gingersoft.gsa.cloud.ui.widget.dialog;
import android.app.Activity;
import android.text.InputType;
import android.text.TextUtils;
import android.widget.EditText;
import com.gingersoft.gsa.cloud.base.R;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
......@@ -59,6 +60,20 @@ public class CommonTipDialog {
dialogBuilder.create(R.style.MyDialogTheme2).show();
}
public static void showDoubtDialog2(Activity context, String msg, OnCallbackListener listener) {
QMUIDialog.MessageDialogBuilder dialogBuilder = new QMUIDialog.MessageDialogBuilder(context);
dialogBuilder.setTitleIcon(R.drawable.qmui_icon_dialog_doubt);
dialogBuilder.setMessage(msg);
dialogBuilder.addAction(R.drawable.shape_red_five_radius_bg, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss();
if (listener != null) {
listener.onSure();
}
});
dialogBuilder.addAction(R.drawable.shape_3c_cancel_btn_bg, "取消", (dialog, index) -> dialog.dismiss());
dialogBuilder.create(R.style.MyDialogTheme2).show();
}
/**
* 危險警示dialog 確認后執行對應方法
*
......@@ -189,39 +204,40 @@ public class CommonTipDialog {
* @param context
* @param title
* @param placeholder
* @param c
* @param object
* @param methodName
* @param parameterTypes
* @param parameters
*/
public static void showEditTextDialog(Activity context, String title, String placeholder, Class c, Object object, String methodName, Class[] parameterTypes, Object[] parameters) {
public static EditText showEditDialog(Activity context, String title, String placeholder, int inputType, OnEditTextListener onEditTextListener) {
final QMUIDialog.EditTextDialogBuilder dialogBuilder = new QMUIDialog.EditTextDialogBuilder(context);
dialogBuilder.setTitle(title);
dialogBuilder.setPlaceholder(placeholder);
dialogBuilder.setInputType(InputType.TYPE_CLASS_TEXT);
dialogBuilder.setInputType(inputType);
dialogBuilder.addAction(0, "確認", QMUIDialogAction.ACTION_PROP_NEGATIVE, (dialog, index) -> {
dialog.dismiss();
if (TextUtils.isEmpty(methodName)) {
return;
}
try {
Method method = c.getDeclaredMethod(methodName, parameterTypes);
method.setAccessible(true);
method.invoke(object, parameters);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
if (onEditTextListener != null) {
CharSequence text = dialogBuilder.getEditText().getText();
onEditTextListener.inputText(text.toString());
}
});
if (!TextUtils.isEmpty(methodName)) {
dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss());
}
dialogBuilder.create(R.style.MyDialogTheme2).show();
dialogBuilder.addAction("取消", (dialog, index) -> dialog.dismiss());
dialogBuilder.create(R.style.MyEditDialogTheme).show();
return dialogBuilder.getEditText();
}
private OnEditTextListener onEditTextListener;
private OnCallbackListener onCallbackListener;
public void setOnEditTextListener(OnEditTextListener onEditTextListener) {
this.onEditTextListener = onEditTextListener;
}
public void setOnCallbackListener(OnCallbackListener onCallbackListener) {
this.onCallbackListener = onCallbackListener;
}
public interface OnEditTextListener {
void inputText(String text);
}
public interface OnCallbackListener {
void onSure();
}
}
package com.gingersoft.gsa.cloud.ui.widget.keyboard;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.R;
import java.util.ArrayList;
import java.util.Map;
/**
* 九宫格键盘适配器
*/
public class KeyBoardAdapter extends BaseAdapter {
private Context mContext;
private ArrayList<Map<String, String>> valueList;
public KeyBoardAdapter(Context mContext, ArrayList<Map<String, String>> valueList) {
this.mContext = mContext;
this.valueList = valueList;
}
@Override
public int getCount() {
return valueList.size();
}
@Override
public Object getItem(int position) {
return valueList.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder;
if (convertView == null) {
convertView = View.inflate(mContext, R.layout.item_grid_virtual_keyboard, null);
viewHolder = new ViewHolder();
viewHolder.btnKey = (TextView) convertView.findViewById(R.id.btn_keys);
viewHolder.imgDelete = (RelativeLayout) convertView.findViewById(R.id.imgDelete);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
if (position == 9) {
viewHolder.imgDelete.setVisibility(View.INVISIBLE);
viewHolder.btnKey.setVisibility(View.VISIBLE);
viewHolder.btnKey.setText(valueList.get(position).get("name"));
viewHolder.btnKey.setBackgroundColor(Color.parseColor("#e0e0e0"));
} else if (position == 11) {
viewHolder.btnKey.setBackgroundResource(R.mipmap.keyboard_delete_img);
viewHolder.imgDelete.setVisibility(View.VISIBLE);
viewHolder.btnKey.setVisibility(View.INVISIBLE);
} else {
viewHolder.imgDelete.setVisibility(View.INVISIBLE);
viewHolder.btnKey.setVisibility(View.VISIBLE);
viewHolder.btnKey.setText(valueList.get(position).get("name"));
}
return convertView;
}
/**
* 存放控件
*/
public final class ViewHolder {
public TextView btnKey;
public RelativeLayout imgDelete;
}
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.ui.widget.keyboard;
/**
* 自定义接口,用于给密码输入完成添加回掉事件
*/
public interface OnPasswordInputFinish {
void inputFinish(String password);
}
\ No newline at end of file
package com.gingersoft.gsa.cloud.ui.widget.keyboard;
import android.content.Context;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.gingersoft.gsa.cloud.base.R;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* 弹框里面的View
*/
public class PasswordView extends RelativeLayout {
Context mContext;
private VirtualKeyboardView virtualKeyboardView;
private TextView[] tvList; //用数组保存6个TextView,为什么用数组?
private ImageView[] imgList; //用数组保存6个TextView,为什么用数组?
private GridView gridView;
private ImageView imgCancel;
private ArrayList<Map<String, String>> valueList;
private int currentIndex = -1; //用于记录当前输入密码格位置
public PasswordView(Context context) {
this(context, null);
}
public PasswordView(Context context, AttributeSet attrs) {
super(context, attrs);
this.mContext = context;
View view = View.inflate(context, R.layout.layout_popup_bottom, null);
virtualKeyboardView = (VirtualKeyboardView) view.findViewById(R.id.virtualKeyboardView);
imgCancel = (ImageView) view.findViewById(R.id.img_cancel);
gridView = virtualKeyboardView.getGridView();
initValueList();
initView(view);
setupView();
addView(view);
}
private void initView(View view) {
tvList = new TextView[6];
imgList = new ImageView[6];
tvList[0] = (TextView) view.findViewById(R.id.tv_pass1);
tvList[1] = (TextView) view.findViewById(R.id.tv_pass2);
tvList[2] = (TextView) view.findViewById(R.id.tv_pass3);
tvList[3] = (TextView) view.findViewById(R.id.tv_pass4);
tvList[4] = (TextView) view.findViewById(R.id.tv_pass5);
tvList[5] = (TextView) view.findViewById(R.id.tv_pass6);
imgList[0] = (ImageView) view.findViewById(R.id.img_pass1);
imgList[1] = (ImageView) view.findViewById(R.id.img_pass2);
imgList[2] = (ImageView) view.findViewById(R.id.img_pass3);
imgList[3] = (ImageView) view.findViewById(R.id.img_pass4);
imgList[4] = (ImageView) view.findViewById(R.id.img_pass5);
imgList[5] = (ImageView) view.findViewById(R.id.img_pass6);
}
// 这里,我们没有使用默认的数字键盘,因为第10个数字不显示.而是空白
private void initValueList() {
valueList = new ArrayList<>();
// 初始化按钮上应该显示的数字
for (int i = 1; i < 13; i++) {
Map<String, String> map = new HashMap<String, String>();
if (i < 10) {
map.put("name", String.valueOf(i));
} else if (i == 10) {
map.put("name", "");
} else if (i == 11) {
map.put("name", String.valueOf(0));
} else if (i == 12) {
map.put("name", "");
}
valueList.add(map);
}
}
private void setupView() {
// 这里、重新为数字键盘gridView设置了Adapter
KeyBoardAdapter keyBoardAdapter = new KeyBoardAdapter(mContext, valueList);
gridView.setAdapter(keyBoardAdapter);
gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (position < 11 && position != 9) { //点击0~9按钮
if (currentIndex >= -1 && currentIndex < 5) { //判断输入位置————要小心数组越界
;
++currentIndex;
tvList[currentIndex].setText(valueList.get(position).get("name"));
tvList[currentIndex].setVisibility(View.INVISIBLE);
imgList[currentIndex].setVisibility(View.VISIBLE);
}
} else {
if (position == 11) { //点击退格键
if (currentIndex - 1 >= -1) { //判断是否删除完毕————要小心数组越界
tvList[currentIndex].setText("");
tvList[currentIndex].setVisibility(View.VISIBLE);
imgList[currentIndex].setVisibility(View.INVISIBLE);
currentIndex--;
}
}
}
}
});
}
//设置监听方法,在第6位输入完成后触发
public void setOnFinishInput(final OnPasswordInputFinish pass) {
tvList[5].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) {
}
@Override
public void afterTextChanged(Editable s) {
if (s.toString().length() == 1) {
String strPassword = ""; //每次触发都要先将strPassword置空,再重新获取,避免由于输入删除再输入造成混乱
for (int i = 0; i < 6; i++) {
strPassword += tvList[i].getText().toString().trim();
}
pass.inputFinish(strPassword); //接口中要实现的方法,完成密码输入完成后的响应逻辑
}
}
});
}
public VirtualKeyboardView getVirtualKeyboardView() {
return virtualKeyboardView;
}
public ImageView getImgCancel() {
return imgCancel;
}
}
package com.gingersoft.gsa.cloud.ui.widget.keyboard;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.PopupWindow;
import android.widget.Toast;
import com.gingersoft.gsa.cloud.base.R;
/**
* 输入支付密码
*
* @author lining
*/
public class PopEnterPassword extends PopupWindow {
private PasswordView pwdView;
private View mMenuView;
private Activity mContext;
public PopEnterPassword(final Activity context) {
super(context);
this.mContext = context;
LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mMenuView = inflater.inflate(R.layout.pop_enter_password, null);
pwdView = (PasswordView) mMenuView.findViewById(R.id.pwd_view);
//添加密码输入完成的响应
pwdView.setOnFinishInput(new OnPasswordInputFinish() {
@Override
public void inputFinish(final String password) {
new Thread(new Runnable() {
@Override
public void run() {
// 模拟耗时的操作。
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
mContext.runOnUiThread(new Runnable() {
@Override
public void run() {
dismiss();
Toast.makeText(mContext, "支付成功,密码为:" + password, Toast.LENGTH_SHORT).show();
}
});
}
}).start();
}
});
// 监听X关闭按钮
pwdView.getImgCancel().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
// 监听键盘上方的返回
pwdView.getVirtualKeyboardView().getLayoutBack().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
// 设置SelectPicPopupWindow的View
this.setContentView(mMenuView);
// 设置SelectPicPopupWindow弹出窗体的宽
this.setWidth(LayoutParams.MATCH_PARENT);
// 设置SelectPicPopupWindow弹出窗体的高
this.setHeight(LayoutParams.WRAP_CONTENT);
// 设置SelectPicPopupWindow弹出窗体可点击
this.setFocusable(true);
// 设置SelectPicPopupWindow弹出窗体动画效果
this.setAnimationStyle(R.style.pop_add_ainm);
// 实例化一个ColorDrawable颜色为半透明
ColorDrawable dw = new ColorDrawable(0x66000000);
// 设置SelectPicPopupWindow弹出窗体的背景
this.setBackgroundDrawable(dw);
}
}
package com.gingersoft.gsa.cloud.ui.widget.keyboard;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.GridView;
import android.widget.RelativeLayout;
import com.gingersoft.gsa.cloud.base.R;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
/**
* @author : bin
* @create date: 2020-10-28
* @update date: 2020-10-28
* @description:
*/
public class VirtualKeyboardView extends RelativeLayout implements View.OnClickListener {
private Context context;
private GridView gridView;
private RelativeLayout layoutBack;
private ArrayList<Map<String, String>> valueList;
public VirtualKeyboardView(Context context) {
this(context, null);
}
public VirtualKeyboardView(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
View view = View.inflate(context, R.layout.layout_virtual_keyboard, null);
valueList = new ArrayList<>();
layoutBack = (RelativeLayout) view.findViewById(R.id.layoutBack);
layoutBack.setOnClickListener(this);
gridView = (GridView) view.findViewById(R.id.gv_keybord);
setView();
addView(view);
}
public RelativeLayout getLayoutBack() {
return layoutBack;
}
public ArrayList<Map<String, String>> getValueList() {
return valueList;
}
public GridView getGridView() {
return gridView;
}
private void setView() {
/* 初始化按钮上应该显示的数字 */
for (int i = 1; i < 13; i++) {
Map<String, String> map = new HashMap<String, String>();
if (i < 10) {
map.put("name", String.valueOf(i));
} else if (i == 10) {
map.put("name", ".");
} else if (i == 11) {
map.put("name", String.valueOf(0));
} else if (i == 12) {
map.put("name", "");
}
valueList.add(map);
}
KeyBoardAdapter keyBoardAdapter = new KeyBoardAdapter(context, valueList);
gridView.setAdapter(keyBoardAdapter);
}
@Override
public void onClick(View v) {
}
}
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="0dp" />
<stroke
android:width="0.66dp"
android:color="#bfbfbf" />
<solid android:color="@android:color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑入式 -->
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromYDelta="100%p"
android:toYDelta="0" />
<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"
android:duration="300" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- 上下滑入式 -->
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<translate
android:duration="300"
android:fromYDelta="0"
android:toYDelta="50%p" />
<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="300"
/>
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape>
<solid android:color="#C0C4C7" />
</shape>
</item>
<item android:state_enabled="true" android:state_pressed="false">
<shape>
<solid android:color="#F5F5F5" />
</shape>
</item>
<item android:state_enabled="true" android:state_pressed="true">
<shape>
<solid android:color="#C0C4C7" />
</shape>
</item>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
android:useLevel="false">
<solid android:color="#000000" />
<size
android:width="20dp"
android:height="20dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="0dp" />
<stroke
android:width="0.66dp"
android:color="#bfbfbf" />
<solid android:color="@android:color/white" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e0e0e0">
<TextView
android:id="@+id/btn_keys"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_60"
android:layout_centerInParent="true"
android:background="@drawable/ui_selector_item_background"
android:gravity="center"
android:includeFontPadding="false"
android:textColor="#333333"
android:textSize="@dimen/sp_26" />
<RelativeLayout
android:id="@+id/imgDelete"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_60"
android:layout_centerInParent="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/keyboard_delete_img" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- 输入键盘 -->
<GridView
android:id="@+id/gv_keybord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#bdbdbd"
android:horizontalSpacing="1px"
android:numColumns="3"
android:verticalSpacing="1px" />
<View
android:id="@+id/line"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_above="@id/gv_keybord"
android:background="#bdbdbd" />
<RelativeLayout
android:id="@+id/layoutBack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/line"
android:background="#f5f5f5"
android:padding="@dimen/dp_10">
<ImageView
android:id="@+id/imgBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@mipmap/keyboard_back_img" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_above="@id/layoutBack"
android:layout_marginTop="@dimen/dp_1"
android:background="#bdbdbd" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/loadsir_empty"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
android:textColor="#999999"
android:textSize="@dimen/load_dialog_text_size"
android:text="自定義頁面"
android:layout_marginBottom="@dimen/head_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/loadsir_empty"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
android:textColor="#999999"
android:textSize="@dimen/load_dialog_text_size"
android:text="@string/emptyView_mode_desc_double"
android:layout_marginBottom="@dimen/head_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/loadsir_network"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
android:textColor="#999999"
android:textSize="@dimen/load_dialog_text_size"
android:text="@string/emptyView_mode_desc_fail_desc"
android:layout_marginBottom="@dimen/head_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_reload"
android:layout_width="match_parent"
android:layout_height="@dimen/button_height"
android:background="@color/theme_color"
android:layout_margin="@dimen/dp_10"
android:textSize="@dimen/text_size_default"
android:textColor="@color/theme_white_color"
android:text="@string/emptyView_mode_desc_retry"
app:qmui_radius="@dimen/dp_5"
app:qmui_backgroundColor="@color/theme_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/ui_shape_rect_loading"
android:gravity="center"
android:layout_gravity="center"
android:minWidth="120dp"
android:minHeight="120dp"
android:orientation="vertical"
android:padding="10dp">
<ProgressBar
style="@style/AppTheme.Base"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tv_loading_dialog_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/ui_loading"
android:textColor="@color/theme_white_color"
android:textSize="@dimen/load_dialog_text_size" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableTop="@mipmap/loadsir_network"
android:gravity="center"
android:drawablePadding="@dimen/dp_10"
android:textColor="#999999"
android:textSize="@dimen/load_dialog_text_size"
android:text="@string/emptyView_mode_desc_timeout_desc"
android:layout_marginBottom="@dimen/head_height"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
android:id="@+id/btn_reload"
android:layout_width="match_parent"
android:layout_height="@dimen/button_height"
android:background="@color/theme_color"
android:layout_margin="@dimen/dp_10"
android:textSize="@dimen/text_size_default"
android:textColor="@color/theme_white_color"
android:text="@string/emptyView_mode_desc_retry"
app:qmui_radius="@dimen/dp_5"
app:qmui_backgroundColor="@color/theme_color"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.gingersoft.gsa.cloud.ui.widget.keyboard.PasswordView
android:id="@+id/pwd_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</FrameLayout>
\ No newline at end of file
......@@ -126,7 +126,8 @@
<!-- EmptyViewFragment 空界面展示界面 -->
<string name="emptyView_mode_title_loading">顯示Loading</string>
<string name="emptyView_mode_desc_fail_title">加載失敗</string>
<string name="emptyView_mode_desc_fail_desc">請檢測網絡是否正常連接</string>
<string name="emptyView_mode_desc_fail_desc">網絡加載失敗,請檢查網絡重試</string>
<string name="emptyView_mode_desc_timeout_desc">網絡加載超時,請檢查網絡重試</string>
<string name="emptyView_mode_desc_retry">點擊重試</string>
<string name="emptyView_mode_desc_double">未獲取到數據</string>
......@@ -141,6 +142,8 @@
<string name="response_error_request_was_redirected_to_another_page">請求被重定向到其他頁面</string>
<string name="response_error_request_logged">賬號已在其他設備登錄</string>
<string name="app_exception">很抱歉,程序出現異常,即將退出!</string>
<string name="queue_write_external_storage_permission_hint">保存失敗,請先前往設置開放存儲權限</string>
......
......@@ -89,6 +89,11 @@
<item name="android:textSize">16sp</item>
</style>
<style name="pop_add_ainm" parent="android:Animation">
<item name="android:windowEnterAnimation">@anim/push_bottom_in</item>
<item name="android:windowExitAnimation">@anim/push_bottom_out</item>
</style>
<!-- **************************QMUI 相关*******************************-->
<style name="QDtextAppearanceListItem">
......@@ -177,6 +182,17 @@
<item name="qmui_dialog_menu_item_style">@style/DialogTheme2MenuItemStyle</item>
</style>
<style name="MyEditDialogTheme" parent="QMUI.Dialog.EditContent">
<!-- <item name="qmui_dialog_wrapper_style">@style/dialog_wrapper_style_63</item>-->
<item name="qmui_dialog_title_style">@style/DialogTheme2TitleStyle</item>
<item name="qmui_dialog_action_container_style">@style/DialogTheme2ActionContainerStyle
</item>
<item name="qmui_dialog_action_style">@style/DialogTheme2ActionStyle</item>
<item name="qmui_dialog_message_content_style">@style/DialogTheme2MessageContentStyle</item>
<item name="qmui_dialog_menu_container_style">@style/DialogTheme2MenuContainerStyle</item>
<item name="qmui_dialog_menu_item_style">@style/DialogTheme2MenuItemStyle</item>
</style>
<style name="ReleaseDialogTheme" parent="MyDialogTheme2">
<!-- <item name="qmui_dialog_wrapper_style">@style/QMUI.Dialog.Wrapper</item>-->
<item name="qmui_dialog_message_content_style">@style/ReleaseMessageContentStyle</item>
......
......@@ -9,27 +9,27 @@ project.dependencies.add('api', project(':cc')) //用最新版
//project.dependencies.add('api', "com.billy.android:cc:2.1.6") //用最新版
dependencies {
if (project.name != 'base-module' && project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
if (project.name != 'base-module' && project.name != 'database-module' &&project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
api project(':base-module')
}
if (project.name != 'base-module' && project.name != 'table-base' && (project.name == 'table-module' || project.name == 'manager-module' || project.name == 'order-base')) {
if (project.name != 'base-module' && project.name != 'database-module' && project.name != 'table-base' && (project.name == 'table-module' || project.name == 'manager-module' || project.name == 'order-base')) {
api project(':table-base')
}
if (project.name != 'base-module' && project.name != 'order-base' && (project.name == 'table-module' || project.name == 'print-module' ||
if (project.name != 'base-module' && project.name != 'order-base' && project.name != 'database-module' && (project.name == 'table-module' || project.name == 'print-module' ||
project.name == 'coldchain-module'|| project.name == 'delivery_pick_module' || project.name == 'order-advance-module')) {
api project(':order-base')
}
if (project.name == 'table-module' ) {
api project(':pay-module')
}
if (project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
if (project.name != 'database-module' && project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
api project(':database-module')
}
if (project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-qmui' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
api project(':arms')
}
//
if (project.name != 'qm-qmui' && project.name != 'arms' && project.name != 'fragmentation_core' && project.name != 'qm-arch' && project.name != 'qm-skin-maker') {
// if (project.name != 'arms') {
api project(':qm-qmui')
// implementation rootProject.ext.dependencies["qmui"]
}
if (project.name != 'qm-arch' && project.name != 'qm-qmui' && project.name != 'base-module' && project.name != 'qm-skin-maker') {
api project(':qm-arch')
......@@ -37,12 +37,6 @@ dependencies {
if (project.name != 'qm-skin-maker' && project.name != 'qm-arch' && project.name != 'qm-qmui') {
api project(':qm-skin-maker')
}
// if (project.name == 'main-module') {
// api project(':updateApk')
// }
// if (project.name == 'arms') {
// api project(':fragmentation_core')
// }
implementation rootProject.ext.dependencies["retrofit-url-manager"]
annotationProcessor rootProject.ext.dependencies["butterknife-compiler"]
// annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]//依赖插件
......@@ -52,6 +46,10 @@ dependencies {
implementation 'org.jetbrains:annotations:15.0'
//日誌管理
implementation 'com.elvishew:xlog:1.6.1'
//lombok
implementation 'org.projectlombok:lombok:1.18.10'
annotationProcessor 'org.projectlombok:lombok:1.18.10'
}
//此文件是作为组件化配置的公共gradle脚本文件,在每个组件中都apply此文件,下载到工程根目录后,可以在下方添加一些自己工程中通用的配置
......
......@@ -56,6 +56,7 @@ ext {
"nineoldandroids" : "com.nineoldandroids:library:2.4.0",
"paginate" : "com.github.markomilos:paginate:0.5.1",
"vlayout" : "com.alibaba.android:vlayout:1.1.0@aar",
"loadsir" : "com.kingja.loadsir:loadsir:1.3.8",
//rx1
"rxandroid" : "io.reactivex:rxandroid:1.2.1",
......@@ -78,8 +79,9 @@ ext {
"rxpermissions2" : "com.tbruyelle.rxpermissions2:rxpermissions:0.9.5@aar",
"rxerrorhandler2" : "me.jessyan:rxerrorhandler:2.1.1",
//rxbinding
"rxbinding" : "com.jakewharton.rxbinding4:rxbinding:4.0.0",
"rxbinding2" : "com.jakewharton.rxbinding2:rxbinding:2.1.1",
//tools
"dagger2" : "com.google.dagger:dagger:${version["dagger2SdkVersion"]}",
......
ext.alwaysLib = true //虽然apply了cc-settings-2.gradle,但一直作为library编译,否则别的组件依赖此module时会报错
apply from: rootProject.file("cc-settings.gradle")
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'org.greenrobot.greendao'
android {
compileSdkVersion rootProject.ext.android["compileSdkVersion"]
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
// 避免 lint 检测出错时停止构建
lintOptions {
abortOnError false
}
defaultConfig {
minSdkVersion rootProject.ext.android["minSdkVersion"]
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
multiDexEnabled true
//配置注解处理器
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}
}
resourcePrefix "database"
buildTypes {
debug {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
minifyEnabled false
proguardFiles 'proguard.cfg'
}
release {
buildConfigField "boolean", "LOG_DEBUG", "false"
buildConfigField "boolean", "USE_CANARY", "false"
minifyEnabled false
shrinkResources false
zipAlignEnabled false
proguardFiles 'proguard.cfg'
}
}
greendao {
/**
* 版本号
*/
schemaVersion 21
/**
* greendao输出dao的数据库操作实体类文件夹(相对路径 包名+自定义路径名称,包将创建于包名的直接路径下)
*/
daoPackage 'com.gingersoft.gsa.cloud.database.greendao'
/**
* greenDao实体类包文件夹
*/
targetGenDir 'src/main/java'
generateTests false //设置为true以自动生成单元测试。
}
}
dependencies {
if (project.ext.runAsApp) {
annotationProcessor rootProject.ext.dependencies["dagger2-compiler"]
debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"]
testImplementation rootProject.ext.dependencies["canary-release"]
} else {
compileOnly rootProject.ext.dependencies["dagger2-compiler"]
compileOnly rootProject.ext.dependencies["canary-debug"]
compileOnly rootProject.ext.dependencies["canary-release"]
compileOnly rootProject.ext.dependencies["canary-release"]
}
// 數據庫
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'org.greenrobot:greendao-generator:3.2.2'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gingersoft.gsa.cloud.database" />
package com.gingersoft.gsa.cloud.database;
import android.content.Context;
import com.gingersoft.gsa.cloud.base.BuildConfig;
import com.gingersoft.gsa.cloud.database.greendao.DaoMaster;
import com.gingersoft.gsa.cloud.database.greendao.DaoSession;
import org.greenrobot.greendao.query.QueryBuilder;
......
......@@ -230,8 +230,6 @@ public class ComboItem {
public ComboItem() {
}
public boolean isSold() {
if(!TextUtils.isEmpty(currentMaxNumber) && ("售罄".equals(currentMaxNumber) || "暫停".equals(currentMaxNumber))){
return true;
......@@ -247,341 +245,140 @@ public class ComboItem {
return foodCombo;
}
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Long getComId() {
return this.comId;
}
public void setComId(Long comId) {
this.comId = comId;
}
public Long getFid() {
return this.fid;
}
public void setFid(Long fid) {
this.fid = fid;
}
public long getQty() {
return this.qty;
}
public void setQty(long qty) {
this.qty = qty;
}
public double getDiffAmt() {
return this.diffAmt;
}
public void setDiffAmt(double diffAmt) {
this.diffAmt = diffAmt;
}
public long getSeqNo() {
return this.seqNo;
}
public void setSeqNo(long seqNo) {
this.seqNo = seqNo;
}
public long getVisible() {
return this.visible;
}
public void setVisible(long visible) {
this.visible = visible;
}
public Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return this.createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return this.updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public long getConditions() {
return this.conditions;
}
public void setConditions(long conditions) {
this.conditions = conditions;
}
public long getIsRT() {
return this.isRT;
}
public void setIsRT(long isRT) {
this.isRT = isRT;
}
public byte getDeletes() {
return this.deletes;
}
public void setDeletes(byte deletes) {
this.deletes = deletes;
}
public long getPosId() {
return this.posId;
}
public void setPosId(long posId) {
this.posId = posId;
}
public long getRestaurant_id() {
return this.restaurant_id;
}
public void setRestaurant_id(long restaurant_id) {
this.restaurant_id = restaurant_id;
}
public byte getIsMainAccount() {
return this.isMainAccount;
}
public void setIsMainAccount(byte isMainAccount) {
this.isMainAccount = isMainAccount;
}
public String getPrintSeting() {
return this.printSeting;
}
public void setPrintSeting(String printSeting) {
this.printSeting = printSeting;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getName1() {
return name1;
}
public void setName1(String name1) {
this.name1 = name1;
}
public String getName2() {
return name2;
}
public void setName2(String name2) {
this.name2 = name2;
}
public long getParentId() {
return parentId;
}
public void setParentId(long parentId) {
this.parentId = parentId;
}
public int getSelectQty() {
return selectQty;
}
public void setSelectQty(int selectQty) {
this.selectQty = selectQty;
}
public String getDefmodifier() {
return defmodifier;
}
public void setDefmodifier(String defmodifier) {
this.defmodifier = defmodifier;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public long getAblediscount() {
return ablediscount;
}
public void setAblediscount(long ablediscount) {
this.ablediscount = ablediscount;
}
public int getServiceCharge() {
return serviceCharge;
}
public void setServiceCharge(int serviceCharge) {
this.serviceCharge = serviceCharge;
}
public int getAutoMode() {
return autoMode;
}
public void setAutoMode(int autoMode) {
this.autoMode = autoMode;
}
public boolean isModifier() {
return isModifier;
}
public void setModifier(boolean modifier) {
isModifier = modifier;
}
public long getInvisible() {
return invisible;
}
public void setInvisible(long invisible) {
this.invisible = invisible;
}
public String getMaxNumber() {
return maxNumber;
}
public void setMaxNumber(String maxNumber) {
this.maxNumber = maxNumber;
}
public String getCurrentMaxNumber() {
return currentMaxNumber;
}
public void setCurrentMaxNumber(String currentMaxNumber) {
this.currentMaxNumber = currentMaxNumber;
}
public int getBgColor() {
return bgColor;
}
public void setBgColor(int bgColor) {
this.bgColor = bgColor;
}
public int getFontColor() {
return fontColor;
}
public void setFontColor(int fontColor) {
this.fontColor = fontColor;
}
public Modifier getModifier() {
return modifier;
}
public void setModifier(Modifier modifier) {
this.modifier = modifier;
}
public double getPointsAdd() {
return pointsAdd;
}
public void setPointsAdd(double pointsAdd) {
this.pointsAdd = pointsAdd;
}
public long getPointsRatio() {
return pointsRatio;
}
public void setPointsRatio(long pointsRatio) {
this.pointsRatio = pointsRatio;
}
public double getPointsRedeem() {
return pointsRedeem;
}
public void setPointsRedeem(double pointsRedeem) {
this.pointsRedeem = pointsRedeem;
}
public String getFoodSummary() {
return foodSummary;
}
public void setFoodSummary(String foodSummary) {
this.foodSummary = foodSummary;
}
}
package com.gingersoft.gsa.cloud.database.bean;
import com.gingersoft.gsa.cloud.base.utils.MoneyUtil;
import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Transient;
import lombok.Data;
import org.greenrobot.greendao.annotation.Generated;
/**
* 作者:ELEGANT_BIN
* 版本:1.6.0
......@@ -21,6 +20,7 @@ import lombok.Data;
@Entity
public class Discount {
/**
* ID
*/
......@@ -129,12 +129,15 @@ public class Discount {
@Transient
private long memberId = -1;
@Generated(hash = 1938515536)
public Discount(Long id, int restaurantId, double amount, int discountValue, int type, String discountType, int status,
String remark, byte freeServiceCharge, byte managerApproval, String color, String placeOrderType, double discountCap,
double salesAmount, byte taxFree, byte exclusive, byte pause, byte additionalDiscount, byte onlyOnce,
double minBillAmount, byte pointsDeduction, byte wholeFreePoints, byte amountTypeMin, String beginTime, String endTime) {
public Discount(Long id, int restaurantId, double amount, int discountValue,
int type, String discountType, int status, String remark,
byte freeServiceCharge, byte managerApproval, String color,
String placeOrderType, double discountCap, double salesAmount,
byte taxFree, byte exclusive, byte pause, byte additionalDiscount,
byte onlyOnce, double minBillAmount, byte pointsDeduction,
byte wholeFreePoints, byte amountTypeMin, String beginTime,
String endTime) {
this.id = id;
this.restaurantId = restaurantId;
this.amount = amount;
......@@ -166,53 +169,6 @@ public class Discount {
public Discount() {
}
public long getMemberId() {
return memberId;
}
public void setMemberId(long memberId) {
this.memberId = memberId;
}
/**
* 計算折扣金額
*
* @param discount
* @param sourcePrice
* @return
*/
public static double calculationDiscount(Discount discount, double sourcePrice) {
double discountPrice;
if (discount.getType() == 0) {
//金額折扣
discountPrice = discount.getAmount();
} else {
//百分比折扣
discountPrice = MoneyUtil.divide(MoneyUtil.multiply(sourcePrice, discount.getDiscountValue()), 100).doubleValue();
}
if (sourcePrice < discountPrice) {
//折扣金額不能超出總額
discountPrice = sourcePrice;
}
// else {
// discountPrice = sourcePrice - discountPrice;
// }
return -MoneyUtil.get_ItemDecimals_money(Math.abs(discountPrice));
}
public static double calculationMemberDiscount(int discountRate, double sourcePrice) {
double discountPrice = MoneyUtil.divide(MoneyUtil.multiply(sourcePrice, discountRate), 100).doubleValue();
if (sourcePrice < discountPrice) {
//折扣金額不能超出總額
discountPrice = sourcePrice;
}
// else {
// discountPrice = sourcePrice - discountPrice;
// }
return -MoneyUtil.get_ItemDecimals_money(Math.abs(discountPrice));
}
public Long getId() {
return this.id;
}
......@@ -341,8 +297,8 @@ public class Discount {
this.exclusive = exclusive;
}
public byte getPause() {
return this.pause;
public boolean isPause() {
return pause == 1;
}
public void setPause(byte pause) {
......@@ -413,6 +369,10 @@ public class Discount {
this.endTime = endTime;
}
public byte getPause() {
return this.pause;
}
......
......@@ -2,7 +2,6 @@ package com.gingersoft.gsa.cloud.database.utils;
import android.content.Context;
import android.util.Log;
import com.gingersoft.gsa.cloud.database.DaoManager;
import com.gingersoft.gsa.cloud.database.bean.ColorBean;
import com.gingersoft.gsa.cloud.database.greendao.ColorBeanDao;
......
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