Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
supplier
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王宇航
supplier
Commits
4a8fc677
Commit
4a8fc677
authored
Jul 14, 2020
by
Wyh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
7.14 prj打印模板調整測試,prj打印報錯問題修復
parent
5fe03d9f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
105 additions
and
35 deletions
+105
-35
base-module/src/main/java/com/gingersoft/gsa/cloud/base/utils/okhttpUtils/OkHttp3Utils.java
+1
-1
login-module/src/main/res/layout/user_login_activity_login.xml
+2
-0
print-module/src/main/AndroidManifest.xml
+1
-0
print-module/src/main/java/com/joe/print/mvp/model/bean/PrintInfoBean.java
+3
-1
print-module/src/main/java/com/joe/print/mvp/print/EpsonPrint.java
+63
-17
print-module/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
+6
-4
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintTestActivity.java
+29
-12
No files found.
base-module/src/main/java/com/gingersoft/gsa/cloud/base/utils/okhttpUtils/OkHttp3Utils.java
View file @
4a8fc677
...
@@ -48,7 +48,7 @@ public class OkHttp3Utils {
...
@@ -48,7 +48,7 @@ public class OkHttp3Utils {
.
connectTimeout
(
GsaCloudApplication
.
REQUEST_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
connectTimeout
(
GsaCloudApplication
.
REQUEST_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
GsaCloudApplication
.
REQUEST_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
readTimeout
(
GsaCloudApplication
.
REQUEST_TIMEOUT
,
TimeUnit
.
SECONDS
)
.
addInterceptor
(
new
UserAgentIntercepter
())
.
addInterceptor
(
new
UserAgentIntercepter
())
//
.addInterceptor(new LoggingInterceptor())
.
addInterceptor
(
new
LoggingInterceptor
())
.
build
();
.
build
();
}
}
...
...
login-module/src/main/res/layout/user_login_activity_login.xml
View file @
4a8fc677
...
@@ -83,6 +83,7 @@
...
@@ -83,6 +83,7 @@
android:layout_toLeftOf=
"@id/iv_clear_account"
android:layout_toLeftOf=
"@id/iv_clear_account"
android:layout_toRightOf=
"@id/iv_account"
android:layout_toRightOf=
"@id/iv_account"
android:hint=
"請輸入賬戶名或手機號"
android:hint=
"請輸入賬戶名或手機號"
android:maxLines=
"1"
android:maxLength=
"16"
android:maxLength=
"16"
android:paddingRight=
"@dimen/dp_10"
/>
android:paddingRight=
"@dimen/dp_10"
/>
</RelativeLayout>
</RelativeLayout>
...
@@ -137,6 +138,7 @@
...
@@ -137,6 +138,7 @@
android:layout_toRightOf=
"@id/iv_pwd"
android:layout_toRightOf=
"@id/iv_pwd"
android:hint=
"輸入6~20個字符"
android:hint=
"輸入6~20個字符"
android:inputType=
"textPassword"
android:inputType=
"textPassword"
android:maxLines=
"1"
android:maxLength=
"20"
android:maxLength=
"20"
android:paddingRight=
"@dimen/dp_10"
/>
android:paddingRight=
"@dimen/dp_10"
/>
</RelativeLayout>
</RelativeLayout>
...
...
print-module/src/main/AndroidManifest.xml
View file @
4a8fc677
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
<meta-data
<meta-data
android:name=
"com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:name=
"com.gingersoft.gsa.cloud.globalconfig.GlobalConfiguration"
android:value=
"ConfigModule"
/>
android:value=
"ConfigModule"
/>
<activity
android:name=
".mvp.ui.activity.PrintTestActivity"
/>
</application>
</application>
...
...
print-module/src/main/java/com/joe/print/mvp/model/bean/PrintInfoBean.java
View file @
4a8fc677
...
@@ -11,7 +11,7 @@ public class PrintInfoBean {
...
@@ -11,7 +11,7 @@ public class PrintInfoBean {
private
int
[]
color
=
new
int
[]{
0
};
private
int
[]
color
=
new
int
[]{
0
};
private
double
[]
size
=
new
double
[]{
0
};
private
double
[]
size
=
new
double
[]{
1
};
//語言,每列是什麼語言
//語言,每列是什麼語言
private
String
[]
Language
=
new
String
[]{
"tw"
};
private
String
[]
Language
=
new
String
[]{
"tw"
};
...
@@ -38,6 +38,8 @@ public class PrintInfoBean {
...
@@ -38,6 +38,8 @@ public class PrintInfoBean {
Language
=
language
;
Language
=
language
;
}
}
public
PrintInfoBean
(
String
[]
content
,
int
gravity
)
{
public
PrintInfoBean
(
String
[]
content
,
int
gravity
)
{
this
.
content
=
content
;
this
.
content
=
content
;
this
.
gravity
=
gravity
;
this
.
gravity
=
gravity
;
...
...
print-module/src/main/java/com/joe/print/mvp/print/EpsonPrint.java
View file @
4a8fc677
...
@@ -78,6 +78,13 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -78,6 +78,13 @@ public class EpsonPrint implements ReceiveListener {
}
}
}
}
public
PrinterStatusInfo
getStatus
()
{
if
(
mPrinter
==
null
)
{
return
null
;
}
return
mPrinter
.
getStatus
();
}
public
void
finalizeObject
()
{
public
void
finalizeObject
()
{
if
(
mPrinter
==
null
)
{
if
(
mPrinter
==
null
)
{
return
;
return
;
...
@@ -252,11 +259,12 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -252,11 +259,12 @@ public class EpsonPrint implements ReceiveListener {
mPrinter
.
addTextAlign
(
Printer
.
ALIGN_RIGHT
);
mPrinter
.
addTextAlign
(
Printer
.
ALIGN_RIGHT
);
}
}
//如果打印多列內容,並且字體大小配置多個,則每一列取自己對應的字體大小
//如果打印多列內容,並且字體大小配置多個,則每一列取自己對應的字體大小
for
(
int
i
=
0
;
i
<
printInfoBean
.
get
Size
().
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
printInfoBean
.
get
Content
().
length
;
i
++)
{
print
(
printInfoBean
,
i
);
print
(
printInfoBean
,
i
);
}
}
mPrinter
.
addFeedLine
(
1
);
mPrinter
.
addFeedLine
(
1
);
}
}
mPrinter
.
addPulse
(
Printer
.
DRAWER_LOW
,
Printer
.
PULSE_100
);
mPrinter
.
addCut
(
Printer
.
CUT_FEED
);
mPrinter
.
addCut
(
Printer
.
CUT_FEED
);
mPrinter
.
sendData
(
Printer
.
PARAM_DEFAULT
);
mPrinter
.
sendData
(
Printer
.
PARAM_DEFAULT
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -265,38 +273,76 @@ public class EpsonPrint implements ReceiveListener {
...
@@ -265,38 +273,76 @@ public class EpsonPrint implements ReceiveListener {
}
}
}
}
private
int
location
=
0
;
private
void
print
(
PrintInfoBean
printInfoBean
,
int
i
)
throws
Epos2Exception
{
private
void
print
(
PrintInfoBean
printInfoBean
,
int
i
)
throws
Epos2Exception
{
if
(
printInfoBean
.
getIsBold
()[
i
])
{
if
(
i
==
0
)
{
mPrinter
.
addTextStyle
(
0
,
0
,
0
,
Printer
.
COLOR_1
);
location
=
0
;
}
if
(
printInfoBean
.
getIsBold
().
length
==
1
)
{
mPrinter
.
addTextStyle
(
0
,
0
,
printInfoBean
.
getIsBold
()[
0
]
?
1
:
0
,
Printer
.
COLOR_1
);
}
else
{
}
else
{
mPrinter
.
addTextStyle
(
0
,
0
,
1
,
Printer
.
COLOR_1
);
if
(
printInfoBean
.
getIsBold
()[
i
])
{
mPrinter
.
addTextStyle
(
0
,
0
,
0
,
Printer
.
COLOR_1
);
}
else
{
mPrinter
.
addTextStyle
(
0
,
0
,
1
,
Printer
.
COLOR_1
);
}
}
}
StringBuilder
space
=
new
StringBuilder
();
if
(
printInfoBean
.
getSize
()[
i
]
==
1
)
{
if
(
printInfoBean
.
getSize
().
length
==
1
)
{
mPrinter
.
addTextSize
(
1
,
1
);
for
(
int
j
=
0
;
j
<
location
/
printInfoBean
.
getSize
()[
0
];
j
++)
{
space
.
append
(
" "
);
}
mPrinter
.
addTextSize
((
int
)
printInfoBean
.
getSize
()[
0
],
(
int
)
printInfoBean
.
getSize
()[
0
]);
location
+=
printInfoBean
.
getContent
()[
i
].
length
()
*
printInfoBean
.
getSize
()[
0
];
}
else
{
}
else
{
mPrinter
.
addTextSize
(
2
,
2
);
for
(
int
j
=
0
;
j
<
location
/
printInfoBean
.
getSize
()[
i
];
j
++)
{
space
.
append
(
" "
);
}
mPrinter
.
addTextSize
((
int
)
printInfoBean
.
getSize
()[
i
],
(
int
)
printInfoBean
.
getSize
()[
i
]);
location
+=
printInfoBean
.
getContent
()[
i
].
length
()
*
printInfoBean
.
getSize
()[
i
];
}
if
(
printInfoBean
.
getLanguage
().
length
==
1
)
{
setLanguage
(
printInfoBean
.
getLanguage
()[
0
]);
}
else
{
setLanguage
(
printInfoBean
.
getLanguage
()[
i
]);
}
}
mPrinter
.
addText
(
space
+
printInfoBean
.
getContent
()[
i
]);
// mPrinter.addLineSpace(100);//行間距
}
if
(
"en"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]))
{
private
void
setLanguage
(
String
language
)
throws
Epos2Exception
{
if
(
"en"
.
equals
(
language
))
{
//切換對應語言
//切換對應語言
mPrinter
.
addTextLang
(
Printer
.
LANG_EN
);
mPrinter
.
addTextLang
(
Printer
.
LANG_EN
);
}
else
if
(
"ja"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]
))
{
}
else
if
(
"ja"
.
equals
(
language
))
{
mPrinter
.
addTextLang
(
Printer
.
LANG_JA
);
mPrinter
.
addTextLang
(
Printer
.
LANG_JA
);
}
else
if
(
"cn"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]
))
{
}
else
if
(
"cn"
.
equals
(
language
))
{
mPrinter
.
addTextLang
(
Printer
.
LANG_ZH_CN
);
mPrinter
.
addTextLang
(
Printer
.
LANG_ZH_CN
);
}
else
if
(
"tw"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]
))
{
}
else
if
(
"tw"
.
equals
(
language
))
{
mPrinter
.
addTextLang
(
Printer
.
LANG_ZH_TW
);
mPrinter
.
addTextLang
(
Printer
.
LANG_ZH_TW
);
}
else
if
(
"ko"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]
))
{
}
else
if
(
"ko"
.
equals
(
language
))
{
mPrinter
.
addTextLang
(
Printer
.
LANG_KO
);
mPrinter
.
addTextLang
(
Printer
.
LANG_KO
);
}
else
if
(
"th"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]
))
{
}
else
if
(
"th"
.
equals
(
language
))
{
mPrinter
.
addTextLang
(
Printer
.
LANG_TH
);
mPrinter
.
addTextLang
(
Printer
.
LANG_TH
);
}
else
if
(
"vi"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]
))
{
}
else
if
(
"vi"
.
equals
(
language
))
{
mPrinter
.
addTextLang
(
Printer
.
LANG_VI
);
mPrinter
.
addTextLang
(
Printer
.
LANG_VI
);
}
else
if
(
"multi"
.
equals
(
printInfoBean
.
getLanguage
()[
i
]
))
{
}
else
if
(
"multi"
.
equals
(
language
))
{
mPrinter
.
addTextLang
(
Printer
.
LANG_MULTI
);
mPrinter
.
addTextLang
(
Printer
.
LANG_MULTI
);
}
}
mPrinter
.
addText
(
printInfoBean
.
getContent
()[
i
]);
}
public
static
double
getChineseValueLength
(
String
value
)
{
double
valueLength
=
0
;
String
chinese
=
"[\u4e00-\u9fa5]"
;
for
(
int
i
=
0
;
i
<
value
.
length
();
i
++)
{
String
temp
=
value
.
substring
(
i
,
i
+
1
);
if
(
temp
.
matches
(
chinese
))
{
valueLength
+=
1.5
;
}
else
{
valueLength
+=
1
;
}
}
return
valueLength
;
}
}
public
int
putPrintData
(
String
ip
,
Bitmap
bitmap
)
{
public
int
putPrintData
(
String
ip
,
Bitmap
bitmap
)
{
...
...
print-module/src/main/java/com/joe/print/mvp/print/PrinterRoot.java
View file @
4a8fc677
...
@@ -711,10 +711,12 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
...
@@ -711,10 +711,12 @@ public abstract class PrinterRoot implements PrintSocketHolder.OnStateChangedLis
@Override
@Override
public
void
onPtrReceive
(
Printer
printer
,
int
i
,
PrinterStatusInfo
printerStatusInfo
,
String
s
)
{
public
void
onPtrReceive
(
Printer
printer
,
int
i
,
PrinterStatusInfo
printerStatusInfo
,
String
s
)
{
Log
.
e
(
"eee"
,
"EPSON打印結果:"
+
i
);
Log
.
e
(
"eee"
,
"EPSON打印結果:"
+
i
);
if
(
i
==
0
)
{
if
(
printListener
!=
null
)
{
printListener
.
printSuccess
();
if
(
i
==
0
)
{
}
else
{
printListener
.
printSuccess
();
printListener
.
printFile
();
}
else
{
printListener
.
printFile
();
}
}
}
// EpsonPrint.getInstance().disconnectPrinter();
// EpsonPrint.getInstance().disconnectPrinter();
// EpsonPrint.getInstance().finalizeObject();
// EpsonPrint.getInstance().finalizeObject();
...
...
print-module/src/main/java/com/joe/print/mvp/ui/activity/PrintTestActivity.java
View file @
4a8fc677
...
@@ -4,7 +4,9 @@ import android.os.Bundle;
...
@@ -4,7 +4,9 @@ import android.os.Bundle;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.epson.epos2.printer.PrinterStatusInfo
;
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.base.application.GsaCloudApplication
;
import
com.gingersoft.gsa.cloud.base.utils.toast.ToastUtils
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.database.bean.PrinterDeviceBean
;
import
com.gingersoft.gsa.cloud.print.PrintExecutor
;
import
com.gingersoft.gsa.cloud.print.PrintExecutor
;
import
com.gingersoft.gsa.cloud.print.PrintSocketHolder
;
import
com.gingersoft.gsa.cloud.print.PrintSocketHolder
;
...
@@ -18,6 +20,8 @@ import java.util.List;
...
@@ -18,6 +20,8 @@ import java.util.List;
public
class
PrintTestActivity
extends
AppCompatActivity
implements
PrintSocketHolder
.
OnStateChangedListener
,
PrintExecutor
.
OnPrintResultListener
{
public
class
PrintTestActivity
extends
AppCompatActivity
implements
PrintSocketHolder
.
OnStateChangedListener
,
PrintExecutor
.
OnPrintResultListener
{
private
int
lineLength
=
24
;
//一行42個
private
int
lineLength
=
24
;
//一行42個
private
int
LEFT_TEXT_LENGTH
=
8
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -26,16 +30,20 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
...
@@ -26,16 +30,20 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
PrinterDeviceBean
printerDeviceBean
=
new
PrinterDeviceBean
(
"192.168.1.218"
,
9100
,
"400"
);
PrinterDeviceBean
printerDeviceBean
=
new
PrinterDeviceBean
(
"192.168.1.218"
,
9100
,
"400"
);
List
<
PrintInfoBean
>
printInfoBeans
=
new
ArrayList
<>();
List
<
PrintInfoBean
>
printInfoBeans
=
new
ArrayList
<>();
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"測試一行多少個字測試一行多少個字測試一"
},
new
double
[]{
2
},
new
String
[]{
"tw"
}));
// printInfoBeans.add(new PrintInfoBean(new String[]{"測試一行多少個字測試一行多少個字測試一"}, new double[]{2}, new String[]{"tw"}));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"asdfskjflsjflsjlfjslfjsldjflsjfsd"
},
new
double
[]{
2
},
new
String
[]{
"tw"
}));
// printInfoBeans.add(new PrintInfoBean(new String[]{"asdfskjflsjflsjlfjslfjsldjflsjfsd"}, new double[]{2}, new String[]{"tw"}));
// printInfoBeans.add(new PrintInfoBean(new String[]{"測試一行多少個字測試一行多少個字測試一"}, new double[]{1}, new String[]{"tw"}));
// printInfoBeans.add(new PrintInfoBean(new String[]{"asdfskjflsjflsjlfjslfjsldjflsjfsd"}, new double[]{1}, new String[]{"tw"}));
// printInfoBeans.add(new PrintInfoBean(new String[]{"純屬餐廳"}, new double[]{1}, new String[]{"tw"}));
// printInfoBeans.add(new PrintInfoBean(new String[]{"純屬餐廳"}, new double[]{1}, new String[]{"tw"}));
//
//
// printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("自取", 2)}, new Boolean[]{true}, new double[]{2}, new String[]{"tw"}));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"外賣"
},
new
Boolean
[]{
true
},
new
double
[]{
2
},
0
));
//
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"訂單碼: "
,
"0046"
},
new
Boolean
[]{
false
,
true
},
new
double
[]{
1
,
2
},
0
));
// printInfoBeans.add(new PrintInfoBean(new String[]{"貨到付款"}, new Boolean[]{true}, new double[]{2}, new String[]{"tw"}));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"落單時間: "
,
"07-13 19:05"
},
new
double
[]{
1
},
0
));
// printInfoBeans.add(new PrintInfoBean(new String[]{"07-08(週三)立即"}, new double[]{2}, new String[]{"tw"}));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"D1廚房 "
,
"BARRY1"
},
new
double
[]{
1
},
0
));
// printInfoBeans.add(new PrintInfoBean(new String[]{getLineBorder("", 1)}, new String[]{"tw"}));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
getLineBorder
(
""
,
1
)},
0
));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"1"
,
"食品名稱"
},
new
Boolean
[]{
true
},
new
double
[]{
2
},
0
));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"1"
,
" 細項名稱"
},
new
Boolean
[]{
true
},
new
double
[]{
2
},
0
));
printInfoBeans
.
add
(
new
PrintInfoBean
(
new
String
[]{
"外賣"
},
new
Boolean
[]{
true
},
new
double
[]{
2
},
1
));
findViewById
(
R
.
id
.
btn_test
).
setOnClickListener
(
view
->
{
findViewById
(
R
.
id
.
btn_test
).
setOnClickListener
(
view
->
{
//打印測試
//打印測試
...
@@ -52,6 +60,10 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
...
@@ -52,6 +60,10 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
// executor.doPrinterRequestAsync(maker);
// executor.doPrinterRequestAsync(maker);
EpsonPrint
mPrinter
=
EpsonPrint
.
getInstance
();
EpsonPrint
mPrinter
=
EpsonPrint
.
getInstance
();
PrinterStatusInfo
status
=
mPrinter
.
getStatus
();
if
(
status
!=
null
&&
status
.
getPaper
()
==
2
)
{
ToastUtils
.
show
(
this
,
"缺紙了"
);
}
mPrinter
.
initializeObject
(
GsaCloudApplication
.
getAppContext
(),
null
);
mPrinter
.
initializeObject
(
GsaCloudApplication
.
getAppContext
(),
null
);
mPrinter
.
putPrintString
(
"192.168.1.203"
,
printInfoBeans
);
mPrinter
.
putPrintString
(
"192.168.1.203"
,
printInfoBeans
);
...
@@ -73,12 +85,17 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
...
@@ -73,12 +85,17 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
}
}
private
String
getLineBorder
(
String
text
,
double
fontSize
)
{
private
String
getLineBorder
(
String
text
,
double
fontSize
)
{
if
(
fontSize
==
0
)
{
if
(
fontSize
==
0
)
{
fontSize
=
1
;
fontSize
=
1
;
}
}
//中文字符個數,Epson打印機每個中文字符佔1.5格
int
count
=
(
int
)
((
lineLength
/
fontSize
)
-
text
.
length
());
double
cnCount
=
getChineseValueLength
(
text
);
int
count
=
(
int
)
Math
.
floor
(((
lineLength
/
fontSize
)
-
cnCount
));
if
(
count
<=
0
)
{
return
text
;
}
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
count
/
2
;
i
++)
{
for
(
int
i
=
0
;
i
<
count
/
2
;
i
++)
{
builder
.
append
(
"-"
);
builder
.
append
(
"-"
);
...
@@ -90,8 +107,8 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
...
@@ -90,8 +107,8 @@ public class PrintTestActivity extends AppCompatActivity implements PrintSocketH
return
builder
.
toString
();
return
builder
.
toString
();
}
}
public
static
int
getChineseValueLength
(
String
value
)
{
public
static
double
getChineseValueLength
(
String
value
)
{
int
valueLength
=
0
;
double
valueLength
=
0
;
String
chinese
=
"[\u4e00-\u9fa5]"
;
String
chinese
=
"[\u4e00-\u9fa5]"
;
for
(
int
i
=
0
;
i
<
value
.
length
();
i
++)
{
for
(
int
i
=
0
;
i
<
value
.
length
();
i
++)
{
String
temp
=
value
.
substring
(
i
,
i
+
1
);
String
temp
=
value
.
substring
(
i
,
i
+
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment