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
e373d759
Commit
e373d759
authored
May 30, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
网络组件部分迁移处理
parent
bb56064f
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
85 additions
and
41 deletions
+85
-41
build.gradle
app/build.gradle
+0
-1
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
MiyaApplication.kt
app/src/main/java/com/miya/fastcashier/MiyaApplication.kt
+36
-19
ViewPayOrderData.kt
.../main/java/com/miya/fastcashier/beans/ViewPayOrderData.kt
+1
-1
LFilePickerActivity.java
...in/java/com/miya/fastcashier/log/LFilePickerActivity.java
+1
-1
SystemParameterDialog.kt
...in/java/com/miya/fastcashier/log/SystemParameterDialog.kt
+3
-0
ApiRequest.kt
app/src/main/java/com/miya/fastcashier/net/ApiRequest.kt
+4
-3
PrintService.kt
...rc/main/java/com/miya/fastcashier/service/PrintService.kt
+1
-1
MainActivity.kt
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
+0
-1
SearchOrderActivity.kt
.../main/java/com/miya/fastcashier/ui/SearchOrderActivity.kt
+1
-0
SettingActivity.kt
app/src/main/java/com/miya/fastcashier/ui/SettingActivity.kt
+4
-3
AuthorizePasswordInputDialog.kt
...iya/fastcashier/ui/dialog/AuthorizePasswordInputDialog.kt
+1
-1
LoginViewModel.kt
...ain/java/com/miya/fastcashier/viewmodel/LoginViewModel.kt
+1
-1
SearchOrderViewModel.kt
...va/com/miya/fastcashier/viewmodel/SearchOrderViewModel.kt
+1
-3
build.gradle
lib_common/build.gradle
+1
-0
BaseApplication.kt
...c/main/java/com/fastcashier/lib_common/BaseApplication.kt
+16
-0
CommonCallback.kt
...ain/java/com/fastcashier/lib_common/net/CommonCallback.kt
+4
-4
BaseFunction.kt
...main/java/com/fastcashier/lib_common/util/BaseFunction.kt
+1
-1
strings.xml
lib_common/src/main/res/values/strings.xml
+8
-0
No files found.
app/build.gradle
View file @
e373d759
...
...
@@ -70,7 +70,6 @@ dependencies {
implementation
project
(
':lib_common'
)
implementation
'androidx.annotation:annotation:1.1.0'
implementation
'com.rengwuxian.materialedittext:library:2.1.4'
implementation
'com.github.GrenderG:Toasty:1.5.2'
kapt
'androidx.room:room-compiler:2.4.0'
...
...
app/src/main/AndroidManifest.xml
View file @
e373d759
...
...
@@ -4,7 +4,7 @@
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<application
android:name=
".
Base
Application"
android:name=
".
Miya
Application"
android:allowBackup=
"false"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
...
...
app/src/main/java/com/miya/fastcashier/
Base
Application.kt
→
app/src/main/java/com/miya/fastcashier/
Miya
Application.kt
View file @
e373d759
...
...
@@ -13,6 +13,7 @@ import com.elvishew.xlog.printer.Printer
import
com.elvishew.xlog.printer.file.FilePrinter
import
com.elvishew.xlog.printer.file.backup.NeverBackupStrategy
import
com.elvishew.xlog.printer.file.naming.DateFileNameGenerator
import
com.fastcashier.lib_common.BaseApplication
import
com.miya.fastcashier.service.AccountService
import
com.miya.fastcashier.utils.ContextUtils
import
com.miya.fastcashier.utils.DateUtils
...
...
@@ -29,11 +30,11 @@ import java.io.File
import
java.util.*
class
Base
Application
:
MultiDexApplication
()
{
class
Miya
Application
:
MultiDexApplication
()
{
companion
object
{
private
lateinit
var
instance
:
Base
Application
fun
getApplication
()
=
instance
private
lateinit
var
instance
:
Miya
Application
open
fun
getApplication
()
=
instance
}
override
fun
onCreate
()
{
...
...
@@ -121,61 +122,77 @@ class BaseApplication : MultiDexApplication() {
private
fun
screenAdapt
()
{
registerActivityLifecycleCallbacks
(
object
:
ActivityLifecycleCallbacks
{
override
fun
onActivityCreated
(
activity
:
Activity
,
savedInstanceState
:
Bundle
?)
{
DensityUtils
.
setDensity
(
activity
,
this
@
Base
Application
)
DensityUtils
.
setDensity
(
activity
,
this
@
Miya
Application
)
XLog
.
d
(
DateUtils
.
format18
(
Date
())
+
" onActivityCreated"
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityCreated() called with: activity = [$activity]\n"
)
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityCreated() called with: activity = [$activity]\n"
)
}
}
override
fun
onActivityStarted
(
activity
:
Activity
)
{
XLog
.
d
(
DateUtils
.
format18
(
Date
())
+
" onActivityStarted"
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityStarted() called with: activity = [$activity]\n"
)
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityStarted() called with: activity = [$activity]\n"
)
}
}
override
fun
onActivityResumed
(
activity
:
Activity
)
{
XLog
.
d
(
DateUtils
.
format18
(
Date
())
+
" onActivityResumed"
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityResumed() called with: activity = [$activity]\n"
)
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityResumed() called with: activity = [$activity]\n"
)
}
}
override
fun
onActivityPaused
(
activity
:
Activity
)
{
XLog
.
d
(
DateUtils
.
format18
(
Date
())
+
" onActivityPaused"
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityPaused() called with: activity = [$activity]\n"
)
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityPaused() called with: activity = [$activity]\n"
)
}
}
override
fun
onActivityStopped
(
activity
:
Activity
)
{
XLog
.
d
(
DateUtils
.
format18
(
Date
())
+
" onActivityStopped"
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityStopped() called with: activity = [$activity]\n"
)
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityStopped() called with: activity = [$activity]\n"
)
}
}
override
fun
onActivitySaveInstanceState
(
activity
:
Activity
,
outState
:
Bundle
)
{
XLog
.
d
(
DateUtils
.
format18
(
Date
())
+
" onActivitySaveInstanceState"
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
val
memoryStatus
=
"\ttotalMemory:${Runtime.getRuntime().totalMemory()}\tfreeMemory:${Runtime.getRuntime().freeMemory()}"
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
val
memoryStatus
=
"\ttotalMemory:${
Runtime
.
getRuntime
().
totalMemory
()
}
\
tfreeMemory
:
$
{
Runtime
.
getRuntime
().
freeMemory
()}
"
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivitySaveInstanceState() called with:"
+
" activity = [$activity]\nmemoryStatus: $memoryStatus"
)
" activity = [$activity]\nmemoryStatus: $memoryStatus"
)
}
}
override
fun
onActivityDestroyed
(
activity
:
Activity
)
{
XLog
.
d
(
DateUtils
.
format18
(
Date
())
+
" onActivityDestroyed"
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityDestroyed() called with: activity = [$activity]\n"
)
LogFileUtils
.
writeLog
(
ContextUtils
.
getContext
(),
"\n${DateUtils.format18(Date())}########onActivityDestroyed() called with: activity = [$activity]\n"
)
}
}
})
...
...
app/src/main/java/com/miya/fastcashier/beans/ViewPayOrderData.kt
View file @
e373d759
...
...
@@ -3,9 +3,9 @@ package com.miya.fastcashier.beans
import
android.text.TextUtils
import
androidx.room.Entity
import
androidx.room.PrimaryKey
import
com.fastcashier.lib_common.util.isEmpty
import
com.miya.fastcashier.dao.DatabaseKeeper
import
com.miya.fastcashier.service.AccountService
import
com.miya.fastcashier.utils.isEmpty
import
com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import
java.lang.RuntimeException
...
...
app/src/main/java/com/miya/fastcashier/log/LFilePickerActivity.java
View file @
e373d759
...
...
@@ -16,12 +16,12 @@ import com.blankj.utilcode.util.EncodeUtils;
import
com.blankj.utilcode.util.LogUtils
;
import
com.blankj.utilcode.util.StringUtils
;
import
com.fastcashier.lib_common.BuildConfig
;
import
com.fastcashier.lib_common.net.CommonCallback
;
import
com.miya.fastcashier.R
;
import
com.miya.fastcashier.beans.SelfCashierTerminalConfig
;
import
com.miya.fastcashier.net.ApiConfig
;
import
com.miya.fastcashier.net.ApiRequest
;
import
com.miya.fastcashier.net.ApiService
;
import
com.miya.fastcashier.net.CommonCallback
;
import
com.miya.fastcashier.service.AccountService
;
import
com.miya.fastcashier.ui.BaseActivity
;
import
com.miya.fastcashier.utils.LogFileUtils
;
...
...
app/src/main/java/com/miya/fastcashier/log/SystemParameterDialog.kt
View file @
e373d759
...
...
@@ -7,6 +7,9 @@ import android.view.View
import
android.view.WindowManager
import
android.widget.TextView
import
com.fastcashier.lib_common.BuildConfig
import
com.fastcashier.lib_common.util.getVersion
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.net.ApiConfig.baseUrl
...
...
app/src/main/java/com/miya/fastcashier/net/ApiRequest.kt
View file @
e373d759
package
com.miya.fastcashier.net
import
android.util.Log
import
com.miya.fastcashier.BaseApplication
import
com.fastcashier.lib_common.net.CommonCallback
import
com.miya.fastcashier.MiyaApplication
import
com.miya.fastcashier.beans.LoginRequest
import
com.miya.fastcashier.beans.SelfCashierAccountInfo
import
com.miya.fastcashier.beans.LoginRequest;
import
com.miya.fastcashier.utils.LogFileUtils
import
okhttp3.MultipartBody
import
okhttp3.OkHttpClient
...
...
@@ -34,7 +35,7 @@ class ApiRequest private constructor() {
MiyaHttpLoggingInterceptor
{
Log
.
e
(
"####"
,
it
)
if
(!
LogFileUtils
.
isProhibitWrite
)
{
LogFileUtils
.
writeLog
(
Base
Application
.
getApplication
(),
it
)
LogFileUtils
.
writeLog
(
Miya
Application
.
getApplication
(),
it
)
}
}.
apply
{
level
=
MiyaHttpLoggingInterceptor
.
Level
.
BODY
}
...
...
app/src/main/java/com/miya/fastcashier/service/PrintService.kt
View file @
e373d759
package
com.miya.fastcashier.service
import
android.text.TextUtils
import
com.fastcashier.lib_common.util.isEmpty
import
com.miya.fastcashier.beans.SelfCashierAccountInfo
import
com.miya.fastcashier.beans.ViewOrderStatisticsInfo
import
com.miya.fastcashier.utils.DateUtils
import
com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import
com.miya.fastcashier.utils.StringPriceFormat
import
com.miya.fastcashier.utils.isEmpty
import
com.miya.fastcashier.utils.manage.OrderRecordManageKit
import
com.miya.print.IPrinter
import
com.miya.print.PrinterManager
...
...
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
View file @
e373d759
...
...
@@ -7,7 +7,6 @@ import android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.FragmentManager
import
androidx.lifecycle.ViewModelProvider
import
com.miya.fastcashier.BaseApplication
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.ActivityMainBinding
import
com.miya.fastcashier.service.AccountService
...
...
app/src/main/java/com/miya/fastcashier/ui/SearchOrderActivity.kt
View file @
e373d759
...
...
@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
androidx.viewpager2.adapter.FragmentStateAdapter
import
com.elvishew.xlog.XLog
import
com.fastcashier.lib_common.util.dp2px
import
com.google.android.material.tabs.TabLayoutMediator
import
com.miya.fastcashier.R
import
com.miya.fastcashier.beans.ViewPayOrderData
...
...
app/src/main/java/com/miya/fastcashier/ui/SettingActivity.kt
View file @
e373d759
...
...
@@ -3,10 +3,11 @@ package com.miya.fastcashier.ui
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
android.util.Log
import
android.view.Gravity
import
androidx.fragment.app.FragmentManager
import
com.miya.fastcashier.BaseApplication
import
com.fastcashier.lib_common.BaseApplication
import
com.fastcashier.lib_common.BaseApplication.Companion.getApplication
import
com.miya.fastcashier.MiyaApplication
import
com.miya.fastcashier.R
import
com.miya.fastcashier.databinding.ActivitySettingBinding
import
com.miya.fastcashier.log.FunctionCenterActivity
...
...
@@ -109,7 +110,7 @@ class SettingActivity : BaseActivity() {
alertDialog
!!
.
dismiss
()
alertDialog
=
null
run
{
Base
Application
.
getApplication
().
resetConfig
()
Miya
Application
.
getApplication
().
resetConfig
()
LoginActivity
.
start
(
this
@SettingActivity
,
Intent
.
FLAG_ACTIVITY_CLEAR_TASK
...
...
app/src/main/java/com/miya/fastcashier/ui/dialog/AuthorizePasswordInputDialog.kt
View file @
e373d759
...
...
@@ -10,11 +10,11 @@ import android.widget.EditText
import
androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.DialogFragment
import
androidx.fragment.app.FragmentManager
import
com.fastcashier.lib_common.util.dp2px
import
com.miya.fastcashier.databinding.DialogAuthorizePasswordInputBinding
import
com.miya.fastcashier.ui.BaseActivity
import
com.miya.fastcashier.ui.RefundActivity
import
com.miya.fastcashier.utils.CenterToasty
import
com.miya.fastcashier.utils.dp2px
import
com.miya.fastcashier.utils.manage.AccountPasswordManageKit
class
AuthorizePasswordInputDialog
:
DialogFragment
(),
View
.
OnClickListener
{
...
...
app/src/main/java/com/miya/fastcashier/viewmodel/LoginViewModel.kt
View file @
e373d759
...
...
@@ -4,12 +4,12 @@ import androidx.lifecycle.LiveData
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
import
com.fastcashier.lib_common.net.CommonCallback
import
com.miya.fastcashier.R
import
com.miya.fastcashier.beans.LoginFormState
import
com.miya.fastcashier.beans.LoginRequest
import
com.miya.fastcashier.beans.SelfCashierAccountInfo
import
com.miya.fastcashier.net.ApiRequest
import
com.miya.fastcashier.net.CommonCallback
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
...
...
app/src/main/java/com/miya/fastcashier/viewmodel/SearchOrderViewModel.kt
View file @
e373d759
...
...
@@ -4,14 +4,12 @@ import android.text.TextUtils
import
androidx.lifecycle.MutableLiveData
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
import
com.fastcashier.lib_common.util.isEmpty
import
com.miya.fastcashier.dao.DatabaseKeeper
import
com.miya.fastcashier.utils.DateUtils
import
com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import
com.miya.fastcashier.utils.isEmpty
import
com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
java.lang.Exception
import
com.miya.fastcashier.beans.ViewPayOrderData
as
ViewPayOrderData1
class
SearchOrderViewModel
:
ViewModel
()
{
...
...
lib_common/build.gradle
View file @
e373d759
...
...
@@ -41,6 +41,7 @@ dependencies {
api
'androidx.core:core-ktx:1.3.1'
api
'androidx.appcompat:appcompat:1.3.1'
api
'androidx.annotation:annotation:1.1.0'
api
'com.google.android.material:material:1.2.1'
api
'androidx.constraintlayout:constraintlayout:2.0.1'
api
'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
...
...
lib_common/src/main/java/com/fastcashier/lib_common/BaseApplication.kt
0 → 100644
View file @
e373d759
package
com.fastcashier.lib_common
import
android.app.Application
abstract
class
BaseApplication
:
Application
()
{
companion
object
{
private
lateinit
var
instance
:
BaseApplication
fun
getApplication
()
=
instance
}
override
fun
onCreate
()
{
super
.
onCreate
()
instance
=
this
}
}
\ No newline at end of file
app/src/main/java/com/miya/fastcashier
/net/CommonCallback.kt
→
lib_common/src/main/java/com/fastcashier/lib_common
/net/CommonCallback.kt
View file @
e373d759
package
com.
miya.fastcashier
.net
package
com.
fastcashier.lib_common
.net
import
android.util.Log
import
com.fastcashier.lib_common.BaseApplication.Companion.getApplication
import
com.fastcashier.lib_common.R
import
com.fastcashier.lib_common.net.BaseResponse
import
com.miya.fastcashier.BaseApplication.Companion.getApplication
import
com.miya.fastcashier.R
import
com.miya.fastcashier.utils.isNetworkConnected
import
com.fastcashier.lib_common.util.isNetworkConnected
import
retrofit2.Call
import
retrofit2.Callback
import
retrofit2.Response
...
...
app/src/main/java/com/miya/fastcashier/utils
/BaseFunction.kt
→
lib_common/src/main/java/com/fastcashier/lib_common/util
/BaseFunction.kt
View file @
e373d759
package
com.
miya.fastcashier.utils
package
com.
fastcashier.lib_common.util
import
android.content.Context
import
android.content.pm.PackageInfo
...
...
lib_common/src/main/res/values/strings.xml
0 → 100644
View file @
e373d759
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
>
<string
name=
"common_prompt_network_error"
>
网络异常,请检查后再试
</string>
<string
name=
"common_prompt_network_timeout"
>
请求超时,请重试
</string>
<string
name=
"common_prompt_data_error"
>
加载失败,请重新加载
</string>
<string
name=
"common_prompt_data_empty"
>
还没有内容呢
</string>
<string
name=
"common_prompt_data_no_more"
>
没有更多了
</string>
</resources>
\ No newline at end of file
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