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
d224c083
Commit
d224c083
authored
Oct 18, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_common' into 'develop'
dev_common 2 develop,合并渠道配置、部分优化 See merge request
!8
parents
02a1d96a
6cc0d15a
Hide whitespace changes
Inline
Side-by-side
Showing
53 changed files
with
573 additions
and
325 deletions
+573
-325
build.gradle
app/build.gradle
+1
-5
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+2
-2
channel.json
app/src/main/assets/channel.json
+14
-0
MiyaApplication.kt
app/src/main/java/com/miya/fastcashier/MiyaApplication.kt
+9
-4
ChannelInfoBean.java
.../main/java/com/miya/fastcashier/bean/ChannelInfoBean.java
+59
-0
LFileParamBean.kt
...src/main/java/com/miya/fastcashier/bean/LFileParamBean.kt
+3
-7
LoginFormStateBean.kt
...main/java/com/miya/fastcashier/bean/LoginFormStateBean.kt
+2
-2
PayDatabase.kt
app/src/main/java/com/miya/fastcashier/dao/PayDatabase.kt
+1
-1
ApiRequest.kt
app/src/main/java/com/miya/fastcashier/net/ApiRequest.kt
+0
-99
MiyaApi.kt
app/src/main/java/com/miya/fastcashier/net/MiyaApi.kt
+2
-6
MiyaApiRequest.kt
app/src/main/java/com/miya/fastcashier/net/MiyaApiRequest.kt
+53
-0
AliPayCodeActivity.kt
...c/main/java/com/miya/fastcashier/ui/AliPayCodeActivity.kt
+1
-1
FunctionCenterActivity.kt
...in/java/com/miya/fastcashier/ui/FunctionCenterActivity.kt
+5
-3
LFilePickerActivity.java
...ain/java/com/miya/fastcashier/ui/LFilePickerActivity.java
+15
-9
LoginActivity.kt
app/src/main/java/com/miya/fastcashier/ui/LoginActivity.kt
+52
-47
MainActivity.kt
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
+44
-38
PayActivity.kt
app/src/main/java/com/miya/fastcashier/ui/PayActivity.kt
+2
-2
PayCodeActivity.kt
app/src/main/java/com/miya/fastcashier/ui/PayCodeActivity.kt
+1
-1
PriceInputActivity.kt
...c/main/java/com/miya/fastcashier/ui/PriceInputActivity.kt
+2
-2
RefundActivity.kt
app/src/main/java/com/miya/fastcashier/ui/RefundActivity.kt
+2
-2
ResetAuthorizePasswordActivity.kt
...com/miya/fastcashier/ui/ResetAuthorizePasswordActivity.kt
+2
-2
SearchOrderActivity.kt
.../main/java/com/miya/fastcashier/ui/SearchOrderActivity.kt
+2
-2
SettingActivity.kt
app/src/main/java/com/miya/fastcashier/ui/SettingActivity.kt
+0
-1
WxPayCodeActivity.kt
...rc/main/java/com/miya/fastcashier/ui/WxPayCodeActivity.kt
+1
-1
PathAdapter.java
...ain/java/com/miya/fastcashier/ui/adapter/PathAdapter.java
+2
-1
AuthorizePasswordInputDialog.kt
...iya/fastcashier/ui/dialog/AuthorizePasswordInputDialog.kt
+2
-2
CustomImageCenterDialog.kt
...com/miya/fastcashier/ui/dialog/CustomImageCenterDialog.kt
+2
-2
SystemParameterDialog.kt
...a/com/miya/fastcashier/ui/dialog/SystemParameterDialog.kt
+3
-3
CenterToasty.java
...src/main/java/com/miya/fastcashier/util/CenterToasty.java
+1
-1
ContextUtils.java
...src/main/java/com/miya/fastcashier/util/ContextUtils.java
+1
-1
DateSelectHelper.kt
...c/main/java/com/miya/fastcashier/util/DateSelectHelper.kt
+1
-1
DensityUtils.kt
app/src/main/java/com/miya/fastcashier/util/DensityUtils.kt
+1
-1
FileUtils.java
app/src/main/java/com/miya/fastcashier/util/FileUtils.java
+4
-4
ScanGunKeyEventHelper.java
...java/com/miya/fastcashier/util/ScanGunKeyEventHelper.java
+1
-1
WordUtil.kt
app/src/main/java/com/miya/fastcashier/util/WordUtil.kt
+1
-2
AccountPasswordManageKit.kt
.../miya/fastcashier/util/manage/AccountPasswordManageKit.kt
+1
-1
ChannelManageKit.kt
...java/com/miya/fastcashier/util/manage/ChannelManageKit.kt
+138
-0
LocalKeyDataMKManageKit.kt
...m/miya/fastcashier/util/manage/LocalKeyDataMKManageKit.kt
+3
-4
FileComparator.kt
...va/com/miya/fastcashier/util/manage/log/FileComparator.kt
+1
-1
LFileFilter.kt
.../java/com/miya/fastcashier/util/manage/log/LFileFilter.kt
+1
-5
LFilePickerManageKit.kt
.../miya/fastcashier/util/manage/log/LFilePickerManageKit.kt
+27
-25
LoginViewModel.kt
...ain/java/com/miya/fastcashier/viewmodel/LoginViewModel.kt
+8
-8
EmptyRecyclerView.kt
...ain/java/com/miya/fastcashier/widget/EmptyRecyclerView.kt
+1
-1
activity_lfile_picker.xml
app/src/main/res/layout/activity_lfile_picker.xml
+1
-1
activity_login.xml
app/src/main/res/layout/activity_login.xml
+10
-9
版本历史.md
doc/版本历史.md
+5
-0
gradle.properties
gradle.properties
+1
-1
build.gradle
lib_common/build.gradle
+0
-1
AccountService.kt
...fastcashier/lib_common/function/account/AccountService.kt
+1
-1
ApiClient.kt
...src/main/java/com/fastcashier/lib_common/net/ApiClient.kt
+61
-0
BaseApi.kt
...n/src/main/java/com/fastcashier/lib_common/net/BaseApi.kt
+14
-0
RequestSignInterceptor.kt
.../com/fastcashier/lib_common/net/RequestSignInterceptor.kt
+5
-10
LogFileUtils.kt
...main/java/com/fastcashier/lib_common/util/LogFileUtils.kt
+1
-1
No files found.
app/build.gradle
View file @
d224c083
...
...
@@ -55,7 +55,7 @@ android {
variant
.
outputs
.
all
{
output
->
outputFileName
=
new
File
(
output
.
outputFile
.
parent
,
"${getAppChannel()}"
+
"
_v"
+
"Miya_FastCashier
_v"
+
variant
.
versionName
+
"_"
+
variant
.
versionCode
+
"_"
+
variant
.
buildType
.
name
+
"_"
+
...
...
@@ -89,8 +89,4 @@ static String buildTime() {
Date
date
=
new
Date
()
String
dates
=
date
.
format
(
"yyyyMMddHHmm"
,
TimeZone
.
getTimeZone
(
"Asia/Shanghai"
))
return
dates
}
String
getAppChannel
()
{
return
project
.
CHANNEL
}
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
d224c083
...
...
@@ -58,10 +58,10 @@
android:name=
".ui.ResetAuthorizePasswordActivity"
android:exported=
"true"
/>
<activity
android:name=
".
log
.FunctionCenterActivity"
android:name=
".
ui
.FunctionCenterActivity"
android:exported=
"true"
/>
<activity
android:name=
".
log
.LFilePickerActivity"
android:name=
".
ui
.LFilePickerActivity"
android:exported=
"true"
/>
</application>
...
...
app/src/main/assets/channel.json
0 → 100644
View file @
d224c083
[
{
"ChannelId"
:
-1
,
"ChannelName"
:
"通用"
,
"ChannelNameEn"
:
"common"
,
"ChannelAccountArray"
:
[
"6038001"
]
},
{
"ChannelId"
:
1
,
"ChannelName"
:
"匡威"
,
"ChannelNameEn"
:
"converse"
,
"ChannelAccountArray"
:
[
"6011001"
,
"6013001"
,
"6014001"
,
"6017001"
,
"6021001"
]
}
]
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/MiyaApplication.kt
View file @
d224c083
...
...
@@ -17,10 +17,11 @@ import com.fastcashier.lib_common.base.BaseApplication
import
com.fastcashier.lib_common.function.account.AccountService
import
com.fastcashier.lib_common.function.pay.OrderRecordManageKit
import
com.fastcashier.lib_common.util.DateUtils
import
com.miya.fastcashier.utils.ContextUtils
import
com.miya.fastcashier.utils.DensityUtils
import
com.miya.fastcashier.utils.LogFileUtils
import
com.miya.fastcashier.utils.manage.LocalKeyDataMKManageKit
import
com.fastcashier.lib_common.util.LogFileUtils
import
com.miya.fastcashier.util.ContextUtils
import
com.miya.fastcashier.util.DensityUtils
import
com.miya.fastcashier.util.manage.ChannelManageKit
import
com.miya.fastcashier.util.manage.LocalKeyDataMKManageKit
import
com.miya.print.PrinterManager
import
com.sdy.miya.moblie.component.pay.core.net.MiYaPayMobileApiClient
import
com.sdy.miya.moblie.component.pay.core.net.MiyaHttpLoggingInterceptor
...
...
@@ -42,6 +43,8 @@ class MiyaApplication : BaseApplication() {
instance
=
this
ContextUtils
.
init
(
this
)
//初始化账号数据
ChannelManageKit
.
initChannelRes
(
this
)
//打印机初始化
PrinterManager
.
getInstance
().
init
(
this
)
//屏幕适配
...
...
@@ -203,5 +206,7 @@ class MiyaApplication : BaseApplication() {
OrderRecordManageKit
.
clearOrderDataYeaterday
()
//清除本地个人信息
AccountService
.
clear
()
//清除本地渠道数据信息
ChannelManageKit
.
clearChannelResData
()
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/bean/ChannelInfoBean.java
0 → 100644
View file @
d224c083
package
com
.
miya
.
fastcashier
.
bean
;
import
com.fastcashier.lib_common.base.BaseBean
;
import
java.util.List
;
/**
* 类描述:渠道配置信息
* 创建人:zpxiang
* 创建时间:
* 修改人:
* 修改时间:
*/
public
class
ChannelInfoBean
extends
BaseBean
{
/**
* ChannelId : 1
* ChannelName : 匡威
* ChannelNameEn : converse
* ChannelAccountArray : ["6011","6013","6014","6017","6021"]
*/
private
String
ChannelId
;
private
String
ChannelName
;
private
String
ChannelNameEn
;
private
List
<
String
>
ChannelAccountArray
;
public
void
setChannelId
(
String
channelId
)
{
ChannelId
=
channelId
;
}
public
String
getChannelId
()
{
return
ChannelId
;
}
public
String
getChannelName
()
{
return
ChannelName
;
}
public
void
setChannelName
(
String
channelName
)
{
ChannelName
=
channelName
;
}
public
String
getChannelNameEn
()
{
return
ChannelNameEn
;
}
public
void
setChannelNameEn
(
String
channelNameEn
)
{
ChannelNameEn
=
channelNameEn
;
}
public
List
<
String
>
getChannelAccountArray
()
{
return
ChannelAccountArray
;
}
public
void
setChannelAccountArray
(
List
<
String
>
channelAccountArray
)
{
ChannelAccountArray
=
channelAccountArray
;
}
}
app/src/main/java/com/miya/fastcashier/
log/LFileParamEntity
.kt
→
app/src/main/java/com/miya/fastcashier/
bean/LFileParamBean
.kt
View file @
d224c083
package
com.miya.fastcashier.
log
package
com.miya.fastcashier.
bean
import
java.io.Serializable
import
com.fastcashier.lib_common.base.BaseBean
/**
* 作者:Leon
* 时间:2017/3/21 14:50
*/
class
LFileParamEntity
:
Serializable
{
class
LFileParamBean
:
BaseBean
()
{
var
title
:
String
?
=
null
@get
:
Deprecated
(
""
)
...
...
app/src/main/java/com/miya/fastcashier/
net/param/LoginFormState
.kt
→
app/src/main/java/com/miya/fastcashier/
bean/LoginFormStateBean
.kt
View file @
d224c083
package
com.miya.fastcashier.
net.param
package
com.miya.fastcashier.
bean
/**
* Data validation state of the login form.
*/
data class
LoginFormState
(
data class
LoginFormState
Bean
(
val
usernameError
:
Int
?
=
null
,
val
passwordError
:
Int
?
=
null
,
val
isDataValid
:
Boolean
=
false
...
...
app/src/main/java/com/miya/fastcashier/dao/PayDatabase.kt
View file @
d224c083
...
...
@@ -3,7 +3,7 @@ package com.miya.fastcashier.dao
import
androidx.room.Database
import
androidx.room.RoomDatabase
import
androidx.room.Room
import
com.miya.fastcashier.util
s
.ContextUtils
import
com.miya.fastcashier.util.ContextUtils
import
androidx.sqlite.db.SupportSQLiteDatabase
import
androidx.room.migration.Migration
...
...
app/src/main/java/com/miya/fastcashier/net/ApiRequest.kt
deleted
100644 → 0
View file @
02a1d96a
package
com.miya.fastcashier.net
import
android.text.TextUtils
import
android.util.Log
import
com.fastcashier.lib_common.base.BaseApplication
import
com.fastcashier.lib_common.function.account.SelfCashierAccountInfo
import
com.fastcashier.lib_common.function.account.SelfCashierTerminalConfig
import
com.fastcashier.lib_common.net.ApiConfig
import
com.fastcashier.lib_common.net.CommonCallback
import
com.fastcashier.lib_common.net.MiyaHttpLoggingInterceptor
import
com.fastcashier.lib_common.net.SSLCertificatesInit
import
com.miya.fastcashier.net.param.LoginParams
import
com.miya.fastcashier.utils.LogFileUtils
import
okhttp3.MultipartBody
import
okhttp3.OkHttpClient
import
retrofit2.Retrofit
import
retrofit2.converter.gson.GsonConverterFactory
import
javax.net.ssl.SSLSocketFactory
import
javax.net.ssl.X509TrustManager
class
ApiRequest
private
constructor
()
{
companion
object
{
private
var
apiService
:
ApiService
?
=
null
private
var
sInstance
:
ApiRequest
?
=
null
@Synchronized
fun
getInstance
():
ApiRequest
{
if
(
null
==
sInstance
)
{
sInstance
=
ApiRequest
()
}
return
sInstance
!!
}
private
fun
getApiService
():
ApiService
{
if
(
null
==
apiService
)
{
val
httpLoggingInterceptor
=
MiyaHttpLoggingInterceptor
{
Log
.
e
(
"####"
,
it
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
BaseApplication
.
getApplication
(),
it
)
}
}.
apply
{
level
=
MiyaHttpLoggingInterceptor
.
Level
.
BODY
}
val
socketFactory
=
arrayOfNulls
<
SSLSocketFactory
>(
1
)
val
trustManager
=
arrayOfNulls
<
X509TrustManager
>(
1
)
SSLCertificatesInit
.
init
(
socketFactory
,
trustManager
)
val
client
=
OkHttpClient
.
Builder
()
.
addInterceptor
(
httpLoggingInterceptor
)
.
addInterceptor
(
RequestSignInterceptor
())
.
sslSocketFactory
(
socketFactory
[
0
]
!!
,
trustManager
[
0
]
!!
)
.
build
()
val
retrofit
=
Retrofit
.
Builder
()
.
baseUrl
(
ApiConfig
.
baseUrl
)
.
client
(
client
)
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
build
()
apiService
=
retrofit
.
create
(
ApiService
::
class
.
java
)
}
return
apiService
!!
}
}
fun
login
(
loginParams
:
LoginParams
,
commonCallback
:
CommonCallback
<
SelfCashierAccountInfo
>
)
{
getApiService
().
login
(
loginParams
).
enqueue
(
commonCallback
)
}
fun
uploadFile
(
url
:
String
,
part
:
MultipartBody
.
Part
,
commonCallback
:
CommonCallback
<
String
>
)
{
getApiService
().
uploadFile
(
url
,
part
).
enqueue
(
commonCallback
)
}
fun
getDataSourceIp
(
selfCashierTerminalConfig
:
SelfCashierTerminalConfig
,
equType
:
String
):
String
?
{
if
(
selfCashierTerminalConfig
?.
scoRuntimeConfig
==
null
)
{
throw
RuntimeException
(
"DataSourceIpUtils SelfCashierTerminalConfig is null"
)
}
val
path
=
"${ApiService.UPLOAD_LOG_FILE}?equType=$equType"
return
if
(
TextUtils
.
isEmpty
(
selfCashierTerminalConfig
.
scoRuntimeConfig
.
erpIp
))
(
ApiConfig
.
baseUrl
+
path
)
else
selfCashierTerminalConfig
.
scoRuntimeConfig
.
erpIp
+
path
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/net/
ApiService
.kt
→
app/src/main/java/com/miya/fastcashier/net/
MiyaApi
.kt
View file @
d224c083
...
...
@@ -2,6 +2,7 @@ package com.miya.fastcashier.net
import
com.fastcashier.lib_common.function.account.SelfCashierAccountInfo
import
com.fastcashier.lib_common.net.ApiConfig
import
com.fastcashier.lib_common.net.BaseApi
import
com.fastcashier.lib_common.net.BaseResponse
import
com.miya.fastcashier.net.param.LoginParams
import
okhttp3.MultipartBody
...
...
@@ -11,7 +12,7 @@ import retrofit2.http.*
/**
* 请求地址配置
*/
interface
ApiService
{
interface
MiyaApi
:
BaseApi
{
companion
object
{
...
...
@@ -24,11 +25,6 @@ interface ApiService {
* 上传日志文件
*/
var
UPLOAD_LOG_FILE
:
String
=
"verify/r-log/upload-log-file"
fun
wrapUrl
(
suffix
:
String
):
String
{
return
ApiConfig
.
baseUrl
.
plus
(
suffix
)
}
}
@POST
(
LOGIN
)
...
...
app/src/main/java/com/miya/fastcashier/net/MiyaApiRequest.kt
0 → 100644
View file @
d224c083
package
com.miya.fastcashier.net
import
android.text.TextUtils
import
com.fastcashier.lib_common.function.account.SelfCashierAccountInfo
import
com.fastcashier.lib_common.function.account.SelfCashierTerminalConfig
import
com.fastcashier.lib_common.net.*
import
com.miya.fastcashier.net.param.LoginParams
import
okhttp3.MultipartBody
class
MiyaApiRequest
{
companion
object
{
private
var
sMiyaApi
:
MiyaApi
?
=
null
private
fun
getApi
():
MiyaApi
{
if
(
null
==
sMiyaApi
)
{
sMiyaApi
=
ApiClient
.
getInstance
().
creatApi
(
MiyaApi
::
class
.
java
)
}
return
sMiyaApi
!!
}
fun
login
(
loginParams
:
LoginParams
,
commonCallback
:
CommonCallback
<
SelfCashierAccountInfo
>
)
{
getApi
().
login
(
loginParams
).
enqueue
(
commonCallback
)
}
fun
uploadFile
(
url
:
String
,
part
:
MultipartBody
.
Part
,
commonCallback
:
CommonCallback
<
String
>
)
{
getApi
().
uploadFile
(
url
,
part
).
enqueue
(
commonCallback
)
}
fun
getDataSourceIp
(
selfCashierTerminalConfig
:
SelfCashierTerminalConfig
,
equType
:
String
):
String
?
{
if
(
selfCashierTerminalConfig
?.
scoRuntimeConfig
==
null
)
{
throw
RuntimeException
(
"DataSourceIpUtils SelfCashierTerminalConfig is null"
)
}
val
path
=
"${MiyaApi.UPLOAD_LOG_FILE}?equType=$equType"
return
if
(
TextUtils
.
isEmpty
(
selfCashierTerminalConfig
.
scoRuntimeConfig
.
erpIp
))
(
ApiConfig
.
baseUrl
.
plus
(
path
))
else
selfCashierTerminalConfig
.
scoRuntimeConfig
.
erpIp
+
path
}
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/ui/AliPayCodeActivity.kt
View file @
d224c083
...
...
@@ -12,7 +12,7 @@ import com.fastcashier.lib_common.function.pay.OrderRecordManageKit
import
com.fastcashier.lib_common.util.StringPriceFormatUtils
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityAliPayCodeBinding
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.viewmodel.PayViewModel
import
com.miya.print.utils.BitmapUtils
import
com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
...
...
app/src/main/java/com/miya/fastcashier/
log
/FunctionCenterActivity.kt
→
app/src/main/java/com/miya/fastcashier/
ui
/FunctionCenterActivity.kt
View file @
d224c083
package
com.miya.fastcashier.
log
package
com.miya.fastcashier.
ui
import
android.content.Intent
import
android.os.Bundle
import
com.fastcashier.lib_common.base.BaseActivity
import
com.fastcashier.lib_common.util.LogFileUtils
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityFunctionCenterBinding
import
com.miya.fastcashier.utils.LogFileUtils
import
com.miya.fastcashier.util.manage.log.LFilePickerManageKit
import
com.miya.fastcashier.ui.dialog.SystemParameterDialog
/**
* 功能中心
...
...
@@ -35,7 +37,7 @@ class FunctionCenterActivity : BaseActivity() {
}
fun
toUploadLog
()
{
LFilePicker
()
LFilePicker
ManageKit
()
.
withActivity
(
this
)
.
withStartPath
(
LogFileUtils
.
CACHE_FILE_PATH
)
//指定初始显示路径
.
withIsGreater
(
true
)
//过滤文件大小 小于指定大小的文件
...
...
app/src/main/java/com/miya/fastcashier/
log
/LFilePickerActivity.java
→
app/src/main/java/com/miya/fastcashier/
ui
/LFilePickerActivity.java
View file @
d224c083
package
com
.
miya
.
fastcashier
.
log
;
package
com
.
miya
.
fastcashier
.
ui
;
import
android.content.Intent
;
import
android.graphics.Color
;
...
...
@@ -20,10 +20,16 @@ import com.fastcashier.lib_common.base.BaseActivity;
import
com.fastcashier.lib_common.function.account.AccountService
;
import
com.fastcashier.lib_common.function.account.SelfCashierTerminalConfig
;
import
com.fastcashier.lib_common.net.CommonCallback
;
import
com.fastcashier.lib_common.util.LogFileUtils
;
import
com.miya.fastcashier.R
;
import
com.miya.fastcashier.net.ApiRequest
;
import
com.miya.fastcashier.net.ApiService
;
import
com.miya.fastcashier.utils.LogFileUtils
;
import
com.miya.fastcashier.util.manage.log.LFileFilter
;
import
com.miya.fastcashier.bean.LFileParamBean
;
import
com.miya.fastcashier.net.MiyaApiRequest
;
import
com.miya.fastcashier.net.MiyaApi
;
import
com.miya.fastcashier.ui.adapter.PathAdapter
;
import
com.miya.fastcashier.ui.dialog.CustomImageCenterDialog
;
import
com.miya.fastcashier.util.FileUtils
;
import
com.miya.fastcashier.widget.EmptyRecyclerView
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -49,7 +55,7 @@ public class LFilePickerActivity extends BaseActivity {
private
String
mPath
;
private
PathAdapter
mPathAdapter
;
private
Toolbar
mToolbar
;
private
LFileParam
Entity
mParamEntity
;
private
LFileParam
Bean
mParamEntity
;
private
boolean
mIsAllSelected
=
false
;
private
Menu
mMenu
;
private
Toast
successToast
;
...
...
@@ -61,7 +67,7 @@ public class LFilePickerActivity extends BaseActivity {
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
mParamEntity
=
(
LFileParam
Entity
)
getIntent
().
getExtras
().
getSerializable
(
"param"
);
mParamEntity
=
(
LFileParam
Bean
)
getIntent
().
getExtras
().
getSerializable
(
"param"
);
setTheme
(
mParamEntity
.
getTheme
());
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_lfile_picker
);
...
...
@@ -268,15 +274,15 @@ public class LFilePickerActivity extends BaseActivity {
File
file
=
new
File
(
path
);
RequestBody
requestBody
=
RequestBody
.
create
(
MediaType
.
parse
(
""
),
file
);
MultipartBody
.
Part
part
=
MultipartBody
.
Part
.
createFormData
(
"logFile"
,
file
.
getName
(),
requestBody
);
String
ip
=
ApiRequest
.
Companion
.
getInstance
()
.
getDataSourceIp
(
selfCashierTerminalConfig
,
equType
);
String
ip
=
MiyaApiRequest
.
Companion
.
getDataSourceIp
(
selfCashierTerminalConfig
,
equType
);
if
(!
TextUtils
.
isEmpty
(
selfCashierTerminalConfig
.
getScoRuntimeConfig
().
getPlatformUrl
()))
{
ip
=
selfCashierTerminalConfig
.
getScoRuntimeConfig
().
getPlatformUrl
()
+
ApiService
.
Companion
.
getUPLOAD_LOG_FILE
();
+
MiyaApi
.
Companion
.
getUPLOAD_LOG_FILE
();
}
LogUtils
.
e
(
"ip = "
+
ip
);
tryGenQrCodeMsg
(
file
.
getName
());
ApiRequest
.
Companion
.
getInstance
()
.
uploadFile
(
ip
,
part
,
MiyaApiRequest
.
Companion
.
uploadFile
(
ip
,
part
,
new
CommonCallback
<
String
>()
{
@Override
public
void
onSuccess
(
String
data
)
{
...
...
app/src/main/java/com/miya/fastcashier/ui/LoginActivity.kt
View file @
d224c083
...
...
@@ -17,10 +17,11 @@ import com.blankj.utilcode.util.ToastUtils
import
com.fastcashier.lib_common.function.account.AccountService
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityLoginBinding
import
com.miya.fastcashier.utils.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.manage.ChannelManageKit
import
com.miya.fastcashier.util.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.viewmodel.LoginViewModel
import
com.permissionx.guolindev.PermissionX
import
com.permissionx.guolindev.callback.RequestCallback
class
LoginActivity
:
AppCompatActivity
()
{
...
...
@@ -41,30 +42,24 @@ class LoginActivity : AppCompatActivity() {
binding
=
ActivityLoginBinding
.
inflate
(
layoutInflater
)
setContentView
(
binding
.
root
)
val
username
=
binding
.
username
val
password
=
binding
.
password
val
loading
=
binding
.
loading
val
login
=
binding
.
login
val
tvErrInfo
=
binding
.
tvErrInfo
loginViewModel
=
ViewModelProvider
(
this
)
.
get
(
LoginViewModel
::
class
.
java
)
loginViewModel
.
loginLiveData
.
observe
(
this
)
{
result
->
l
oading
.
visibility
=
View
.
GONE
binding
.
vL
oading
.
visibility
=
View
.
GONE
result
.
getOrElse
{
tvEr
rInfo
.
text
=
it
.
message
tvEr
rInfo
.
visibility
=
View
.
VISIBLE
binding
.
tvErro
rInfo
.
text
=
it
.
message
binding
.
tvErro
rInfo
.
visibility
=
View
.
VISIBLE
return
@observe
}
result
.
getOrNull
().
also
{
it
?.
let
{
it1
->
val
userName
=
u
sername
.
text
.
toString
()
val
passWord
=
p
assword
.
text
.
toString
()
val
userName
=
binding
.
etU
sername
.
text
.
toString
()
val
passWord
=
binding
.
etP
assword
.
text
.
toString
()
LocalKeyDataMKManageKit
.
putLoginIngfo
(
userName
,
passWord
)
AccountService
.
init
(
it1
,
userName
)
...
...
@@ -80,75 +75,68 @@ class LoginActivity : AppCompatActivity() {
loginViewModel
.
loginFormState
.
observe
(
this
@LoginActivity
,
Observer
{
val
loginState
=
it
?:
return
@Observer
l
ogin
.
isEnabled
=
loginState
.
isDataValid
binding
.
btnL
ogin
.
isEnabled
=
loginState
.
isDataValid
if
(
loginState
.
usernameError
!=
null
)
{
u
sername
.
error
=
getString
(
loginState
.
usernameError
)
binding
.
etU
sername
.
error
=
getString
(
loginState
.
usernameError
)
}
if
(
loginState
.
passwordError
!=
null
&&
!
TextUtils
.
isEmpty
(
p
assword
.
text
))
{
p
assword
.
error
=
getString
(
loginState
.
passwordError
)
if
(
loginState
.
passwordError
!=
null
&&
!
TextUtils
.
isEmpty
(
binding
.
etP
assword
.
text
))
{
binding
.
etP
assword
.
error
=
getString
(
loginState
.
passwordError
)
}
})
u
sername
.
apply
{
binding
.
etU
sername
.
apply
{
afterTextChanged
{
loginViewModel
.
loginDataChanged
(
u
sername
.
text
.
toString
(),
p
assword
.
text
.
toString
()
binding
.
etU
sername
.
text
.
toString
(),
binding
.
etP
assword
.
text
.
toString
()
)
}
setOnEditorActionListener
{
_
,
actionId
,
_
->
when
(
actionId
)
{
EditorInfo
.
IME_ACTION_NEXT
->
{
p
assword
.
requestFocus
()
password
.
text
?.
let
{
p
assword
.
setSelection
(
it
.
length
)
};
binding
.
etP
assword
.
requestFocus
()
binding
.
etPassword
.
text
?.
let
{
binding
.
etP
assword
.
setSelection
(
it
.
length
)
};
}
}
false
}
}
p
assword
.
apply
{
binding
.
etP
assword
.
apply
{
afterTextChanged
{
loginViewModel
.
loginDataChanged
(
u
sername
.
text
.
toString
(),
p
assword
.
text
.
toString
()
binding
.
etU
sername
.
text
.
toString
(),
binding
.
etP
assword
.
text
.
toString
()
)
}
setOnEditorActionListener
{
_
,
actionId
,
_
->
when
(
actionId
)
{
EditorInfo
.
IME_ACTION_DONE
->
{
loading
.
visibility
=
View
.
VISIBLE
;
loginViewModel
.
login
(
username
.
text
.
toString
(),
password
.
text
.
toString
()
)
if
(!
TextUtils
.
isEmpty
(
binding
.
etUsername
.
text
.
toString
()))
{
checkPermissions
()
}
}
}
false
}
binding
.
l
ogin
.
clickWithTrigger
{
binding
.
btnL
ogin
.
clickWithTrigger
{
checkPermissions
()
}
}
LocalKeyDataMKManageKit
.
getLoginUserName
()
?.
let
{
u
sername
.
setText
(
it
)
binding
.
etU
sername
.
setText
(
it
)
}
LocalKeyDataMKManageKit
.
getLoginUserPassword
()
?.
let
{
p
assword
.
setText
(
it
)
binding
.
etP
assword
.
setText
(
it
)
}
if
(!
TextUtils
.
isEmpty
(
username
.
text
)
&&
!
TextUtils
.
isEmpty
(
password
.
text
))
{
loading
.
visibility
=
View
.
VISIBLE
;
loginViewModel
.
login
(
username
.
text
.
toString
(),
password
.
text
.
toString
()
)
if
(!
TextUtils
.
isEmpty
(
binding
.
etUsername
.
text
)
&&
!
TextUtils
.
isEmpty
(
binding
.
etPassword
.
text
))
{
checkPermissions
()
}
}
private
fun
checkPermissions
()
{
...
...
@@ -157,23 +145,40 @@ class LoginActivity : AppCompatActivity() {
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
,
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
)
.
request
(
RequestCallback
{
allGranted
:
Boolean
,
grantedList
:
List
<
String
?
>?,
deniedList
:
List
<
String
?
>?
->
.
request
{
allGranted
:
Boolean
,
grantedList
:
List
<
String
?
>?,
deniedList
:
List
<
String
?
>?
->
if
(
allGranted
)
{
binding
.
loading
.
visibility
=
View
.
VISIBLE
loginViewModel
.
login
(
binding
.
username
.
text
.
toString
(),
binding
.
password
.
text
.
toString
()
)
login
()
}
else
{
ToastUtils
.
showShort
(
"请检查权限后重试"
)
}
})
}
}
private
fun
login
()
{
binding
.
vLoading
.
visibility
=
View
.
VISIBLE
val
userName
=
binding
.
etUsername
.
text
.
toString
()
loginViewModel
.
login
(
userName
,
binding
.
etPassword
.
text
.
toString
()
)
//暂不加账号过滤
// if (ChannelManageKit.containsAccount(this, userName)) {
// loginViewModel.login(
// userName,
// binding.etPassword.text.toString()
// )
// } else {
// binding.vLoading.visibility = View.GONE
// CenterToasty.error(this, "账号有误,请检查后重试").show()
// }
}
/**
* Extension function to simplify setting an afterTextChanged action to EditText components.
*/
private
fun
EditText
.
afterTextChanged
(
afterTextChanged
:
(
String
)
->
Unit
)
{
this
.
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
afterTextChanged
(
editable
:
Editable
?)
{
afterTextChanged
.
invoke
(
editable
.
toString
())
...
...
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
View file @
d224c083
...
...
@@ -2,7 +2,6 @@ package com.miya.fastcashier.ui
import
android.content.Intent
import
android.os.Bundle
import
android.util.Log
import
android.view.Gravity
import
android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
...
...
@@ -15,18 +14,16 @@ import com.fastcashier.lib_common.function.print.PrintService
import
com.fastcashier.lib_common.ui.dialog.CommonDialog
import
com.fastcashier.lib_common.util.DateUtils
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.fastcashier.lib_common.util.getVersion
import
com.fastcashier.lib_common.util.getVersionName
import
com.miya.fastcashier.BuildConfig
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.ActivityMainBinding
import
com.miya.fastcashier.ui.dialog.AuthorizePasswordInputDialog
import
com.miya.fastcashier.util
s
.*
import
com.miya.fastcashier.util
s
.manage.AccountPasswordManageKit
import
com.miya.fastcashier.util
s
.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.util.*
import
com.miya.fastcashier.util.manage.AccountPasswordManageKit
import
com.miya.fastcashier.util.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.viewmodel.MainViewModel
import
com.sdy.miya.moblie.component.pay.core.utils.PayLogFileUtils
import
es.dmoral.toasty.Toasty
import
com.fastcashier.lib_common.util.LogFileUtils
import
java.util.*
class
MainActivity
:
BaseActivity
()
{
...
...
@@ -48,6 +45,13 @@ class MainActivity : BaseActivity() {
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
initView
()
initData
()
initListener
()
}
private
fun
initView
()
{
binding
=
ActivityMainBinding
.
inflate
(
layoutInflater
)
setContentView
(
binding
.
root
)
viewModel
=
ViewModelProvider
(
this
).
get
(
MainViewModel
::
class
.
java
)
...
...
@@ -55,7 +59,34 @@ class MainActivity : BaseActivity() {
binding
.
tvStoreName
.
text
=
AccountService
.
getAccountInfo
()
?.
shopInfo
?.
storeName
binding
.
tvSlog
.
text
=
AccountService
.
getUserName
()
binding
.
tvVersion
.
text
=
getVersionName
(
this
)
}
private
fun
initData
()
{
viewModel
.
statisticsLiveData
.
observe
(
this
,
{
result
->
result
.
onSuccess
{
}
result
.
onFailure
{
e
->
CenterToasty
.
error
(
this
@MainActivity
,
e
.
message
?:
""
).
show
()
}
})
viewModel
.
balanceLiveData
.
observe
(
this
,
{
result
->
result
.
onSuccess
{
LocalKeyDataMKManageKit
.
putBalanceDate
(
it
)
}
result
.
onFailure
{
e
->
CenterToasty
.
error
(
this
@MainActivity
,
e
.
message
?:
""
).
show
()
}
})
checkAccountPassword
()
OrderRecordManageKit
.
clearOrderDataYeaterday
()
LogFileUtils
.
deleteLog
(
LogFileUtils
.
DAYS_INTERVAL_LOG_DELETE
)
PayLogFileUtils
.
deleteLog
(
LogFileUtils
.
DAYS_INTERVAL_LOG_DELETE
)
}
private
fun
initListener
()
{
binding
.
llPay
.
clickWithTrigger
{
PriceInputActivity
.
start
(
this
@MainActivity
)
}
...
...
@@ -82,8 +113,9 @@ class MainActivity : BaseActivity() {
dateSelectHelper
=
DateSelectHelper
(
this
@MainActivity
)
{
var
currentDate
=
Date
()
if
(
currentDate
.
time
<=
it
.
time
){
CenterToasty
.
error
(
this
@MainActivity
,
getString
(
R
.
string
.
toast_warn_time
)).
show
()
if
(
currentDate
.
time
<=
it
.
time
)
{
CenterToasty
.
error
(
this
@MainActivity
,
getString
(
R
.
string
.
toast_warn_time
))
.
show
()
return
@DateSelectHelper
}
viewModel
.
orderStatistics
(
it
,
currentDate
,
false
)
...
...
@@ -94,12 +126,10 @@ class MainActivity : BaseActivity() {
binding
.
llBalance
.
clickWithTrigger
{
showConfirmBalanceDialog
()
}
}
initData
()
checkAccountPassword
()
OrderRecordManageKit
.
clearOrderDataYeaterday
()
LogFileUtils
.
deleteLog
(
LogFileUtils
.
DAYS_INTERVAL_LOG_DELETE
)
PayLogFileUtils
.
deleteLog
(
LogFileUtils
.
DAYS_INTERVAL_LOG_DELETE
)
private
fun
checkAccountPassword
()
{
AccountPasswordManageKit
.
get
().
checkAccountPassword
(
this
)
}
private
fun
toRefund
()
{
...
...
@@ -112,30 +142,6 @@ class MainActivity : BaseActivity() {
AuthorizePasswordInputDialog
.
newInstance
().
show
(
fm
,
FRAGMENT_TAG
)
}
private
fun
checkAccountPassword
()
{
AccountPasswordManageKit
.
get
().
checkAccountPassword
(
this
)
}
private
fun
initData
()
{
viewModel
.
statisticsLiveData
.
observe
(
this
,
{
result
->
result
.
onSuccess
{
}
result
.
onFailure
{
e
->
CenterToasty
.
error
(
this
@MainActivity
,
e
.
message
?:
""
).
show
()
}
})
viewModel
.
balanceLiveData
.
observe
(
this
,
{
result
->
result
.
onSuccess
{
LocalKeyDataMKManageKit
.
putBalanceDate
(
it
)
}
result
.
onFailure
{
e
->
CenterToasty
.
error
(
this
@MainActivity
,
e
.
message
?:
""
).
show
()
}
})
}
private
fun
showConfirmBalanceDialog
()
{
if
(
confirmDialog
==
null
||
!
confirmDialog
!!
.
isShowing
)
{
confirmDialog
=
CommonDialog
(
this
)
...
...
app/src/main/java/com/miya/fastcashier/ui/PayActivity.kt
View file @
d224c083
...
...
@@ -10,8 +10,8 @@ import com.fastcashier.lib_common.config.IntentExtra
import
com.fastcashier.lib_common.function.pay.OrderRecordManageKit
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityPayBinding
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util
s
.ScanGunKeyEventHelper
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.ScanGunKeyEventHelper
import
com.miya.fastcashier.viewmodel.PayViewModel
import
java.util.*
...
...
app/src/main/java/com/miya/fastcashier/ui/PayCodeActivity.kt
View file @
d224c083
...
...
@@ -14,7 +14,7 @@ import com.miya.fastcashier.R
import
com.miya.fastcashier.R.mipmap.ic_alipay
import
com.miya.fastcashier.R.mipmap.ic_wxpay
import
com.miya.fastcashier.databinding.ActivityPayCodeBinding
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.viewmodel.PayViewModel
import
com.miya.print.utils.BitmapUtils
import
com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
...
...
app/src/main/java/com/miya/fastcashier/ui/PriceInputActivity.kt
View file @
d224c083
...
...
@@ -17,8 +17,8 @@ import com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.ActivityPriceInputBinding
import
com.miya.fastcashier.ui.dialog.PayChooseDialog
import
com.miya.fastcashier.ui.dialog.PayChooseDialog.GeneratePayCodeClickListener
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util
s
.WordUtil
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.WordUtil
import
com.miya.fastcashier.viewmodel.PayViewModel
import
com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import
java.math.BigDecimal
...
...
app/src/main/java/com/miya/fastcashier/ui/RefundActivity.kt
View file @
d224c083
...
...
@@ -9,8 +9,8 @@ import com.fastcashier.lib_common.base.BaseActivity
import
com.fastcashier.lib_common.ui.dialog.NumberManualDialog
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityRefundBinding
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util
s
.ScanGunKeyEventHelper
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.ScanGunKeyEventHelper
import
com.miya.fastcashier.viewmodel.PayViewModel
...
...
app/src/main/java/com/miya/fastcashier/ui/ResetAuthorizePasswordActivity.kt
View file @
d224c083
...
...
@@ -7,8 +7,8 @@ import android.text.TextUtils
import
com.fastcashier.lib_common.base.BaseActivity
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityResetAuthorizePasswordBinding
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util
s
.manage.AccountPasswordManageKit
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.manage.AccountPasswordManageKit
class
ResetAuthorizePasswordActivity
:
BaseActivity
()
{
...
...
app/src/main/java/com/miya/fastcashier/ui/SearchOrderActivity.kt
View file @
d224c083
...
...
@@ -29,8 +29,8 @@ import com.miya.fastcashier.dao.ViewPayOrderData
import
com.miya.fastcashier.databinding.ActivitySearchOrderBinding
import
com.miya.fastcashier.databinding.FragmentSearchOrderBinding
import
com.miya.fastcashier.databinding.ItemSearchOrderListBinding
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util
s
.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.manage.LocalKeyDataMKManageKit
import
com.miya.fastcashier.viewmodel.SearchOrderViewModel
/**
...
...
app/src/main/java/com/miya/fastcashier/ui/SettingActivity.kt
View file @
d224c083
...
...
@@ -12,7 +12,6 @@ import com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.MiyaApplication
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.ActivitySettingBinding
import
com.miya.fastcashier.log.FunctionCenterActivity
import
com.miya.fastcashier.ui.dialog.AuthorizePasswordInputDialog
class
SettingActivity
:
BaseActivity
()
{
...
...
app/src/main/java/com/miya/fastcashier/ui/WxPayCodeActivity.kt
View file @
d224c083
...
...
@@ -12,7 +12,7 @@ import com.fastcashier.lib_common.function.pay.OrderRecordManageKit
import
com.fastcashier.lib_common.util.StringPriceFormatUtils
import
com.fastcashier.lib_common.util.clickWithTrigger
import
com.miya.fastcashier.databinding.ActivityWxPayCodeBinding
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.viewmodel.PayViewModel
import
com.miya.print.utils.BitmapUtils
import
com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
...
...
app/src/main/java/com/miya/fastcashier/
log
/PathAdapter.java
→
app/src/main/java/com/miya/fastcashier/
ui/adapter
/PathAdapter.java
View file @
d224c083
package
com
.
miya
.
fastcashier
.
log
;
package
com
.
miya
.
fastcashier
.
ui
.
adapter
;
import
android.annotation.SuppressLint
;
import
android.content.Context
;
...
...
@@ -11,6 +11,7 @@ import android.widget.RelativeLayout;
import
android.widget.TextView
;
import
com.miya.fastcashier.R
;
import
com.miya.fastcashier.util.FileUtils
;
import
java.io.File
;
import
java.io.FileFilter
;
...
...
app/src/main/java/com/miya/fastcashier/ui/dialog/AuthorizePasswordInputDialog.kt
View file @
d224c083
...
...
@@ -14,8 +14,8 @@ import com.fastcashier.lib_common.base.BaseActivity
import
com.fastcashier.lib_common.util.dp2px
import
com.miya.fastcashier.databinding.DialogAuthorizePasswordInputBinding
import
com.miya.fastcashier.ui.RefundActivity
import
com.miya.fastcashier.util
s
.CenterToasty
import
com.miya.fastcashier.util
s
.manage.AccountPasswordManageKit
import
com.miya.fastcashier.util.CenterToasty
import
com.miya.fastcashier.util.manage.AccountPasswordManageKit
class
AuthorizePasswordInputDialog
:
DialogFragment
(),
View
.
OnClickListener
{
...
...
app/src/main/java/com/miya/fastcashier/log/CustomImageCenterDialog.kt
→
app/src/main/java/com/miya/fastcashier/
ui/dia
log/CustomImageCenterDialog.kt
View file @
d224c083
package
com.miya.fastcashier.log
package
com.miya.fastcashier.
ui.dia
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
...
...
@@ -17,6 +16,7 @@ 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
...
...
app/src/main/java/com/miya/fastcashier/log/SystemParameterDialog.kt
→
app/src/main/java/com/miya/fastcashier/
ui/dia
log/SystemParameterDialog.kt
View file @
d224c083
package
com.miya.fastcashier.log
package
com.miya.fastcashier.
ui.dia
log
import
android.app.Dialog
import
android.content.Context
...
...
@@ -15,7 +15,7 @@ import com.fastcashier.lib_common.util.getVersionCode
import
com.fastcashier.lib_common.util.getWifyName
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.DialogSystemParameterBinding
import
com.miya.fastcashier.util
s.*
import
com.miya.fastcashier.util
.manage.ChannelManageKit
import
com.miya.print.PrinterManager
import
java.util.*
...
...
@@ -53,7 +53,7 @@ class SystemParameterDialog(context: Context) : Dialog(context, R.style.CommonDi
viewBinding
.
tvPrintType
,
if
(
PrinterManager
.
getInstance
().
printer
==
null
)
context
.
resources
.
getString
(
R
.
string
.
app_unkown
)
else
PrinterManager
.
getInstance
().
printer
.
printerName
)
setInfo
(
viewBinding
.
tvChannel
,
BuildConfig
.
CHANNEL
)
setInfo
(
viewBinding
.
tvChannel
,
ChannelManageKit
.
getAppChannelName
(
context
)
)
viewBinding
.
ivClose
.
setOnClickListener
(
View
.
OnClickListener
{
dismiss
()
})
resize
()
}
...
...
app/src/main/java/com/miya/fastcashier/util
s
/CenterToasty.java
→
app/src/main/java/com/miya/fastcashier/util/CenterToasty.java
View file @
d224c083
package
com
.
miya
.
fastcashier
.
util
s
;
package
com
.
miya
.
fastcashier
.
util
;
import
android.content.Context
;
import
android.view.Gravity
;
...
...
app/src/main/java/com/miya/fastcashier/util
s
/ContextUtils.java
→
app/src/main/java/com/miya/fastcashier/util/ContextUtils.java
View file @
d224c083
package
com
.
miya
.
fastcashier
.
util
s
;
package
com
.
miya
.
fastcashier
.
util
;
import
android.content.Context
;
...
...
app/src/main/java/com/miya/fastcashier/util
s
/DateSelectHelper.kt
→
app/src/main/java/com/miya/fastcashier/util/DateSelectHelper.kt
View file @
d224c083
package
com.miya.fastcashier.util
s
package
com.miya.fastcashier.util
import
android.app.Activity
import
com.bigkoo.pickerview.builder.TimePickerBuilder
...
...
app/src/main/java/com/miya/fastcashier/util
s
/DensityUtils.kt
→
app/src/main/java/com/miya/fastcashier/util/DensityUtils.kt
View file @
d224c083
package
com.miya.fastcashier.util
s
package
com.miya.fastcashier.util
import
android.app.Application
import
android.content.ComponentCallbacks
...
...
app/src/main/java/com/miya/fastcashier/
log
/FileUtils.java
→
app/src/main/java/com/miya/fastcashier/
util
/FileUtils.java
View file @
d224c083
package
com
.
miya
.
fastcashier
.
log
;
package
com
.
miya
.
fastcashier
.
util
;
import
com.miya.fastcashier.util.manage.log.FileComparator
;
import
java.io.File
;
import
java.io.FileFilter
;
...
...
@@ -8,10 +10,8 @@ import java.util.Collections;
import
java.util.Iterator
;
import
java.util.List
;
/**
* Created by Dimorinny on 24.10.15.
*/
public
class
FileUtils
{
public
static
List
<
File
>
getFileListByDirPath
(
String
path
,
FileFilter
filter
)
{
File
directory
=
new
File
(
path
);
File
[]
files
=
directory
.
listFiles
(
filter
);
...
...
app/src/main/java/com/miya/fastcashier/util
s
/ScanGunKeyEventHelper.java
→
app/src/main/java/com/miya/fastcashier/util/ScanGunKeyEventHelper.java
View file @
d224c083
package
com
.
miya
.
fastcashier
.
util
s
;
package
com
.
miya
.
fastcashier
.
util
;
import
android.os.Handler
;
import
android.text.TextUtils
;
...
...
app/src/main/java/com/miya/fastcashier/util
s
/WordUtil.kt
→
app/src/main/java/com/miya/fastcashier/util/WordUtil.kt
View file @
d224c083
package
com.miya.fastcashier.util
s
package
com.miya.fastcashier.util
import
android.content.Context
import
android.text.SpannableString
import
com.miya.fastcashier.utils.WordUtil
import
android.text.TextUtils
import
android.text.style.ForegroundColorSpan
import
androidx.core.content.ContextCompat
...
...
app/src/main/java/com/miya/fastcashier/util
s
/manage/AccountPasswordManageKit.kt
→
app/src/main/java/com/miya/fastcashier/util/manage/AccountPasswordManageKit.kt
View file @
d224c083
package
com.miya.fastcashier.util
s
.manage
package
com.miya.fastcashier.util.manage
import
android.Manifest
import
android.os.Environment
...
...
app/src/main/java/com/miya/fastcashier/util/manage/ChannelManageKit.kt
0 → 100644
View file @
d224c083
package
com.miya.fastcashier.util.manage
import
android.content.Context
import
android.text.TextUtils
import
com.blankj.utilcode.util.GsonUtils
import
com.fastcashier.lib_common.function.account.AccountService.getUserName
import
com.google.gson.reflect.TypeToken
import
com.miya.fastcashier.bean.ChannelInfoBean
import
java.io.BufferedReader
import
java.io.IOException
import
java.io.InputStreamReader
import
java.util.*
import
kotlin.collections.HashMap
/**
* 类说明:渠道管理类(用于处理品牌全局设置,以及换肤所需渠道配置)
* 详细描述:目前通过本地资源文件加载 todo 后期能改成接口返回渠道最好
* 创建人:zpxiang
* 创建时间:
* 修改人:
* 修改时间:
*/
object
ChannelManageKit
{
private
var
channelMap
:
HashMap
<
String
,
ChannelInfoBean
>?
=
null
//key为账号,value为所属的品牌信息
private
const
val
CHANNEL_OFFICIAL_ACCOUNT
=
"-1"
private
const
val
CHANNEL_OFFICIAL_CHANNELNAME
=
"通用"
private
const
val
CHANNEL_OFFICIAL_CHANNELNAME_EN
=
"common"
/**
* 初始化本地渠道数据
*/
fun
initChannelRes
(
context
:
Context
?)
{
clearChannelResData
()
if
(
null
==
context
)
{
initDefaultChannelRes
()
return
}
val
assetsJson
=
getAssetsJson
(
context
,
"channel.json"
)
if
(
TextUtils
.
isEmpty
(
assetsJson
))
{
initDefaultChannelRes
()
return
}
val
channelInfoList
=
GsonUtils
.
fromJson
<
ArrayList
<
ChannelInfoBean
>>(
assetsJson
,
object
:
TypeToken
<
List
<
ChannelInfoBean
?>?>()
{}.
type
)
channelMap
=
HashMap
()
if
(!
channelInfoList
.
isEmpty
())
{
for
(
i
in
channelInfoList
.
indices
)
{
val
channelInfoBean
=
channelInfoList
[
i
]
val
channelAccountArray
=
channelInfoBean
.
channelAccountArray
if
(
channelAccountArray
.
isEmpty
())
{
initDefaultChannelRes
()
continue
}
for
(
j
in
channelAccountArray
.
indices
)
{
val
account
=
channelAccountArray
[
j
]
channelMap
!!
[
account
]
=
channelInfoBean
}
}
}
}
private
fun
initDefaultChannelRes
()
{
if
(
channelMap
==
null
)
{
channelMap
=
HashMap
()
}
val
commonChannel
=
ChannelInfoBean
()
commonChannel
.
channelId
=
"-1"
commonChannel
.
channelName
=
CHANNEL_OFFICIAL_CHANNELNAME
commonChannel
.
channelNameEn
=
CHANNEL_OFFICIAL_CHANNELNAME_EN
channelMap
!!
[
CHANNEL_OFFICIAL_ACCOUNT
]
=
commonChannel
}
/**
* 判断本地是否包含本品牌账户,此处暂时用来处理区别大屏和手持账号
*/
fun
containsAccount
(
context
:
Context
?,
account
:
String
):
Boolean
{
if
(
channelMap
==
null
||
channelMap
!!
.
isEmpty
())
{
initChannelRes
(
context
)
}
return
channelMap
!!
.
containsKey
(
account
)
}
/**
* 获取渠道名称
*/
fun
getAppChannelName
(
context
:
Context
?):
String
{
if
(
channelMap
==
null
||
channelMap
!!
.
isEmpty
())
{
initChannelRes
(
context
)
}
val
containsKey
=
channelMap
!!
.
containsKey
(
getUserName
())
return
if
(!
containsKey
)
{
CHANNEL_OFFICIAL_CHANNELNAME
}
else
channelMap
!!
[
getUserName
()]
!!
.
channelName
}
/**
* 获取App渠道编号
*/
fun
getAppChannelId
(
context
:
Context
?):
String
{
if
(
context
==
null
)
{
return
CHANNEL_OFFICIAL_ACCOUNT
}
if
(
channelMap
==
null
||
channelMap
!!
.
isEmpty
())
{
initChannelRes
(
context
)
}
return
if
(!
channelMap
!!
.
containsKey
(
getUserName
()))
{
CHANNEL_OFFICIAL_ACCOUNT
}
else
channelMap
!!
[
getUserName
()]
!!
.
channelId
}
fun
clearChannelResData
()
{
if
(
null
==
channelMap
)
{
return
}
channelMap
!!
.
clear
()
channelMap
=
null
}
/**
* 读取json文件
*/
private
fun
getAssetsJson
(
context
:
Context
,
fileName
:
String
):
String
{
val
stringBuilder
=
StringBuilder
()
val
assetManager
=
context
.
assets
try
{
val
bf
=
BufferedReader
(
InputStreamReader
(
assetManager
.
open
(
fileName
),
"UTF-8"
))
var
line
:
String
?
while
(
bf
.
readLine
().
also
{
line
=
it
}
!=
null
)
{
stringBuilder
.
append
(
line
)
}
}
catch
(
e
:
IOException
)
{
e
.
printStackTrace
()
}
return
stringBuilder
.
toString
()
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier/util
s
/manage/LocalKeyDataMKManageKit.kt
→
app/src/main/java/com/miya/fastcashier/util/manage/LocalKeyDataMKManageKit.kt
View file @
d224c083
package
com.miya.fastcashier.util
s
.manage
package
com.miya.fastcashier.util.manage
import
com.fastcashier.lib_common.function.account.AccountService
import
com.tencent.mmkv.MMKV
import
java.util.*
/**
* 类描述:本地关键数据MMKV统一管理
...
...
@@ -17,7 +16,7 @@ class LocalKeyDataMKManageKit {
companion
object
{
/***************************************** 分账户的关键数据,分区存储ID为MMKV_ID *****************************************/
private
val
MMKV_ID
=
"fastcashier_key_data"
private
val
MMKV_
KEY_
ID
=
"fastcashier_key_data"
private
val
BALANCEDATE_ID
=
"balanceDate"
/**
...
...
@@ -62,7 +61,7 @@ class LocalKeyDataMKManageKit {
}
private
fun
getKeyDataMK
():
MMKV
{
val
MMKV_ID_WITH_USER
=
MMKV_ID
.
plus
(
"_${AccountService.getUserName()}"
)
val
MMKV_ID_WITH_USER
=
MMKV_
KEY_
ID
.
plus
(
"_${AccountService.getUserName()}"
)
return
MMKV
.
mmkvWithID
(
MMKV_ID_WITH_USER
)
}
...
...
app/src/main/java/com/miya/fastcashier/log/FileComparator.kt
→
app/src/main/java/com/miya/fastcashier/
util/manage/
log/FileComparator.kt
View file @
d224c083
package
com.miya.fastcashier.log
package
com.miya.fastcashier.
util.manage.
log
import
java.io.File
import
java.util.Comparator
...
...
app/src/main/java/com/miya/fastcashier/log/LFileFilter.kt
→
app/src/main/java/com/miya/fastcashier/
util/manage/
log/LFileFilter.kt
View file @
d224c083
package
com.miya.fastcashier.log
package
com.miya.fastcashier.
util.manage.
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
{
...
...
app/src/main/java/com/miya/fastcashier/
log/LFilePicker
.kt
→
app/src/main/java/com/miya/fastcashier/
util/manage/log/LFilePickerManageKit
.kt
View file @
d224c083
package
com.miya.fastcashier.log
package
com.miya.fastcashier.
util.manage.
log
import
android.app.Activity
import
android.app.Fragment
...
...
@@ -6,12 +6,14 @@ import android.content.Intent
import
android.os.Bundle
import
androidx.annotation.StyleRes
import
com.miya.fastcashier.R
import
com.miya.fastcashier.bean.LFileParamBean
import
com.miya.fastcashier.ui.LFilePickerActivity
/**
* 作者:Leon
* 时间:2017/3/20 16:57
* 功能中心日志界面跳转配置管理类
*/
class
LFilePicker
{
class
LFilePickerManageKit
{
private
var
mActivity
:
Activity
?
=
null
private
var
mFragment
:
Fragment
?
=
null
private
var
mTitle
:
String
?
=
null
...
...
@@ -39,7 +41,7 @@ class LFilePicker {
* @param activity
* @return
*/
fun
withActivity
(
activity
:
Activity
?):
LFilePicker
{
fun
withActivity
(
activity
:
Activity
?):
LFilePicker
ManageKit
{
mActivity
=
activity
return
this
}
...
...
@@ -50,7 +52,7 @@ class LFilePicker {
* @param fragment
* @return
*/
fun
withFragment
(
fragment
:
Fragment
?):
LFilePicker
{
fun
withFragment
(
fragment
:
Fragment
?):
LFilePicker
ManageKit
{
mFragment
=
fragment
return
this
}
...
...
@@ -61,7 +63,7 @@ class LFilePicker {
* @param title
* @return
*/
fun
withTitle
(
title
:
String
?):
LFilePicker
{
fun
withTitle
(
title
:
String
?):
LFilePicker
ManageKit
{
mTitle
=
title
return
this
}
...
...
@@ -73,7 +75,7 @@ class LFilePicker {
* @return
*/
@Deprecated
(
""
)
fun
withTitleColor
(
color
:
String
?):
LFilePicker
{
fun
withTitleColor
(
color
:
String
?):
LFilePicker
ManageKit
{
mTitleColor
=
color
return
this
}
...
...
@@ -84,7 +86,7 @@ class LFilePicker {
* @param theme
* @return
*/
fun
withTheme
(
@StyleRes
theme
:
Int
):
LFilePicker
{
fun
withTheme
(
@StyleRes
theme
:
Int
):
LFilePicker
ManageKit
{
this
.
theme
=
theme
return
this
}
...
...
@@ -95,7 +97,7 @@ class LFilePicker {
* @param style
* @return
*/
fun
withTitleStyle
(
@StyleRes
style
:
Int
):
LFilePicker
{
fun
withTitleStyle
(
@StyleRes
style
:
Int
):
LFilePicker
ManageKit
{
mTitleStyle
=
style
return
this
}
...
...
@@ -106,7 +108,7 @@ class LFilePicker {
* @param color
* @return
*/
fun
withBackgroundColor
(
color
:
String
?):
LFilePicker
{
fun
withBackgroundColor
(
color
:
String
?):
LFilePicker
ManageKit
{
mBackgroundColor
=
color
return
this
}
...
...
@@ -117,7 +119,7 @@ class LFilePicker {
* @param requestCode
* @return
*/
fun
withRequestCode
(
requestCode
:
Int
):
LFilePicker
{
fun
withRequestCode
(
requestCode
:
Int
):
LFilePicker
ManageKit
{
mRequestCode
=
requestCode
return
this
}
...
...
@@ -128,7 +130,7 @@ class LFilePicker {
* @param backStyle
* @return
*/
fun
withBackIcon
(
backStyle
:
Int
):
LFilePicker
{
fun
withBackIcon
(
backStyle
:
Int
):
LFilePicker
ManageKit
{
mBackStyle
=
0
//默认样式
mBackStyle
=
backStyle
return
this
...
...
@@ -140,7 +142,7 @@ class LFilePicker {
* @param isMutily
* @return
*/
fun
withMutilyMode
(
isMutily
:
Boolean
):
LFilePicker
{
fun
withMutilyMode
(
isMutily
:
Boolean
):
LFilePicker
ManageKit
{
mMutilyMode
=
isMutily
return
this
}
...
...
@@ -151,7 +153,7 @@ class LFilePicker {
* @param text
* @return
*/
fun
withAddText
(
text
:
String
?):
LFilePicker
{
fun
withAddText
(
text
:
String
?):
LFilePicker
ManageKit
{
mAddText
=
text
return
this
}
...
...
@@ -162,12 +164,12 @@ class LFilePicker {
* @param style
* @return
*/
fun
withIconStyle
(
style
:
Int
):
LFilePicker
{
fun
withIconStyle
(
style
:
Int
):
LFilePicker
ManageKit
{
mIconStyle
=
style
return
this
}
fun
withFileFilter
(
arrs
:
Array
<
String
>):
LFilePicker
{
fun
withFileFilter
(
arrs
:
Array
<
String
>):
LFilePicker
ManageKit
{
mFileTypes
=
arrs
return
this
}
...
...
@@ -178,7 +180,7 @@ class LFilePicker {
* @param notFoundFiles
* @return
*/
fun
withNotFoundBooks
(
notFoundFiles
:
String
?):
LFilePicker
{
fun
withNotFoundBooks
(
notFoundFiles
:
String
?):
LFilePicker
ManageKit
{
mNotFoundFiles
=
notFoundFiles
return
this
}
...
...
@@ -189,7 +191,7 @@ class LFilePicker {
* @param num
* @return
*/
fun
withMaxNum
(
num
:
Int
):
LFilePicker
{
fun
withMaxNum
(
num
:
Int
):
LFilePicker
ManageKit
{
mMaxNum
=
num
return
this
}
...
...
@@ -200,7 +202,7 @@ class LFilePicker {
* @param fileName
* @return
*/
fun
withFileName
(
fileName
:
String
?):
LFilePicker
{
fun
withFileName
(
fileName
:
String
?):
LFilePicker
ManageKit
{
mFileName
=
fileName
return
this
}
...
...
@@ -211,7 +213,7 @@ class LFilePicker {
* @param path
* @return
*/
fun
withStartPath
(
path
:
String
?):
LFilePicker
{
fun
withStartPath
(
path
:
String
?):
LFilePicker
ManageKit
{
mStartPath
=
path
return
this
}
...
...
@@ -222,7 +224,7 @@ class LFilePicker {
* @param chooseMode
* @return
*/
fun
withChooseMode
(
chooseMode
:
Boolean
):
LFilePicker
{
fun
withChooseMode
(
chooseMode
:
Boolean
):
LFilePicker
ManageKit
{
mChooseMode
=
chooseMode
return
this
}
...
...
@@ -233,7 +235,7 @@ class LFilePicker {
* @param isGreater true:大于 ;false:小于,同时包含指定大小在内
* @return
*/
fun
withIsGreater
(
isGreater
:
Boolean
):
LFilePicker
{
fun
withIsGreater
(
isGreater
:
Boolean
):
LFilePicker
ManageKit
{
mIsGreater
=
isGreater
return
this
}
...
...
@@ -244,7 +246,7 @@ class LFilePicker {
* @param fileSize
* @return
*/
fun
withFileSize
(
fileSize
:
Long
):
LFilePicker
{
fun
withFileSize
(
fileSize
:
Long
):
LFilePicker
ManageKit
{
mFileSize
=
fileSize
return
this
}
...
...
@@ -275,7 +277,7 @@ class LFilePicker {
private
val
bundle
:
Bundle
private
get
()
{
val
paramEntity
=
LFileParam
Entity
()
val
paramEntity
=
LFileParam
Bean
()
paramEntity
.
title
=
mTitle
paramEntity
.
theme
=
theme
paramEntity
.
titleColor
=
mTitleColor
...
...
app/src/main/java/com/miya/fastcashier/viewmodel/LoginViewModel.kt
View file @
d224c083
...
...
@@ -7,23 +7,23 @@ import androidx.lifecycle.viewModelScope
import
com.fastcashier.lib_common.function.account.SelfCashierAccountInfo
import
com.fastcashier.lib_common.net.CommonCallback
import
com.miya.fastcashier.R
import
com.miya.fastcashier.
net.param.LoginFormState
import
com.miya.fastcashier.
bean.LoginFormStateBean
import
com.miya.fastcashier.net.param.LoginParams
import
com.miya.fastcashier.net.ApiRequest
import
com.miya.fastcashier.net.
Miya
ApiRequest
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
class
LoginViewModel
:
ViewModel
()
{
val
loginLiveData
:
MutableLiveData
<
Result
<
SelfCashierAccountInfo
>>
=
MutableLiveData
()
val
_loginForm
=
MutableLiveData
<
LoginFormState
>()
val
loginFormState
:
LiveData
<
LoginFormState
>
=
_loginForm
val
_loginForm
=
MutableLiveData
<
LoginFormState
Bean
>()
val
loginFormState
:
LiveData
<
LoginFormState
Bean
>
=
_loginForm
fun
login
(
userName
:
String
,
passWord
:
String
)
{
viewModelScope
.
launch
(
Dispatchers
.
IO
)
{
ApiRequest
.
getInstance
()
.
login
(
MiyaApiRequest
.
login
(
LoginParams
(
userName
,
passWord
,
""
),
object
:
CommonCallback
<
SelfCashierAccountInfo
>(){
override
fun
onSuccess
(
data
:
SelfCashierAccountInfo
)
{
...
...
@@ -43,11 +43,11 @@ class LoginViewModel : ViewModel() {
fun
loginDataChanged
(
username
:
String
,
password
:
String
)
{
if
(!
isUserNameValid
(
username
))
{
_loginForm
.
value
=
LoginFormState
(
usernameError
=
R
.
string
.
username_not_empty
)
_loginForm
.
value
=
LoginFormState
Bean
(
usernameError
=
R
.
string
.
username_not_empty
)
}
else
if
(!
isPasswordValid
(
password
))
{
_loginForm
.
value
=
LoginFormState
(
passwordError
=
R
.
string
.
password_not_empty
)
_loginForm
.
value
=
LoginFormState
Bean
(
passwordError
=
R
.
string
.
password_not_empty
)
}
else
{
_loginForm
.
value
=
LoginFormState
(
isDataValid
=
true
)
_loginForm
.
value
=
LoginFormState
Bean
(
isDataValid
=
true
)
}
}
...
...
app/src/main/java/com/miya/fastcashier/
log
/EmptyRecyclerView.kt
→
app/src/main/java/com/miya/fastcashier/
widget
/EmptyRecyclerView.kt
View file @
d224c083
package
com.miya.fastcashier.
log
package
com.miya.fastcashier.
widget
import
android.content.Context
import
android.util.AttributeSet
...
...
app/src/main/res/layout/activity_lfile_picker.xml
View file @
d224c083
...
...
@@ -60,7 +60,7 @@
android:textColor=
"@color/lfile_white"
android:textSize=
"18sp"
/>
<com.miya.fastcashier.
log
.EmptyRecyclerView
<com.miya.fastcashier.
widget
.EmptyRecyclerView
android:id=
"@+id/recylerview"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
app/src/main/res/layout/activity_login.xml
View file @
d224c083
...
...
@@ -8,7 +8,7 @@
tools:context=
".ui.LoginActivity"
>
<com.rengwuxian.materialedittext.MaterialEditText
android:id=
"@+id/username"
android:id=
"@+id/
et_
username"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"46dp"
...
...
@@ -25,7 +25,7 @@
app:met_bottomTextSize=
"26sp"
/>
<com.rengwuxian.materialedittext.MaterialEditText
android:id=
"@+id/password"
android:id=
"@+id/
et_
password"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"46dp"
...
...
@@ -39,11 +39,11 @@
android:textSize=
"32sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/username"
app:layout_constraintTop_toBottomOf=
"@+id/
et_
username"
app:met_bottomTextSize=
"26sp"
/>
<Button
android:id=
"@+id/login"
android:id=
"@+id/
btn_
login"
android:layout_width=
"656dp"
android:layout_height=
"100dp"
android:layout_gravity=
"start"
...
...
@@ -56,7 +56,7 @@
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/password"
app:layout_constraintTop_toBottomOf=
"@+id/
et_
password"
app:layout_constraintVertical_bias=
"0.2"
/>
<ImageView
...
...
@@ -94,7 +94,7 @@
app:layout_constraintStart_toEndOf=
"@+id/ivLogo"
/>
<TextView
android:id=
"@+id/tv
ErrI
nfo"
android:id=
"@+id/tv
_error_i
nfo"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"账号或密码输入错误,请重新输入"
...
...
@@ -102,13 +102,13 @@
android:textSize=
"24sp"
android:visibility=
"gone"
app:layout_constraintStart_toEndOf=
"@+id/ivLogo"
app:layout_constraintStart_toStartOf=
"@+id/username"
app:layout_constraintTop_toBottomOf=
"@+id/password"
/>
app:layout_constraintStart_toStartOf=
"@+id/
et_
username"
app:layout_constraintTop_toBottomOf=
"@+id/
et_
password"
/>
<!--封装成一个View-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/loading"
android:id=
"@+id/
v_
loading"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:visibility=
"gone"
>
...
...
@@ -148,6 +148,7 @@
app:SpinKit_Color=
"@color/white"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
doc/版本历史.md
View file @
d224c083
# 版本历史
## tag
####优化版本 :
-基础业务组件抽取,libcommon库抽取
-混淆配置,灰度转正式
## tag
####v2.1.6 :
-统计打印业务逻辑优化,时间选择控件优化
...
...
gradle.properties
View file @
d224c083
...
...
@@ -22,6 +22,6 @@ android.jetifier.blacklist=miya-print
android.useDeprecatedNdk
=
true
#区别品牌
CHANNEL
=
converse
#
CHANNEL=converse
#区别环境 true:是测试环境,仅供内部人员测试使用;false:非测试包,供外部人员、渠道推广、应用商店等使用
ISTEST
=
false
\ No newline at end of file
lib_common/build.gradle
View file @
d224c083
...
...
@@ -14,7 +14,6 @@ android {
multiDexEnabled
true
consumerProguardFiles
"consumer-rules.pro"
buildConfigField
'String'
,
"CHANNEL"
,
"\"$CHANNEL\""
buildConfigField
"Boolean"
,
"ISTEST"
,
ISTEST
.
toString
()
buildConfigField
"String"
,
"appType"
,
"\"mpos\""
}
...
...
lib_common/src/main/java/com/fastcashier/lib_common/function/account/AccountService.kt
View file @
d224c083
...
...
@@ -19,7 +19,7 @@ object AccountService {
}
fun
getUserName
():
String
{
return
userName
.
toString
()
;
return
userName
.
toString
()
}
fun
getAccountPassword
():
String
{
...
...
lib_common/src/main/java/com/fastcashier/lib_common/net/ApiClient.kt
0 → 100644
View file @
d224c083
package
com.fastcashier.lib_common.net
import
android.util.Log
import
com.blankj.utilcode.util.LogUtils
import
com.fastcashier.lib_common.base.BaseApplication
import
com.fastcashier.lib_common.util.LogFileUtils
import
okhttp3.OkHttpClient
import
retrofit2.Retrofit
import
retrofit2.converter.gson.GsonConverterFactory
import
javax.net.ssl.SSLSocketFactory
import
javax.net.ssl.X509TrustManager
class
ApiClient
private
constructor
()
{
companion
object
{
private
var
sInstance
:
ApiClient
?
=
null
@Synchronized
fun
getInstance
():
ApiClient
{
if
(
null
==
sInstance
)
{
sInstance
=
ApiClient
()
}
return
sInstance
!!
}
}
private
fun
generateClient
():
Retrofit
{
val
httpLoggingInterceptor
=
MiyaHttpLoggingInterceptor
{
Log
.
e
(
"####"
,
it
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
BaseApplication
.
getApplication
(),
it
)
}
}.
apply
{
level
=
MiyaHttpLoggingInterceptor
.
Level
.
BODY
}
val
socketFactory
=
arrayOfNulls
<
SSLSocketFactory
>(
1
)
val
trustManager
=
arrayOfNulls
<
X509TrustManager
>(
1
)
SSLCertificatesInit
.
init
(
socketFactory
,
trustManager
)
val
client
=
OkHttpClient
.
Builder
()
.
addInterceptor
(
httpLoggingInterceptor
)
.
addInterceptor
(
RequestSignInterceptor
())
.
sslSocketFactory
(
socketFactory
[
0
]
!!
,
trustManager
[
0
]
!!
)
.
build
()
val
retrofit
=
Retrofit
.
Builder
()
.
baseUrl
(
ApiConfig
.
baseUrl
)
.
client
(
client
)
.
addConverterFactory
(
GsonConverterFactory
.
create
())
.
build
()
return
retrofit
}
fun
<
T
>
creatApi
(
tClass
:
Class
<
T
>?):
T
?
{
return
generateClient
().
create
(
tClass
)
}
}
\ No newline at end of file
lib_common/src/main/java/com/fastcashier/lib_common/net/BaseApi.kt
0 → 100644
View file @
d224c083
package
com.fastcashier.lib_common.net
/**
* 请求Api基础配置
*/
interface
BaseApi
{
companion
object
{
fun
wrapUrl
(
suffix
:
String
):
String
{
return
ApiConfig
.
baseUrl
.
plus
(
suffix
)
}
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier
/net/RequestSignInterceptor.kt
→
lib_common/src/main/java/com/fastcashier/lib_common
/net/RequestSignInterceptor.kt
View file @
d224c083
package
com.
miya.fastcashier
.net
package
com.
fastcashier.lib_common
.net
import
com.fastcashier.lib_common.function.account.AccountService.getAccountInfo
import
com.fastcashier.lib_common.net.ApiConfig.getAuthorization
import
com.miya.fastcashier.net.ApiService.Companion.wrapUrl
import
okhttp3.Interceptor
import
okhttp3.Request
import
okhttp3.Response
...
...
@@ -21,17 +20,13 @@ class RequestSignInterceptor : Interceptor {
@Throws
(
IOException
::
class
)
override
fun
intercept
(
chain
:
Interceptor
.
Chain
):
Response
{
val
original
:
Request
=
chain
.
request
()
val
requestUrl
=
original
.
url
.
toString
()
val
requestBuilder
:
Request
.
Builder
=
original
.
newBuilder
()
val
accountInfo
=
getAccountInfo
()
if
(
accountInfo
!=
null
&&
accountInfo
.
accessToken
!=
null
)
{
val
loginUrl
=
wrapUrl
(
ApiService
.
LOGIN
)
if
(
requestUrl
!=
loginUrl
)
{
requestBuilder
.
addHeader
(
AUTHORIZATION
,
getAuthorization
(
accountInfo
.
accessToken
.
accessToken
)
)
}
requestBuilder
.
addHeader
(
AUTHORIZATION
,
getAuthorization
(
accountInfo
.
accessToken
.
accessToken
)
)
}
val
request
:
Request
=
requestBuilder
.
build
()
return
chain
.
proceed
(
request
)
...
...
app/src/main/java/com/miya/fastcashier/utils
/LogFileUtils.kt
→
lib_common/src/main/java/com/fastcashier/lib_common/util
/LogFileUtils.kt
View file @
d224c083
package
com.
miya.fastcashier.utils
package
com.
fastcashier.lib_common.util
import
android.content.Context
import
android.content.pm.PackageInfo
...
...
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