Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MiYaFastCashier
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangjiantao
MiYaFastCashier
Commits
c519909e
Commit
c519909e
authored
May 23, 2022
by
赵鹏翔
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java to kotlin
parent
5d0b76ed
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
612 additions
and
449 deletions
+612
-449
CustomImageCenterDialog.java
...ava/com/miya/fastcashier/log/CustomImageCenterDialog.java
+0
-153
CustomImageCenterDialog.kt
.../java/com/miya/fastcashier/log/CustomImageCenterDialog.kt
+143
-0
FileComparator.kt
app/src/main/java/com/miya/fastcashier/log/FileComparator.kt
+25
-0
LFileFilter.java
app/src/main/java/com/miya/fastcashier/log/LFileFilter.java
+0
-33
LFileFilter.kt
app/src/main/java/com/miya/fastcashier/log/LFileFilter.kt
+26
-0
LFilePicker.kt
app/src/main/java/com/miya/fastcashier/log/LFilePicker.kt
+300
-0
LFilePickerActivity.java
...in/java/com/miya/fastcashier/log/LFilePickerActivity.java
+1
-1
ParamEntity.java
app/src/main/java/com/miya/fastcashier/log/ParamEntity.java
+0
-165
ParamEntity.kt
app/src/main/java/com/miya/fastcashier/log/ParamEntity.kt
+30
-0
SystemParameterDialog.java
.../java/com/miya/fastcashier/log/SystemParameterDialog.java
+0
-97
SystemParameterDialog.kt
...in/java/com/miya/fastcashier/log/SystemParameterDialog.kt
+87
-0
No files found.
app/src/main/java/com/miya/fastcashier/log/CustomImageCenterDialog.java
deleted
100644 → 0
View file @
5d0b76ed
package
com
.
miya
.
fastcashier
.
log
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.os.Build
;
import
android.text.TextUtils
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.blankj.utilcode.util.SizeUtils
;
import
com.miya.fastcashier.R
;
import
com.miya.print.utils.QRCodeUtil
;
import
androidx.annotation.NonNull
;
public
class
CustomImageCenterDialog
extends
Dialog
{
private
TextView
tvOk
;
private
TextView
tvHint
;
private
ImageView
ivContent
;
boolean
isFullScreen
;
private
String
mImageContent
;
private
String
mHintContentText
;
private
String
mConfirmContent
;
private
Bitmap
mQrCodeBitmap
;
/**
* 设置是否全屏显示
*
* @param isFullScreen
* @return
*/
public
CustomImageCenterDialog
setFullScreen
(
boolean
isFullScreen
)
{
this
.
isFullScreen
=
isFullScreen
;
return
this
;
}
@Override
public
void
onWindowFocusChanged
(
boolean
hasFocus
)
{
super
.
onWindowFocusChanged
(
hasFocus
);
if
(
isFullScreen
)
{
setFullScreen
();
}
}
/**
* 隐藏虚拟按键,并且全屏
*/
protected
void
setFullScreen
()
{
//隐藏虚拟按键,并且全屏
if
(
Build
.
VERSION
.
SDK_INT
>
11
&&
Build
.
VERSION
.
SDK_INT
<
19
)
{
// lower api
View
v
=
this
.
getWindow
().
getDecorView
();
v
.
setSystemUiVisibility
(
View
.
GONE
);
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
//for new api versions.
View
decorView
=
getWindow
().
getDecorView
();
int
uiOptions
=
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION//暂时不需要hideNavigation
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
View
.
SYSTEM_UI_FLAG_FULLSCREEN
// hide status bar
|
View
.
SYSTEM_UI_FLAG_IMMERSIVE_STICKY
;
decorView
.
setSystemUiVisibility
(
uiOptions
);
getWindow
().
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
);
}
}
public
CustomImageCenterDialog
(
@NonNull
Context
context
)
{
super
(
context
,
R
.
style
.
CommonDialog
);
initWindows
();
setCanceledOnTouchOutside
(
false
);
setContentView
(
R
.
layout
.
dialog_center_image
);
setCancelable
(
true
);
initView
();
}
private
void
initView
()
{
tvOk
=
findViewById
(
R
.
id
.
tvOk
);
tvHint
=
findViewById
(
R
.
id
.
tvSubContent
);
ivContent
=
findViewById
(
R
.
id
.
ivContent
);
}
public
CustomImageCenterDialog
setQrContent
(
String
msg
)
{
mImageContent
=
msg
;
return
this
;
}
public
CustomImageCenterDialog
setConfirmContent
(
String
msg
)
{
mConfirmContent
=
msg
;
return
this
;
}
public
CustomImageCenterDialog
setHintContent
(
String
msg
)
{
mHintContentText
=
msg
;
return
this
;
}
/**
* 创建dialog
*
* @return
*/
public
CustomImageCenterDialog
build
()
{
if
(!
TextUtils
.
isEmpty
(
mConfirmContent
)){
tvOk
.
setText
(
mConfirmContent
);
}
if
(!
TextUtils
.
isEmpty
(
mHintContentText
)){
tvHint
.
setText
(
mHintContentText
);
}
if
(!
TextUtils
.
isEmpty
(
mImageContent
)){
mQrCodeBitmap
=
QRCodeUtil
.
createQRCodeBitmap
(
mImageContent
,
SizeUtils
.
dp2px
(
300
));
ivContent
.
setImageBitmap
(
mQrCodeBitmap
);
}
tvOk
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
mQrCodeBitmap
!=
null
)
{
mQrCodeBitmap
.
recycle
();
}
dismiss
();
}
});
if
(
isFullScreen
)
{
setFullScreen
();
}
return
this
;
}
/**
* 初始化对话框(供子类选择调用)
*/
protected
void
initWindows
()
{
Window
win
=
this
.
getWindow
();
win
.
requestFeature
(
Window
.
FEATURE_NO_TITLE
);
win
.
getDecorView
().
setPadding
(
0
,
0
,
0
,
0
);
WindowManager
.
LayoutParams
lp
=
win
.
getAttributes
();
lp
.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
;
lp
.
height
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
;
// lp.windowAnimations = R.style.LightInAndOutStyle;
lp
.
gravity
=
Gravity
.
CENTER
;
win
.
setAttributes
(
lp
);
win
.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
);
}
}
app/src/main/java/com/miya/fastcashier/log/CustomImageCenterDialog.kt
0 → 100644
View file @
c519909e
package
com.miya.fastcashier.log
import
android.app.Dialog
import
android.content.Context
import
com.miya.fastcashier.R
import
android.widget.TextView
import
android.graphics.Bitmap
import
com.miya.fastcashier.log.CustomImageCenterDialog
import
android.os.Build
import
android.view.WindowManager
import
android.text.TextUtils
import
com.miya.print.utils.QRCodeUtil
import
com.blankj.utilcode.util.SizeUtils
import
android.view.Gravity
import
android.view.View
import
android.view.Window
import
android.widget.ImageView
class
CustomImageCenterDialog
(
context
:
Context
)
:
Dialog
(
context
,
R
.
style
.
CommonDialog
)
{
private
var
tvOk
:
TextView
?
=
null
private
var
tvHint
:
TextView
?
=
null
private
var
ivContent
:
ImageView
?
=
null
var
isFullScreen
=
false
private
var
mImageContent
:
String
?
=
null
private
var
mHintContentText
:
String
?
=
null
private
var
mConfirmContent
:
String
?
=
null
private
var
mQrCodeBitmap
:
Bitmap
?
=
null
override
fun
onWindowFocusChanged
(
hasFocus
:
Boolean
)
{
super
.
onWindowFocusChanged
(
hasFocus
)
if
(
isFullScreen
)
{
setFullScreen
()
}
}
/**
* 隐藏虚拟按键,并且全屏
*/
protected
fun
setFullScreen
()
{
//隐藏虚拟按键,并且全屏
if
(
Build
.
VERSION
.
SDK_INT
>
11
&&
Build
.
VERSION
.
SDK_INT
<
19
)
{
// lower api
val
v
=
this
.
window
!!
.
decorView
v
.
systemUiVisibility
=
View
.
GONE
}
else
if
(
Build
.
VERSION
.
SDK_INT
>=
19
)
{
//for new api versions.
val
decorView
=
window
!!
.
decorView
val
uiOptions
=
(
View
.
SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION//暂时不需要hideNavigation
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
or
View
.
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
or
View
.
SYSTEM_UI_FLAG_FULLSCREEN
// hide status bar
or
View
.
SYSTEM_UI_FLAG_IMMERSIVE_STICKY
)
decorView
.
systemUiVisibility
=
uiOptions
window
!!
.
addFlags
(
WindowManager
.
LayoutParams
.
FLAG_TRANSLUCENT_NAVIGATION
)
}
}
private
fun
initView
()
{
tvOk
=
findViewById
(
R
.
id
.
tvOk
)
tvHint
=
findViewById
(
R
.
id
.
tvSubContent
)
ivContent
=
findViewById
(
R
.
id
.
ivContent
)
}
/**
* 设置是否全屏显示
*
* @param isFullScreen
* @return
*/
fun
setFullScreenStatus
(
isFullScreen
:
Boolean
):
CustomImageCenterDialog
{
this
.
isFullScreen
=
isFullScreen
return
this
}
fun
setQrContent
(
msg
:
String
?):
CustomImageCenterDialog
{
mImageContent
=
msg
return
this
}
fun
setConfirmContent
(
msg
:
String
?):
CustomImageCenterDialog
{
mConfirmContent
=
msg
return
this
}
fun
setHintContent
(
msg
:
String
?):
CustomImageCenterDialog
{
mHintContentText
=
msg
return
this
}
/**
* 创建dialog
*
* @return
*/
fun
build
():
CustomImageCenterDialog
{
if
(!
TextUtils
.
isEmpty
(
mConfirmContent
))
{
tvOk
!!
.
text
=
mConfirmContent
}
if
(!
TextUtils
.
isEmpty
(
mHintContentText
))
{
tvHint
!!
.
text
=
mHintContentText
}
if
(!
TextUtils
.
isEmpty
(
mImageContent
))
{
mQrCodeBitmap
=
QRCodeUtil
.
createQRCodeBitmap
(
mImageContent
,
SizeUtils
.
dp2px
(
300f
))
ivContent
!!
.
setImageBitmap
(
mQrCodeBitmap
)
}
tvOk
!!
.
setOnClickListener
{
if
(
mQrCodeBitmap
!=
null
)
{
mQrCodeBitmap
!!
.
recycle
()
}
dismiss
()
}
if
(
isFullScreen
)
{
setFullScreen
()
}
return
this
}
/**
* 初始化对话框(供子类选择调用)
*/
protected
fun
initWindows
()
{
val
win
=
this
.
window
win
!!
.
requestFeature
(
Window
.
FEATURE_NO_TITLE
)
win
.
decorView
.
setPadding
(
0
,
0
,
0
,
0
)
val
lp
=
win
.
attributes
lp
.
width
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
lp
.
height
=
WindowManager
.
LayoutParams
.
MATCH_PARENT
// lp.windowAnimations = R.style.LightInAndOutStyle;
lp
.
gravity
=
Gravity
.
CENTER
win
.
attributes
=
lp
win
.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
)
}
init
{
initWindows
()
setCanceledOnTouchOutside
(
false
)
setContentView
(
R
.
layout
.
dialog_center_image
)
setCancelable
(
true
)
initView
()
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/log/FileComparator.
java
→
app/src/main/java/com/miya/fastcashier/log/FileComparator.
kt
View file @
c519909e
package
com
.
miya
.
fastcashier
.
log
;
package
com.miya.fastcashier.log
import
java.io.File
;
import
java.util.Comparator
;
import
java.io.File
import
java.util.Comparator
/**
* Created by Dimorinny on 24.10.15.
*/
public
class
FileComparator
implements
Comparator
<
File
>
{
@Override
public
int
compare
(
File
f1
,
File
f2
)
{
if
(
f1
==
f2
)
{
return
0
;
class
FileComparator
:
Comparator
<
File
>
{
override
fun
compare
(
f1
:
File
,
f2
:
File
):
Int
{
if
(
f1
=
==
f2
)
{
return
0
}
if
(
f1
.
isDirectory
()
&&
f2
.
isFile
()
)
{
if
(
f1
.
isDirectory
&&
f2
.
isFile
)
{
// Show directories above files
return
-
1
;
return
-
1
}
if
(
f1
.
isFile
()
&&
f2
.
isDirectory
()
)
{
return
if
(
f1
.
isFile
&&
f2
.
isDirectory
)
{
// Show files below directories
return
1
;
}
1
}
else
f1
.
name
.
compareTo
(
f2
.
name
,
ignoreCase
=
true
)
// Sort the directories alphabetically
return
f1
.
getName
().
compareToIgnoreCase
(
f2
.
getName
());
}
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/log/LFileFilter.java
deleted
100644 → 0
View file @
5d0b76ed
package
com
.
miya
.
fastcashier
.
log
;
import
java.io.File
;
import
java.io.FileFilter
;
/**
* 作者:Leon
* 时间:2017/3/24 13:43
*/
public
class
LFileFilter
implements
FileFilter
{
private
String
[]
mTypes
;
public
LFileFilter
(
String
[]
types
)
{
this
.
mTypes
=
types
;
}
@Override
public
boolean
accept
(
File
file
)
{
if
(
file
.
isDirectory
())
{
return
true
;
}
if
(
mTypes
!=
null
&&
mTypes
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
mTypes
.
length
;
i
++)
{
if
(
file
.
getName
().
endsWith
(
mTypes
[
i
].
toLowerCase
())
||
file
.
getName
().
endsWith
(
mTypes
[
i
].
toUpperCase
()))
{
return
true
;
}
}
}
else
{
return
true
;
}
return
false
;
}
}
app/src/main/java/com/miya/fastcashier/log/LFileFilter.kt
0 → 100644
View file @
c519909e
package
com.miya.fastcashier.log
import
java.io.File
import
java.io.FileFilter
/**
* 作者:Leon
* 时间:2017/3/24 13:43
*/
class
LFileFilter
(
private
val
mTypes
:
Array
<
String
>?)
:
FileFilter
{
override
fun
accept
(
file
:
File
):
Boolean
{
if
(
file
.
isDirectory
)
{
return
true
}
if
(
mTypes
!=
null
&&
mTypes
.
size
>
0
)
{
for
(
i
in
mTypes
.
indices
)
{
if
(
file
.
name
.
endsWith
(
mTypes
[
i
].
toLowerCase
())
||
file
.
name
.
endsWith
(
mTypes
[
i
].
toUpperCase
()))
{
return
true
}
}
}
else
{
return
true
}
return
false
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/log/LFilePicker.
java
→
app/src/main/java/com/miya/fastcashier/log/LFilePicker.
kt
View file @
c519909e
package
com
.
miya
.
fastcashier
.
log
;
package
com.miya.fastcashier.log
import
android.app.Activity
;
import
android.app.Fragment
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
com.miya.fastcashier.R
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.StyleRes
;
import
android.app.Activity
import
android.app.Fragment
import
android.content.Intent
import
android.os.Bundle
import
androidx.annotation.StyleRes
import
com.miya.fastcashier.R
/**
* 作者:Leon
* 时间:2017/3/20 16:57
*/
public
class
LFilePicker
{
private
Activity
mActivity
;
private
Fragment
mFragment
;
private
String
mTitle
;
private
String
mTitleColor
;
private
int
theme
=
R
.
style
.
LFileTheme
;
private
int
mTitleStyle
=
R
.
style
.
LFileToolbarTextStyle
;
private
String
mBackgroundColor
;
private
int
mBackStyle
;
private
int
mRequestCode
;
private
boolean
mMutilyMode
=
true
;
private
boolean
mChooseMode
=
true
;
private
String
mAddText
;
private
int
mIconStyle
;
private
String
[]
mFileTypes
;
private
String
mNotFoundFiles
;
private
int
mMaxNum
;
private
String
mStartPath
;
private
boolean
mIsGreater
=
true
;
//是否大于
private
long
mFileSize
;
private
String
mFileName
;
class
LFilePicker
{
private
var
mActivity
:
Activity
?
=
null
private
var
mFragment
:
Fragment
?
=
null
private
var
mTitle
:
String
?
=
null
private
var
mTitleColor
:
String
?
=
null
private
var
theme
=
R
.
style
.
LFileTheme
private
var
mTitleStyle
=
R
.
style
.
LFileToolbarTextStyle
private
var
mBackgroundColor
:
String
?
=
null
private
var
mBackStyle
=
0
private
var
mRequestCode
=
0
private
var
mMutilyMode
=
true
private
var
mChooseMode
=
true
private
var
mAddText
:
String
?
=
null
private
var
mIconStyle
=
0
private
var
mFileTypes
:
Array
<
String
>?
=
null
private
var
mNotFoundFiles
:
String
?
=
null
private
var
mMaxNum
=
0
private
var
mStartPath
:
String
?
=
null
private
var
mIsGreater
=
true
//是否大于
private
var
mFileSize
:
Long
=
0
private
var
mFileName
:
String
?
=
null
/**
* 绑定Activity
...
...
@@ -42,9 +39,9 @@ public class LFilePicker {
* @param activity
* @return
*/
public
LFilePicker
withActivity
(
Activity
activity
)
{
this
.
mActivity
=
activity
;
return
this
;
fun
withActivity
(
activity
:
Activity
?):
LFilePicker
{
mActivity
=
activity
return
this
}
/**
...
...
@@ -53,9 +50,9 @@ public class LFilePicker {
* @param fragment
* @return
*/
public
LFilePicker
withFragment
(
Fragment
fragment
)
{
this
.
mFragment
=
fragment
;
return
this
;
fun
withFragment
(
fragment
:
Fragment
?):
LFilePicker
{
mFragment
=
fragment
return
this
}
/**
...
...
@@ -64,9 +61,9 @@ public class LFilePicker {
* @param title
* @return
*/
public
LFilePicker
withTitle
(
String
title
)
{
this
.
mTitle
=
title
;
return
this
;
fun
withTitle
(
title
:
String
?):
LFilePicker
{
mTitle
=
title
return
this
}
/**
...
...
@@ -75,10 +72,10 @@ public class LFilePicker {
* @param color
* @return
*/
@Deprecated
public
LFilePicker
withTitleColor
(
String
color
)
{
this
.
mTitleColor
=
color
;
return
this
;
@Deprecated
(
""
)
fun
withTitleColor
(
color
:
String
?):
LFilePicker
{
mTitleColor
=
color
return
this
}
/**
...
...
@@ -87,9 +84,9 @@ public class LFilePicker {
* @param theme
* @return
*/
public
LFilePicker
withTheme
(
@StyleRes
int
theme
)
{
this
.
theme
=
theme
;
return
this
;
fun
withTheme
(
@StyleRes
theme
:
Int
):
LFilePicker
{
this
.
theme
=
theme
return
this
}
/**
...
...
@@ -98,9 +95,9 @@ public class LFilePicker {
* @param style
* @return
*/
public
LFilePicker
withTitleStyle
(
@StyleRes
int
style
)
{
this
.
mTitleStyle
=
style
;
return
this
;
fun
withTitleStyle
(
@StyleRes
style
:
Int
):
LFilePicker
{
mTitleStyle
=
style
return
this
}
/**
...
...
@@ -109,9 +106,9 @@ public class LFilePicker {
* @param color
* @return
*/
public
LFilePicker
withBackgroundColor
(
String
color
)
{
this
.
mBackgroundColor
=
color
;
return
this
;
fun
withBackgroundColor
(
color
:
String
?):
LFilePicker
{
mBackgroundColor
=
color
return
this
}
/**
...
...
@@ -120,9 +117,9 @@ public class LFilePicker {
* @param requestCode
* @return
*/
public
LFilePicker
withRequestCode
(
int
requestCode
)
{
this
.
mRequestCode
=
requestCode
;
return
this
;
fun
withRequestCode
(
requestCode
:
Int
):
LFilePicker
{
mRequestCode
=
requestCode
return
this
}
/**
...
...
@@ -131,10 +128,10 @@ public class LFilePicker {
* @param backStyle
* @return
*/
public
LFilePicker
withBackIcon
(
int
backStyle
)
{
this
.
mBackStyle
=
0
;
//默认样式
this
.
mBackStyle
=
backStyle
;
return
this
;
fun
withBackIcon
(
backStyle
:
Int
):
LFilePicker
{
mBackStyle
=
0
//默认样式
mBackStyle
=
backStyle
return
this
}
/**
...
...
@@ -143,9 +140,9 @@ public class LFilePicker {
* @param isMutily
* @return
*/
public
LFilePicker
withMutilyMode
(
boolean
isMutily
)
{
this
.
mMutilyMode
=
isMutily
;
return
this
;
fun
withMutilyMode
(
isMutily
:
Boolean
):
LFilePicker
{
mMutilyMode
=
isMutily
return
this
}
/**
...
...
@@ -154,9 +151,9 @@ public class LFilePicker {
* @param text
* @return
*/
public
LFilePicker
withAddText
(
String
text
)
{
this
.
mAddText
=
text
;
return
this
;
fun
withAddText
(
text
:
String
?):
LFilePicker
{
mAddText
=
text
return
this
}
/**
...
...
@@ -165,14 +162,14 @@ public class LFilePicker {
* @param style
* @return
*/
public
LFilePicker
withIconStyle
(
int
style
)
{
this
.
mIconStyle
=
style
;
return
this
;
fun
withIconStyle
(
style
:
Int
):
LFilePicker
{
mIconStyle
=
style
return
this
}
public
LFilePicker
withFileFilter
(
String
[]
arrs
)
{
this
.
mFileTypes
=
arrs
;
return
this
;
fun
withFileFilter
(
arrs
:
Array
<
String
>):
LFilePicker
{
mFileTypes
=
arrs
return
this
}
/**
...
...
@@ -181,9 +178,9 @@ public class LFilePicker {
* @param notFoundFiles
* @return
*/
public
LFilePicker
withNotFoundBooks
(
String
notFoundFiles
)
{
this
.
mNotFoundFiles
=
notFoundFiles
;
return
this
;
fun
withNotFoundBooks
(
notFoundFiles
:
String
?):
LFilePicker
{
mNotFoundFiles
=
notFoundFiles
return
this
}
/**
...
...
@@ -192,9 +189,9 @@ public class LFilePicker {
* @param num
* @return
*/
public
LFilePicker
withMaxNum
(
int
num
)
{
this
.
mMaxNum
=
num
;
return
this
;
fun
withMaxNum
(
num
:
Int
):
LFilePicker
{
mMaxNum
=
num
return
this
}
/**
...
...
@@ -203,21 +200,20 @@ public class LFilePicker {
* @param fileName
* @return
*/
public
LFilePicker
withFileName
(
String
fileName
)
{
this
.
mFileName
=
fileName
;
return
this
;
fun
withFileName
(
fileName
:
String
?):
LFilePicker
{
mFileName
=
fileName
return
this
}
/**
* 设置初始显示路径
*
* @param path
* @return
*/
public
LFilePicker
withStartPath
(
String
path
)
{
this
.
mStartPath
=
path
;
return
this
;
fun
withStartPath
(
path
:
String
?):
LFilePicker
{
mStartPath
=
path
return
this
}
/**
...
...
@@ -226,9 +222,9 @@ public class LFilePicker {
* @param chooseMode
* @return
*/
public
LFilePicker
withChooseMode
(
boolean
chooseMode
)
{
this
.
mChooseMode
=
chooseMode
;
return
this
;
fun
withChooseMode
(
chooseMode
:
Boolean
):
LFilePicker
{
mChooseMode
=
chooseMode
return
this
}
/**
...
...
@@ -237,9 +233,9 @@ public class LFilePicker {
* @param isGreater true:大于 ;false:小于,同时包含指定大小在内
* @return
*/
public
LFilePicker
withIsGreater
(
boolean
isGreater
)
{
this
.
mIsGreater
=
isGreater
;
return
this
;
fun
withIsGreater
(
isGreater
:
Boolean
):
LFilePicker
{
mIsGreater
=
isGreater
return
this
}
/**
...
...
@@ -248,59 +244,57 @@ public class LFilePicker {
* @param fileSize
* @return
*/
public
LFilePicker
withFileSize
(
long
fileSize
)
{
this
.
mFileSize
=
fileSize
;
return
this
;
fun
withFileSize
(
fileSize
:
Long
):
LFilePicker
{
mFileSize
=
fileSize
return
this
}
public
void
start
()
{
fun
start
()
{
if
(
mActivity
==
null
&&
mFragment
==
null
)
{
throw
new
RuntimeException
(
"You must pass Activity or Fragment by withActivity or withFragment or withSupportFragment method"
);
throw
RuntimeException
(
"You must pass Activity or Fragment by withActivity or withFragment or withSupportFragment method"
)
}
Intent
intent
=
initIntent
();
Bundle
bundle
=
getBundle
();
intent
.
putExtras
(
bundle
);
val
intent
=
initIntent
()
val
bundle
=
bundle
intent
.
putExtras
(
bundle
)
if
(
mActivity
!=
null
)
{
mActivity
.
startActivityForResult
(
intent
,
mRequestCode
);
mActivity
!!
.
startActivityForResult
(
intent
,
mRequestCode
)
}
else
{
mFragment
.
startActivityForResult
(
intent
,
mRequestCode
);
mFragment
!!
.
startActivityForResult
(
intent
,
mRequestCode
)
}
}
private
Intent
initIntent
()
{
Intent
intent
;
if
(
mActivity
!=
null
)
{
intent
=
new
Intent
(
mActivity
,
LFilePickerActivity
.
class
);
private
fun
initIntent
():
Intent
{
val
intent
:
Intent
intent
=
if
(
mActivity
!=
null
)
{
Intent
(
mActivity
,
LFilePickerActivity
::
class
.
java
)
}
else
{
intent
=
new
Intent
(
mFragment
.
getActivity
(),
LFilePickerActivity
.
class
);
Intent
(
mFragment
!!
.
activity
,
LFilePickerActivity
::
class
.
java
)
}
return
intent
;
return
intent
}
@NonNull
private
Bundle
getBundle
()
{
ParamEntity
paramEntity
=
new
ParamEntity
();
paramEntity
.
setTitle
(
mTitle
);
paramEntity
.
setTheme
(
theme
);
paramEntity
.
setTitleColor
(
mTitleColor
);
paramEntity
.
setTitleStyle
(
mTitleStyle
);
paramEntity
.
setBackgroundColor
(
mBackgroundColor
);
paramEntity
.
setBackIcon
(
mBackStyle
);
paramEntity
.
setMutilyMode
(
mMutilyMode
);
paramEntity
.
setAddText
(
mAddText
);
paramEntity
.
setIconStyle
(
mIconStyle
);
paramEntity
.
setFileTypes
(
mFileTypes
);
paramEntity
.
setNotFoundFiles
(
mNotFoundFiles
);
paramEntity
.
setMaxNum
(
mMaxNum
);
paramEntity
.
setChooseMode
(
mChooseMode
);
paramEntity
.
setPath
(
mStartPath
);
paramEntity
.
setFileSize
(
mFileSize
);
paramEntity
.
setFileName
(
mFileName
);
paramEntity
.
setGreater
(
mIsGreater
);
Bundle
bundle
=
new
Bundle
();
bundle
.
putSerializable
(
"param"
,
paramEntity
);
return
bundle
;
}
}
private
val
bundle
:
Bundle
private
get
()
{
val
paramEntity
=
ParamEntity
()
paramEntity
.
title
=
mTitle
paramEntity
.
theme
=
theme
paramEntity
.
titleColor
=
mTitleColor
paramEntity
.
titleStyle
=
mTitleStyle
paramEntity
.
backgroundColor
=
mBackgroundColor
paramEntity
.
backIcon
=
mBackStyle
paramEntity
.
isMutilyMode
=
mMutilyMode
paramEntity
.
addText
=
mAddText
paramEntity
.
iconStyle
=
mIconStyle
paramEntity
.
fileTypes
=
mFileTypes
paramEntity
.
notFoundFiles
=
mNotFoundFiles
paramEntity
.
maxNum
=
mMaxNum
paramEntity
.
isChooseMode
=
mChooseMode
paramEntity
.
path
=
mStartPath
paramEntity
.
fileSize
=
mFileSize
paramEntity
.
fileName
=
mFileName
paramEntity
.
isGreater
=
mIsGreater
val
bundle
=
Bundle
()
bundle
.
putSerializable
(
"param"
,
paramEntity
)
return
bundle
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/log/LFilePickerActivity.java
View file @
c519909e
...
...
@@ -335,7 +335,7 @@ public class LFilePickerActivity extends BaseActivity {
mCustomImageCenterDialog
=
new
CustomImageCenterDialog
(
this
);
}
mCustomImageCenterDialog
.
setOnDismissListener
(
dialog
->
LFilePickerActivity
.
this
.
finish
());
mCustomImageCenterDialog
.
setFullScreen
(
true
)
mCustomImageCenterDialog
.
setFullScreen
Status
(
true
)
.
setHintContent
(
"请将日志二维码拍照保存"
)
.
setQrContent
(
mQrCodeEncodeMsg
)
.
build
().
show
();
...
...
app/src/main/java/com/miya/fastcashier/log/ParamEntity.java
deleted
100644 → 0
View file @
5d0b76ed
package
com
.
miya
.
fastcashier
.
log
;
import
java.io.Serializable
;
/**
* 作者:Leon
* 时间:2017/3/21 14:50
*/
public
class
ParamEntity
implements
Serializable
{
private
String
title
;
private
String
titleColor
;
private
int
titleStyle
;
private
int
theme
;
private
String
backgroundColor
;
private
int
backIcon
;
private
boolean
mutilyMode
;
private
String
addText
;
private
int
iconStyle
;
private
String
[]
fileTypes
;
private
String
notFoundFiles
;
private
int
maxNum
;
private
boolean
chooseMode
=
true
;
private
String
path
;
private
long
fileSize
;
private
boolean
isGreater
;
private
String
fileName
;
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
@Deprecated
public
String
getTitleColor
()
{
return
titleColor
;
}
@Deprecated
public
void
setTitleColor
(
String
titleColor
)
{
this
.
titleColor
=
titleColor
;
}
public
int
getTheme
()
{
return
theme
;
}
public
void
setTheme
(
int
theme
)
{
this
.
theme
=
theme
;
}
public
int
getTitleStyle
()
{
return
titleStyle
;
}
public
void
setTitleStyle
(
int
titleStyle
)
{
this
.
titleStyle
=
titleStyle
;
}
public
String
getBackgroundColor
()
{
return
backgroundColor
;
}
public
void
setBackgroundColor
(
String
backgroundColor
)
{
this
.
backgroundColor
=
backgroundColor
;
}
public
boolean
isMutilyMode
()
{
return
mutilyMode
;
}
public
void
setMutilyMode
(
boolean
mutilyMode
)
{
this
.
mutilyMode
=
mutilyMode
;
}
public
int
getBackIcon
()
{
return
backIcon
;
}
public
void
setBackIcon
(
int
backIcon
)
{
this
.
backIcon
=
backIcon
;
}
public
String
getAddText
()
{
return
addText
;
}
public
void
setAddText
(
String
addText
)
{
this
.
addText
=
addText
;
}
public
int
getIconStyle
()
{
return
iconStyle
;
}
public
void
setIconStyle
(
int
iconStyle
)
{
this
.
iconStyle
=
iconStyle
;
}
public
String
[]
getFileTypes
()
{
return
fileTypes
;
}
public
void
setFileTypes
(
String
[]
fileTypes
)
{
this
.
fileTypes
=
fileTypes
;
}
public
String
getNotFoundFiles
()
{
return
notFoundFiles
;
}
public
void
setNotFoundFiles
(
String
notFoundFiles
)
{
this
.
notFoundFiles
=
notFoundFiles
;
}
public
int
getMaxNum
()
{
return
maxNum
;
}
public
void
setMaxNum
(
int
maxNum
)
{
this
.
maxNum
=
maxNum
;
}
public
boolean
isChooseMode
()
{
return
chooseMode
;
}
public
void
setChooseMode
(
boolean
chooseMode
)
{
this
.
chooseMode
=
chooseMode
;
}
public
String
getPath
()
{
return
path
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
long
getFileSize
()
{
return
fileSize
;
}
public
void
setFileSize
(
long
fileSize
)
{
this
.
fileSize
=
fileSize
;
}
public
boolean
isGreater
()
{
return
isGreater
;
}
public
void
setGreater
(
boolean
greater
)
{
isGreater
=
greater
;
}
}
app/src/main/java/com/miya/fastcashier/log/ParamEntity.kt
0 → 100644
View file @
c519909e
package
com.miya.fastcashier.log
import
java.io.Serializable
/**
* 作者:Leon
* 时间:2017/3/21 14:50
*/
class
ParamEntity
:
Serializable
{
var
title
:
String
?
=
null
@get
:
Deprecated
(
""
)
@set
:
Deprecated
(
""
)
var
titleColor
:
String
?
=
null
var
titleStyle
=
0
var
theme
=
0
var
backgroundColor
:
String
?
=
null
var
backIcon
=
0
var
isMutilyMode
=
false
var
addText
:
String
?
=
null
var
iconStyle
=
0
var
fileTypes
:
Array
<
String
>?
=
null
var
notFoundFiles
:
String
?
=
null
var
maxNum
=
0
var
isChooseMode
=
true
var
path
:
String
?
=
null
var
fileSize
:
Long
=
0
var
isGreater
=
false
var
fileName
:
String
?
=
null
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/log/SystemParameterDialog.java
deleted
100644 → 0
View file @
5d0b76ed
package
com
.
miya
.
fastcashier
.
log
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.view.Gravity
;
import
android.view.View
;
import
android.view.WindowManager
;
import
android.widget.TextView
;
import
com.miya.fastcashier.BuildConfig
;
import
com.miya.fastcashier.R
;
import
com.miya.fastcashier.beans.SelfCashierAccountInfo
;
import
com.miya.fastcashier.databinding.DialogSystemParameterBinding
;
import
com.miya.fastcashier.net.ApiConfig
;
import
com.miya.fastcashier.service.AccountService
;
import
com.miya.fastcashier.utils.BaseFunctionKt
;
import
com.miya.print.PrinterManager
;
import
androidx.annotation.NonNull
;
public
class
SystemParameterDialog
extends
Dialog
{
private
DialogSystemParameterBinding
viewBinding
;
public
SystemParameterDialog
(
@NonNull
Context
context
)
{
super
(
context
,
R
.
style
.
CommonDialog
);
viewBinding
=
DialogSystemParameterBinding
.
inflate
(
getLayoutInflater
());
setContentView
(
viewBinding
.
getRoot
());
setCanceledOnTouchOutside
(
false
);
setCancelable
(
true
);
init
();
}
private
void
init
()
{
SelfCashierAccountInfo
accountInfo
=
AccountService
.
INSTANCE
.
getAccountInfo
();
setInfo
(
viewBinding
.
tvVersion
,
BaseFunctionKt
.
getVersion
(
getContext
()));
setInfo
(
viewBinding
.
tvStoreName
,
accountInfo
.
getShopInfo
().
getStoreName
());
setInfo
(
viewBinding
.
tvStoreNum
,
accountInfo
.
getShopInfo
().
getStoreId
());
setInfo
(
viewBinding
.
tvMerchantNum
,
accountInfo
.
getShopInfo
().
getHhMerchant
());
setInfo
(
viewBinding
.
tvPos
,
accountInfo
.
getShopInfo
().
getPosId
());
setInfo
(
viewBinding
.
tvCashier
,
accountInfo
.
getShopInfo
().
getOperatorId
());
setInfo
(
viewBinding
.
tvVersionType
,
"fastCashier_"
+
BuildConfig
.
appType
);
setInfo
(
viewBinding
.
tvEquipment
,
"sunmi_v2pro"
);
setInfo
(
viewBinding
.
tvServerUrl
,
ApiConfig
.
getBaseUrl
());
setInfo
(
viewBinding
.
tvWifiName
,
BaseFunctionKt
.
getWifyName
(
getContext
()));
setInfo
(
viewBinding
.
tvNetIp
,
BaseFunctionKt
.
getNetIp
(
getContext
())
==
null
?
"未知"
:
BaseFunctionKt
.
getNetIp
(
getContext
()));
setInfo
(
viewBinding
.
tvPrintType
,
PrinterManager
.
getInstance
().
getPrinter
()
==
null
?
getContext
().
getResources
().
getString
(
R
.
string
.
app_unkown
)
:
PrinterManager
.
getInstance
().
getPrinter
().
getPrinterName
());
setInfo
(
viewBinding
.
tvChannel
,
BuildConfig
.
CHANNEL
);
viewBinding
.
ivClose
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
dismiss
();
}
});
resize
();
}
private
void
setInfo
(
View
view
,
String
info
)
{
((
TextView
)
view
).
setText
(
info
);
}
/**
* 设置对话框大小
*
* @param width 宽度,传0表示走默认宽度
* @param height 高度,传0表示走默认高度
*/
public
SystemParameterDialog
setSize
(
int
width
,
int
height
)
{
if
(
width
<
0
||
height
<
0
)
{
return
this
;
}
WindowManager
.
LayoutParams
layoutParams
=
getWindow
().
getAttributes
();
if
(
width
!=
0
&&
height
!=
0
)
{
layoutParams
.
width
=
width
;
layoutParams
.
height
=
height
;
}
else
if
(
width
==
0
&&
height
!=
0
)
{
layoutParams
.
height
=
height
;
}
else
if
(
width
!=
0
&&
height
==
0
)
{
layoutParams
.
width
=
width
;
}
getWindow
().
setGravity
(
Gravity
.
CENTER
);
getWindow
().
setAttributes
(
layoutParams
);
return
this
;
}
private
void
resize
()
{
this
.
getWindow
().
setLayout
(
WindowManager
.
LayoutParams
.
MATCH_PARENT
,
WindowManager
.
LayoutParams
.
MATCH_PARENT
);
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/log/SystemParameterDialog.kt
0 → 100644
View file @
c519909e
package
com.miya.fastcashier.log
import
android.app.Dialog
import
android.content.Context
import
android.view.Gravity
import
android.view.View
import
android.view.WindowManager
import
android.widget.TextView
import
com.miya.fastcashier.BuildConfig
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.DialogSystemParameterBinding
import
com.miya.fastcashier.net.ApiConfig.baseUrl
import
com.miya.fastcashier.service.AccountService.getAccountInfo
import
com.miya.fastcashier.utils.getNetIp
import
com.miya.fastcashier.utils.getVersion
import
com.miya.fastcashier.utils.getWifyName
import
com.miya.print.PrinterManager
class
SystemParameterDialog
(
context
:
Context
)
:
Dialog
(
context
,
R
.
style
.
CommonDialog
)
{
private
val
viewBinding
:
DialogSystemParameterBinding
init
{
viewBinding
=
DialogSystemParameterBinding
.
inflate
(
layoutInflater
)
setContentView
(
viewBinding
.
root
)
setCanceledOnTouchOutside
(
false
)
setCancelable
(
true
)
init
()
}
private
fun
init
()
{
val
accountInfo
=
getAccountInfo
()
setInfo
(
viewBinding
.
tvVersion
,
getVersion
(
context
))
setInfo
(
viewBinding
.
tvStoreName
,
accountInfo
!!
.
shopInfo
.
storeName
)
setInfo
(
viewBinding
.
tvStoreNum
,
accountInfo
.
shopInfo
.
storeId
)
setInfo
(
viewBinding
.
tvMerchantNum
,
accountInfo
.
shopInfo
.
hhMerchant
)
setInfo
(
viewBinding
.
tvPos
,
accountInfo
.
shopInfo
.
posId
)
setInfo
(
viewBinding
.
tvCashier
,
accountInfo
.
shopInfo
.
operatorId
)
setInfo
(
viewBinding
.
tvVersionType
,
"fastCashier_"
+
BuildConfig
.
appType
)
setInfo
(
viewBinding
.
tvEquipment
,
"sunmi_v2pro"
)
setInfo
(
viewBinding
.
tvServerUrl
,
baseUrl
)
setInfo
(
viewBinding
.
tvWifiName
,
getWifyName
(
context
))
setInfo
(
viewBinding
.
tvNetIp
,
if
(
getNetIp
(
context
)
==
null
)
"未知"
else
getNetIp
(
context
))
setInfo
(
viewBinding
.
tvPrintType
,
if
(
PrinterManager
.
getInstance
().
printer
==
null
)
context
.
resources
.
getString
(
R
.
string
.
app_unkown
)
else
PrinterManager
.
getInstance
().
printer
.
printerName
)
setInfo
(
viewBinding
.
tvChannel
,
BuildConfig
.
CHANNEL
)
viewBinding
.
ivClose
.
setOnClickListener
(
View
.
OnClickListener
{
dismiss
()
})
resize
()
}
private
fun
setInfo
(
view
:
View
,
info
:
String
?)
{
(
view
as
TextView
).
text
=
info
}
/**
* 设置对话框大小
*
* @param width 宽度,传0表示走默认宽度
* @param height 高度,传0表示走默认高度
*/
fun
setSize
(
width
:
Int
,
height
:
Int
):
SystemParameterDialog
{
if
(
width
<
0
||
height
<
0
)
{
return
this
}
val
layoutParams
=
window
!!
.
attributes
if
(
width
!=
0
&&
height
!=
0
)
{
layoutParams
.
width
=
width
layoutParams
.
height
=
height
}
else
if
(
width
==
0
&&
height
!=
0
)
{
layoutParams
.
height
=
height
}
else
if
(
width
!=
0
&&
height
==
0
)
{
layoutParams
.
width
=
width
}
window
!!
.
setGravity
(
Gravity
.
CENTER
)
window
!!
.
attributes
=
layoutParams
return
this
}
private
fun
resize
()
{
this
.
window
!!
.
setLayout
(
WindowManager
.
LayoutParams
.
MATCH_PARENT
,
WindowManager
.
LayoutParams
.
MATCH_PARENT
)
}
}
\ No newline at end of file
赵鹏翔
@zhaopengxiang
mentioned in commit
477e95f6
·
May 23, 2022
mentioned in commit
477e95f6
mentioned in commit 477e95f6e81ccccb1119b0bdca57b8b9c1f8a49d
Toggle commit list
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