Skip to content

Commit

Permalink
Merge pull request #6 from kadbbz/dev-1.10
Browse files Browse the repository at this point in the history
Dev 1.10
  • Loading branch information
kadbbz authored May 25, 2023
2 parents df95df5 + 343d5c3 commit 743818d
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ HAC是[活字格低代码开发平台](https://www.grapecity.com.cn/solutions/hu
* 提供调用蓝牙打印机(DothanTech方案)的能力
* 提供读取NFC标签的能力
* 提供下载和预览PDF文件的能力
* 提供获取设备唯一标识(SSAID)的能力
* 适配活字格[“PDA交互命令”(插件)](https://marketplace.grapecity.com.cn/ApplicationDetails?productID=SP2209070004&productDetailID=D2209070005)[“手机扫码命令”(插件)](https://marketplace.grapecity.com.cn/ApplicationDetails?productID=SP2104270020&productDetailID=D2206270041&tabName=Tabs_detail)

## 可供Web应用调用的JavaScript接口清单
Expand Down
10 changes: 4 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ android {
//noinspection ExpiredTargetSdkVersion
targetSdk 26
versionCode 4
versionName '1.9.1-release'

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionName '1.10.0-release'
}

buildTypes {
Expand All @@ -23,8 +21,8 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
buildFeatures {
viewBinding true
Expand All @@ -42,7 +40,7 @@ dependencies {
implementation 'com.github.getActivity:XXPermissions:16.6'
//noinspection GradleDependency
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'com.google.android.material:material:1.9.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation files('libs/LPAPI-2021-02-02-R.jar')
implementation 'com.zhihu.android:matisse:0.5.3-beta3'
Expand Down
2 changes: 1 addition & 1 deletion app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"filters": [],
"attributes": [],
"versionCode": 4,
"versionName": "1.9.1-release",
"versionName": "1.10.0-release",
"outputFile": "app-release.apk"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.huozige.lab.container.platform.hzg.HZGWebInterop;
import com.huozige.lab.container.platform.AbstractStaticFilesCacheFilter;
import com.huozige.lab.container.platform.AbstractWebInterop;
import com.huozige.lab.container.proxy.DeviceInfoProxy;
import com.huozige.lab.container.proxy.DothanPrinterProxy;
import com.huozige.lab.container.proxy.LocalKvProxy;
import com.huozige.lab.container.proxy.NfcProxy;
Expand Down Expand Up @@ -103,7 +104,8 @@ protected void onCreate(Bundle savedInstanceState) {
new GeoProxy(), // 获取地理位置信息
new LocalKvProxy(), // 读写本地存储
new DothanPrinterProxy(), // 操作蓝牙打印机(DothanTech方案)
new PDFPreviewProxy()
new PDFPreviewProxy(),
new DeviceInfoProxy()
};

for (AbstractProxy br : _bridges
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class HZGCacheFilter extends AbstractStaticFilesCacheFilter {
*/
final static String[] SUPPORTED_VERSIONS = {
"8.0.6.0", // 8.0
"8.0.105.0"}; // 8.1
"8.0.105.0",// 8.1
"9.0.3.0"}; // 9.0

/**
* 执行缓存检查
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import androidx.activity.result.contract.ActivityResultContracts;

import com.huozige.lab.container.proxy.support.scanner.NfcProxy_ReadingActivity;
import com.huozige.lab.container.utilities.MiscUtilities;

/**
* 让页面能读取NFC标签
Expand Down Expand Up @@ -59,6 +60,9 @@ public void onActivityCreated() {
// 记录日志
getInterop().writeLogIntoConsole( "NFC Reading completed. Tag is : " + tag );

// 去除非ASCII字符
tag= MiscUtilities.removeNonASCIIChars(tag);

// 将结果写入单元格
getInterop().setInputValue( _cellTag, tag);
} else if(code == NfcProxy_ReadingActivity.SCAN_STATUS_NA){
Expand Down
31 changes: 17 additions & 14 deletions app/src/main/java/com/huozige/lab/container/proxy/PDAProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
import androidx.activity.result.contract.ActivityResultContracts;

import com.huozige.lab.container.proxy.support.scanner.PDAProxy_SingleScanActivity;
import com.huozige.lab.container.utilities.MiscUtilities;

/**
* 让页面具备操作扫码枪硬件的能力
* pda.modal_scan(cell): 带模态窗口的单次扫码
* pda.continuous_scan(cell): 开始持续扫码
* pda.continuous_scan_stop(): 停止持续扫码
*
*/
public class PDAProxy extends AbstractProxy {

Expand Down Expand Up @@ -62,23 +62,23 @@ public void onActivityCreated() {
String resultS = data.getStringExtra(PDAProxy_SingleScanActivity.BUNDLE_EXTRA_RESULT);

// 记录日志
getInterop().writeLogIntoConsole( "PDA scan completed. Result is : " + resultS);
getInterop().writeLogIntoConsole("PDA scan completed. Result is : " + resultS);

// 将结果写入单元格
getInterop().setInputValue( _cell, resultS);
getInterop().setInputValue(_cell, resultS);
} else {
// 记录日志
getInterop().writeLogIntoConsole( "PDA scan canceled or failed. Return code is : " + code);
getInterop().writeLogIntoConsole("PDA scan canceled or failed. Return code is : " + code);

// 重置单元格
getInterop().setInputValue( _cell, "");
getInterop().setInputValue(_cell, "");
}
} else {
// 记录日志
getInterop().writeErrorIntoConsole( "PDA scan failed.");
getInterop().writeErrorIntoConsole("PDA scan failed.");

// 重置单元格
getInterop().setInputValue( _cell, "");
getInterop().setInputValue(_cell, "");
}
});
}
Expand Down Expand Up @@ -118,6 +118,9 @@ public void onReceive(Context context, Intent intent) {

Log.v(LOG_TAG, "当次扫码结果是:" + result);

// 去除非ASCII字符
result = MiscUtilities.removeNonASCIIChars(result);

if (_continueScanOn) {

// 将当次扫描结果拼接到累计结果上,一次刷新到页面,分割符为半角逗号,与活字格的内置数组保持一致
Expand All @@ -127,7 +130,7 @@ public void onReceive(Context context, Intent intent) {
String rc = _continueScanResultCache.endsWith(",") ? _continueScanResultCache.substring(0, _continueScanResultCache.length() - 1) : _continueScanResultCache;

// 记录日志
getInterop().writeLogIntoConsole( "PDA scan (Continues Mode) result received. Current scan is : " + result + " , total result is : " + rc);
getInterop().writeLogIntoConsole("PDA scan (Continues Mode) result received. Current scan is : " + result + " , total result is : " + rc);

// 输出到界面
getInterop().setInputValue(continueScanCell, rc);
Expand All @@ -139,7 +142,7 @@ public void onReceive(Context context, Intent intent) {
stopReceiver();

// 记录日志
getInterop().writeLogIntoConsole( "PDA scan (Continues Mode)'s count reach limit, stopping the broadcast receiver.");
getInterop().writeLogIntoConsole("PDA scan (Continues Mode)'s count reach limit, stopping the broadcast receiver.");

}

Expand Down Expand Up @@ -167,7 +170,7 @@ public void modal_scan(String cellLocation) {
_arcScanner.launch(new Intent(getInterop().getActivityContext(), PDAProxy_SingleScanActivity.class));

// 记录日志
getInterop().writeLogIntoConsole( "PDA scan (Single Mode) started.");
getInterop().writeLogIntoConsole("PDA scan (Single Mode) started.");

}

Expand All @@ -180,10 +183,10 @@ public void modal_scan(String cellLocation) {
@JavascriptInterface
public void continuous_scan(String cellLocation, String limit) {

Log.v(LOG_TAG,"continuous_scan start with limit : "+limit);
Log.v(LOG_TAG, "continuous_scan start with limit : " + limit);
// 记录传入参数
continueScanCell = cellLocation;
_continueScanLimit =(null==limit || Integer.decode(limit) <= 0) ? Integer.MAX_VALUE : Integer.decode(limit); // 传入0或者复数,则不限制最大次数
_continueScanLimit = (null == limit || Integer.decode(limit) <= 0) ? Integer.MAX_VALUE : Integer.decode(limit); // 传入0或者复数,则不限制最大次数

// 重置临时变量
_continueScanOn = true;
Expand Down Expand Up @@ -219,7 +222,7 @@ private void startReceiver() {
getInterop().getActivityContext().registerReceiver(_scanReceiver, intentFilter);

// 记录日志
getInterop().writeLogIntoConsole( "PDA scan (Continues Mode) started.");
getInterop().writeLogIntoConsole("PDA scan (Continues Mode) started.");

}

Expand All @@ -234,7 +237,7 @@ private void stopReceiver() {
_continueScanOn = false;

// 记录日志
getInterop().writeLogIntoConsole( "PDA scan (Continues Mode) stopped.");
getInterop().writeLogIntoConsole("PDA scan (Continues Mode) stopped.");

}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public Boolean quickConfig(String json) {
this.upsertSettingMenuVisible(config.getString(PREFERENCE_KEY_MENU_SETTING_V).equalsIgnoreCase("1") || config.getString(PREFERENCE_KEY_MENU_SETTING_V).equalsIgnoreCase("true") || config.getString(PREFERENCE_KEY_MENU_SETTING_V).equalsIgnoreCase("yes"));
this.upsertActionBarVisible(config.getString(PREFERENCE_KEY_ACTIONBAR_V).equalsIgnoreCase("1") || config.getString(PREFERENCE_KEY_ACTIONBAR_V).equalsIgnoreCase("true") || config.getString(PREFERENCE_KEY_ACTIONBAR_V).equalsIgnoreCase("yes"));
this.upsertTCD(parseHexInteger(config.getString(PREFERENCE_KEY_TCD)));
this.upsertHA(config.getString(PREFERENCE_KEY_HA).equalsIgnoreCase("1") || config.getString(PREFERENCE_KEY_HA).equalsIgnoreCase("true") || config.getString(PREFERENCE_KEY_HA).equalsIgnoreCase("yes"));

return true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ buildscript {
}

plugins {
id 'com.android.application' version '7.4.0' apply false
id 'com.android.library' version '7.4.0' apply false
id 'com.android.application' version '8.0.1' apply false
id 'com.android.library' version '8.0.1' apply false
}

task clean(type: Delete) {
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ android.useAndroidX=true
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# ?????????? AndroidX
android.enableJetifier = true
android.enableJetifier = true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
1 change: 1 addition & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Fri Apr 28 12:07:53 CST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit 743818d

Please sign in to comment.