initial repo for android!
BIN
.gradle/6.1.1/executionHistory/executionHistory.bin
Normal file
BIN
.gradle/6.1.1/executionHistory/executionHistory.lock
Normal file
BIN
.gradle/6.1.1/fileChanges/last-build.bin
Normal file
BIN
.gradle/6.1.1/fileContent/fileContent.lock
Normal file
BIN
.gradle/6.1.1/fileHashes/fileHashes.bin
Normal file
BIN
.gradle/6.1.1/fileHashes/fileHashes.lock
Normal file
BIN
.gradle/6.1.1/fileHashes/resourceHashesCache.bin
Normal file
0
.gradle/6.1.1/gc.properties
Normal file
BIN
.gradle/6.1.1/javaCompile/classAnalysis.bin
Normal file
BIN
.gradle/6.1.1/javaCompile/jarAnalysis.bin
Normal file
BIN
.gradle/6.1.1/javaCompile/javaCompile.lock
Normal file
BIN
.gradle/6.1.1/javaCompile/taskHistory.bin
Normal file
BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock
Normal file
2
.gradle/buildOutputCleanup/cache.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
#Wed Sep 24 16:05:42 CEST 2025
|
||||
gradle.version=6.1.1
|
||||
BIN
.gradle/buildOutputCleanup/outputFiles.bin
Normal file
BIN
.gradle/checksums/checksums.lock
Normal file
BIN
.gradle/checksums/md5-checksums.bin
Normal file
BIN
.gradle/checksums/sha1-checksums.bin
Normal file
2
.gradle/config.properties
Normal file
@@ -0,0 +1,2 @@
|
||||
#Wed Sep 24 15:44:07 CEST 2025
|
||||
java.home=C\:\\Program Files\\Android\\Android Studio\\jdk-11.0.19
|
||||
0
.gradle/vcs-1/gc.properties
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
1
.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
AndroidTSPLDemo
|
||||
769
.idea/caches/deviceStreaming.xml
generated
Normal file
@@ -0,0 +1,769 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DeviceStreaming">
|
||||
<option name="deviceSelectionList">
|
||||
<list>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="Sony" />
|
||||
<option name="codename" value="A402SO" />
|
||||
<option name="id" value="A402SO" />
|
||||
<option name="manufacturer" value="Sony" />
|
||||
<option name="name" value="Xperia 10" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2520" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="27" />
|
||||
<option name="brand" value="DOCOMO" />
|
||||
<option name="codename" value="F01L" />
|
||||
<option name="id" value="F01L" />
|
||||
<option name="manufacturer" value="FUJITSU" />
|
||||
<option name="name" value="F-01L" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1280" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="OnePlus" />
|
||||
<option name="codename" value="OP535DL1" />
|
||||
<option name="id" value="OP535DL1" />
|
||||
<option name="manufacturer" value="OnePlus" />
|
||||
<option name="name" value="CPH2409" />
|
||||
<option name="screenDensity" value="401" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2412" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="OnePlus" />
|
||||
<option name="codename" value="OP5552L1" />
|
||||
<option name="id" value="OP5552L1" />
|
||||
<option name="manufacturer" value="OnePlus" />
|
||||
<option name="name" value="CPH2415" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2412" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="OnePlus" />
|
||||
<option name="codename" value="OP5552L1" />
|
||||
<option name="id" value="OP5552L1" />
|
||||
<option name="manufacturer" value="OnePlus" />
|
||||
<option name="name" value="CPH2415" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2412" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="OPPO" />
|
||||
<option name="codename" value="OP573DL1" />
|
||||
<option name="id" value="OP573DL1" />
|
||||
<option name="manufacturer" value="OPPO" />
|
||||
<option name="name" value="CPH2557" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="28" />
|
||||
<option name="brand" value="DOCOMO" />
|
||||
<option name="codename" value="SH-01L" />
|
||||
<option name="id" value="SH-01L" />
|
||||
<option name="manufacturer" value="SHARP" />
|
||||
<option name="name" value="AQUOS sense2 SH-01L" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2160" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a14m" />
|
||||
<option name="id" value="a14m" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-A145R" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2408" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a15" />
|
||||
<option name="id" value="a15" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="A15" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a15x" />
|
||||
<option name="id" value="a15x" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="A15 5G" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a16x" />
|
||||
<option name="id" value="a16x" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="A16 5G" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="a35x" />
|
||||
<option name="id" value="a35x" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="A35" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="akita" />
|
||||
<option name="id" value="akita" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 8a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="akita" />
|
||||
<option name="id" value="akita" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 8a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="arcfox" />
|
||||
<option name="id" value="arcfox" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="razr plus 2024" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="1272" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="austin" />
|
||||
<option name="id" value="austin" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g 5G (2022)" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="b0q" />
|
||||
<option name="id" value="b0q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S22 Ultra" />
|
||||
<option name="screenDensity" value="600" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="3088" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="b6q" />
|
||||
<option name="id" value="b6q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Flip 6" />
|
||||
<option name="screenDensity" value="340" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2640" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="32" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="bluejay" />
|
||||
<option name="id" value="bluejay" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 6a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="caiman" />
|
||||
<option name="id" value="caiman" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="960" />
|
||||
<option name="screenY" value="2142" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="caiman" />
|
||||
<option name="id" value="caiman" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="960" />
|
||||
<option name="screenY" value="2142" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="comet" />
|
||||
<option name="id" value="comet" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro Fold" />
|
||||
<option name="screenDensity" value="390" />
|
||||
<option name="screenX" value="2076" />
|
||||
<option name="screenY" value="2152" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="comet" />
|
||||
<option name="id" value="comet" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro Fold" />
|
||||
<option name="screenDensity" value="390" />
|
||||
<option name="screenX" value="2076" />
|
||||
<option name="screenY" value="2152" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="29" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="crownqlteue" />
|
||||
<option name="id" value="crownqlteue" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Note9" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2220" />
|
||||
<option name="screenY" value="1080" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="dm2q" />
|
||||
<option name="id" value="dm2q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="S23 Plus" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="dm3q" />
|
||||
<option name="id" value="dm3q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S23 Ultra" />
|
||||
<option name="screenDensity" value="600" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="3088" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="dubai" />
|
||||
<option name="id" value="dubai" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="edge 30" />
|
||||
<option name="screenDensity" value="405" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="e1q" />
|
||||
<option name="id" value="e1q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S24" />
|
||||
<option name="screenDensity" value="480" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="e3q" />
|
||||
<option name="id" value="e3q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S24 Ultra" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="3120" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="eos" />
|
||||
<option name="id" value="eos" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Eos" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="384" />
|
||||
<option name="screenY" value="384" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="felix" />
|
||||
<option name="id" value="felix" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Fold" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2208" />
|
||||
<option name="screenY" value="1840" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="felix" />
|
||||
<option name="id" value="felix" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Fold" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2208" />
|
||||
<option name="screenY" value="1840" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="felix_camera" />
|
||||
<option name="id" value="felix_camera" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Fold (Camera-enabled)" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="2208" />
|
||||
<option name="screenY" value="1840" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="fogona" />
|
||||
<option name="id" value="fogona" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g play - 2024" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="fogos" />
|
||||
<option name="id" value="fogos" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g34 5G" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="g0q" />
|
||||
<option name="id" value="g0q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-S906U1" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gta9pwifi" />
|
||||
<option name="id" value="gta9pwifi" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-X210" />
|
||||
<option name="screenDensity" value="240" />
|
||||
<option name="screenX" value="1200" />
|
||||
<option name="screenY" value="1920" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts7lwifi" />
|
||||
<option name="id" value="gts7lwifi" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-T870" />
|
||||
<option name="screenDensity" value="340" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts7xllite" />
|
||||
<option name="id" value="gts7xllite" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-T738U" />
|
||||
<option name="screenDensity" value="340" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts8uwifi" />
|
||||
<option name="id" value="gts8uwifi" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Tab S8 Ultra" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="1848" />
|
||||
<option name="screenY" value="2960" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts8wifi" />
|
||||
<option name="id" value="gts8wifi" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Tab S8" />
|
||||
<option name="screenDensity" value="274" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts9fe" />
|
||||
<option name="id" value="gts9fe" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Tab S9 FE 5G" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="2304" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="gts9wifi" />
|
||||
<option name="id" value="gts9wifi" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-X710" />
|
||||
<option name="screenDensity" value="340" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="husky" />
|
||||
<option name="id" value="husky" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 8 Pro" />
|
||||
<option name="screenDensity" value="390" />
|
||||
<option name="screenX" value="1008" />
|
||||
<option name="screenY" value="2244" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="30" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="java" />
|
||||
<option name="id" value="java" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="G20" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="komodo" />
|
||||
<option name="id" value="komodo" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro XL" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="1008" />
|
||||
<option name="screenY" value="2244" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="komodo" />
|
||||
<option name="id" value="komodo" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9 Pro XL" />
|
||||
<option name="screenDensity" value="360" />
|
||||
<option name="screenX" value="1008" />
|
||||
<option name="screenY" value="2244" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="lion" />
|
||||
<option name="id" value="lion" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g04" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1612" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="lynx" />
|
||||
<option name="id" value="lynx" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 7a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="lyriq" />
|
||||
<option name="id" value="lyriq" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="edge 40" />
|
||||
<option name="screenDensity" value="400" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="manaus" />
|
||||
<option name="id" value="manaus" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="edge 40 neo" />
|
||||
<option name="screenDensity" value="400" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="motorola" />
|
||||
<option name="codename" value="maui" />
|
||||
<option name="id" value="maui" />
|
||||
<option name="manufacturer" value="Motorola" />
|
||||
<option name="name" value="moto g play - 2023" />
|
||||
<option name="screenDensity" value="280" />
|
||||
<option name="screenX" value="720" />
|
||||
<option name="screenY" value="1600" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="o1q" />
|
||||
<option name="id" value="o1q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S21" />
|
||||
<option name="screenDensity" value="421" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="31" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="oriole" />
|
||||
<option name="id" value="oriole" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 6" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="pa3q" />
|
||||
<option name="id" value="pa3q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S25 Ultra" />
|
||||
<option name="screenDensity" value="600" />
|
||||
<option name="screenX" value="1440" />
|
||||
<option name="screenY" value="3120" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="panther" />
|
||||
<option name="id" value="panther" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 7" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="q5q" />
|
||||
<option name="id" value="q5q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Z Fold5" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1812" />
|
||||
<option name="screenY" value="2176" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="q6q" />
|
||||
<option name="id" value="q6q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy Z Fold6" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1856" />
|
||||
<option name="screenY" value="2160" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="30" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="r11" />
|
||||
<option name="id" value="r11" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Watch" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="384" />
|
||||
<option name="screenY" value="384" />
|
||||
<option name="type" value="WEAR_OS" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="r11q" />
|
||||
<option name="id" value="r11q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-S711U" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="30" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="redfin" />
|
||||
<option name="id" value="redfin" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 5" />
|
||||
<option name="screenDensity" value="440" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2340" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="shiba" />
|
||||
<option name="id" value="shiba" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 8" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="t2q" />
|
||||
<option name="id" value="t2q" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="Galaxy S21 Plus" />
|
||||
<option name="screenDensity" value="394" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2400" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="33" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="tangorpro" />
|
||||
<option name="id" value="tangorpro" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel Tablet" />
|
||||
<option name="screenDensity" value="320" />
|
||||
<option name="screenX" value="1600" />
|
||||
<option name="screenY" value="2560" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="tegu" />
|
||||
<option name="id" value="tegu" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9a" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2424" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="tokay" />
|
||||
<option name="id" value="tokay" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2424" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="35" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="tokay" />
|
||||
<option name="id" value="tokay" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2424" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="36" />
|
||||
<option name="brand" value="google" />
|
||||
<option name="codename" value="tokay" />
|
||||
<option name="id" value="tokay" />
|
||||
<option name="manufacturer" value="Google" />
|
||||
<option name="name" value="Pixel 9" />
|
||||
<option name="screenDensity" value="420" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2424" />
|
||||
</PersistentDeviceSelectionData>
|
||||
<PersistentDeviceSelectionData>
|
||||
<option name="api" value="34" />
|
||||
<option name="brand" value="samsung" />
|
||||
<option name="codename" value="xcover7" />
|
||||
<option name="id" value="xcover7" />
|
||||
<option name="manufacturer" value="Samsung" />
|
||||
<option name="name" value="SM-G556B" />
|
||||
<option name="screenDensity" value="450" />
|
||||
<option name="screenX" value="1080" />
|
||||
<option name="screenY" value="2408" />
|
||||
</PersistentDeviceSelectionData>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<bytecodeTargetLevel target="11" />
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/deploymentTargetSelector.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="deploymentTargetSelector">
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
</SelectionState>
|
||||
</selectionStates>
|
||||
</component>
|
||||
</project>
|
||||
22
.idea/gradle.xml
generated
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="testRunner" value="CHOOSE_PER_TEST" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/library" />
|
||||
<option value="$PROJECT_DIR$/material-spinner-1.0.5" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveExternalAnnotations" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/migrations.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectMigrations">
|
||||
<option name="MigrateToGradleLocalJavaHome">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
10
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
17
.idea/runConfigurations.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
|
||||
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
|
||||
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
BIN
app/.DS_Store
vendored
Normal file
1
app/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
65
app/build.gradle
Normal file
@@ -0,0 +1,65 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.2"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.sdk.tspl.demo"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 30
|
||||
versionCode 21050601
|
||||
versionName "TSPL Demo V1.21.01"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
includeCompileClasspath = true
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
variant.outputs.all {
|
||||
outputFileName = defaultConfig.versionName +".apk"
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
jniLibs.srcDirs = ['libs']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar", "*.aar"])
|
||||
implementation 'io.reactivex:rxjava:1.3.8'
|
||||
implementation 'io.reactivex:rxandroid:1.2.1'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0'
|
||||
implementation 'androidx.print:print:1.0.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation 'com.jakewharton:butterknife:10.0.0'
|
||||
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
|
||||
//implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.3'
|
||||
//implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.14'
|
||||
implementation 'com.github.barteksc:pdfium-android:1.5.0'
|
||||
//implementation 'com.leon:lfilepickerlibrary:1.7.0'
|
||||
}
|
||||
BIN
app/libs/BaseRecyclerViewAdapterHelper-2.9.50.aar
Normal file
BIN
app/libs/TSPL_V1.21.jar
Normal file
BIN
app/libs/arm64-v8a/libLZO.so
Normal file
BIN
app/libs/armeabi-v7a/libLZO.so
Normal file
BIN
app/libs/armeabi/libLZO.so
Normal file
BIN
app/libs/lfilepickerlibrary-1.7.0.aar
Normal file
BIN
app/libs/lzo_V1.0.jar
Normal file
BIN
app/libs/material-spinner-1.0.5.aar
Normal file
BIN
app/libs/mips/libLZO.so
Normal file
BIN
app/libs/mips64/libLZO.so
Normal file
BIN
app/libs/rxpermissions-0.9.3.aar
Normal file
BIN
app/libs/x86/libLZO.so
Normal file
BIN
app/libs/x86_64/libLZO.so
Normal file
21
app/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# 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
|
||||
BIN
app/src/.DS_Store
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
assertEquals("com.sdk.tspl.demo", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
67
app/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.sdk.tspl.demo">
|
||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
|
||||
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
||||
<uses-permission android:name="android.permission.BLUETOOTH" />
|
||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"></uses-permission>
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"></uses-permission>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-feature android:name="android.hardware.usb.host" />
|
||||
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-feature android:name = "android.hardware.camera" />
|
||||
<uses-feature android:name = "android.hardware.camera.autofocus" />
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/logo2"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity
|
||||
android:name=".Activity_Logo"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity android:name=".Activity_Main"
|
||||
android:label="@string/app_title"
|
||||
></activity>
|
||||
<activity android:name=".Activity_1DBarcodes"></activity>
|
||||
<activity android:name=".Activity_DeviceList"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity android:name=".Activity_Image_Preview"></activity>
|
||||
<activity android:name=".Activity_Print_Image"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity android:name=".Activity_PRNFile"></activity>
|
||||
<activity android:name=".Activity_Image_File"></activity>
|
||||
<activity android:name=".Activity_QRCode"></activity>
|
||||
|
||||
<activity android:name=".Activity_Setting"></activity>
|
||||
<activity android:name=".Activity_TextFormat"></activity>
|
||||
<activity android:name=".Activity_Wifi"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
<activity android:name=".Activity_Image_Print"></activity>
|
||||
<activity android:name=".BTActivity"></activity>
|
||||
<activity android:name=".Activity_Status"
|
||||
android:theme="@android:style/Theme.Dialog">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
60
app/src/main/assets/TSPL.txt
Normal file
@@ -0,0 +1,60 @@
|
||||
SIZE 100mm,170 mm
|
||||
DIRECTION 0,0
|
||||
REFERENCE 0,0
|
||||
SET PEEL OFF
|
||||
SET TEAR ON
|
||||
CLS
|
||||
|
||||
BAR 192,112,2,144
|
||||
TEXT 320,144,"0",1,24,24,"[number]"
|
||||
BAR 16,256,768,2
|
||||
|
||||
BARCODE 192,274,"128",80,1,1,3,7,"[barcode]"
|
||||
BAR 16,400,768 ,2
|
||||
|
||||
TEXT 40,424,"9",1,24,24,"寄件人:"
|
||||
TEXT 176,424,"9",1,24,24,"[sender_name] [sender_phone]"
|
||||
TEXT 176,464,"9",1,24,24,"[sender_address]"
|
||||
BAR 16,528,704,2
|
||||
|
||||
|
||||
TEXT 40,552,"9",1,24,24,"发件人:"
|
||||
TEXT 176,552,"9",1,24,24,"[receiver_name] [receiver_phone]"
|
||||
TEXT 176,600,"9",1,24,24,"[receiver_address]"
|
||||
BAR 16,656,704,2
|
||||
|
||||
TEXT 40,680,"9",1,24,24,"发件人/代收人:"
|
||||
BAR 400,656,2,144
|
||||
TEXT 424,680,"9",1,24,24,"签收时间"
|
||||
TEXT 500,740,"9",1,24,24,"年 月 日"
|
||||
|
||||
BAR 720,400,2,400
|
||||
TEXT 736,544,"9",1,24,24,"签"
|
||||
TEXT 736,580,"9",1,24,24,"收"
|
||||
TEXT 736,616,"9",1,24,24,"联"
|
||||
|
||||
BARCODE 454,824,"128",64,1,0,2,3,"[barcode]"
|
||||
|
||||
TEXT 40,936,"9",1,24,24,"寄件人:"
|
||||
TEXT 176,936,"9",1,24,24,"[sender_name] [sender_phone]"
|
||||
TEXT 176,976,"9",1,24,24,"[sender_address]"
|
||||
BAR 16,1040,704 ,2
|
||||
|
||||
TEXT 40,1064,"9",1,24,24,"发件人:"
|
||||
TEXT 176,1064,"9",1,24,24,"[receiver_name] [receiver_phone]"
|
||||
TEXT 176,1112,"9",1,24,24,"[receiver_address]"
|
||||
BAR 16,1168,768 ,2
|
||||
|
||||
BAR 720,912,2,256
|
||||
TEXT 736,988,"9",1,24,24,"收"
|
||||
TEXT 736,1024,"9",1,24,24,"件"
|
||||
TEXT 736,1060,"9",1,24,24,"联"
|
||||
|
||||
TEXT 40,1192,"9",1,24,24,"订单详情:"
|
||||
TEXT 192,1192,"9",1,24,24,"[Orderdetails1]"
|
||||
TEXT 192,1224,"9",1,24,24,"[Orderdetails2]"
|
||||
TEXT 192,1256,"9",1,24,24,"[Orderdetails3]"
|
||||
QRCODE 40,112,Q,4,M,0,"http://weixin.qq.com/r/EEhRSYbE4duercIq9x0C"
|
||||
QRCODE 680,1192,Q,4,M,0,"http://weixin.qq.com/r/EEhRSYbE4duercIq9x0C"
|
||||
BAR 592,1168,2,192
|
||||
PRINT 1,1
|
||||
201
app/src/main/java/com/sdk/tspl/demo/Activity_1DBarcodes.java
Normal file
@@ -0,0 +1,201 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import tspl.HPRTPrinterHelper;
|
||||
|
||||
|
||||
public class Activity_1DBarcodes extends Activity
|
||||
{
|
||||
private Context thisCon=null;
|
||||
private Spinner spnBarcodeType=null;
|
||||
private ArrayAdapter arrBarcodeType;
|
||||
private Spinner spnBarcodeWidth=null;
|
||||
private ArrayAdapter arrBarcodeWidth;
|
||||
private Spinner spnBarcode_readable=null;
|
||||
private Spinner spnBarcode_rotation=null;
|
||||
private Spinner spnBarcode_narrow=null;
|
||||
private ArrayAdapter arrBarcodeHRILayout;
|
||||
private ArrayAdapter arrBarcoderotation;
|
||||
private ArrayAdapter arrBarcodenarrow;
|
||||
private EditText txtBarcodeData=null;
|
||||
private EditText txtBarcodeHeight=null;
|
||||
private EditText txtBarcode_x=null;
|
||||
private EditText txtBarcode_y=null;
|
||||
|
||||
private int justification=0;
|
||||
private int BarcodeType=0;
|
||||
private int BarcodeWidth=2;
|
||||
private int Barcodereadable=0;
|
||||
private int Barcoderotation=0;
|
||||
private int Barcodenarrow=0;
|
||||
private String Barcodetype;
|
||||
private PublicAction pAct;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_1dbarcodes);
|
||||
thisCon=this.getApplicationContext();
|
||||
pAct = new PublicAction(thisCon);
|
||||
spnBarcodeType = (Spinner) findViewById(R.id.spnBarcodeType);
|
||||
//arrBarcodeType = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
String[] barcode=new String[PrinterProperty.Barcode.split(",").length-1];
|
||||
if (PrinterProperty.Barcode.contains("QRCODE")) {
|
||||
for (int i = 0; i < PrinterProperty.Barcode.split(",").length-1; i++) {
|
||||
barcode[i]=PrinterProperty.Barcode.split(",")[i];
|
||||
}
|
||||
}else {
|
||||
barcode=new String[PrinterProperty.Barcode.split(",").length];
|
||||
for (int i = 0; i < PrinterProperty.Barcode.split(",").length; i++) {
|
||||
barcode[i]=PrinterProperty.Barcode.split(",")[i];
|
||||
}
|
||||
}
|
||||
arrBarcodeType = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item,barcode);
|
||||
arrBarcodeType=ArrayAdapter.createFromResource(this, R.array.activity_1dbarcodes_barcode_type, android.R.layout.simple_spinner_item);
|
||||
arrBarcodeType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnBarcodeType.setAdapter(arrBarcodeType);
|
||||
spnBarcodeType.setOnItemSelectedListener(new OnItemSelectedBarcodeType());
|
||||
|
||||
spnBarcodeWidth = (Spinner) findViewById(R.id.spnBarcodeWidth);
|
||||
arrBarcodeWidth = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrBarcodeWidth=ArrayAdapter.createFromResource(this, R.array.activity_1dbarcodes_width, android.R.layout.simple_spinner_item);
|
||||
arrBarcodeWidth.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnBarcodeWidth.setAdapter(arrBarcodeWidth);
|
||||
spnBarcodeWidth.setOnItemSelectedListener(new OnItemSelectedBarcodeWidth());
|
||||
|
||||
spnBarcode_readable = (Spinner) findViewById(R.id.spnBarcode_readable);
|
||||
arrBarcodeHRILayout = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrBarcodeHRILayout=ArrayAdapter.createFromResource(this, R.array.activity_1dbarcodes_hri_position, android.R.layout.simple_spinner_item);
|
||||
arrBarcodeHRILayout.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnBarcode_readable.setAdapter(arrBarcodeHRILayout);
|
||||
spnBarcode_readable.setOnItemSelectedListener(new OnItemSelectedBarcodeHRILayout());
|
||||
|
||||
spnBarcode_rotation = (Spinner) findViewById(R.id.spnBarcode_rotation);
|
||||
arrBarcoderotation = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrBarcoderotation=ArrayAdapter.createFromResource(this, R.array.activity_1dbarcodes_hri_rotation, android.R.layout.simple_spinner_item);
|
||||
arrBarcoderotation.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnBarcode_rotation.setAdapter(arrBarcoderotation);
|
||||
spnBarcode_rotation.setOnItemSelectedListener(new OnItemSelectedBarcoderotation());
|
||||
|
||||
spnBarcode_narrow = (Spinner) findViewById(R.id.spnBarcode_narrow);
|
||||
arrBarcodenarrow = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrBarcodenarrow=ArrayAdapter.createFromResource(this, R.array.activity_1dbarcodes_width, android.R.layout.simple_spinner_item);
|
||||
arrBarcodenarrow.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnBarcode_narrow.setAdapter(arrBarcodenarrow);
|
||||
spnBarcode_narrow.setOnItemSelectedListener(new OnItemSelectedBarcodenarrow());
|
||||
|
||||
txtBarcodeData=(EditText)this.findViewById(R.id.txtBarcodeData);
|
||||
txtBarcodeHeight=(EditText)this.findViewById(R.id.txtBarcodeHeight);
|
||||
txtBarcode_x=(EditText)this.findViewById(R.id.txtBarcode_x);
|
||||
txtBarcode_y=(EditText)this.findViewById(R.id.txtBarcode_y);
|
||||
|
||||
}
|
||||
|
||||
private class OnItemSelectedBarcodeType implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
Barcodetype=spnBarcodeType.getSelectedItem().toString();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedBarcodeWidth implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
BarcodeWidth=arg2+2;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedBarcodeHRILayout implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
Barcodereadable=arg2;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
private class OnItemSelectedBarcoderotation implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
Barcoderotation=arg2*90;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
private class OnItemSelectedBarcodenarrow implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
Barcodenarrow=arg2+2;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void onClickPrint(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
if(txtBarcodeData.getText().toString().trim().length()==0)
|
||||
{
|
||||
Toast.makeText(thisCon, getString(R.string.activity_1dbarcodes_no_data), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if(HPRTPrinterHelper.printAreaSize("100", "80")==-1){
|
||||
Toast.makeText(thisCon,getString(R.string.activity_main_disconnected),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
HPRTPrinterHelper.CLS();
|
||||
HPRTPrinterHelper.printBarcode(txtBarcode_x.getText().toString(), txtBarcode_y.getText().toString(), Barcodetype,txtBarcodeHeight.getText().toString(), ""+Barcodereadable,""+Barcoderotation,""+Barcodenarrow,""+BarcodeWidth,txtBarcodeData.getText().toString().trim());
|
||||
HPRTPrinterHelper.Print("1", "1");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_1DBarcodes --> onClickPrint ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
312
app/src/main/java/com/sdk/tspl/demo/Activity_DeviceList.java
Normal file
@@ -0,0 +1,312 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.bluetooth.BluetoothSocket;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import tspl.HPRTPrinterHelper;
|
||||
|
||||
|
||||
public class Activity_DeviceList extends Activity {
|
||||
|
||||
public static final String TAG = "DeviceListActivity";
|
||||
public static final boolean D = true;
|
||||
// 返回 Intent的extra
|
||||
public static String EXTRA_DEVICE_ADDRESS = "device_address";
|
||||
// 成员字段
|
||||
public BluetoothAdapter mBtAdapter;
|
||||
private BluetoothDevice mmDevice;
|
||||
private BluetoothSocket mmSocket;
|
||||
private InputStream mmInStream;
|
||||
private OutputStream mmOutStream;
|
||||
private static final UUID MY_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
|
||||
|
||||
public List<String> pairedDeviceList=null;
|
||||
public List<String> newDeviceList=null;
|
||||
public ArrayAdapter<String> mPairedDevicesArrayAdapter;
|
||||
public ArrayAdapter<String> mNewDevicesArrayAdapter;
|
||||
public static String toothAddress=null;
|
||||
public static String toothName=null;
|
||||
private Context thisCon=null;
|
||||
private String strAddressList="";
|
||||
private Thread thread;
|
||||
Handler handler=new Handler(){
|
||||
public void handleMessage(Message msg) {
|
||||
progress.setVisibility(View.GONE);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("is_connected", ((msg.what==0)?"OK":"NO"));
|
||||
intent.putExtra("BTAddress", toothAddress);
|
||||
setResult(HPRTPrinterHelper.ACTIVITY_CONNECT_BT, intent);
|
||||
finish();
|
||||
};
|
||||
};
|
||||
private Message message;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
//启用窗口拓展功能,方便调用
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_devicelist);
|
||||
setResult(Activity.RESULT_CANCELED);
|
||||
progress = (ProgressBar) findViewById(R.id.progress);
|
||||
Button scanButton = (Button) findViewById(R.id.button_scan);
|
||||
scanButton.setOnClickListener(new OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
strAddressList="";
|
||||
doDiscovery();
|
||||
v.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
thisCon=this.getApplicationContext();
|
||||
|
||||
// 初始化 arryadapter 已经配对的设备和新扫描到得设备
|
||||
mPairedDevicesArrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,getPairedData());
|
||||
mNewDevicesArrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1);
|
||||
ListView pairedListView = (ListView) findViewById(R.id.paired_devices);
|
||||
ListView newDevicesListView = (ListView) findViewById(R.id.new_devices);
|
||||
pairedListView.setAdapter(mPairedDevicesArrayAdapter);
|
||||
newDevicesListView.setAdapter(mNewDevicesArrayAdapter);
|
||||
String ACTION_PAIRING_REQUEST = "android.bluetooth.device.action.PAIRING_REQUEST";
|
||||
IntentFilter intent = new IntentFilter();
|
||||
intent.addAction(BluetoothDevice.ACTION_FOUND);// 用BroadcastReceiver来取得搜索结果
|
||||
intent.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
|
||||
intent.addAction(ACTION_PAIRING_REQUEST);
|
||||
intent.addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
|
||||
intent.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
|
||||
intent.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
|
||||
registerReceiver(mReceiver, intent);
|
||||
try
|
||||
{
|
||||
pairedListView.setOnItemClickListener(mDeviceClickListener);
|
||||
newDevicesListView.setOnItemClickListener(mDeviceClickListener);
|
||||
}catch(Exception excpt)
|
||||
{
|
||||
Toast.makeText(this, thisCon.getString(R.string.activity_devicelist_get_device_err)+excpt,Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
//取得已经配对的蓝牙信息,用来加载到ListView中去
|
||||
public List<String> getPairedData()
|
||||
{
|
||||
List<String> data = new ArrayList<String>();
|
||||
//默认的蓝牙适配器
|
||||
mBtAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
// 得到当前的一个已经配对的蓝牙设备
|
||||
Set<BluetoothDevice> pairedDevices = mBtAdapter.getBondedDevices();
|
||||
ListView pairedListView = (ListView) findViewById(R.id.paired_devices);
|
||||
ListView newDevicesListView = (ListView) findViewById(R.id.new_devices);
|
||||
if (pairedDevices.size() > 0)
|
||||
{
|
||||
findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
|
||||
for (BluetoothDevice device : pairedDevices) //遍历
|
||||
{
|
||||
data.add(device.getName() + "\n" + device.getAddress());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
String noDevices = getResources().getText(R.string.activity_devicelist_none_paired).toString();
|
||||
data.add(noDevices);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy()
|
||||
{
|
||||
super.onDestroy();
|
||||
// 确认是否还需要做扫描
|
||||
if (mBtAdapter != null)
|
||||
mBtAdapter.cancelDiscovery();
|
||||
if (thread!=null) {
|
||||
Thread dummy = thread;
|
||||
thread = null;
|
||||
dummy.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动装置发现的BluetoothAdapter
|
||||
*/
|
||||
public void doDiscovery()
|
||||
{
|
||||
if (D) Log.d(TAG, "doDiscovery()");
|
||||
// 在标题中注明扫描
|
||||
setProgressBarIndeterminateVisibility(true);
|
||||
setTitle(R.string.activity_devicelist_scanning);
|
||||
// 打开子标题的新设备
|
||||
findViewById(R.id.title_new_devices).setVisibility(View.VISIBLE);
|
||||
// 若启动了扫描,关闭扫描
|
||||
if (mBtAdapter.isDiscovering()) {
|
||||
mBtAdapter.cancelDiscovery();
|
||||
}
|
||||
//扫描
|
||||
int intStartCount=0;
|
||||
while (!mBtAdapter.startDiscovery() && intStartCount<5)
|
||||
{
|
||||
Log.e("BlueTooth", "扫描尝试失败");
|
||||
intStartCount++;
|
||||
try
|
||||
{
|
||||
Thread.sleep(100);
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 给列表的中的蓝牙设备创建监听事件
|
||||
public OnItemClickListener mDeviceClickListener = new OnItemClickListener()
|
||||
{
|
||||
|
||||
|
||||
public void onItemClick(AdapterView<?> av, View v, int arg2, long arg3)
|
||||
{
|
||||
boolean hasConnected=false;
|
||||
progress.setVisibility(View.VISIBLE);
|
||||
try
|
||||
{
|
||||
if(mBtAdapter.isDiscovering())
|
||||
{
|
||||
mBtAdapter.cancelDiscovery();
|
||||
}
|
||||
|
||||
//取得蓝牙mvc地址
|
||||
String info = ((TextView) v).getText().toString();
|
||||
toothAddress = info.substring(info.length() - 17);
|
||||
if(!toothAddress.contains(":"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
thread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
try {
|
||||
int portOpen = HPRTPrinterHelper.PortOpen("Bluetooth,"+toothAddress);
|
||||
message = new Message();
|
||||
message.what=portOpen;
|
||||
handler.sendMessage(message);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
thread.start();
|
||||
// hasConnected= ConnectDevice();
|
||||
// if (hasConnected)
|
||||
// {
|
||||
// DisConnect();
|
||||
// }
|
||||
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
progress.setVisibility(View.GONE);
|
||||
e.printStackTrace();
|
||||
}
|
||||
// finally
|
||||
// {
|
||||
// finish();
|
||||
// }
|
||||
}
|
||||
};
|
||||
// 扫描完成时候,改变按钮text
|
||||
public final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
|
||||
String action = intent.getAction();
|
||||
BluetoothDevice device = null;
|
||||
// 搜索设备时,取得设备的MAC地址
|
||||
if (BluetoothDevice.ACTION_FOUND.equals(action)) {
|
||||
device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
if (device.getBondState() == BluetoothDevice.BOND_NONE)
|
||||
{
|
||||
if(device.getBluetoothClass().getMajorDeviceClass()==1536)
|
||||
{
|
||||
if(!strAddressList.contains(device.getAddress()))
|
||||
{
|
||||
Bundle b = intent.getExtras();
|
||||
String object = String.valueOf(b.get("android.bluetooth.device.extra.RSSI"));
|
||||
int valueOf = Integer.valueOf(object);
|
||||
float power=(float) ((Math.abs(valueOf)-59)/(10*2.0));
|
||||
float pow=(float) Math.pow(10,power);
|
||||
strAddressList+=device.getAddress()+",";
|
||||
DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
||||
mNewDevicesArrayAdapter.add(device.getName()+" "+decimalFormat.format(pow)+" m" + "\n" + device.getAddress());
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)){
|
||||
device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
switch (device.getBondState()) {
|
||||
case BluetoothDevice.BOND_BONDING:
|
||||
Log.d("BlueToothTestActivity", "正在配对......");
|
||||
break;
|
||||
case BluetoothDevice.BOND_BONDED:
|
||||
Log.d("BlueToothTestActivity", "完成配对");
|
||||
break;
|
||||
case BluetoothDevice.BOND_NONE:
|
||||
Log.d("BlueToothTestActivity", "取消配对");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (BluetoothAdapter.ACTION_DISCOVERY_FINISHED.equals(action))
|
||||
{
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
setTitle(R.string.activity_devicelist_select_device);
|
||||
if (mNewDevicesArrayAdapter.getCount() == 0) { }
|
||||
}
|
||||
}
|
||||
};
|
||||
private ProgressBar progress;
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
// TODO Auto-generated method stub
|
||||
super.onStop();
|
||||
if (thread!=null) {
|
||||
Thread dummy = thread;
|
||||
thread = null;
|
||||
dummy.interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
198
app/src/main/java/com/sdk/tspl/demo/Activity_Image_File.java
Normal file
@@ -0,0 +1,198 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleAdapter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Activity_Image_File extends Activity {
|
||||
private ListView listV = null;
|
||||
private List<File> list = null;
|
||||
private int a[] = {R.drawable.icon_folder,R.drawable.icon_prn,R.drawable.icon_file_image};
|
||||
private ArrayList<HashMap<String, Object>> recordItem;
|
||||
private static final String PREFS_NAME = "MyPrefsFile";
|
||||
private String FileFilterList="prn,";
|
||||
private File FolderPath;
|
||||
//private String PrePath;
|
||||
private Context thisCon;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.activity_prn_file);
|
||||
|
||||
listV = (ListView)findViewById(R.id.list);
|
||||
|
||||
Intent iFilePath = getIntent();
|
||||
FolderPath=new File(iFilePath.getStringExtra("Folder"));
|
||||
FileFilterList=iFilePath.getStringExtra("FileFilter");
|
||||
list_files();
|
||||
}
|
||||
|
||||
private void list_files()
|
||||
{
|
||||
File[] file = FolderPath.listFiles();
|
||||
fill(file);
|
||||
}
|
||||
|
||||
private void fill(File[] file)
|
||||
{
|
||||
SimpleAdapter adapter = null;
|
||||
recordItem = new ArrayList<HashMap<String, Object>>();
|
||||
list = new ArrayList<File>();
|
||||
|
||||
List<String> fDir = new ArrayList<String>();
|
||||
List<String> fDirPath = new ArrayList<String>();
|
||||
List<String> fFile = new ArrayList<String>();
|
||||
List<String> fFilePath = new ArrayList<String>();
|
||||
List<String> fAllFile = new ArrayList<String>();
|
||||
List<String> fAllFilePath = new ArrayList<String>();
|
||||
for(File f: file)
|
||||
{
|
||||
if(f.isDirectory())
|
||||
{
|
||||
if(!f.getName().substring(0,1).equals("."))
|
||||
{
|
||||
fDir.add(f.getName());
|
||||
fDirPath.add(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!f.getName().substring(0,1).equals("."))
|
||||
{
|
||||
fFile.add(f.getName());
|
||||
fFilePath.add(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(fDir,String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(fDirPath,String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(fFile,String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(fFilePath,String.CASE_INSENSITIVE_ORDER);
|
||||
for(int i=0;i<fDir.size();i++)
|
||||
{
|
||||
fAllFile.add(fDir.get(i));
|
||||
fAllFilePath.add(fDirPath.get(i));
|
||||
}
|
||||
for(int i=0;i<fFile.size();i++)
|
||||
{
|
||||
fAllFile.add(fFile.get(i));
|
||||
fAllFilePath.add(fFilePath.get(i));
|
||||
}
|
||||
|
||||
File fileTemp=null;
|
||||
int intFileType=0;
|
||||
String strFilePrefix="";
|
||||
String strFileName="";
|
||||
for(int i=0;i<fAllFile.size();i++)
|
||||
{
|
||||
fileTemp=new File(fAllFilePath.get(i));
|
||||
strFileName=fileTemp.getName();
|
||||
strFilePrefix=strFileName.substring(strFileName.lastIndexOf(".")+1);
|
||||
if (!fileTemp.isDirectory() && (!FileFilterList.equals("") && !FileFilterList.contains(strFilePrefix+",")))
|
||||
continue;
|
||||
|
||||
intFileType=Invalid(fileTemp);
|
||||
if(intFileType == -1)
|
||||
{
|
||||
list.add(fileTemp);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[0]);
|
||||
map.put("name", strFileName);
|
||||
recordItem.add(map);
|
||||
}
|
||||
if(intFileType == 0)
|
||||
{
|
||||
list.add(fileTemp);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[1]);
|
||||
map.put("name", strFileName);
|
||||
recordItem.add(map);
|
||||
}
|
||||
if(intFileType == 1)
|
||||
{
|
||||
list.add(fileTemp);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[2]);
|
||||
map.put("name", strFileName);
|
||||
recordItem.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
if(list.size()==0)
|
||||
{
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[0]);
|
||||
map.put("name", "...");
|
||||
recordItem.add(map);
|
||||
}
|
||||
|
||||
adapter = new SimpleAdapter(this, recordItem, R.layout.file_item_bar, new String[]{"picture", "name"}, new int[]{R.id.picture, R.id.text});
|
||||
listV.setAdapter(adapter);
|
||||
listV.setOnItemClickListener(new Clicker());
|
||||
}
|
||||
|
||||
//<2F>ļ<EFBFBD><C4BC><EFBFBD>չ<EFBFBD><D5B9>
|
||||
private int Invalid(File f)
|
||||
{
|
||||
String strFilePrefix="";
|
||||
String strFileName="";
|
||||
strFileName=f.getName();
|
||||
strFilePrefix=strFileName.substring(strFileName.lastIndexOf(".")+1);
|
||||
|
||||
String strType0="prn,";
|
||||
String strType1="gif,png,bmp,jpg,";
|
||||
|
||||
if(strType0.contains(strFilePrefix.toLowerCase()+","))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(strType1.contains(strFilePrefix.toLowerCase()+","))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
private class Clicker implements OnItemClickListener
|
||||
{
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
if(list.size()==0)
|
||||
finish();
|
||||
else
|
||||
{
|
||||
File file = list.get(arg2);
|
||||
if(file.isFile())
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Intent myIntent = new Intent();
|
||||
myIntent.setClass(Activity_Image_File.this, Activity_Image_File.class);
|
||||
myIntent.putExtra("Folder", file.getAbsolutePath());
|
||||
myIntent.putExtra("FileFilter", FileFilterList);
|
||||
startActivityFromChild(Activity_Image_File.this, myIntent, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
127
app/src/main/java/com/sdk/tspl/demo/Activity_Image_Preview.java
Normal file
@@ -0,0 +1,127 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
public class Activity_Image_Preview extends Activity
|
||||
{
|
||||
ImageView view;
|
||||
String ImagePath;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_image_preview);
|
||||
|
||||
view=(ImageView)this.findViewById(R.id.webPreview);
|
||||
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
startActivityForResult(intent, 1);
|
||||
}
|
||||
|
||||
public void onClickOK(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("ImagePath", ImagePath);
|
||||
setResult(10, intent);
|
||||
finish();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Print_Image --> onClickPhoto ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickCancel(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
finish();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Print_Image --> onClickPrint ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == Activity.RESULT_OK)
|
||||
{
|
||||
String sdStatus = Environment.getExternalStorageState();
|
||||
if (!sdStatus.equals(Environment.MEDIA_MOUNTED))
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Image_Preview --> onActivityResult ")).append("SD card is not avaiable/writeable right now.").toString());
|
||||
return;
|
||||
}
|
||||
new DateFormat();
|
||||
String name = DateFormat.format("yyyyMMdd_hhmmss",Calendar.getInstance(Locale.CHINA)) + ".jpg";
|
||||
Toast.makeText(this, name, Toast.LENGTH_LONG).show();
|
||||
Bundle bundle = data.getExtras();
|
||||
Bitmap bitmap = (Bitmap) bundle.get("data");//
|
||||
|
||||
FileOutputStream b = null;
|
||||
File file = new File("/sdcard/HPRTSDKSample/");
|
||||
if(!file.exists())
|
||||
file.mkdirs();//
|
||||
ImagePath = "/sdcard/HPRTSDKSample/"+name;
|
||||
|
||||
try
|
||||
{
|
||||
b = new FileOutputStream(ImagePath);
|
||||
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, b);//
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
b.flush();
|
||||
b.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
view.setImageBitmap(bitmap);//
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.e("error", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
|
||||
public class Activity_Image_Print extends Activity
|
||||
{
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_image_print);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
38
app/src/main/java/com/sdk/tspl/demo/Activity_Logo.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Window;
|
||||
|
||||
public class Activity_Logo extends Activity
|
||||
{
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.activity_logo);
|
||||
|
||||
new Thread()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
/*try
|
||||
{
|
||||
Thread.sleep((long)Integer.parseInt(Activity_Logo.this.getString(R.string.logo_show_time)));
|
||||
}
|
||||
catch (InterruptedException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}*/
|
||||
|
||||
Intent itnCall=new Intent(Activity_Logo.this,Activity_Main.class);
|
||||
startActivity(itnCall);
|
||||
finish();
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
}
|
||||
754
app/src/main/java/com/sdk/tspl/demo/Activity_Main.java
Normal file
@@ -0,0 +1,754 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.ProgressDialog;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.hardware.usb.UsbDevice;
|
||||
import android.hardware.usb.UsbInterface;
|
||||
import android.hardware.usb.UsbManager;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
import com.leon.lfilepickerlibrary.LFilePicker;
|
||||
import com.tbruyelle.rxpermissions.RxPermissions;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import rx.functions.Action1;
|
||||
import tspl.HPRTPrinterHelper;
|
||||
import tspl.IPort;
|
||||
import tspl.Print;
|
||||
import tspl.PublicFunction;
|
||||
|
||||
|
||||
public class Activity_Main extends Activity
|
||||
{
|
||||
private static final int REQUESTCODE_FROM_ACTIVITY = 1000;
|
||||
private Context thisCon=null;
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
private PublicFunction PFun=null;
|
||||
private PublicAction PAct=null;
|
||||
|
||||
private Button btnWIFI=null;
|
||||
private Button btnBT=null;
|
||||
private Button btnUSB=null;
|
||||
|
||||
private Spinner spnPrinterList=null;
|
||||
private TextView txtTips=null;
|
||||
private Button btnOpenCashDrawer=null;
|
||||
private Button btnSampleReceipt=null;
|
||||
private Button btn1DBarcodes=null;
|
||||
private Button btnQRCode=null;
|
||||
private Button btnPDF417=null;
|
||||
private Button btnCut=null;
|
||||
private Button btnPageMode=null;
|
||||
private Button btnImageManage=null;
|
||||
|
||||
private EditText edtTimes=null;
|
||||
|
||||
private ArrayAdapter arrPrinterList;
|
||||
private String ConnectType="";
|
||||
// private String PrinterName="";
|
||||
private String PortParam="";
|
||||
|
||||
private UsbManager mUsbManager=null;
|
||||
private UsbDevice device=null;
|
||||
private static final String ACTION_USB_PERMISSION = "com.HPRTSDKSample";
|
||||
private PendingIntent mPermissionIntent=null;
|
||||
private static IPort Printer=null;
|
||||
private Handler handler;
|
||||
private ProgressDialog dialog;
|
||||
private static String[] PERMISSIONS_STORAGE = {
|
||||
"android.permission.READ_EXTERNAL_STORAGE",
|
||||
"android.permission.WRITE_EXTERNAL_STORAGE" };
|
||||
private Print print;
|
||||
private ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||
private String mStatusStr="";
|
||||
private boolean isPage = true;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
setTitle(BuildConfig.VERSION_NAME);
|
||||
try{
|
||||
thisCon=this.getApplicationContext();
|
||||
initPrint();
|
||||
btnWIFI = (Button) findViewById(R.id.btnWIFI);
|
||||
btnUSB = (Button) findViewById(R.id.btnUSB);
|
||||
btnBT = (Button) findViewById(R.id.btnBT);
|
||||
|
||||
//edtTimes = (EditText) findViewById(R.id.edtTimes);
|
||||
|
||||
spnPrinterList = (Spinner) findViewById(R.id.spn_printer_list);
|
||||
txtTips = (TextView) findViewById(R.id.txtTips);
|
||||
btnSampleReceipt = (Button) findViewById(R.id.btnSampleReceipt);
|
||||
btnOpenCashDrawer = (Button) findViewById(R.id.btnOpenCashDrawer);
|
||||
btn1DBarcodes = (Button) findViewById(R.id.btn1DBarcodes);
|
||||
btnQRCode = (Button) findViewById(R.id.btnQRCode);
|
||||
btnPDF417 = (Button) findViewById(R.id.btnPDF417);
|
||||
btnCut = (Button) findViewById(R.id.btnCut);
|
||||
btnPageMode = (Button) findViewById(R.id.btnPageMode);
|
||||
btnImageManage = (Button) findViewById(R.id.btnImageManage);
|
||||
|
||||
mPermissionIntent = PendingIntent.getBroadcast(thisCon, 0, new Intent(ACTION_USB_PERMISSION), 0);
|
||||
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
|
||||
filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
|
||||
thisCon.registerReceiver(mUsbReceiver, filter);
|
||||
|
||||
IntentFilter intent = new IntentFilter();
|
||||
intent.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
|
||||
registerReceiver(mReceiver, intent);
|
||||
|
||||
PFun=new PublicFunction(thisCon);
|
||||
PAct=new PublicAction(thisCon);
|
||||
InitSetting();
|
||||
EnableBluetooth();
|
||||
handler = new Handler(){
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
// TODO Auto-generated method stub
|
||||
super.handleMessage(msg);
|
||||
if (msg.what==1) {
|
||||
Toast.makeText(thisCon, "succeed", Toast.LENGTH_SHORT).show();
|
||||
dialog.cancel();
|
||||
}else {
|
||||
Toast.makeText(thisCon, "failure",Toast.LENGTH_SHORT).show();
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_disconnected));
|
||||
dialog.cancel();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
catch (Exception e){
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> onCreate ")).append(e.getMessage()).toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void initPrint() {
|
||||
print = new Print();
|
||||
}
|
||||
|
||||
private void InitSetting(){
|
||||
String SettingValue="";
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Codepage");
|
||||
if(SettingValue.equals(""))
|
||||
PFun.WriteSharedPreferencesData("Codepage", "0,PC437(USA:Standard Europe)");
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Cut");
|
||||
if(SettingValue.equals(""))
|
||||
PFun.WriteSharedPreferencesData("Cut", "0");
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Cashdrawer");
|
||||
if(SettingValue.equals(""))
|
||||
PFun.WriteSharedPreferencesData("Cashdrawer", "0");
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Buzzer");
|
||||
if(SettingValue.equals(""))
|
||||
PFun.WriteSharedPreferencesData("Buzzer", "0");
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Feeds");
|
||||
if(SettingValue.equals(""))
|
||||
PFun.WriteSharedPreferencesData("Feeds", "0");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//EnableBluetooth
|
||||
private boolean EnableBluetooth()
|
||||
{
|
||||
boolean bRet = false;
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if(mBluetoothAdapter != null)
|
||||
{
|
||||
if(mBluetoothAdapter.isEnabled())
|
||||
return true;
|
||||
mBluetoothAdapter.enable();
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
}
|
||||
catch (InterruptedException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
if(!mBluetoothAdapter.isEnabled())
|
||||
{
|
||||
bRet = true;
|
||||
Log.d("PRTLIB", "BTO_EnableBluetooth --> Open OK");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Main --> EnableBluetooth ").append("Bluetooth Adapter is null.")).toString());
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
//call back by scan bluetooth printer
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, final Intent data)
|
||||
{
|
||||
try
|
||||
{
|
||||
String strIsConnected;
|
||||
switch(resultCode)
|
||||
{
|
||||
case RESULT_CANCELED:
|
||||
connectBT(data.getStringExtra("SelectedBDAddress"));
|
||||
case HPRTPrinterHelper.ACTIVITY_CONNECT_WIFI:
|
||||
String strIPAddress="";
|
||||
String strPort="";
|
||||
strIsConnected=data.getExtras().getString("is_connected");
|
||||
if (strIsConnected.equals("NO")){
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_scan_error));
|
||||
return;
|
||||
}
|
||||
else{
|
||||
strIPAddress=data.getExtras().getString("IPAddress");
|
||||
strPort=data.getExtras().getString("Port");
|
||||
if(strIPAddress==null || !strIPAddress.contains("."))
|
||||
return;
|
||||
// HPRTPrinter=new HPRTPrinterHelper(thisCon,spnPrinterList.getSelectedItem().toString().trim());
|
||||
if(HPRTPrinterHelper.PortOpen("WiFi,"+strIPAddress+","+strPort)!=0)
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connecterr));
|
||||
else
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connected));
|
||||
return;
|
||||
}
|
||||
case HPRTPrinterHelper.ACTIVITY_IMAGE_FILE:
|
||||
// PAct.LanguageEncode();
|
||||
dialog = new ProgressDialog(Activity_Main.this);
|
||||
dialog.setMessage("Printing.....");
|
||||
dialog.setProgress(100);
|
||||
dialog.show();
|
||||
new Thread(){
|
||||
public void run() {
|
||||
try {
|
||||
String strImageFile=data.getExtras().getString("FilePath");
|
||||
Bitmap bmp=BitmapFactory.decodeFile(strImageFile);
|
||||
int height = bmp.getHeight()/8;
|
||||
if(HPRTPrinterHelper.printAreaSize("100",""+ height)==-1){
|
||||
Toast.makeText(thisCon,getString(R.string.activity_main_disconnected),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
HPRTPrinterHelper.CLS();
|
||||
int a=HPRTPrinterHelper.printImage("0","0",strImageFile,true);
|
||||
HPRTPrinterHelper.Print("1", "1");
|
||||
if (a>0) {
|
||||
handler.sendEmptyMessage(1);
|
||||
}else {
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
}catch (Exception e) {
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
return;
|
||||
case HPRTPrinterHelper.ACTIVITY_PRNFILE:
|
||||
String strPRNFile=data.getExtras().getString("FilePath");
|
||||
HPRTPrinterHelper.PrintBinaryFile(strPRNFile);
|
||||
return;
|
||||
case RESULT_OK:
|
||||
if (requestCode == REQUESTCODE_FROM_ACTIVITY) {
|
||||
List<String> list = data.getStringArrayListExtra("paths");
|
||||
String mFilename = list.get(0);
|
||||
File file = new File(mFilename);
|
||||
if (file==null){
|
||||
Toast.makeText(thisCon,"file error",Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
selectImageModel(file);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}catch(Exception e){
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> onActivityResult ")).append(e.getMessage()).toString());
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
private void selectImageModel(File file) {
|
||||
final String[] papertype = getResources().getStringArray(R.array.print_image_model);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(Activity_Main.this);
|
||||
builder.setTitle(getResources().getString(R.string.activity_main_print_image_model))
|
||||
.setItems(papertype, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
switch(i){
|
||||
case 0:
|
||||
printPDF(file,false);
|
||||
break;
|
||||
case 1:
|
||||
printPDF(file,true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
|
||||
private void printPDF(File file,boolean model) {
|
||||
dialog = new ProgressDialog(Activity_Main.this);
|
||||
dialog.setMessage("Printing.....");
|
||||
dialog.setProgress(100);
|
||||
dialog.show();
|
||||
new Thread(){
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
try{
|
||||
List<Bitmap> bitmaps = Utility.pdfToBitmap(thisCon, file, "1", 576);
|
||||
if (bitmaps==null||bitmaps.size()==0||bitmaps.get(0)==null){
|
||||
handler.sendEmptyMessage(0);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < bitmaps.size(); i++) {
|
||||
Bitmap bitmap = bitmaps.get(i);
|
||||
HPRTPrinterHelper.printAreaSize(""+(bitmap.getWidth()/8),""+(bitmap.getHeight()/8));
|
||||
HPRTPrinterHelper.CLS();
|
||||
HPRTPrinterHelper.printImage("0","0",bitmap,true,model);
|
||||
if(HPRTPrinterHelper.Print("1","1")!=-1){
|
||||
handler.sendEmptyMessage(1);
|
||||
}else{
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
handler.sendEmptyMessage(0);
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
private void connectBT(String selectedBDAddress) {
|
||||
if (TextUtils.isEmpty(selectedBDAddress))
|
||||
return;
|
||||
final ProgressDialog progressDialog = new ProgressDialog(Activity_Main.this);
|
||||
progressDialog.setMessage(getString(R.string.activity_devicelist_connect));
|
||||
progressDialog.show();
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
super.run();
|
||||
try {
|
||||
final int result = HPRTPrinterHelper.PortOpen("Bluetooth,"+selectedBDAddress);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (result==0)
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connected));
|
||||
else
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connecterr)+result);
|
||||
}
|
||||
});
|
||||
progressDialog.dismiss();
|
||||
} catch (Exception e) {
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public void onClickConnect(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try{
|
||||
HPRTPrinterHelper.PortClose();
|
||||
if(view.getId()==R.id.btnBT){
|
||||
RxPermissions rxPermissions = new RxPermissions(this);
|
||||
rxPermissions.request(Manifest.permission.BLUETOOTH_ADMIN,
|
||||
Manifest.permission.BLUETOOTH,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION).subscribe(new Action1<Boolean>() {
|
||||
@Override
|
||||
public void call(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
Log.d("Print", "call: ");
|
||||
ConnectType="Bluetooth";
|
||||
Intent intent = new Intent(thisCon,BTActivity.class);
|
||||
intent.putExtra("TAG", 0);
|
||||
startActivityForResult(intent, 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(view.getId()==R.id.btnWIFI) {
|
||||
ConnectType="WiFi";
|
||||
Intent serverIntent = new Intent(thisCon,Activity_Wifi.class);
|
||||
startActivityForResult(serverIntent, HPRTPrinterHelper.ACTIVITY_CONNECT_WIFI);
|
||||
return;
|
||||
}
|
||||
else if(view.getId()==R.id.btnUSB) {
|
||||
ConnectType="USB";
|
||||
//USB not need call "iniPort"
|
||||
mUsbManager = (UsbManager) thisCon.getSystemService(Context.USB_SERVICE);
|
||||
HashMap<String, UsbDevice> deviceList = mUsbManager.getDeviceList();
|
||||
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
|
||||
boolean HavePrinter=false;
|
||||
while(deviceIterator.hasNext()){
|
||||
device = deviceIterator.next();
|
||||
int count = device.getInterfaceCount();
|
||||
for (int i = 0; i < count; i++){
|
||||
UsbInterface intf = device.getInterface(i);
|
||||
if (intf.getInterfaceClass() == 7){
|
||||
HavePrinter=true;
|
||||
mUsbManager.requestPermission(device, mPermissionIntent);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!HavePrinter)
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connect_usb_printer));
|
||||
}
|
||||
}catch (Exception e){
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> onClickConnect "+ConnectType)).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
private BroadcastReceiver mUsbReceiver = new BroadcastReceiver()
|
||||
{
|
||||
public void onReceive(Context context, Intent intent)
|
||||
{
|
||||
try{
|
||||
String action = intent.getAction();
|
||||
if (ACTION_USB_PERMISSION.equals(action)){
|
||||
synchronized (this){
|
||||
device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
|
||||
if (intent.getBooleanExtra(UsbManager.EXTRA_PERMISSION_GRANTED, false)){
|
||||
if(HPRTPrinterHelper.PortOpen(thisCon,device)!=0){
|
||||
// HPRTPrinter=null;
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connecterr));
|
||||
return;
|
||||
}else
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connected));
|
||||
|
||||
}else{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (UsbManager.ACTION_USB_DEVICE_DETACHED.equals(action)){
|
||||
device = (UsbDevice)intent.getParcelableExtra(UsbManager.EXTRA_DEVICE);
|
||||
if (device != null){
|
||||
int count = device.getInterfaceCount();
|
||||
for (int i = 0; i < count; i++){
|
||||
UsbInterface intf = device.getInterface(i);
|
||||
//Class ID 7代表打印机
|
||||
if (intf.getInterfaceClass() == 7){
|
||||
HPRTPrinterHelper.PortClose();
|
||||
txtTips.setText(R.string.activity_main_tips);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> mUsbReceiver ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void onClickClose(View view){
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try{
|
||||
HPRTPrinterHelper.PortClose();
|
||||
this.txtTips.setText(R.string.activity_main_tips);
|
||||
return;
|
||||
}catch (Exception e){
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> onClickClose ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickbtnSetting(View view){
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try{
|
||||
startActivity(new Intent(Activity_Main.this, Activity_Setting.class));
|
||||
}
|
||||
catch (Exception e){
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> onClickClose ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickDo(View view){
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
if(!HPRTPrinterHelper.IsOpened()){
|
||||
Toast.makeText(thisCon, thisCon.getText(R.string.activity_main_tips), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
if(view.getId()==R.id.btnGetStatus){
|
||||
Intent myIntent = new Intent(this, Activity_Status.class);
|
||||
myIntent.putExtra("StatusMode", PrinterProperty.StatusMode);
|
||||
startActivityFromChild(this, myIntent, 0);
|
||||
}
|
||||
else if(view.getId()==R.id.btnSampleReceipt){
|
||||
PrintSampleReceipt();
|
||||
}
|
||||
else if(view.getId()==R.id.btn1DBarcodes){
|
||||
Intent myIntent = new Intent(this, Activity_1DBarcodes.class);
|
||||
startActivityFromChild(this, myIntent, 0);
|
||||
}
|
||||
else if(view.getId()==R.id.btnTextFormat){
|
||||
Intent myIntent = new Intent(this, Activity_TextFormat.class);
|
||||
startActivityFromChild(this, myIntent, 0);
|
||||
}
|
||||
else if(view.getId()==R.id.btnPrintImageFile){
|
||||
Utility.checkBlueboothPermission(Activity_Main.this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE, PERMISSIONS_STORAGE, new Utility.Callback() {
|
||||
@Override
|
||||
public void permit() {
|
||||
Intent myIntent = new Intent(Activity_Main.this, Activity_PRNFile.class);
|
||||
myIntent.putExtra("Folder", android.os.Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
myIntent.putExtra("FileFilter", "jpg,gif,png,bmp,");
|
||||
startActivityForResult(myIntent, HPRTPrinterHelper.ACTIVITY_IMAGE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pass() {
|
||||
Intent myIntent = new Intent(Activity_Main.this, Activity_PRNFile.class);
|
||||
myIntent.putExtra("Folder", android.os.Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
myIntent.putExtra("FileFilter", "jpg,gif,png,bmp,");
|
||||
startActivityForResult(myIntent, HPRTPrinterHelper.ACTIVITY_IMAGE_FILE);
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(view.getId()==R.id.btnPrintPRNFile){
|
||||
Intent myIntent = new Intent(this, Activity_PRNFile.class);
|
||||
myIntent.putExtra("Folder", android.os.Environment.getExternalStorageDirectory().getAbsolutePath());
|
||||
myIntent.putExtra("FileFilter", "prn,");
|
||||
startActivityForResult(myIntent, HPRTPrinterHelper.ACTIVITY_PRNFILE);
|
||||
}
|
||||
else if(view.getId()==R.id.btnQRCode){
|
||||
Intent myIntent = new Intent(this, Activity_QRCode.class);
|
||||
startActivityFromChild(this, myIntent, 0);
|
||||
}
|
||||
else if(view.getId()==R.id.btnPrintTestPage){
|
||||
try {
|
||||
HPRTPrinterHelper.SelfTest();
|
||||
} catch (Exception e) {
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> onClickWIFI ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}else if(view.getId()==R.id.btnPrintStatus){
|
||||
getPrintStatus();
|
||||
}else if(view.getId()==R.id.btnPrintBlock){
|
||||
printBlock();
|
||||
}else if(view.getId()==R.id.btn_print_pdf){
|
||||
RxPermissions rxPermissions = new RxPermissions(this);
|
||||
rxPermissions.request(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.MANAGE_EXTERNAL_STORAGE).subscribe(new Action1<Boolean>() {
|
||||
@Override
|
||||
public void call(Boolean aBoolean) {
|
||||
if (aBoolean)
|
||||
printPDF();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void printPDF() {
|
||||
new LFilePicker()
|
||||
.withActivity(this)
|
||||
.withRequestCode(REQUESTCODE_FROM_ACTIVITY)
|
||||
.withStartPath(Environment.getExternalStorageDirectory().getAbsolutePath())
|
||||
.withTitle(getResources().getString(R.string.activity_esc_function_btnpagemode))
|
||||
.withMutilyMode(false)
|
||||
.withBackgroundColor("#000000")
|
||||
.withTitleColor("#ffffff")
|
||||
.withFileFilter(new String[]{".PDF", ".pdf"})
|
||||
.start();
|
||||
}
|
||||
|
||||
private void printBlock() {
|
||||
try{
|
||||
HPRTPrinterHelper.printAreaSize("100","100");
|
||||
HPRTPrinterHelper.CLS();
|
||||
HPRTPrinterHelper.printBlock(0,0,200,100,0,0,2,2,16,2,"TestTestTestTest");
|
||||
HPRTPrinterHelper.Print("1","1");
|
||||
}catch (Exception e){}
|
||||
}
|
||||
|
||||
private void getPrintStatus(){
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try{
|
||||
int printerStatus = HPRTPrinterHelper.getPrinterStatus();
|
||||
switch(printerStatus){
|
||||
case HPRTPrinterHelper.STATUS_DISCONNECT:
|
||||
mStatusStr=getString(R.string.status_disconnect);
|
||||
break;
|
||||
case HPRTPrinterHelper.STATUS_TIMEOUT:
|
||||
mStatusStr=getString(R.string.status_timeout);
|
||||
break;
|
||||
case HPRTPrinterHelper.STATUS_OK:
|
||||
mStatusStr=getString(R.string.status_ok);
|
||||
break;
|
||||
case HPRTPrinterHelper.STATUS_COVER_OPENED:
|
||||
mStatusStr=getString(R.string.status_cover_opened);
|
||||
break;
|
||||
case HPRTPrinterHelper.STATUS_NOPAPER:
|
||||
mStatusStr=getString(R.string.status_nopaper);
|
||||
break;
|
||||
case HPRTPrinterHelper.STATUS_OVER_HEATING:
|
||||
mStatusStr=getString(R.string.status_over_heating);
|
||||
break;
|
||||
case HPRTPrinterHelper.STATUS_PRINTING:
|
||||
mStatusStr=getString(R.string.status_printing);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(thisCon,mStatusStr,Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
}catch (Exception e){}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void PrintSampleReceipt(){
|
||||
try{
|
||||
if(HPRTPrinterHelper.printAreaSize("100", "100")==-1){
|
||||
Log.d("Print", "PrintSampleReceipt: Write == -1");
|
||||
Toast.makeText(thisCon,thisCon.getString(R.string.activity_main_disconnected),Toast.LENGTH_SHORT).show();
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_disconnected));
|
||||
return;
|
||||
}
|
||||
HPRTPrinterHelper.CLS();
|
||||
String[] ReceiptLines = getResources().getStringArray(R.array.activity_main_sample_2inch_receipt);
|
||||
for(int i=0;i<ReceiptLines.length;i++){
|
||||
HPRTPrinterHelper.printText("50", ""+(i*30), "9", "0", 2, ReceiptLines[i]);
|
||||
}
|
||||
HPRTPrinterHelper.printQRcode("10", "640", "M", "5", "M1", "0", "123ABC");
|
||||
HPRTPrinterHelper.printQRcode("200", "640", "M", "5", "M1", "0", "123ABC");
|
||||
HPRTPrinterHelper.Print("1", "1");
|
||||
|
||||
}
|
||||
catch(Exception e){
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> PrintSampleReceipt ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void printmodel(View view) {
|
||||
// TODO Auto-generated method stub
|
||||
try
|
||||
{
|
||||
HashMap<String, String> pum=new HashMap<String, String>();
|
||||
pum.put("[number]", "021D-123-789");
|
||||
pum.put("[barcode]", "AFC7150124715012424");
|
||||
pum.put("[receiver_name]", "齐齐哈尔木鱼");
|
||||
pum.put("[receiver_phone]", "15605883677 0571-53992320");
|
||||
pum.put("[receiver_address]", "黑龙江齐齐哈尔市建华区文化大街42号齐齐哈尔大学计算机工程学院001班");
|
||||
pum.put("[sender_name]", "浙江杭州行者");//收件人地址第一行
|
||||
pum.put("[sender_phone]", "18000989090 0571-53992320");//收件人第二行(若是没有,赋值"")
|
||||
pum.put("[sender_address]", "浙江省杭州市余杭区文一西路1001号阿里巴巴淘宝城5号办公楼5号小邮局");//收件人第三行(若是没有,赋值"")
|
||||
pum.put("[Orderdetails1]", "我是厦门高崎路飞机场金砖回忆");
|
||||
pum.put("[Orderdetails2]", "Orderdetails2");
|
||||
pum.put("[Orderdetails3]", "Orderdetails3");//寄件人地址第一行
|
||||
Set<String> keySet = pum.keySet();
|
||||
Iterator<String> iterator = keySet.iterator();
|
||||
InputStream afis =this.getResources().getAssets().open("TSPL.txt");//打印模版放在assets文件夹里
|
||||
String path = new String(InputStreamToByte(afis ),"utf-8");//打印模版以utf-8无bom格式保存
|
||||
while (iterator.hasNext()) {
|
||||
String string = (String)iterator.next();
|
||||
path = path.replace(string, pum.get(string));
|
||||
}
|
||||
if(HPRTPrinterHelper.PrintData(path)==-1){
|
||||
Toast.makeText(thisCon,thisCon.getString(R.string.activity_main_disconnected),Toast.LENGTH_SHORT).show();
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_disconnected));
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("Activity_Main --> printmodel ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
private byte[] InputStreamToByte(InputStream is) throws IOException {
|
||||
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
|
||||
int ch;
|
||||
while ((ch = is.read()) != -1) {
|
||||
bytestream.write(ch);
|
||||
}
|
||||
byte imgdata[] = bytestream.toByteArray();
|
||||
bytestream.close();
|
||||
return imgdata;
|
||||
}
|
||||
public final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
if(BluetoothDevice.ACTION_ACL_DISCONNECTED.equals(action)){
|
||||
try {
|
||||
HPRTPrinterHelper.PortClose();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
txtTips.setText(R.string.activity_main_tips);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
try {
|
||||
HPRTPrinterHelper.PortClose();
|
||||
if (mUsbReceiver!=null){
|
||||
unregisterReceiver(mUsbReceiver);
|
||||
}
|
||||
if (mReceiver!=null){
|
||||
unregisterReceiver(mReceiver);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
229
app/src/main/java/com/sdk/tspl/demo/Activity_PRNFile.java
Normal file
@@ -0,0 +1,229 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SimpleAdapter;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import tspl.HPRTPrinterHelper;
|
||||
|
||||
|
||||
public class Activity_PRNFile extends Activity
|
||||
{
|
||||
private ListView listV = null;
|
||||
private List<File> list = null;
|
||||
private int a[] = {R.drawable.icon_folder,R.drawable.icon_prn,R.drawable.icon_file_image};
|
||||
private ArrayList<HashMap<String, Object>> recordItem;
|
||||
private static final String PREFS_NAME = "MyPrefsFile";
|
||||
private String FileFilterList="prn,";
|
||||
private File FolderPath;
|
||||
private Context thisCon;
|
||||
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
setContentView(R.layout.activity_prn_file);
|
||||
|
||||
listV = (ListView)findViewById(R.id.list);
|
||||
|
||||
Intent iFilePath = getIntent();
|
||||
FolderPath=new File(iFilePath.getStringExtra("Folder"));
|
||||
FileFilterList=iFilePath.getStringExtra("FileFilter");
|
||||
list_files();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
try
|
||||
{
|
||||
switch(resultCode)
|
||||
{
|
||||
case HPRTPrinterHelper.ACTIVITY_IMAGE_FILE:
|
||||
setResult(HPRTPrinterHelper.ACTIVITY_IMAGE_FILE, data);
|
||||
this.finish();
|
||||
case HPRTPrinterHelper.ACTIVITY_PRNFILE:
|
||||
setResult(HPRTPrinterHelper.ACTIVITY_PRNFILE, data);
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_PRNFile --> onActivityResult ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void list_files()
|
||||
{
|
||||
File[] file = FolderPath.listFiles();
|
||||
fill(file);
|
||||
}
|
||||
|
||||
private void fill(File[] file)
|
||||
{
|
||||
SimpleAdapter adapter = null;
|
||||
recordItem = new ArrayList<HashMap<String, Object>>();
|
||||
list = new ArrayList<File>();
|
||||
|
||||
List<String> fDir = new ArrayList<String>();
|
||||
List<String> fDirPath = new ArrayList<String>();
|
||||
List<String> fFile = new ArrayList<String>();
|
||||
List<String> fFilePath = new ArrayList<String>();
|
||||
List<String> fAllFile = new ArrayList<String>();
|
||||
List<String> fAllFilePath = new ArrayList<String>();
|
||||
for(File f: file)
|
||||
{
|
||||
if(f.isDirectory())
|
||||
{
|
||||
if(!f.getName().substring(0,1).equals("."))
|
||||
{
|
||||
fDir.add(f.getName());
|
||||
fDirPath.add(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!f.getName().substring(0,1).equals("."))
|
||||
{
|
||||
fFile.add(f.getName());
|
||||
fFilePath.add(f.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(fDir,String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(fDirPath,String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(fFile,String.CASE_INSENSITIVE_ORDER);
|
||||
Collections.sort(fFilePath,String.CASE_INSENSITIVE_ORDER);
|
||||
for(int i=0;i<fDir.size();i++)
|
||||
{
|
||||
fAllFile.add(fDir.get(i));
|
||||
fAllFilePath.add(fDirPath.get(i));
|
||||
}
|
||||
for(int i=0;i<fFile.size();i++)
|
||||
{
|
||||
fAllFile.add(fFile.get(i));
|
||||
fAllFilePath.add(fFilePath.get(i));
|
||||
}
|
||||
|
||||
File fileTemp=null;
|
||||
int intFileType=0;
|
||||
String strFilePrefix="";
|
||||
String strFileName="";
|
||||
for(int i=0;i<fAllFile.size();i++)
|
||||
{
|
||||
fileTemp=new File(fAllFilePath.get(i));
|
||||
strFileName=fileTemp.getName();
|
||||
strFilePrefix=strFileName.substring(strFileName.lastIndexOf(".")+1);
|
||||
if (!fileTemp.isDirectory() && (!FileFilterList.equals("") && !FileFilterList.contains(strFilePrefix+",")))
|
||||
continue;
|
||||
|
||||
intFileType=Invalid(fileTemp);
|
||||
if(intFileType == -1)
|
||||
{
|
||||
list.add(fileTemp);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[0]);
|
||||
map.put("name", strFileName);
|
||||
recordItem.add(map);
|
||||
}
|
||||
if(intFileType == 0)
|
||||
{
|
||||
list.add(fileTemp);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[1]);
|
||||
map.put("name", strFileName);
|
||||
recordItem.add(map);
|
||||
}
|
||||
if(intFileType == 1)
|
||||
{
|
||||
list.add(fileTemp);
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[2]);
|
||||
map.put("name", strFileName);
|
||||
recordItem.add(map);
|
||||
}
|
||||
}
|
||||
|
||||
if(list.size()==0)
|
||||
{
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("picture", a[0]);
|
||||
map.put("name", "...");
|
||||
recordItem.add(map);
|
||||
}
|
||||
|
||||
adapter = new SimpleAdapter(this, recordItem, R.layout.file_item_bar, new String[]{"picture", "name"}, new int[]{R.id.picture, R.id.text});
|
||||
listV.setAdapter(adapter);
|
||||
listV.setOnItemClickListener(new Clicker());
|
||||
}
|
||||
|
||||
private int Invalid(File f)
|
||||
{
|
||||
String strFilePrefix="";
|
||||
String strFileName="";
|
||||
strFileName=f.getName();
|
||||
strFilePrefix=strFileName.substring(strFileName.lastIndexOf(".")+1);
|
||||
|
||||
String strType0="prn,";
|
||||
String strType1="gif,png,jpg,bmp,";
|
||||
|
||||
if(strType0.contains(strFilePrefix.toLowerCase()+","))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if(strType1.contains(strFilePrefix.toLowerCase()+","))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private class Clicker implements OnItemClickListener
|
||||
{
|
||||
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
if(list.size()==0)
|
||||
finish();
|
||||
else
|
||||
{
|
||||
File file = list.get(arg2);
|
||||
if(file.isFile())
|
||||
{
|
||||
int ResultType=(Invalid(file)==0?HPRTPrinterHelper.ACTIVITY_PRNFILE:HPRTPrinterHelper.ACTIVITY_IMAGE_FILE);
|
||||
|
||||
Intent myIntent = new Intent();
|
||||
myIntent.setClass(Activity_PRNFile.this, Activity_PRNFile.class);
|
||||
myIntent.putExtra("FilePath", file.getAbsolutePath());
|
||||
setResult(ResultType, myIntent);
|
||||
finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
Intent myIntent = new Intent();
|
||||
myIntent.setClass(Activity_PRNFile.this, Activity_PRNFile.class);
|
||||
myIntent.putExtra("Folder", file.getAbsolutePath());
|
||||
myIntent.putExtra("FileFilter", FileFilterList);
|
||||
startActivityFromChild(Activity_PRNFile.this, myIntent, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
125
app/src/main/java/com/sdk/tspl/demo/Activity_Print_Image.java
Normal file
@@ -0,0 +1,125 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.format.DateFormat;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Calendar;
|
||||
import java.util.Locale;
|
||||
|
||||
import tspl.PublicFunction;
|
||||
|
||||
|
||||
public class Activity_Print_Image extends Activity
|
||||
{
|
||||
String TempFilePath=Environment.getExternalStorageDirectory().toString()+"/HPRTSDKSample/";
|
||||
String TempFileName=TempFilePath+"temp.jpg";
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_print_image);
|
||||
|
||||
if(PublicFunction.ExistSDCard())
|
||||
{
|
||||
File TempFolder = new File(TempFilePath);
|
||||
if(!TempFolder.exists())
|
||||
TempFolder.mkdirs();//
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Print_Image --> onCreate ")).append("SD card is not avaiable/writeable right now.").toString());
|
||||
this.finish();
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickPhoto(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
||||
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(new File(TempFileName)));
|
||||
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
|
||||
startActivityForResult(intent, 1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Print_Image --> onClickPhoto ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickGallery(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
Intent myIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
startActivityForResult(myIntent, 20);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Print_Image --> onClickPrint ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data)
|
||||
{
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
try
|
||||
{
|
||||
String strFilePath;
|
||||
Bitmap bmp=null;
|
||||
Cursor cursor;
|
||||
|
||||
switch(resultCode)
|
||||
{
|
||||
case Activity.RESULT_OK:
|
||||
new DateFormat();
|
||||
String name = DateFormat.format("yyyyMMdd_hhmmss",Calendar.getInstance(Locale.CHINA)) + ".jpg";
|
||||
Toast.makeText(this, name, Toast.LENGTH_LONG).show();
|
||||
|
||||
String path = TempFilePath+name;
|
||||
File file = new File(TempFileName);
|
||||
boolean blnOK=file.renameTo(new File(path));
|
||||
|
||||
bmp = BitmapFactory.decodeFile(path);
|
||||
//HPRTPrinterHelper.PrintBitmap(bmp,0,0);
|
||||
case 20:
|
||||
Uri selectedImage = data.getData();
|
||||
String[] filePathColumn = { MediaStore.Images.Media.DATA };
|
||||
cursor = getContentResolver().query(selectedImage,filePathColumn, null, null, null);
|
||||
cursor.moveToFirst();
|
||||
int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
|
||||
strFilePath = cursor.getString(columnIndex);
|
||||
cursor.close();
|
||||
bmp=BitmapFactory.decodeFile(strFilePath);
|
||||
//HPRTPrinterHelper.PrintBitmap(bmp,0,0);
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Main --> onActivityResult ")).append(e.getMessage()).toString());
|
||||
}
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
}
|
||||
160
app/src/main/java/com/sdk/tspl/demo/Activity_QRCode.java
Normal file
@@ -0,0 +1,160 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import tspl.HPRTPrinterHelper;
|
||||
|
||||
public class Activity_QRCode extends Activity
|
||||
{
|
||||
private Context thisCon=null;
|
||||
private Spinner spnQRCodeSize=null;
|
||||
private ArrayAdapter arrQRCodeSize;
|
||||
private Spinner spnQRCodeModel=null;
|
||||
private ArrayAdapter arrQRCodeModel;
|
||||
private Spinner spnQRCodeLevel=null;
|
||||
private Spinner spnqrcode_rotation=null;
|
||||
private ArrayAdapter arrQRCoderotation;
|
||||
private ArrayAdapter arrQRCodeLevel;
|
||||
private EditText txtQRCodeData=null;
|
||||
private EditText txtqrcode_x=null;
|
||||
private EditText txtqrcode_y=null;
|
||||
private int qrcoderotation=0;
|
||||
private int QRCodeSize=3;
|
||||
private String QRCodeModel="A";
|
||||
private String QRCodeLevel="L";
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_qrcode);
|
||||
thisCon=this.getApplicationContext();
|
||||
|
||||
txtQRCodeData=(EditText)this.findViewById(R.id.txtQRCodeData);
|
||||
txtqrcode_x=(EditText)this.findViewById(R.id.txtqrcode_x);
|
||||
txtqrcode_y=(EditText)this.findViewById(R.id.txtqrcode_y);
|
||||
|
||||
|
||||
String[] sList;
|
||||
spnQRCodeSize = (Spinner) findViewById(R.id.spnQRCodeSize);
|
||||
sList="1,2,3,4,5,6,7,8,9,10".split(",");
|
||||
arrQRCodeSize = new ArrayAdapter<String>(Activity_QRCode.this,android.R.layout.simple_spinner_item, sList);
|
||||
arrQRCodeSize.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnQRCodeSize.setAdapter(arrQRCodeSize);
|
||||
spnQRCodeSize.setOnItemSelectedListener(new OnItemSelectedQRCodeSize());
|
||||
|
||||
spnQRCodeModel = (Spinner) findViewById(R.id.spnQRCodeModel);
|
||||
sList="A".split(",");
|
||||
arrQRCodeModel = new ArrayAdapter<String>(Activity_QRCode.this,android.R.layout.simple_spinner_item, sList);
|
||||
arrQRCodeModel.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnQRCodeModel.setAdapter(arrQRCodeModel);
|
||||
spnQRCodeModel.setOnItemSelectedListener(new OnItemSelectedQRCodeModel());
|
||||
|
||||
spnQRCodeLevel = (Spinner) findViewById(R.id.spnQRCodeLevel);
|
||||
sList="L,M,Q,H".split(",");
|
||||
arrQRCodeLevel = new ArrayAdapter<String>(Activity_QRCode.this,android.R.layout.simple_spinner_item, sList);
|
||||
arrQRCodeLevel.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnQRCodeLevel.setAdapter(arrQRCodeLevel);
|
||||
spnQRCodeLevel.setOnItemSelectedListener(new OnItemSelectedQRCodeLevel());
|
||||
|
||||
spnqrcode_rotation = (Spinner) findViewById(R.id.spnqrcode_rotation);
|
||||
arrQRCoderotation = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrQRCoderotation=ArrayAdapter.createFromResource(this, R.array.activity_1dbarcodes_hri_rotation, android.R.layout.simple_spinner_item);
|
||||
arrQRCoderotation.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnqrcode_rotation.setAdapter(arrQRCoderotation);
|
||||
spnqrcode_rotation.setOnItemSelectedListener(new OnItemSelectedqrcoderotation());
|
||||
}
|
||||
|
||||
private class OnItemSelectedqrcoderotation implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
qrcoderotation=arg2*90;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
private class OnItemSelectedQRCodeSize implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
QRCodeSize=arg2+1;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedQRCodeModel implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
QRCodeModel=spnQRCodeModel.getSelectedItem().toString();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedQRCodeLevel implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
QRCodeLevel=spnQRCodeLevel.getSelectedItem().toString();
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickPrint(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
String text = txtQRCodeData.getText().toString().trim();
|
||||
if(text.length()==0){
|
||||
Toast.makeText(thisCon, getString(R.string.activity_qrcode_no_data), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
text = text.replace("\n", "\r\n");
|
||||
if(HPRTPrinterHelper.printAreaSize("100", "80")==-1){
|
||||
Toast.makeText(thisCon,getString(R.string.activity_main_disconnected),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
HPRTPrinterHelper.CLS();
|
||||
HPRTPrinterHelper.printQRcode(txtqrcode_x.getText().toString(), txtqrcode_y.getText().toString(), QRCodeLevel, ""+QRCodeSize, QRCodeModel, ""+qrcoderotation, text);
|
||||
HPRTPrinterHelper.Print("1","1");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_QRCode --> onClickPrint ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
198
app/src/main/java/com/sdk/tspl/demo/Activity_Setting.java
Normal file
@@ -0,0 +1,198 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
|
||||
import tspl.PublicFunction;
|
||||
|
||||
public class Activity_Setting extends Activity
|
||||
{
|
||||
private Spinner spnCodepage=null;
|
||||
private Spinner spnCut=null;
|
||||
private Spinner spnCashdrawer=null;
|
||||
private Spinner spnBuzzer=null;
|
||||
private Spinner spnFeeds=null;
|
||||
|
||||
private ArrayAdapter arrCodepage;
|
||||
private ArrayAdapter arrCut;
|
||||
private ArrayAdapter arrCashdrawer;
|
||||
private ArrayAdapter arrBuzzer;
|
||||
private ArrayAdapter arrFeeds;
|
||||
|
||||
private PublicFunction PFun=null;
|
||||
private Context thisCon=null;
|
||||
private PublicAction pAct;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_setting);
|
||||
|
||||
spnCodepage = (Spinner) findViewById(R.id.spnCodepage);
|
||||
arrCodepage = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrCodepage=ArrayAdapter.createFromResource(this, R.array.codepage, android.R.layout.simple_spinner_item);
|
||||
arrCodepage.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnCodepage.setAdapter(arrCodepage);
|
||||
spnCodepage.setOnItemSelectedListener(new OnItemSelectedCodepage());
|
||||
|
||||
spnCut = (Spinner) findViewById(R.id.spnCut);
|
||||
arrCut = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrCut=ArrayAdapter.createFromResource(this, R.array.cut_paper_list, android.R.layout.simple_spinner_item);
|
||||
arrCut.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnCut.setAdapter(arrCut);
|
||||
spnCut.setOnItemSelectedListener(new OnItemSelectedCut());
|
||||
|
||||
spnCashdrawer = (Spinner) findViewById(R.id.spnCashdrawer);
|
||||
arrCashdrawer = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrCashdrawer=ArrayAdapter.createFromResource(this, R.array.open_cashdrawer_list, android.R.layout.simple_spinner_item);
|
||||
arrCashdrawer.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnCashdrawer.setAdapter(arrCashdrawer);
|
||||
spnCashdrawer.setOnItemSelectedListener(new OnItemSelectedCashdrawer());
|
||||
|
||||
spnBuzzer = (Spinner) findViewById(R.id.spnBuzzer);
|
||||
arrBuzzer = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrBuzzer=ArrayAdapter.createFromResource(this, R.array.buzzer_list, android.R.layout.simple_spinner_item);
|
||||
arrBuzzer.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnBuzzer.setAdapter(arrBuzzer);
|
||||
spnBuzzer.setOnItemSelectedListener(new OnItemSelectedBuzzer());
|
||||
|
||||
spnFeeds = (Spinner) findViewById(R.id.spnFeeds);
|
||||
arrFeeds = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrFeeds=ArrayAdapter.createFromResource(this, R.array.feeds_list, android.R.layout.simple_spinner_item);
|
||||
arrFeeds.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnFeeds.setAdapter(arrFeeds);
|
||||
spnFeeds.setOnItemSelectedListener(new OnItemSelectedFeeds());
|
||||
|
||||
thisCon=this.getApplicationContext();
|
||||
PFun=new PublicFunction(thisCon);
|
||||
pAct = new PublicAction(thisCon);
|
||||
InitSetting();
|
||||
}
|
||||
|
||||
private void InitSetting()
|
||||
{
|
||||
String SettingValue="";
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Codepage");
|
||||
if(SettingValue.equals(""))
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Codepage", "0,PC437(USA:Standard Europe)");
|
||||
SettingValue="0";
|
||||
}
|
||||
spnCodepage.setSelection(Integer.parseInt(SettingValue.split(",")[0]));
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Cut");
|
||||
if(SettingValue.equals(""))
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Cut", "0");
|
||||
SettingValue="0";
|
||||
}
|
||||
spnCut.setSelection(Integer.parseInt(SettingValue));
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Cashdrawer");
|
||||
if(SettingValue.equals(""))
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Cashdrawer", "0");
|
||||
SettingValue="0";
|
||||
}
|
||||
spnCashdrawer.setSelection(Integer.parseInt(SettingValue));
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Buzzer");
|
||||
if(SettingValue.equals(""))
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Buzzer", "0");
|
||||
SettingValue="0";
|
||||
}
|
||||
spnBuzzer.setSelection(Integer.parseInt(SettingValue));
|
||||
|
||||
SettingValue=PFun.ReadSharedPreferencesData("Feeds");
|
||||
if(SettingValue.equals(""))
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Feeds", "0");
|
||||
SettingValue="0";
|
||||
}
|
||||
spnFeeds.setSelection(Integer.parseInt(SettingValue));
|
||||
}
|
||||
|
||||
private class OnItemSelectedCodepage implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
String sCodepage=arrCodepage.getItem(arg2).toString();
|
||||
PFun.WriteSharedPreferencesData("Codepage", String.valueOf(arg2)+","+sCodepage);
|
||||
String languageEncode = pAct.LanguageEncode();
|
||||
Log.e("TAG", "languageEncode:"+languageEncode);
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedCut implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Cut",String.valueOf(arg2));
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedCashdrawer implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Cashdrawer", String.valueOf(arg2));
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedBuzzer implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Buzzer", String.valueOf(arg2));
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedFeeds implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
PFun.WriteSharedPreferencesData("Feeds", String.valueOf(arg2));
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
}
|
||||
150
app/src/main/java/com/sdk/tspl/demo/Activity_Status.java
Normal file
@@ -0,0 +1,150 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
public class Activity_Status extends Activity
|
||||
{
|
||||
private Context thisCon;
|
||||
private TextView txtStatus=null;
|
||||
private int iStatusMode=1;
|
||||
private String sStatus="";
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_status);
|
||||
thisCon=this.getApplicationContext();
|
||||
|
||||
txtStatus=(TextView)this.findViewById(R.id.txtStatus);
|
||||
iStatusMode=this.getIntent().getIntExtra("StatusMode", 1);
|
||||
// Refresh();
|
||||
}
|
||||
|
||||
public void onClickRefresh(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
// Refresh();
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// private void Refresh()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// int iReturn=-1;
|
||||
// byte[] statusData;
|
||||
// if(iStatusMode == 1) //only transmit status
|
||||
// {
|
||||
// statusData=new byte[1];
|
||||
// iReturn=HPRTPrinterHelper.GetTransmitStatus(1, statusData);
|
||||
// if(iReturn>0)
|
||||
// {
|
||||
// if(statusData[0]==0)
|
||||
// sStatus=thisCon.getString(R.string.activity_status_transmit_status_no_paper);
|
||||
// else if(statusData[0]==1)
|
||||
// sStatus=thisCon.getString(R.string.activity_status_transmit_status_has_paper);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// txtStatus.setText("1"+thisCon.getText(R.string.activity_status_error));
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// /*if(iStatusMode == 32) //mpt-ii mode status
|
||||
// {
|
||||
// statusData=new byte[1];
|
||||
// iReturn=HPRTPrinterHelper.GetTransmitState(32, statusData);
|
||||
// if(iReturn>0)
|
||||
// {
|
||||
// if(statusData[0]==0)
|
||||
// sStatus=thisCon.getString(R.string.activity_status_transmit_status_no_paper);
|
||||
// else if(statusData[0]==1)
|
||||
// sStatus=thisCon.getString(R.string.activity_status_transmit_status_has_paper);
|
||||
// }
|
||||
// }*/
|
||||
// if((iStatusMode & 2) > 0) //have real time status,needn't transmit status
|
||||
// {
|
||||
// //get paper status
|
||||
// statusData=new byte[1];
|
||||
// iReturn=HPRTPrinterHelper.GetRealTimeStatus((byte)HPRTPrinterHelper.PRINTER_REAL_TIME_STATUS_ITEM_PAPER, statusData);
|
||||
// if(iReturn<=0)
|
||||
// {
|
||||
// txtStatus.setText("2"+thisCon.getText(R.string.activity_status_error));
|
||||
// return;
|
||||
// }
|
||||
// if((statusData[0] & 8)>0)
|
||||
// sStatus=thisCon.getString(R.string.activity_status_real_time_status_paper_near_end);
|
||||
// else
|
||||
// sStatus=thisCon.getString(R.string.activity_status_real_time_status_paper_adquate);
|
||||
// if((statusData[0] & 64)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_transmit_status_no_paper);
|
||||
// else
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_transmit_status_has_paper);
|
||||
//
|
||||
// //get on/off line status
|
||||
// statusData=new byte[1];
|
||||
// iReturn=HPRTPrinterHelper.GetRealTimeStatus((byte)HPRTPrinterHelper.PRINTER_REAL_TIME_STATUS_ITEM_PRINTER, statusData);
|
||||
// if(iReturn<=0)
|
||||
// {
|
||||
// txtStatus.setText("3"+thisCon.getText(R.string.activity_status_error));
|
||||
// return;
|
||||
// }
|
||||
// if((statusData[0] & 8)>0)
|
||||
// {
|
||||
// //get off line status
|
||||
// statusData=new byte[1];
|
||||
// iReturn=HPRTPrinterHelper.GetRealTimeStatus((byte)HPRTPrinterHelper.PRINTER_REAL_TIME_STATUS_ITEM_ONOFFLINE, statusData);
|
||||
// if(iReturn<=0)
|
||||
// {
|
||||
// txtStatus.setText("4"+thisCon.getText(R.string.activity_status_error));
|
||||
// return;
|
||||
// }
|
||||
// if((statusData[0] & 4)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_real_time_status_cover_is_open);
|
||||
// if((statusData[0] & 8)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_real_time_status_pressed_feed_button);
|
||||
// if((statusData[0] & 32)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_real_time_status_stopped_no_paper);
|
||||
// if((statusData[0] & 64)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_real_time_status_has_error);
|
||||
// }
|
||||
//
|
||||
// //get error status
|
||||
// statusData=new byte[1];
|
||||
// iReturn=HPRTPrinterHelper.GetRealTimeStatus((byte)HPRTPrinterHelper.PRINTER_REAL_TIME_STATUS_ITEM_ERROR, statusData);
|
||||
// if(iReturn<0)
|
||||
// {
|
||||
// txtStatus.setText("5"+thisCon.getText(R.string.activity_status_error));
|
||||
// return;
|
||||
// }
|
||||
// if((statusData[0] & 8)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_real_time_status_cutter_error);
|
||||
// if((statusData[0] & 32)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_real_time_status_unrecoverable_error);
|
||||
// if((statusData[0] & 64)>0)
|
||||
// sStatus+="\n" + thisCon.getString(R.string.activity_status_real_time_status_auto_recoverable_error);
|
||||
// }
|
||||
// if(sStatus.equals(""))
|
||||
// txtStatus.setText("6"+thisCon.getText(R.string.activity_status_error));
|
||||
// else
|
||||
// txtStatus.setText(sStatus);
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// Log.d("HPRTSDKSample", (new StringBuilder("Activity_Status --> Refresh ")).append(e.getMessage()).toString());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
211
app/src/main/java/com/sdk/tspl/demo/Activity_TextFormat.java
Normal file
@@ -0,0 +1,211 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemSelectedListener;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.Toast;
|
||||
|
||||
import tspl.HPRTPrinterHelper;
|
||||
import tspl.PublicFunction;
|
||||
|
||||
|
||||
public class Activity_TextFormat extends Activity
|
||||
{
|
||||
private Context thisCon=null;
|
||||
private PublicFunction PFun=null;
|
||||
private EditText txtText=null;
|
||||
private EditText txtformat_x=null;
|
||||
private EditText txtformat_y=null;
|
||||
private Spinner spnformat_font=null;
|
||||
private Spinner spnformat_codepage=null;
|
||||
private Spinner spnformat_rotation=null;
|
||||
private ArrayAdapter arrformat_font;
|
||||
private ArrayAdapter arrformat_codepage;
|
||||
private ArrayAdapter arrformatrotation;
|
||||
private Spinner spnformat_x_multiplication=null;
|
||||
private ArrayAdapter arrformat_x_multiplication;
|
||||
private Spinner spnformat_y_multiplication=null;
|
||||
private ArrayAdapter arrformat_y_multiplication;
|
||||
private String formatfont="0";
|
||||
private int x_multiplication=1;
|
||||
private String y_multiplication="0";
|
||||
private int qrcoderotation=0;
|
||||
private String codepage="Default";
|
||||
private String[] mList ;
|
||||
private int bold=0;
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_text_format);
|
||||
thisCon=this.getApplicationContext();
|
||||
|
||||
txtText = (EditText) findViewById(R.id.txtText);
|
||||
txtformat_x = (EditText) findViewById(R.id.txtformat_x);
|
||||
txtformat_y = (EditText) findViewById(R.id.txtformat_y);
|
||||
spnformat_font = (Spinner) findViewById(R.id.spnformat_font);
|
||||
spnformat_codepage = (Spinner) findViewById(R.id.spnformat_codepage);
|
||||
|
||||
String[] sList = "0,1,2,3,4,5,6,7,8,9".split(",");
|
||||
// String[] sList = getResources().getStringArray(R.array.activity_text_bold);
|
||||
arrformat_font = new ArrayAdapter<String>(Activity_TextFormat.this,android.R.layout.simple_spinner_item, sList);
|
||||
arrformat_font.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnformat_font.setAdapter(arrformat_font);
|
||||
spnformat_font.setOnItemSelectedListener(new OnItemSelectedformatfont());
|
||||
|
||||
mList = getResources().getStringArray(R.array.codepage_list);
|
||||
arrformat_codepage = new ArrayAdapter<String>(Activity_TextFormat.this,android.R.layout.simple_spinner_item, mList);
|
||||
arrformat_codepage.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnformat_codepage.setAdapter(arrformat_codepage);
|
||||
spnformat_codepage.setOnItemSelectedListener(new OnItemSelectedCodePage());
|
||||
|
||||
spnformat_rotation = (Spinner) findViewById(R.id.spnformat_rotation);
|
||||
arrformatrotation = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item);
|
||||
arrformatrotation=ArrayAdapter.createFromResource(this, R.array.activity_1dbarcodes_hri_rotation, android.R.layout.simple_spinner_item);
|
||||
arrformatrotation.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnformat_rotation.setAdapter(arrformatrotation);
|
||||
spnformat_rotation.setOnItemSelectedListener(new OnItemSelectedformatrotation());
|
||||
|
||||
sList = "1,2,3,4,5,6,7".split(",");
|
||||
spnformat_x_multiplication = (Spinner) findViewById(R.id.spnformat_x_multiplication);
|
||||
arrformat_x_multiplication = new ArrayAdapter<String>(Activity_TextFormat.this,android.R.layout.simple_spinner_item, sList);
|
||||
arrformat_x_multiplication.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnformat_x_multiplication.setAdapter(arrformat_x_multiplication);
|
||||
spnformat_x_multiplication.setOnItemSelectedListener(new OnItemSelectedformat_x_multiplication());
|
||||
|
||||
spnformat_y_multiplication = (Spinner) findViewById(R.id.spnformat_y_multiplication);
|
||||
arrformat_y_multiplication = new ArrayAdapter<String>(Activity_TextFormat.this,android.R.layout.simple_spinner_item,getResources().getStringArray(R.array.activity_text_bold));
|
||||
arrformat_y_multiplication.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
spnformat_y_multiplication.setAdapter(arrformat_y_multiplication);
|
||||
spnformat_y_multiplication.setOnItemSelectedListener(new OnItemSelectedformat_y_multiplication());
|
||||
}
|
||||
private class OnItemSelectedCodePage implements OnItemSelectedListener{
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
codepage=mList[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private class OnItemSelectedformatrotation implements OnItemSelectedListener
|
||||
{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3){
|
||||
qrcoderotation=arg2*90;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0){
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
private class OnItemSelectedformatfont implements OnItemSelectedListener{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3){
|
||||
switch (arg2) {
|
||||
case 0:
|
||||
formatfont="0";
|
||||
break;
|
||||
case 1:
|
||||
formatfont="1";
|
||||
break;
|
||||
case 2:
|
||||
formatfont="2";
|
||||
break;
|
||||
case 3:
|
||||
formatfont="3";
|
||||
break;
|
||||
case 4:
|
||||
formatfont="4";
|
||||
break;
|
||||
case 5:
|
||||
formatfont="5";
|
||||
break;
|
||||
case 6:
|
||||
formatfont="6";
|
||||
break;
|
||||
case 7:
|
||||
formatfont="7";
|
||||
break;
|
||||
case 8:
|
||||
formatfont="8";
|
||||
break;
|
||||
case 9:
|
||||
formatfont="9";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0){
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
private class OnItemSelectedformat_x_multiplication implements OnItemSelectedListener{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3){
|
||||
x_multiplication=arg2+1;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0){
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
private class OnItemSelectedformat_y_multiplication implements OnItemSelectedListener{
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,long arg3)
|
||||
{
|
||||
bold=arg2;
|
||||
}
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> arg0){
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickPrint(View view){
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try{
|
||||
String sText=txtText.getText().toString().trim();
|
||||
if(sText.length()==0){
|
||||
Toast.makeText(thisCon, getString(R.string.activity_1dbarcodes_no_data), Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
sText = sText.replace("\n", "\r\n");
|
||||
Log.d("Printer", "sText: "+(HPRTPrinterHelper.bytetohex(sText.getBytes("GBK"))));
|
||||
if(HPRTPrinterHelper.printAreaSize("100", "30")==-1){
|
||||
Toast.makeText(thisCon,getString(R.string.activity_main_disconnected),Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
HPRTPrinterHelper.CLS();
|
||||
if (bold!=0){
|
||||
HPRTPrinterHelper.Bold(bold);
|
||||
}
|
||||
HPRTPrinterHelper.printText(txtformat_x.getText().toString(), txtformat_y.getText().toString(), formatfont, ""+qrcoderotation, x_multiplication, sText);
|
||||
if (bold!=0){
|
||||
HPRTPrinterHelper.Bold(0);
|
||||
}
|
||||
HPRTPrinterHelper.Print("1", "1");
|
||||
}
|
||||
catch (Exception e){
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_TextFormat --> onClickPrint ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
102
app/src/main/java/com/sdk/tspl/demo/Activity_Wifi.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import tspl.HPRTPrinterHelper;
|
||||
|
||||
|
||||
public class Activity_Wifi extends Activity
|
||||
{
|
||||
private Context thisCon=null;
|
||||
private HPRTPrinterHelper HPRTPrinter=new HPRTPrinterHelper();
|
||||
private EditText edtIP=null;
|
||||
private EditText edtPort=null;
|
||||
private TextView txtTips=null;
|
||||
|
||||
// private String PrinterName="";
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.activity_wifi);
|
||||
|
||||
thisCon=this.getApplicationContext();
|
||||
edtIP = (EditText) findViewById(R.id.txtIPAddress);
|
||||
edtPort = (EditText) findViewById(R.id.txtWifiPort);
|
||||
txtTips = (TextView) findViewById(R.id.txtTips);
|
||||
|
||||
Intent intent = getIntent();
|
||||
// PrinterName=intent.getStringExtra("PN");
|
||||
}
|
||||
|
||||
public void onClickConnect(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
if(HPRTPrinter!=null)
|
||||
{
|
||||
HPRTPrinter.PortClose();
|
||||
}
|
||||
|
||||
String strIP=edtIP.getText().toString().trim();
|
||||
String strPort=edtPort.getText().toString().trim();
|
||||
if(strIP.length()==0)
|
||||
{
|
||||
Toast.makeText(thisCon, R.string.activity_wifi_noIP, Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
|
||||
// HPRTPrinter=new HPRTPrinterHelper(thisCon,PrinterName);
|
||||
if(HPRTPrinterHelper.PortOpen("WiFi,"+strIP+","+strPort)!=0)
|
||||
{
|
||||
txtTips.setText(thisCon.getString(R.string.activity_main_connecterr));
|
||||
}
|
||||
else
|
||||
{
|
||||
HPRTPrinterHelper.PortClose();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("is_connected", "OK");
|
||||
intent.putExtra("IPAddress", strIP);
|
||||
intent.putExtra("Port", strPort);
|
||||
setResult(HPRTPrinterHelper.ACTIVITY_CONNECT_WIFI, intent);
|
||||
finish();
|
||||
}
|
||||
HPRTPrinter=null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Wifi --> onClickConnect ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public void onClickCancel(View view)
|
||||
{
|
||||
if (!checkClick.isClickEvent()) return;
|
||||
|
||||
try
|
||||
{
|
||||
// if(HPRTPrinter!=null)
|
||||
// {
|
||||
// }
|
||||
HPRTPrinterHelper.PortClose();
|
||||
|
||||
this.finish();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.d("HPRTSDKSample", (new StringBuilder("Activity_Wifi --> onClickCancel ")).append(e.getMessage()).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
163
app/src/main/java/com/sdk/tspl/demo/BTActivity.java
Normal file
@@ -0,0 +1,163 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ProgressDialog;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.recyclerview.widget.DividerItemDecoration;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class BTActivity extends Activity {
|
||||
|
||||
@BindView(R.id.recy_history)
|
||||
RecyclerView recyHistory;
|
||||
@BindView(R.id.swipe_refresh)
|
||||
SwipeRefreshLayout swipeRefresh;
|
||||
@BindView(R.id.activity_bt)
|
||||
RelativeLayout activityBt;
|
||||
private Context mContext;
|
||||
private ListView list_bt;
|
||||
public BluetoothAdapter myBluetoothAdapter;
|
||||
private Intent intent;
|
||||
private BaseQuickAdapter<BluetoothDevice, BaseViewHolder> baseQuickAdapter;
|
||||
private List<BluetoothDevice> list;
|
||||
private int tag;
|
||||
private Bluetooth bluetooth;
|
||||
private ProgressDialog progressDialog;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_bt);
|
||||
ButterKnife.bind(this);
|
||||
mContext = getApplicationContext();
|
||||
initData();
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
intent = getIntent();
|
||||
tag = intent.getIntExtra("TAG", RESULT_CANCELED);
|
||||
ListBluetoothDevice();
|
||||
}
|
||||
public void ListBluetoothDevice() {
|
||||
if ((myBluetoothAdapter = BluetoothAdapter.getDefaultAdapter()) == null) {
|
||||
Toast.makeText(this, "没有找到蓝牙适配器", Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!myBluetoothAdapter.isEnabled()) {
|
||||
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
|
||||
startActivityForResult(enableBtIntent, 2);
|
||||
}
|
||||
list = new ArrayList<BluetoothDevice>();
|
||||
baseQuickAdapter = new BaseQuickAdapter<BluetoothDevice, BaseViewHolder>(android.R.layout.simple_list_item_2, list) {
|
||||
|
||||
@Override
|
||||
protected void convert(BaseViewHolder helper, BluetoothDevice item) {
|
||||
if (item!=null){
|
||||
if (item.getName()!=null)
|
||||
helper.setText(android.R.id.text1, item.getName().isEmpty()?"Null":item.getName());
|
||||
helper.setText(android.R.id.text2, item.getAddress());
|
||||
}
|
||||
}
|
||||
};
|
||||
recyHistory.setLayoutManager(new LinearLayoutManager(mContext));
|
||||
recyHistory.addItemDecoration(new DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL));
|
||||
recyHistory.setAdapter(baseQuickAdapter);
|
||||
bluetooth = Bluetooth.getBluetooth(this);
|
||||
initBT();
|
||||
baseQuickAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
|
||||
Bluetooth.setOnBondState(list.get(position), new Bluetooth.OnBondState() {
|
||||
@Override
|
||||
public void bondSuccess() {
|
||||
if (progressDialog!=null&&progressDialog.isShowing())
|
||||
progressDialog.dismiss();
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("SelectedBDAddress", list.get(position).getAddress());
|
||||
setResult(tag, intent);
|
||||
finish();
|
||||
}
|
||||
});
|
||||
if (list.get(position).getBondState()==BluetoothDevice.BOND_BONDED){
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra("SelectedBDAddress", list.get(position).getAddress());
|
||||
setResult(tag, intent);
|
||||
finish();
|
||||
}else{
|
||||
// Method method = null;
|
||||
// try {
|
||||
// method = BluetoothDevice.class.getMethod("createBond");
|
||||
// Log.d("Print", "开始配对");
|
||||
// method.invoke(list.get(position));
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
progressDialog = new ProgressDialog(BTActivity.this);
|
||||
progressDialog.setMessage(getString(R.string.activity_devicelist_connect));
|
||||
progressDialog.show();
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
list.get(position).createBond();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
});
|
||||
swipeRefresh.setColorSchemeResources(R.color.colorPrimary);
|
||||
swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
|
||||
@Override
|
||||
public void onRefresh() {
|
||||
initBT();
|
||||
if (swipeRefresh.isRefreshing())
|
||||
swipeRefresh.setRefreshing(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
private void initBT() {
|
||||
Log.d("TAG","initBT:");
|
||||
list.clear();
|
||||
baseQuickAdapter.notifyDataSetChanged();
|
||||
bluetooth.doDiscovery();
|
||||
bluetooth.getData(new Bluetooth.toData() {
|
||||
@Override
|
||||
public void succeed(BluetoothDevice bluetoothDevice) {
|
||||
for (BluetoothDevice printBT : list) {
|
||||
if (bluetoothDevice.getAddress().equals(printBT.getAddress())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//XiangYinBao_X3,ATOL1
|
||||
list.add(bluetoothDevice);
|
||||
baseQuickAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
if (bluetooth!=null)
|
||||
bluetooth.disReceiver();
|
||||
}
|
||||
}
|
||||
144
app/src/main/java/com/sdk/tspl/demo/Bluetooth.java
Normal file
@@ -0,0 +1,144 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.bluetooth.BluetoothAdapter;
|
||||
import android.bluetooth.BluetoothDevice;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tbruyelle.rxpermissions.RxPermissions;
|
||||
|
||||
import rx.functions.Action1;
|
||||
|
||||
|
||||
/**
|
||||
* Created by NO on 2018/7/24.
|
||||
*/
|
||||
|
||||
public class Bluetooth {
|
||||
Context context;
|
||||
static Bluetooth bluetooth;
|
||||
private BluetoothAdapter mBluetoothAdapter;
|
||||
toData mTodata;
|
||||
private static RxPermissions rxPermissions;
|
||||
public static boolean isStaBond = false;
|
||||
private static BluetoothDevice mBluetoothDevice;
|
||||
private static OnBondState mOnBondState;
|
||||
|
||||
|
||||
private Bluetooth(Context context){
|
||||
this.context=context;
|
||||
}
|
||||
public static Bluetooth getBluetooth(Context context){
|
||||
// if (bluetooth==null){
|
||||
bluetooth= new Bluetooth(context);
|
||||
// rxPermissions = new RxPermissions((Activity)context);
|
||||
// }
|
||||
return bluetooth;
|
||||
}
|
||||
private void registerBroadcast() {
|
||||
IntentFilter intent = new IntentFilter();
|
||||
intent.addAction(BluetoothDevice.ACTION_FOUND);// 用BroadcastReceiver来取得搜索结果
|
||||
intent.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
|
||||
intent.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
|
||||
context.registerReceiver(mReceiver, intent);
|
||||
}
|
||||
public void doDiscovery(){
|
||||
if (context!=null){
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
if (mBluetoothAdapter == null) {
|
||||
Utility.show(context, "Device does not support Bluetooth");
|
||||
return;
|
||||
} else if (!mBluetoothAdapter.isEnabled()) {
|
||||
mBluetoothAdapter.enable();
|
||||
}
|
||||
registerBroadcast();
|
||||
rxPermissions = new RxPermissions((Activity)context);
|
||||
rxPermissions.request(Manifest.permission.BLUETOOTH_ADMIN,
|
||||
Manifest.permission.BLUETOOTH,
|
||||
Manifest.permission.ACCESS_FINE_LOCATION).subscribe(new Action1<Boolean>() {
|
||||
@Override
|
||||
public void call(Boolean aBoolean) {
|
||||
if (aBoolean) {
|
||||
if (null == mBluetoothAdapter) {
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
}
|
||||
if (!mBluetoothAdapter.isEnabled()) {
|
||||
mBluetoothAdapter.enable();
|
||||
}
|
||||
if (mBluetoothAdapter.isDiscovering()) {
|
||||
mBluetoothAdapter.cancelDiscovery();
|
||||
}
|
||||
mBluetoothAdapter.startDiscovery();
|
||||
} else {
|
||||
Utility.show(context,"no bluetooth permission");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
public void getData(toData todata){
|
||||
mTodata=todata;
|
||||
}
|
||||
public interface toData{
|
||||
public void succeed(BluetoothDevice bluetoothDevice);
|
||||
}
|
||||
public void disReceiver(){
|
||||
isStaBond = false;
|
||||
if (mReceiver != null&&context!=null)
|
||||
context.unregisterReceiver(mReceiver);
|
||||
if (mBluetoothAdapter.isDiscovering())
|
||||
mBluetoothAdapter.cancelDiscovery();
|
||||
}
|
||||
private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
String action = intent.getAction();
|
||||
BluetoothDevice device = null;
|
||||
switch (action) {
|
||||
case BluetoothDevice.ACTION_FOUND:
|
||||
device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
if(device.getBluetoothClass().getMajorDeviceClass()==1536){
|
||||
if (mTodata!=null){
|
||||
mTodata.succeed(device);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BluetoothDevice.ACTION_BOND_STATE_CHANGED:
|
||||
device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||
switch (device.getBondState()) {
|
||||
case BluetoothDevice.BOND_BONDING:
|
||||
Log.d("Print", "正在配对......");
|
||||
break;
|
||||
case BluetoothDevice.BOND_BONDED:
|
||||
Log.d("Print", "完成配对");
|
||||
if (mOnBondState!=null&&mBluetoothDevice!=null&&isStaBond){
|
||||
if (mBluetoothDevice.getAddress().equals(device.getAddress()))
|
||||
mOnBondState.bondSuccess();
|
||||
}
|
||||
break;
|
||||
case BluetoothDevice.BOND_NONE:
|
||||
Log.d("Print", "取消配对");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case BluetoothAdapter.ACTION_DISCOVERY_FINISHED:
|
||||
Log.d("Print", "搜索完成");
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
public static void setOnBondState(BluetoothDevice bluetoothDevice,OnBondState onBondState){
|
||||
isStaBond=true;
|
||||
mBluetoothDevice = bluetoothDevice;
|
||||
mOnBondState = onBondState;
|
||||
}
|
||||
interface OnBondState {
|
||||
void bondSuccess();
|
||||
}
|
||||
}
|
||||
18
app/src/main/java/com/sdk/tspl/demo/PrinterProperty.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
public class PrinterProperty
|
||||
{
|
||||
public static String Barcode="";
|
||||
public static int PrintableWidth=0;
|
||||
public static boolean Cut=false;
|
||||
public static int CutSpacing=0;
|
||||
public static int TearSpacing=0;
|
||||
public static int ConnectType=0;
|
||||
public static boolean Cashdrawer=false;
|
||||
public static boolean Buzzer=false;
|
||||
public static boolean Pagemode=false;
|
||||
public static String PagemodeArea="";
|
||||
public static boolean GetRemainingPower=false;
|
||||
public static boolean SampleReceipt=true;
|
||||
public static int StatusMode=0;
|
||||
}
|
||||
92
app/src/main/java/com/sdk/tspl/demo/PublicAction.java
Normal file
@@ -0,0 +1,92 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import tspl.HPRTPrinterHelper;
|
||||
import tspl.PublicFunction;
|
||||
|
||||
|
||||
public class PublicAction
|
||||
{
|
||||
private Context context=null;
|
||||
public PublicAction()
|
||||
{
|
||||
|
||||
}
|
||||
public PublicAction(Context con)
|
||||
{
|
||||
context = con;
|
||||
}
|
||||
|
||||
// public void BeforePrintAction()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// PublicFunction PFun=new PublicFunction(context);
|
||||
// if(PFun.ReadSharedPreferencesData("Cut").equals("1") && PrinterProperty.Cut)
|
||||
// HPRTPrinterHelper.CutPaper(HPRTPrinterHelper.HPRT_PARTIAL_CUT,PrinterProperty.CutSpacing);
|
||||
// if(PFun.ReadSharedPreferencesData("Cashdrawer").equals("1") && PrinterProperty.Cashdrawer)
|
||||
// HPRTPrinterHelper.OpenCashdrawer(0);
|
||||
// if(PFun.ReadSharedPreferencesData("Buzzer").equals("1") && PrinterProperty.Buzzer)
|
||||
// HPRTPrinterHelper.BeepBuzzer((byte)1,(byte)10,(byte)0);
|
||||
// }
|
||||
// catch(Exception e)
|
||||
// {
|
||||
// Log.e("HPRTSDKSample", (new StringBuilder("PublicAction --> BeforePrintAction ")).append(e.getMessage()).toString());
|
||||
// }
|
||||
// }
|
||||
|
||||
// public void AfterPrintAction()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// PublicFunction PFun=new PublicFunction(context);
|
||||
//
|
||||
// if(PFun.ReadSharedPreferencesData("Cashdrawer").equals("2") && PrinterProperty.Cashdrawer)
|
||||
// HPRTPrinterHelper.OpenCashdrawer(0);
|
||||
// if(PFun.ReadSharedPreferencesData("Buzzer").equals("2") && PrinterProperty.Buzzer)
|
||||
// HPRTPrinterHelper.BeepBuzzer((byte)1,(byte)10,(byte)10);
|
||||
//
|
||||
// int iFeed=Integer.valueOf(PFun.ReadSharedPreferencesData("Feeds"));
|
||||
// ArrayAdapter arrFeeds;
|
||||
// arrFeeds = new ArrayAdapter<String>(context,android.R.layout.simple_spinner_item);
|
||||
// arrFeeds=ArrayAdapter.createFromResource(context, R.array.feeds_list, android.R.layout.simple_spinner_item);
|
||||
// arrFeeds.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
// iFeed=(Integer.valueOf(arrFeeds.getItem(iFeed).toString().replace("mm", "")));
|
||||
// HPRTPrinterHelper.PrintAndFeed(iFeed*4);
|
||||
// if(PFun.ReadSharedPreferencesData("Cut").equals("2") && PrinterProperty.Cut)
|
||||
//
|
||||
// HPRTPrinterHelper.CutPaper(HPRTPrinterHelper.HPRT_PARTIAL_CUT,PrinterProperty.CutSpacing);
|
||||
// else
|
||||
// HPRTPrinterHelper.PrintAndFeed(PrinterProperty.TearSpacing);
|
||||
// }
|
||||
// catch(Exception e)
|
||||
// {
|
||||
// Log.e("HPRTSDKSample", (new StringBuilder("PublicAction --> AfterPrintAction ")).append(e.getMessage()).toString());
|
||||
// }
|
||||
// }
|
||||
|
||||
public String LanguageEncode()
|
||||
{
|
||||
try
|
||||
{
|
||||
PublicFunction PFun=new PublicFunction(context);
|
||||
String sLanguage=PFun.ReadSharedPreferencesData("Codepage").split(",")[1].toString();
|
||||
String sLEncode="gb2312";
|
||||
int intLanguageNum=0;
|
||||
|
||||
sLEncode=PFun.getLanguageEncode(sLanguage);
|
||||
// intLanguageNum= PFun.getCodePageIndex(sLanguage);
|
||||
// HPRTPrinterHelper.SetCharacterSet((byte)intLanguageNum);
|
||||
HPRTPrinterHelper.LanguageEncode=sLEncode;
|
||||
|
||||
return sLEncode;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.e("HPRTSDKSample", (new StringBuilder("PublicAction --> AfterPrintAction ")).append(e.getMessage()).toString());
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
117
app/src/main/java/com/sdk/tspl/demo/Utility.java
Normal file
@@ -0,0 +1,117 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.shockwave.pdfium.PdfDocument;
|
||||
import com.shockwave.pdfium.PdfiumCore;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by NO on 2017/9/14.
|
||||
*/
|
||||
|
||||
public class Utility {
|
||||
public static void checkBlueboothPermission(Activity context, String permission, String[] requestPermissions, Callback callback){
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
//校验是否已具有模糊定位权限
|
||||
if (ContextCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
|
||||
ActivityCompat.requestPermissions(context, requestPermissions, 100);
|
||||
} else {
|
||||
//具有权限
|
||||
callback.permit();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
//系统不高于6.0直接执行
|
||||
callback.pass();
|
||||
}
|
||||
}
|
||||
public interface Callback {
|
||||
/**
|
||||
* API>=23 允许权限
|
||||
*/
|
||||
void permit();
|
||||
|
||||
|
||||
/**
|
||||
* API<23 无需授予权限
|
||||
*/
|
||||
void pass();
|
||||
}
|
||||
|
||||
public static void show(final Context context, final String message){
|
||||
((Activity)context).runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Toast.makeText(context,message,Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
//file:PDF文件,
|
||||
//pageNumber:需要生成的页数,例如:"1,2-3",
|
||||
//pageWidth:需要生成的宽度
|
||||
public static List<Bitmap> pdfToBitmap(Context context, File file, String pageNumber, int pageWidth) {
|
||||
ArrayList<Bitmap> ListBitmap = new ArrayList<Bitmap>();
|
||||
try {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
ParcelFileDescriptor parcelFileDescriptor = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
|
||||
PdfiumCore pdfiumCore = new PdfiumCore(context);
|
||||
PdfDocument pdfDocument = pdfiumCore.newDocument(parcelFileDescriptor);
|
||||
int pages = pdfiumCore.getPageCount(pdfDocument);
|
||||
String[] split = pageNumber.split(",");
|
||||
for (int i = 0; i < split.length; i++) {
|
||||
String[] split2 = split[i].split("-");
|
||||
if (split2.length == 2) {
|
||||
Integer bigPage = Integer.valueOf(split2[1]);
|
||||
Integer smallPage = Integer.valueOf(split2[0]);
|
||||
int page = bigPage - smallPage;
|
||||
for (int j = 0; j < page + 1; j++) {
|
||||
if (!list.contains("" + (smallPage + j))) {
|
||||
list.add("" + (smallPage + j));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!list.contains(split2[0])) {
|
||||
list.add(split2[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
int width = pageWidth;
|
||||
int height = 864;
|
||||
int dpi = 200;
|
||||
if (list.size() == 0)
|
||||
return ListBitmap;
|
||||
for (int pageIndex = 0; pageIndex < list.size(); pageIndex++) {
|
||||
int page = Integer.valueOf(list.get(pageIndex));
|
||||
if (0 < page && page <= pages) {
|
||||
pdfiumCore.openPage(pdfDocument, page - 1);
|
||||
int pageWidthPoint = pdfiumCore.getPageWidthPoint(pdfDocument, page - 1);
|
||||
int pageHeightPoint = pdfiumCore.getPageHeightPoint(pdfDocument, page - 1);
|
||||
double bili = width / (double) pageWidthPoint;
|
||||
height = (int) (pageHeightPoint * bili);
|
||||
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||
pdfiumCore.renderPageBitmap(pdfDocument, bitmap, page - 1, 0, 0, width, height);
|
||||
ListBitmap.add(bitmap);
|
||||
}
|
||||
}
|
||||
pdfiumCore.closeDocument(pdfDocument);
|
||||
} catch (Exception e) {
|
||||
return ListBitmap;
|
||||
}
|
||||
return ListBitmap;
|
||||
}
|
||||
}
|
||||
14
app/src/main/java/com/sdk/tspl/demo/checkClick.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.sdk.tspl.demo;
|
||||
|
||||
public class checkClick{
|
||||
private static final long CLICK_DELAY = 1000;
|
||||
private static long mOldClickTime;
|
||||
|
||||
public static boolean isClickEvent(){
|
||||
long time = System.currentTimeMillis();
|
||||
if (time - mOldClickTime < CLICK_DELAY)
|
||||
return false;
|
||||
mOldClickTime = time;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
30
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<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>
|
||||
BIN
app/src/main/res/drawable/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 606 B |
170
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@@ -0,0 +1,170 @@
|
||||
<?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>
|
||||
BIN
app/src/main/res/drawable/icon_file_image.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
app/src/main/res/drawable/icon_folder.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
app/src/main/res/drawable/icon_prn.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
app/src/main/res/drawable/logo.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
app/src/main/res/drawable/logo2.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
5
app/src/main/res/drawable/my_edittext.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#00000000"/>
|
||||
<stroke android:width="2dip" android:color="#DEB887" />
|
||||
</shape>
|
||||
BIN
app/src/main/res/drawable/printer.jpg
Normal file
|
After Width: | Height: | Size: 213 KiB |
BIN
app/src/main/res/drawable/selectimage.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
app/src/main/res/drawable/tspl.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
169
app/src/main/res/layout/activity_1dbarcodes.xml
Normal file
@@ -0,0 +1,169 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logoImageView"
|
||||
android:layout_marginTop="2.0dip"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ScrollView
|
||||
android:scrollbarAlwaysDrawVerticalTrack="false"
|
||||
android:id="@+id/preview_dashboard_v"
|
||||
android:background="#ffebebeb"
|
||||
android:scrollbars="vertical"
|
||||
android:fadingEdge="vertical"
|
||||
android:layout_width="0.0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_type"
|
||||
android:textSize="20.0dip" />
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Spinner
|
||||
android:id="@+id/spnBarcodeType"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textSize="20.0dip"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnHelp"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickPrint"
|
||||
android:layout_weight="3"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_1dbarcodes_btnhelp" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_data"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/txtBarcodeData"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:text="123456789"
|
||||
android:maxLines="1"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_start_cd"
|
||||
android:textSize="20.0dip" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
>
|
||||
<EditText
|
||||
android:id="@+id/txtBarcode_x"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:maxLines="1"/>
|
||||
<EditText
|
||||
android:id="@+id/txtBarcode_y"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:layout_weight="1"
|
||||
android:text="0"
|
||||
android:maxLines="1"/>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_height"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/txtBarcodeHeight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:text="80"
|
||||
android:maxLines="1"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_width"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnBarcodeWidth"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_readable"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnBarcode_readable"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_rotation"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnBarcode_rotation"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_1dbarcodes_narrow"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnBarcode_narrow"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrint"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickPrint"
|
||||
android:text="@string/activity_global_print" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
45
app/src/main/res/layout/activity_align.xml
Normal file
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemName3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_global_align"
|
||||
android:textSize="20.0dip" />
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup1"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rdoLeft"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="20.0dip"
|
||||
android:text="@string/activity_global_left_align" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rdoCenter"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="20.0dip"
|
||||
android:text="@string/activity_global_center_align" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rdoRight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="20.0dip"
|
||||
android:text="@string/activity_global_right_align" />
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
17
app/src/main/res/layout/activity_bt.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_bt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recy_history"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
</androidx.recyclerview.widget.RecyclerView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</RelativeLayout>
|
||||
26
app/src/main/res/layout/activity_cashdrawer.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button android:id="@+id/btnOpen1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dip"
|
||||
android:onClick="onClickOpen1"
|
||||
android:text="@string/activity_cashdrawer_open1"/>
|
||||
|
||||
<Button android:id="@+id/btnOpen2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickOpen2"
|
||||
android:text="@string/activity_cashdrawer_open2"/>
|
||||
|
||||
<Button android:id="@+id/btnOpen12"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickOpen12"
|
||||
android:text="@string/activity_cashdrawer_open12"/>
|
||||
|
||||
</LinearLayout>
|
||||
34
app/src/main/res/layout/activity_cut.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<Button android:id="@+id/btnFullCut"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickFullCut"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_cut_fullcut"/>
|
||||
|
||||
<Button android:id="@+id/btnPartialCut"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="5dip"
|
||||
android:onClick="onClickPartialCut"
|
||||
android:text="@string/activity_cut_partialcut"/>
|
||||
|
||||
<Button android:id="@+id/btnFullCutWithFeed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickFullCutWithFeed"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_cut_fullcutwithfeed"/>
|
||||
|
||||
<Button android:id="@+id/btnPartialCutWithFeed"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickPartialCutWithFeed"
|
||||
android:text="@string/activity_cut_partialcutwithfeed"/>
|
||||
|
||||
</LinearLayout>
|
||||
53
app/src/main/res/layout/activity_devicelist.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?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">
|
||||
<!-- 已经配对的设备-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
<TextView android:id="@+id/title_paired_devices"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_devicelist_title_paired_devices"
|
||||
android:visibility="gone"
|
||||
android:background="#666"
|
||||
android:textColor="#fff"
|
||||
android:paddingLeft="5dp"/>
|
||||
<!--已经配对的设备信息 -->
|
||||
<ListView android:id="@+id/paired_devices"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:stackFromBottom="true"
|
||||
android:layout_weight="1"/>
|
||||
<!-- 扫描出来没有经过配对的设备 -->
|
||||
<TextView android:id="@+id/title_new_devices"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_devicelist_title_other_devices"
|
||||
android:visibility="gone"
|
||||
android:background="#666"
|
||||
android:textColor="#fff"
|
||||
android:paddingLeft="5dp"/>
|
||||
<!-- 扫描出来没有经过配对的设备信息 -->
|
||||
<ListView android:id="@+id/new_devices"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:stackFromBottom="true"
|
||||
android:layout_weight="2"/>
|
||||
<!-- 扫描按钮 -->
|
||||
<Button android:id="@+id/button_scan"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_devicelist_button_scan"/>
|
||||
</LinearLayout>
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="gone"
|
||||
/>
|
||||
</RelativeLayout>
|
||||
139
app/src/main/res/layout/activity_esc_function.xml
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ScrollView
|
||||
android:scrollbarAlwaysDrawVerticalTrack="false"
|
||||
android:id="@+id/preview_dashboard_v"
|
||||
android:background="#ffebebeb"
|
||||
android:scrollbars="vertical"
|
||||
android:fadingEdge="vertical"
|
||||
android:layout_width="0.0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/btnGetStatus"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_esc_function_btngetprinterstatus" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnOpenCashDrawer"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_esc_function_btnopencashdrawer" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSampleReceipt"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_esc_function_btnsamplereceipt" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn1DBarcodes"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_esc_function_btn1dbarcodes" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQRCode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_esc_function_btnqrcode" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPDF417"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_esc_function_btnpdf417" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCut"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_esc_function_btncut" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTextFormat"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_esc_function_btntextformatting" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrintImageFile"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_esc_function_btnprintimagefile" />
|
||||
<Button
|
||||
android:id="@+id/btnPrintStatus"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_esc_function_btnprintstatus" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrintPRNFile"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_esc_function_btnprintprnfile" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPageMode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_esc_function_btnpagemode" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnImageManage"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_esc_function_btnimagemanage" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrintBlock"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_esc_function_btnprintblock" />
|
||||
<Button
|
||||
android:id="@+id/btn_print_pdf"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_esc_function_btnprintpdf"
|
||||
android:onClick="onClickDo"
|
||||
/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
66
app/src/main/res/layout/activity_image_manage.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/itemName3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_image_manage_imageno"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnImageIndex"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip" />
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrint"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickPrint"
|
||||
android:text="@string/activity_image_manage_btnprint" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDownload"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDownload"
|
||||
android:text="@string/activity_image_manage_btndownload" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDeleteOne"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDeleteOne"
|
||||
android:text="@string/activity_image_manage_btndeleteone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDeleteAll"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickDeleteAll"
|
||||
android:text="@string/activity_image_manage_btndeleteall" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtSpace"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_image_manage_txtSpace"
|
||||
android:textSize="20.0dip" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtCounter"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_image_manage_txtCounter"
|
||||
android:textSize="20.0dip" />
|
||||
|
||||
</LinearLayout>
|
||||
40
app/src/main/res/layout/activity_image_preview.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<!-- <WebView
|
||||
android:id="@+id/webPreview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_weight="0.12" /> -->
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/webPreview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dip"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_weight="0.12"
|
||||
android:src="@drawable/ic_launcher" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<Button
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickCancel"
|
||||
android:layout_weight="1.0"
|
||||
android:text="@string/activity_image_manage_btnprint" />
|
||||
<Button
|
||||
android:id="@+id/btnOK"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickOK"
|
||||
android:layout_weight="1.0"
|
||||
android:text="@string/activity_image_manage_btnprint" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
16
app/src/main/res/layout/activity_image_print.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<include layout="@layout/activity_align"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrint"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickPrint"
|
||||
android:text="@string/activity_global_print" />
|
||||
|
||||
</LinearLayout>
|
||||
14
app/src/main/res/layout/activity_logo.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logoImageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/logo" />
|
||||
|
||||
</LinearLayout>
|
||||
110
app/src/main/res/layout/activity_main.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemName3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3.0dip"
|
||||
android:text="@string/activity_main_printer"
|
||||
android:textSize="20.0dip" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spn_printer_list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="5dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnBT"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onClickConnect"
|
||||
android:text="@string/activity_main_bt" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnWIFI"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onClickConnect"
|
||||
android:text="@string/activity_main_wifi" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnUSB"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onClickConnect"
|
||||
android:text="@string/activity_main_usb" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtTips"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3.0dip"
|
||||
android:text="@string/activity_main_tips"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="16.0dip" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnClose"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="2.0"
|
||||
android:onClick="onClickClose"
|
||||
android:text="@string/activity_main_close" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnSetting"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onClickbtnSetting"
|
||||
android:visibility="gone"
|
||||
android:text="@string/activity_main_setting" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrintTestPage"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onClickDo"
|
||||
android:text="@string/activity_main_print_test_page" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<include layout="@layout/activity_esc_function"/>
|
||||
|
||||
</LinearLayout>
|
||||
199
app/src/main/res/layout/activity_page_mode.xml
Normal file
@@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ScrollView
|
||||
android:scrollbarAlwaysDrawVerticalTrack="false"
|
||||
android:id="@+id/preview_dashboard_v"
|
||||
android:background="#ffebebeb"
|
||||
android:scrollbars="vertical"
|
||||
android:fadingEdge="vertical"
|
||||
android:layout_width="0.0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/edtText"
|
||||
android:layout_marginTop="2.0dip"
|
||||
android:layout_marginLeft="2.0dip"
|
||||
android:layout_marginRight="2.0dip"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="120sp"
|
||||
android:inputType="textMultiLine"
|
||||
android:background="@drawable/my_edittext"
|
||||
android:gravity="top"
|
||||
android:text="@string/activity_text_format_sampletext" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/txtLeftMargin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_page_mode_left_margin"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/edtLeftMargin"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:maxLines="1"
|
||||
android:digits="0123456789"
|
||||
android:text="0"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/txtTopMargin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_page_mode_top_margin"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/edtTopMargin"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:maxLines="1"
|
||||
android:digits="0123456789"
|
||||
android:text="0"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/txtWidth"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_page_mode_width"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/edtWidth"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:maxLines="1"
|
||||
android:digits="0123456789"
|
||||
android:text="200"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/txtHeight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_page_mode_height"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/edtHeight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:maxLines="1"
|
||||
android:digits="0123456789"
|
||||
android:text="200"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/txtHPosition"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_page_mode_hposition"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/edtHPosition"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:maxLines="1"
|
||||
android:digits="0123456789"
|
||||
android:text="0"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:id="@+id/txtVPosition"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_page_mode_vposition"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/edtVPosition"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:maxLines="1"
|
||||
android:digits="0123456789"
|
||||
android:text="0"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<TextView
|
||||
android:id="@+id/itemName3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_page_mode_print_direction"
|
||||
android:textSize="20.0dip" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spnPrintDirection"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnPrint"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickPrint"
|
||||
android:text="@string/activity_global_print" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
208
app/src/main/res/layout/activity_pdf417.xml
Normal file
@@ -0,0 +1,208 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:gravity="center_vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ScrollView
|
||||
android:scrollbarAlwaysDrawVerticalTrack="false"
|
||||
android:id="@+id/preview_dashboard_v"
|
||||
android:background="#ffebebeb"
|
||||
android:scrollbars="vertical"
|
||||
android:fadingEdge="vertical"
|
||||
android:layout_width="0.0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1.0">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/itemName3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_qrcode_data"
|
||||
android:textSize="20.0dip" />
|
||||
<EditText
|
||||
android:id="@+id/txtpdf417Data"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="80sp"
|
||||
android:inputType="textMultiLine"
|
||||
android:background="@drawable/my_edittext"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:textStyle="bold" />
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_pdf417_dataColumns"
|
||||
android:textSize="20.0dip"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/txtpdf417dataColumns"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/my_edittext"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:hint="0 ≤ n ≤ 30"
|
||||
android:textStyle="bold"
|
||||
android:inputType="number"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_pdf417_dataRows"
|
||||
android:textSize="20.0dip"
|
||||
/>
|
||||
<EditText
|
||||
android:id="@+id/txtpdf417dataRows"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/my_edittext"
|
||||
android:textColor="#000000"
|
||||
android:textSize="20sp"
|
||||
android:hint="3 ≤ n ≤ 90"
|
||||
android:textStyle="bold"
|
||||
android:inputType="number"
|
||||
/>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<LinearLayout
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_pdf417_moduleWidth"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnpdf417moduleWidth"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_pdf417_rowHeight"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnpdf417rowHeight"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_pdf417_errorMode"
|
||||
android:textSize="20.0dip" />
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_pdf417_errorMode"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pdf417_hierarchicalMode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="20.0dip"
|
||||
android:text="@string/activity_pdf417_hierarchicalMode" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pdf417_RatioMode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="20.0dip"
|
||||
android:text="@string/activity_pdf417_RatioMode" />
|
||||
</RadioGroup>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_pdf417_errorLevel"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spn_pdf417_errorLevel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip" />
|
||||
</LinearLayout>
|
||||
<!-- <TextView
|
||||
android:id="@+id/itemName3"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_qrcode_model"
|
||||
android:textSize="20.0dip" />
|
||||
<Spinner
|
||||
android:id="@+id/spnQRCodeModel"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="20.0dip" /> -->
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/activity_pdf417_options"
|
||||
android:textSize="20.0dip" />
|
||||
<RadioGroup
|
||||
android:id="@+id/rg_pdf417_options"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" >
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pdf417_standardMode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="20.0dip"
|
||||
android:text="@string/activity_pdf417_standardMode" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_pdf417_compressionMode"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:textSize="20.0dip"
|
||||
android:text="@string/activity_pdf417_compressionMode" />
|
||||
</RadioGroup>
|
||||
<Button
|
||||
android:id="@+id/btnPrint"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="onClickPrint"
|
||||
android:text="@string/activity_global_print" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
26
app/src/main/res/layout/activity_print_image.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button android:id="@+id/btnPhoto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onClickPhoto"
|
||||
android:text="@string/activity_image_photo"/>
|
||||
|
||||
<Button android:id="@+id/btnGallery"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1.0"
|
||||
android:onClick="onClickGallery"
|
||||
android:text="@string/activity_image_gallery"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
12
app/src/main/res/layout/activity_prn_file.xml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="fill_parent"
|
||||
android:background="#ffffff"
|
||||
android:layout_height="fill_parent">
|
||||
|
||||
<ListView
|
||||
android:id="@+id/list"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:cacheColorHint="#00000000"/>
|
||||
</LinearLayout>
|
||||