├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── drawable │ │ │ │ ├── printer.png │ │ │ │ ├── d2code_black.png │ │ │ │ ├── connetpor_selector.xml │ │ │ │ ├── spiner_selector.xml │ │ │ │ ├── customer_button_selector.xml │ │ │ │ ├── radial_button_selector.xml │ │ │ │ └── square_button_selector.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_print_white_24dp.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_print_white_24dp.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_print_white_24dp.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_print_white_24dp.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_print_white_24dp.png │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── layout │ │ │ │ ├── usb_link.xml │ │ │ │ ├── activity_z76.xml │ │ │ │ ├── printer_list.xml │ │ │ │ ├── activity_tsc.xml │ │ │ │ ├── activity_pos.xml │ │ │ │ ├── activity_first.xml │ │ │ │ ├── activity_qrcode.xml │ │ │ │ └── activity_main.xml │ │ │ └── values-zh │ │ │ │ └── strings.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── xprinter │ │ │ │ └── posconsend │ │ │ │ ├── utils │ │ │ │ ├── StringUtils.java │ │ │ │ ├── Conts.java │ │ │ │ └── DeviceReceiver.java │ │ │ │ └── activity │ │ │ │ ├── Z76Activity.java │ │ │ │ ├── QRcodeActivity.java │ │ │ │ ├── TscActivity.java │ │ │ │ ├── PosActivity.java │ │ │ │ └── MainActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── xprinter │ │ │ └── posconsend │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── xprinter │ │ └── posconsend │ │ └── ExampleInstrumentedTest.java ├── libs │ └── posprinterconnectandsendsdk.jar ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── .idea ├── copyright │ └── profiles_settings.xml ├── vcs.xml ├── encodings.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml ├── compiler.xml └── misc.xml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── README.md ├── .gitignore ├── gradle.properties ├── gradlew.bat └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/printer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/drawable/printer.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PosConSend 2 | demo包含三种连接方式(蓝牙、USB、Wi-Fi) 3 | 打印测试: 4 |    先选择连接方式并且连接成功后就可以选择跳转到相应的打印测试 5 |    包含(pos、76、条码) 6 | ##界面显示 7 | -------------------------------------------------------------------------------- /app/libs/posprinterconnectandsendsdk.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/libs/posprinterconnectandsendsdk.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/d2code_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/drawable/d2code_black.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_print_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-hdpi/ic_print_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_print_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-mdpi/ic_print_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_print_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-xhdpi/ic_print_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_print_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-xxhdpi/ic_print_white_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_print_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/flytofall/PosConSend/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_print_white_24dp.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Dec 28 10:00:20 PST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/connetpor_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #18c117 7 | #0fa466 8 | #cccccc 9 | #ea0923 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/spiner_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/test/java/com/xprinter/posconsend/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.xprinter.posconsend; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/customer_button_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\kylin\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/usb_link.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/xprinter/posconsend/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.xprinter.posconsend; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.xprinter.posconsend", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/radial_button_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/square_button_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | 7 | aaptOptions { 8 | cruncherEnabled = false 9 | useNewCruncher = false 10 | 11 | } 12 | defaultConfig { 13 | applicationId "com.xprinter.posconsend" 14 | minSdkVersion 17 15 | targetSdkVersion 25 16 | versionCode 1 17 | versionName "1.0" 18 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 19 | ndk { 20 | abiFilters 'armeabi','x86'//or armeabi-v7a、arm64-v8a、x86 21 | } 22 | } 23 | buildTypes { 24 | release { 25 | minifyEnabled false 26 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | compile fileTree(include: ['*.jar'], dir: 'libs') 33 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 34 | exclude group: 'com.android.support', module: 'support-annotations' 35 | }) 36 | compile 'com.android.support:appcompat-v7:25.2.0' 37 | testCompile 'junit:junit:4.12' 38 | compile files('libs/posprinterconnectandsendsdk.jar') 39 | // material design 设计包 40 | compile 'com.android.support:design:25.3.1' 41 | //二维码 42 | compile 'com.github.open-android:Zxing:v1.0.3' 43 | //压缩 44 | compile 'com.zxy.android:tiny:0.0.6' 45 | 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/xprinter/posconsend/utils/StringUtils.java: -------------------------------------------------------------------------------- 1 | package com.xprinter.posconsend.utils; 2 | 3 | import java.io.UnsupportedEncodingException; 4 | 5 | /** 6 | * Created by kylin on 2017/4/6. 7 | */ 8 | 9 | public class StringUtils { 10 | /** 11 | * 字符串转byte数组 12 | * */ 13 | public static byte[] strTobytes(String str){ 14 | byte[] b=null,data=null; 15 | try { 16 | b = str.getBytes("utf-8"); 17 | data=new String(b,"utf-8").getBytes("gbk"); 18 | } catch (UnsupportedEncodingException e) { 19 | // TODO Auto-generated catch block 20 | e.printStackTrace(); 21 | } 22 | return data; 23 | } 24 | /** 25 | * byte数组拼接 26 | * */ 27 | public static byte[] byteMerger(byte[] byte_1, byte[] byte_2){ 28 | byte[] byte_3 = new byte[byte_1.length+byte_2.length]; 29 | System.arraycopy(byte_1, 0, byte_3, 0, byte_1.length); 30 | System.arraycopy(byte_2, 0, byte_3, byte_1.length, byte_2.length); 31 | return byte_3; 32 | } 33 | public static byte[] strTobytes(String str ,String charset){ 34 | byte[] b=null,data=null; 35 | try { 36 | b = str.getBytes("utf-8"); 37 | data=new String(b,"utf-8").getBytes(charset); 38 | } catch (UnsupportedEncodingException e) { 39 | // TODO Auto-generated catch block 40 | e.printStackTrace(); 41 | } 42 | return data; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/xprinter/posconsend/utils/Conts.java: -------------------------------------------------------------------------------- 1 | package com.xprinter.posconsend.utils; 2 | 3 | import java.util.HashMap; 4 | 5 | public class Conts { 6 | //public static final String ACTION_SELECT="android.net.xprinter.selectreceiver"; 7 | public static final String ACTION_EDIT="android.net.xprinter.receiver"; 8 | public static final String ACTION_FRAGMENT_LABEL_EDIT="android.net.xprinter.fragmentreceiver1"; 9 | public static final String ACTION_FRAGMENT_BARCODE_EDIT="android.net.xprinter.fragmentreceiver2"; 10 | public static final String ACTION_FRAGMENT_D2BARCODE_EDIT="android.net.xprinter.fragmentreceiver3"; 11 | public static final String ACTION_FRAGMENT_MOBAN1_EDIT="android.net.xprinter.fragmentreceiver4"; 12 | public static final String ACTION_FRAGMENT_MOBAN2_EDIT="android.net.xprinter.fragmentreceiver5"; 13 | public static final String ACTION_FRAGMENT_MOBAN3_EDIT="android.net.xprinter.fragmentreceiver6"; 14 | public static final String ACTION_FRAGMENT_MOBAN4_EDIT="android.net.xprinter.fragmentreceiver7"; 15 | public static final String ACTION_FRAGMENT_IMAGE_EDIT="android.net.xprinter.fragmentreceiver8"; 16 | public static final int ENABLE_BLUETOOTH=1; 17 | public static final int LABEL_PRINT=2; 18 | public static final int type_moban1=5; 19 | public static final int type_moban2=6; 20 | public static final int type_moban3=7; 21 | public static final int type_moban4=8; 22 | public static final int TAKE_PICTURE=100; 23 | public static final int LOAD_PICTURE_KITKAK=101; 24 | public static final int LOAD_PICTURE=102; 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_z76.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 15 | 16 |