Commit 241f791d authored by dizi's avatar dizi

initial

parent 73e72ca4
Pipeline #308 failed with stages
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.wmdigit.wmposdemo"
minSdkVersion 22
targetSdkVersion 30
versionCode 3
versionName '1.0.2'
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
abiFilters 'armeabi-v7a', "arm64-v8a"
}
}
buildTypes {
debug{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
repositories {
flatDir {
dirs 'libs'
}
}
dataBinding{
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'net.sourceforge.jexcelapi:jxl:2.6.12'
implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.4'
implementation files('libs/WmAceKG_v1.0.59_sdk.aar')
testImplementation 'junit:junit:4.+'
def room_version = '2.3.0'
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor 'androidx.room:room-compiler:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.14.9'
// implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.github.getActivity:XXPermissions:13.2'
implementation 'com.squareup.leakcanary:leakcanary-android:2.6'
implementation 'com.elvishew:xlog:1.6.1'
}
\ No newline at end of file
# 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
# 忽略警告
-ignorewarning
# OkHttp3
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn okio.**
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wmdigit.wmposdemo">
<!-- 联网权限 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" /> <!-- 访问网络状态 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<application
android:name=".WmPosDemoApp"
android:allowBackup="true"
android:icon="@mipmap/ic_logo"
android:label="@string/app_name"
android:largeHeap="true"
android:networkSecurityConfig="@xml/network_config"
android:requestLegacyExternalStorage="true"
android:supportsRtl="true"
android:theme="@style/Theme.WmPosDemo2">
<activity android:name=".ui.RegisterActivity" />
<activity
android:name=".ui.WeighingActivity"
android:exported="true"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.CropPicActivity" /> <!-- 适配 Android 7.0 文件意图 -->
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<meta-data
android:name="ScopedStorage"
android:value="true" />
</application>
</manifest>
\ No newline at end of file
This diff is collapsed.
package com.wmdigit.wmposdemo;
import androidx.multidex.MultiDexApplication;
import com.wmdigit.wmpos.WmAceKG;
import com.wmdigit.wmposdemo.utils.DemoPrinter;
public class WmPosDemoApp extends MultiDexApplication {
private static WmPosDemoApp INSTANCE;
public static WmPosDemoApp getInstance() {
return INSTANCE;
}
@Override
public void onCreate() {
super.onCreate();
INSTANCE = this;
/**
* 在manifest添加android:largeHeap="true"
* 注意第二个参数要传false
*/
int code = WmAceKG.init(this,false,0,0.85f);
}
@Override
public void onTerminate() {
super.onTerminate();
}
}
package com.wmdigit.wmposdemo.adapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.wmdigit.wmposdemo.R;
import com.wmdigit.wmposdemo.model.bean.ApiButton;
import java.util.List;
public class ButtonAdapter extends BaseQuickAdapter<ApiButton, BaseViewHolder> {
public ButtonAdapter(int layoutResId, List<ApiButton> data) {
super(layoutResId, data);
}
@Override
protected void convert(BaseViewHolder baseViewHolder, ApiButton apiButton) {
baseViewHolder.setText(R.id.tv_interface_number, apiButton.getMethodNo());
baseViewHolder.setText(R.id.tv_interface_method, apiButton.getMethodName());
baseViewHolder.setText(R.id.tv_interface_desc, apiButton.getMethodDesc());
// 接口等级
switch (apiButton.getLevel()){
case LEVEL_ABANDON:
baseViewHolder.setText(R.id.tv_level, "废弃");
baseViewHolder.setTextColorRes(R.id.tv_level, R.color.gray);
break;
case LEVEL_IMPORTANT:
baseViewHolder.setText(R.id.tv_level, "重要");
baseViewHolder.setTextColorRes(R.id.tv_level, R.color.red);
break;
default:
baseViewHolder.setText(R.id.tv_level, "");
baseViewHolder.setTextColorRes(R.id.tv_level, R.color.gray);
break;
}
}
}
package com.wmdigit.wmposdemo.model;
public interface AiSupport {
void initPosPage();
void setCameraId();
void getCameraFrame();
void saveScaleSetting();
void getScaleSettingI();
void unBindPos();
void clearTrainedDataI();
void autoDetectI();
void setFeedBackI();
void setNoRecommendI();
void getLocalImagePathI();
void getSelfLearnI();
void imageLearnI();
void imageLearnSyncI();
void imageLearnCancelI();
void exportDataI();
void importDataI();
void startServerI();
void stopServerI();
void queryLearnedProductsI();
void queryPosByMacI();
void learnLocalVectorDataI();
void correctI();
void autoMatchProduct();
void checkSnCodeVerification();
void preLearningData();
}
package com.wmdigit.wmposdemo.model.bean;
public class ApiButton {
private String methodNo;
private String methodName;
private String methodDesc;
private ApiLevel level;
public ApiButton(String methodNo, String methodName, String methodDesc) {
this.methodNo = methodNo;
this.methodName = methodName;
this.methodDesc = methodDesc;
this.level = ApiLevel.LEVEL_NORMAL;
}
public ApiButton(String methodNo, String methodName,String methodDesc, ApiLevel level) {
this.methodNo = methodNo;
this.methodName = methodName;
this.methodDesc = methodDesc;
this.level = level;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public ApiLevel getLevel() {
return level;
}
public void setLevel(ApiLevel level) {
this.level = level;
}
public String getMethodNo() {
return methodNo;
}
public void setMethodNo(String methodNo) {
this.methodNo = methodNo;
}
public String getMethodDesc() {
return methodDesc;
}
public void setMethodDesc(String methodDesc) {
this.methodDesc = methodDesc;
}
}
package com.wmdigit.wmposdemo.model.bean;
public enum ApiLevel {
LEVEL_ABANDON(0, "废弃"),
LEVEL_NORMAL(1, "常规"),
LEVEL_IMPORTANT(2, "重要");
private int level;
private String desc;
ApiLevel(int level, String desc) {
this.level = level;
this.desc = desc;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
}
package com.wmdigit.wmposdemo.model.data;
import com.wmdigit.wmposdemo.model.bean.ApiButton;
import com.wmdigit.wmposdemo.model.bean.ApiLevel;
import java.util.ArrayList;
import java.util.List;
public class Constant {
// false-正式环境;true-测试环境 通常情况下,请用正式环境false
public static final boolean isDebug = false;
// 这三条为注册信息,调试时请更换为我们通过邮件发给你的信息,其中POS_CODE可自定义,但不要重复
public static final String SN_CODE = "C15936F9-ECBD-4DBD-8EED-FD0A83D6042A";
public static final String POS_CODE = "0022_0095";
public static final String TENANT = "demo";
// 压力测试用,PLU随机范围
public static final int RANDOM_PLU_MAX = 99999;
public static final int RANDOM_PLU_MIN = 10000;
// 功能按钮列表
public static final List<ApiButton> API_BUTTONS = new ArrayList<ApiButton>() {{
add(new ApiButton("3.2","initPos", "初始化pos"));
add(new ApiButton("3.3","setCameraId", "设置开启摄像头id"));
add(new ApiButton("3.4","getScaleBitmap", "获取全景照片"));
add(new ApiButton("3.5","saveScaleSetting", "标定秤盘并保存坐标信息"));
add(new ApiButton("3.6","getScaleSetting", "判断秤盘是否已标定"));
add(new ApiButton("3.7","setPrint", "设置打印日志",ApiLevel.LEVEL_ABANDON));
add(new ApiButton("3.8","unBindPos", "解绑POS"));
add(new ApiButton("3.9","clearTrainedData", "清除训练数据"));
add(new ApiButton("3.10","autoDetect", "商品识别",ApiLevel.LEVEL_IMPORTANT));
add(new ApiButton("3.11","setFeedBack", "命中或未命中",ApiLevel.LEVEL_IMPORTANT));
add(new ApiButton("3.12","setNoRecommend ", "不再推荐"));
add(new ApiButton("3.13","updateLearningData", "更新学习数据", ApiLevel.LEVEL_ABANDON));
add(new ApiButton("3.14","getLocalImagePath", "获取本地图片地址"));
add(new ApiButton("3.15","getSelfLearn", "根据sessionId获取学习数据"));
add(new ApiButton("3.16","imageLearn", "本地图片异步学习接口"));
add(new ApiButton("3.17","imageLearnSync", "图片同步学习接口"));
add(new ApiButton("3.18","imageLearnCancel", "图片学习任务取消"));
add(new ApiButton("3.19","exportData", "导出学习数据"));
add(new ApiButton("3.20","importData", "导入学习数据"));
add(new ApiButton("3.21","startServer", "启动局域网服务"));
add(new ApiButton("3.22","stopServer", "停止局域网服务"));
add(new ApiButton("3.23","copyProductImage", "复制商品展示图",ApiLevel.LEVEL_ABANDON));
add(new ApiButton("3.24","autoProductImage", "自动对应商品展示图",ApiLevel.LEVEL_ABANDON));
add(new ApiButton("3.25","queryLearnedProducts", "查询已经学习的商品数据"));
add(new ApiButton("3.26","queryPosByMac", "查询POS注册信息"));
add(new ApiButton("3.27","learnLocalVectorData", "学习本地特征数据"));
add(new ApiButton("3.28","correct", "纠错"));
add(new ApiButton("3.29","thumbnailsAutoMatch","商品自动配图"));
add(new ApiButton("3.30","checkSnCodeVerification","校验SN码合法性"));
add(new ApiButton("3.31","preLearning","预学习商品数据"));
}
};
}
package com.wmdigit.wmposdemo.ui;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.TextureView;
import android.view.View;
import android.widget.Toast;
import androidx.databinding.DataBindingUtil;
import com.wmdigit.wmpos.WmAceKG;
import com.wmdigit.wmpos.ai.support.AiSupportActivity;
import com.wmdigit.wmpos.bean.ScaleBitmap;
import com.wmdigit.wmpos.bean.ScaleSetting;
import com.wmdigit.wmpos.cam.support.CamSupportActivity;
import com.wmdigit.wmposdemo.R;
import com.wmdigit.wmposdemo.databinding.ActivityCropPicBinding;
import com.wmdigit.wmposdemo.view.CropView;
public class CropPicActivity extends AiSupportActivity implements View.OnClickListener {
private ActivityCropPicBinding dataBinding;
TextureView textCameraView;
@Override
public void onCreate(Bundle savedInstanceState) {
dataBinding = DataBindingUtil.setContentView(this, R.layout.activity_crop_pic);
// setContentView(R.layout.activity_crop_pic);
textCameraView = findViewById(R.id.text_camera_view);
super.onCreate(savedInstanceState);
dataBinding.tvSure.setOnClickListener(this);
dataBinding.tvCancel.setOnClickListener(this);
dataBinding.tvCrop.setOnClickListener(this);
}
@Override
public TextureView getTextureView() {
return textCameraView;
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.tv_crop:
dataBinding.rlPreview.setVisibility(View.GONE);
dataBinding.rlCrop.setVisibility(View.VISIBLE);
final ScaleBitmap clearestScaleBitmap = getScaleBitmap(false);
Bitmap raw = clearestScaleBitmap.getRaw();
dataBinding.cropImg.setImageBitmap(raw);
break;
case R.id.tv_sure:
dataBinding.cropImg.cropImage(new CropView.OnCropListener() {
@Override
public void onCropFinished(final Bitmap bitmap, final int left, final int top, final int width, final int height) {
runOnUiThread(new Runnable() {
@Override
public void run() {
ScaleSetting scaleSetting = new ScaleSetting(left, top, width, height);
int code = WmAceKG.saveScaleSetting(scaleSetting);
if (code == 0) {
Toast.makeText(CropPicActivity.this, "设置成功", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(CropPicActivity.this, WeighingActivity.class);
startActivity(intent);
finish();
} else {
Toast.makeText(CropPicActivity.this, "设置失敗,错误码:" + code, Toast.LENGTH_SHORT).show();
}
}
});
}
});
break;
case R.id.tv_cancel:
finish();
break;
}
}
}
package com.wmdigit.wmposdemo.ui;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import com.elvishew.xlog.XLog;
import com.hjq.permissions.OnPermissionCallback;
import com.hjq.permissions.Permission;
import com.hjq.permissions.XXPermissions;
import com.wmdigit.wmpos.WmAceKG;
import com.wmdigit.wmpos.utils.SPStaticUtils;
import com.wmdigit.wmposdemo.R;
import com.wmdigit.wmposdemo.databinding.ActivityMainBinding;
import com.wmdigit.wmposdemo.utils.Constant;
import java.util.List;
public class MainActivity extends AppCompatActivity {
private ActivityMainBinding binding;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_main);
checkAllPermissions(this);
binding.tvRecognition.setOnClickListener(v -> {
boolean isBind = SPStaticUtils.getBoolean(Constant.BIND, false);
if (isBind) {
boolean isScale = WmAceKG.getScaleSetting();
if (!isScale) {
toast("您还未裁剪秤盘,为您跳转至裁剪页");
Intent intent = new Intent(MainActivity.this, CropPicActivity.class);
startActivity(intent);
finish();
} else {
toast("获取秤盘信息成功,为您跳转至识别功能页");
Intent intent1 = new Intent(MainActivity.this, WeighingActivity.class);
startActivity(intent1);
}
} else {
toast("您还未给pos机绑定SN号,为您跳转至注册页");
Intent intent = new Intent(this, RegisterActivity.class);
startActivity(intent);
}
});
binding.tvRegister.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, RegisterActivity.class);
startActivity(intent);
}
});
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
@Override
protected void onDestroy() {
super.onDestroy();
}
@SuppressLint("WrongConstant")
private void checkAllPermissions(final Activity activity) {
XXPermissions.with(this)
// 申请单个权限
.permission(Permission.WRITE_EXTERNAL_STORAGE, Permission.READ_EXTERNAL_STORAGE, Permission.CAMERA)
.request(new OnPermissionCallback() {
@Override
public void onGranted(List<String> permissions, boolean all) {
if (all) {
toast("获取权限成功");
} else {
toast("获取部分权限成功,但部分权限未正常授予");
}
}
@Override
public void onDenied(List<String> permissions, boolean never) {
if (never) {
toast("被永久拒绝授权,请手动授予存储和摄像头权限");
// 如果是被永久拒绝就跳转到应用权限系统设置页面
XXPermissions.startPermissionActivity(MainActivity.this, permissions);
} else {
toast("获取存储和摄像头权限失败");
}
}
});
}
private void toast(String s) {
Toast.makeText(this, s, Toast.LENGTH_SHORT).show();
}
}
\ No newline at end of file
package com.wmdigit.wmposdemo.ui;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.databinding.DataBindingUtil;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Toast;
import com.wmdigit.wmpos.WmAceKG;
import com.wmdigit.wmpos.bean.ScaleSetting;
import com.wmdigit.wmpos.http.OnBindPosListener;
import com.wmdigit.wmpos.http.OnQueryPosRegisterInfoListener;
import com.wmdigit.wmpos.utils.LogUtils;
import com.wmdigit.wmpos.utils.SPStaticUtils;
import com.wmdigit.wmposdemo.R;
import com.wmdigit.wmposdemo.databinding.ActivityRegisterBinding;
import com.wmdigit.wmposdemo.utils.Constant;
public class RegisterActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityRegisterBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_register);
binding.btnTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
WmAceKG.queryPosByMac(new OnQueryPosRegisterInfoListener() {
@Override
public void onSuccess(String posId, String snCode, String tenant) {
Toast.makeText(RegisterActivity.this, "获取注册信息成功,已为您自动填写", Toast.LENGTH_SHORT).show();
binding.posEdit.setText(posId);
binding.posSnCode.setText(snCode);
binding.accountCompany.setText(tenant);
}
@Override
public void onFailure(int code, String message) {
Toast.makeText(RegisterActivity.this, "获取失败,返回信息:\n"+message, Toast.LENGTH_SHORT).show();
}
});
}
});
binding.tvSign.setOnClickListener(v -> {
String pos = binding.posEdit.getText().toString();
String companyCode = binding.accountCompany.getText().toString();
String snCode = binding.posSnCode.getText().toString().trim();
if (TextUtils.isEmpty(pos)) {
return;
}
if (TextUtils.isEmpty(companyCode)) {
return;
}
if (TextUtils.isEmpty(snCode)) {
return;
}
WmAceKG.initPos(pos, companyCode, snCode, new OnBindPosListener() {
@Override
public void bindFail(int code, String message) {
LogUtils.e(message);
Toast.makeText(RegisterActivity.this, "绑定失败,返回信息:\n"+message, Toast.LENGTH_SHORT).show();
}
@Override
public void bindLoading() {
Toast.makeText(RegisterActivity.this, "审核中,请联系工作人员", Toast.LENGTH_SHORT).show();
}
@Override
public void bindSuccess() {
SPStaticUtils.put(Constant.ACCOUNT, companyCode);
SPStaticUtils.put(Constant.POS_CODE, pos);
SPStaticUtils.put(Constant.SN_CODE, snCode);
SPStaticUtils.put(Constant.BIND, true);
boolean isScale = WmAceKG.getScaleSetting();
if (!isScale) {
Toast.makeText(RegisterActivity.this, "您未裁剪秤盘,为您跳转至裁剪页", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(RegisterActivity.this, CropPicActivity.class);
startActivity(intent);
finish();
} else {
Intent intent1 = new Intent(RegisterActivity.this, WeighingActivity.class);
startActivity(intent1);
}
}
});
});
}
}
\ No newline at end of file
package com.wmdigit.wmposdemo.utils;
public class Constant {
public final static String ACCOUNT = "COMPANY";
public final static String BIND = "bind";//是否绑定过
public final static String POS_CODE = "pos_code";
public final static String SN_CODE = "sn_code";
}
package com.wmdigit.wmposdemo.utils;
import android.util.Log;
import com.wmdigit.wmpos.utils.log.Printer;
public class DemoPrinter implements Printer {
private String TAG = "DemoPrinter";
@Override
public void i(String msg) {
Log.i(TAG, msg);
}
@Override
public void v(String msg) {
Log.v(TAG, msg);
}
@Override
public void d(String msg) {
Log.d(TAG, msg);
}
@Override
public void w(String msg) {
Log.w(TAG, msg);
}
@Override
public void e(String msg) {
Log.e(TAG, msg);
}
}
package com.wmdigit.wmposdemo.utils;
import android.content.Context;
import android.content.res.Configuration;
public class ScreenUtils {
public static boolean isScreenLandscape(Context context) {
Configuration mConfiguration = context.getResources().getConfiguration(); //获取设置的配置信息
int ori = mConfiguration.orientation ; //获取屏幕方向
if(ori == Configuration.ORIENTATION_LANDSCAPE){
//横屏
return true;
}else if(ori == Configuration.ORIENTATION_PORTRAIT){
//竖屏
return false;
}
return false;
}
}
package com.wmdigit.wmposdemo.utils;
import com.wmdigit.wmposdemo.WmPosDemoApp;
public final class SizeUtils {
/**
* Value of dp to value of px.
*
* @param dpValue The value of dp.
* @return value of px
*/
public static int dp2px(final float dpValue) {
final float scale = WmPosDemoApp.getInstance().getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* Value of px to value of dp.
*
* @param pxValue The value of px.
* @return value of dp
*/
public static int px2dp(final float pxValue) {
final float scale = WmPosDemoApp.getInstance().getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
/**
* Value of sp to value of px.
*
* @param spValue The value of sp.
* @return value of px
*/
public static int sp2px(final float spValue) {
final float fontScale = WmPosDemoApp.getInstance().getResources().getDisplayMetrics().scaledDensity;
return (int) (spValue * fontScale + 0.5f);
}
/**
* Value of px to value of sp.
*
* @param pxValue The value of px.
* @return value of sp
*/
public static int px2sp(final float pxValue) {
final float fontScale = WmPosDemoApp.getInstance().getResources().getDisplayMetrics().scaledDensity;
return (int) (pxValue / fontScale + 0.5f);
}
}
package com.wmdigit.wmposdemo.utils;
import java.util.concurrent.Executors;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* <p>线程池管理类</p>
*
* @time Created by 2018/6/26 17:54
*/
public class ThreadPoolManagerUtils {
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
// 核心线程数
private static final int CORE_POOL_SIZE = CPU_COUNT + 1;
// 线程池最大线程数
private static final int MAXIMUM_POOL_SIZE = CPU_COUNT * 2 + 1;
// 非核心线程闲置时超时0s
private static final long KEEP_ALIVE = 1L;
// 确保该类只有一个实例对象
private static ThreadPoolManagerUtils sInstance;
// 线程池的对象
private ThreadPoolExecutor executor;
private ThreadPoolManagerUtils() {
}
public synchronized static ThreadPoolManagerUtils getInstance() {
if (sInstance == null) {
sInstance = new ThreadPoolManagerUtils();
}
return sInstance;
}
/**
* 使用线程池,线程池中线程的创建完全是由线程池自己来维护的,我们不需要创建任何的线程
*
* @param runnable 在线程池里面运行的线程
*/
public void execute(Runnable runnable) {
if (executor == null) {
executor =
new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>(), Executors.defaultThreadFactory(),
new ThreadPoolExecutor.AbortPolicy());
}
executor.execute(runnable);// 添加任务
}
/**
* 移除指定的线程
*
* @param runnable 指定的线程
*/
public void cancel(Runnable runnable) {
if (runnable != null) {
executor.getQueue().remove(runnable);// 移除任务
}
}
}
This diff is collapsed.
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<solid android:color="@color/black"/>
</shape>
</item>
<item android:top="3dp" android:left="3dp" android:right="3dp" android:bottom="3dp">
<shape>
<solid android:color="#FFFFFF" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.wmdigit.wmposdemo.ui.MainActivity">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_h_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.30" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="50sp"
android:text="元芒i识别演示demo"
android:layout_marginBottom="20dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/gl_h_5"
android:textColor="@color/YM1"/>
<TextView
android:id="@+id/tv_recognition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/YM1"
android:padding="20dp"
android:text="识别进入"
android:layout_marginTop="20dp"
android:textColor="@color/white"
android:textSize="50sp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_register" />
<TextView
android:id="@+id/tv_register"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/YM1"
android:padding="20dp"
android:layout_marginTop="10dp"
android:text="注册"
android:textColor="@color/white"
android:gravity="center"
android:textSize="50sp"
app:layout_constraintTop_toBottomOf="@+id/gl_h_5"
app:layout_constraintEnd_toEndOf="@+id/tv_recognition"
app:layout_constraintStart_toStartOf="@+id/tv_recognition"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode= "true"
android:padding="5dp"
tools:context="com.wmdigit.wmposdemo.ui.WeighingActivity">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_h_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.20" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_h_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.40" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_h_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.60" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_h_8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.80" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_v_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.20" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_v_6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.60" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_buttons"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="@id/gl_h_6"
/>
<View
android:layout_width="wrap_content"
android:layout_height="2dp"
android:background="@color/black"
app:layout_constraintTop_toTopOf="@+id/gl_h_6"
/>
<EditText
android:id="@+id/edt_plu"
android:layout_width="160dp"
android:layout_height="wrap_content"
android:hint="请输入PLU号"
android:inputType="number"
android:textSize="22sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/gl_h_6"/>
<Button
android:id="@+id/btn_get_random"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="获取随机数"
android:textSize="22sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/edt_plu"/>
<Button
android:id="@+id/btn_pressure_test_start"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="压力测试开始"
android:textSize="22sp"
android:layout_marginTop="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_get_random"/>
<Button
android:id="@+id/btn_pressure_test_stop"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="压力测试终止"
android:textSize="22sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/btn_pressure_test_start"/>
<TextView
android:id="@+id/tv_info_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="22sp"
android:text="日志区"
android:paddingVertical="5dp"
android:scrollbars="vertical"
app:layout_constraintStart_toStartOf="@+id/gl_v_2"
app:layout_constraintTop_toTopOf="@+id/gl_h_6"
/>
<TextView
android:id="@+id/tv_info"
android:layout_width="0dp"
android:layout_height="0dp"
android:textColor="@color/black"
android:textSize="22sp"
android:background="@drawable/loginfo_backgroud"
android:scrollbars="vertical"
android:padding="5dp"
app:layout_constraintStart_toStartOf="@+id/gl_v_2"
app:layout_constraintTop_toBottomOf="@+id/tv_info_title"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/gl_v_6"
/>
<ImageView
android:id="@+id/iv_scrop"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="5dp"
android:background="@drawable/loginfo_backgroud"
app:layout_constraintStart_toEndOf="@+id/gl_v_6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tv_info"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<data>
</data>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/rl_Preview"
android:visibility="visible"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
android:id="@+id/text_camera_view"
android:layout_width="1280px"
android:layout_height="720px"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp" />
<TextView
android:id="@+id/tv_crop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp"
android:background="#ff00ff"
android:padding="20dp"
android:text="开始裁剪"
android:textColor="@color/white"
/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/rl_crop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<com.wmdigit.wmposdemo.view.CropView
android:id="@+id/crop_img"
android:layout_width="1280px"
android:layout_height="720px"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:padding="10dp"
android:layout_marginTop="20dp"
app:background_color="#66FFFFFF"
app:crop_enabled="true"
app:crop_mode="ratio_4_3"
app:frame_stroke_weight="2dp"
app:guide_color="#66FFFFFF"
app:guide_show_mode="show_always"
app:guide_stroke_weight="2dp"
app:handle_color="@android:color/white"
app:handle_show_mode="show_always"
app:handle_size="24dp"
app:handle_width="3dp"
app:initial_frame_scale="0.75"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:min_frame_size="100dp"
app:overlay_color="#AA1C1C1C"
app:touch_padding="8dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp">
<LinearLayout
android:id="@+id/ll_cancel"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#550FB9B1"
android:padding="20dp"
android:text="取消"
android:textColor="@color/white"
android:visibility="visible" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_sure"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="center">
<TextView
android:id="@+id/tv_sure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#EB3B5A"
android:padding="20dp"
android:text="确定"
android:textColor="@color/white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</FrameLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.wmdigit.wmposdemo.ui.MainActivity">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_h_5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.50" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="30sp"
android:text="元芒i识别演示demo"
android:fontFamily="sans-serif"
android:layout_marginBottom="20dp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@+id/gl_h_5"
android:textColor="@color/YM1"/>
<TextView
android:id="@+id/tv_recognition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/YM1"
android:padding="20dp"
android:text="识别进入"
android:layout_marginTop="20dp"
android:textColor="@color/white"
android:textSize="30sp"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_register" />
<TextView
android:id="@+id/tv_register"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@color/YM1"
android:padding="20dp"
android:layout_marginTop="10dp"
android:text="注册"
android:textColor="@color/white"
android:gravity="center"
android:textSize="30sp"
app:layout_constraintTop_toBottomOf="@+id/gl_h_5"
app:layout_constraintEnd_toEndOf="@+id/tv_recognition"
app:layout_constraintStart_toStartOf="@+id/tv_recognition"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
tools:context="com.wmdigit.wmposdemo.ui.RegisterActivity">
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.2" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.8" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/guideline1"
app:layout_constraintStart_toStartOf="@+id/guideline2"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="55dp"
android:gravity="center_vertical"
android:text="编号:"
android:textColor="@color/black"
android:textSize="18sp" />
<EditText
android:id="@+id/pos_edit"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@color/white"
android:gravity="center_vertical"
android:hint="@string/hint_pos"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="18sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#eeeeee" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="55dp"
android:gravity="center_vertical"
android:text="SnCode:"
android:textColor="@color/black"
android:textSize="18sp" />
<EditText
android:id="@+id/pos_sn_code"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@color/white"
android:gravity="center_vertical"
android:hint="请输入企业识别号"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="18sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#eeeeee" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="55dp"
android:gravity="center_vertical"
android:text="租户号:"
android:textColor="@color/black"
android:textSize="18sp" />
<EditText
android:id="@+id/account_company"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="@color/white"
android:gravity="center_vertical"
android:hint="请输入企业识别号"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="18sp" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="#eeeeee" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_sign"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/YM1"
android:padding="10dp"
android:text="注册pos"
android:gravity="center"
android:textColor="@color/white"
android:textSize="20sp"
/>
<Button
android:id="@+id/btn_test"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="3.26 查询POS注册信息"
android:layout_marginTop="10dp"
android:textSize="20sp"
/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
\ 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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.TestActivity">
<Button
android:id="@+id/btn_test"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="识别测试"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
<?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:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/YM1"
>
<androidx.core.widget.ContentLoadingProgressBar
android:id="@+id/progress_circular"
style="?android:attr/progressBarStyleSmall"
android:layout_width="30dp"
android:layout_height="30dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.6" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.WmPosDemo2" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="YM1">#0fB9B1</color>
<color name="YM2">#E10FB98C</color>
<color name="gray">#787878</color>
<color name="red">#F44336</color>
</resources>
\ No newline at end of file
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">WmPosDemo</string>
<string name="title_activity_check_data">CheckDataActivity</string>
<string name="prompt_email">Email</string>
<string name="prompt_password">Password</string>
<string name="action_sign_in">Sign in or register</string>
<string name="action_sign_in_short">Sign in</string>
<string name="welcome">"Welcome !"</string>
<string name="invalid_username">Not a valid username</string>
<string name="invalid_password">Password must be >5 characters</string>
<string name="login_failed">"Login failed"</string>
<string name="http_unknown_error">请求出错,未知错误</string>
<string name="http_account_error">账号异常,请重新登录</string>
<string name="http_data_explain_error">数据解析异常,请稍后</string>
<string name="http_server_out_time">服务器请求超时,请稍后再试</string>
<string name="http_network_error">请求失败,请检查网络设置</string>
<string name="http_response_error">服务器响应异常,请稍后再试</string>
<string name="http_server_error">服务器连接异常,请稍后再试</string>
<string name="http_request_cancel">请求被中断,请重试</string>
<string name="sign_in">注册</string>
<string name="hint_mac">mac地址</string>
<string name="hint_pos">请输入POS编号</string>
<string name="click_get">点击获取</string>
</resources>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true"/>
</network-security-config>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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