修正addHR文字大小問題

This commit is contained in:
Jay 2017-09-03 10:34:04 +08:00
parent 41d7a1c4a3
commit 2197e6ab98
4 changed files with 17 additions and 5 deletions

View File

@ -3,9 +3,10 @@
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://D:\Project\ble-android-demo\BTDemo.iml" filepath="D:\Project\ble-android-demo\BTDemo.iml" />
<module fileurl="file://$PROJECT_DIR$/BTDemo.iml" filepath="$PROJECT_DIR$/BTDemo.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://D:\Project\ble-android-demo\app\app.iml" filepath="D:\Project\ble-android-demo\app\app.iml" />
<module fileurl="file://$PROJECT_DIR$/ble-android-demo.iml" filepath="$PROJECT_DIR$/ble-android-demo.iml" />
<module fileurl="file://D:\Project\ble-android-demo\ble-android-demo.iml" filepath="D:\Project\ble-android-demo\ble-android-demo.iml" />
</modules>
</component>
</project>

View File

@ -59,6 +59,8 @@ public class PrinterBle {
final public static int ALIGN_RIGHT = 0x02;
private int lastAlign = 0x00;
private int lastWidth = 1;
private int lastHeigh = 1;
// 藍芽狀態
public int mState = 0x00;
@ -412,20 +414,29 @@ public class PrinterBle {
public PrinterBle setSize(int w, int h) {
if (w < 1 || h < 1 || w > 3 || h > 3) return this;
lastWidth = w;
lastHeigh = h;
return addText(String.format("__&s%d,%d__", w, h));
}
public PrinterBle addHR() {
int align = this.lastAlign;
int w = lastWidth;
int h = lastHeigh;
setAlign(ALIGN_CENTER);
resetSize();
textNewLine();
addTextln(StringUtils.repeat('-', 20));
setAlign(align);
setSize(w, h);
return this;
}
public void resetSize() {
public PrinterBle resetSize() {
lastHeigh = 1;
lastWidth = 1;
setSize(1, 1);
return this;
}
public ArrayList<String> getDataQueue() {

View File

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta2'
classpath 'com.android.tools.build:gradle:3.0.0-beta4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Mon Aug 07 11:04:39 CST 2017
#Sun Sep 03 09:43:10 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-rc-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip