Commit e373d759 authored by 赵鹏翔's avatar 赵鹏翔

网络组件部分迁移处理

parent bb56064f
...@@ -70,7 +70,6 @@ dependencies { ...@@ -70,7 +70,6 @@ dependencies {
implementation project(':lib_common') implementation project(':lib_common')
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4' implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.github.GrenderG:Toasty:1.5.2' implementation 'com.github.GrenderG:Toasty:1.5.2'
kapt 'androidx.room:room-compiler:2.4.0' kapt 'androidx.room:room-compiler:2.4.0'
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application <application
android:name=".BaseApplication" android:name=".MiyaApplication"
android:allowBackup="false" android:allowBackup="false"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
......
...@@ -13,6 +13,7 @@ import com.elvishew.xlog.printer.Printer ...@@ -13,6 +13,7 @@ import com.elvishew.xlog.printer.Printer
import com.elvishew.xlog.printer.file.FilePrinter import com.elvishew.xlog.printer.file.FilePrinter
import com.elvishew.xlog.printer.file.backup.NeverBackupStrategy import com.elvishew.xlog.printer.file.backup.NeverBackupStrategy
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator
import com.fastcashier.lib_common.BaseApplication
import com.miya.fastcashier.service.AccountService import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.utils.ContextUtils import com.miya.fastcashier.utils.ContextUtils
import com.miya.fastcashier.utils.DateUtils import com.miya.fastcashier.utils.DateUtils
...@@ -29,11 +30,11 @@ import java.io.File ...@@ -29,11 +30,11 @@ import java.io.File
import java.util.* import java.util.*
class BaseApplication : MultiDexApplication() { class MiyaApplication : MultiDexApplication() {
companion object { companion object {
private lateinit var instance: BaseApplication private lateinit var instance: MiyaApplication
fun getApplication() = instance open fun getApplication() = instance
} }
override fun onCreate() { override fun onCreate() {
...@@ -121,61 +122,77 @@ class BaseApplication : MultiDexApplication() { ...@@ -121,61 +122,77 @@ class BaseApplication : MultiDexApplication() {
private fun screenAdapt() { private fun screenAdapt() {
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks { registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
DensityUtils.setDensity(activity, this@BaseApplication) DensityUtils.setDensity(activity, this@MiyaApplication)
XLog.d(DateUtils.format18(Date()) + " onActivityCreated") XLog.d(DateUtils.format18(Date()) + " onActivityCreated")
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
LogFileUtils.writeLog(ContextUtils.getContext(), LogFileUtils.writeLog(
"\n${DateUtils.format18(Date())}########onActivityCreated() called with: activity = [$activity]\n") ContextUtils.getContext(),
"\n${DateUtils.format18(Date())}########onActivityCreated() called with: activity = [$activity]\n"
)
} }
} }
override fun onActivityStarted(activity: Activity) { override fun onActivityStarted(activity: Activity) {
XLog.d(DateUtils.format18(Date()) + " onActivityStarted") XLog.d(DateUtils.format18(Date()) + " onActivityStarted")
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
LogFileUtils.writeLog(ContextUtils.getContext(), LogFileUtils.writeLog(
"\n${DateUtils.format18(Date())}########onActivityStarted() called with: activity = [$activity]\n") ContextUtils.getContext(),
"\n${DateUtils.format18(Date())}########onActivityStarted() called with: activity = [$activity]\n"
)
} }
} }
override fun onActivityResumed(activity: Activity) { override fun onActivityResumed(activity: Activity) {
XLog.d(DateUtils.format18(Date()) + " onActivityResumed") XLog.d(DateUtils.format18(Date()) + " onActivityResumed")
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
LogFileUtils.writeLog(ContextUtils.getContext(), LogFileUtils.writeLog(
"\n${DateUtils.format18(Date())}########onActivityResumed() called with: activity = [$activity]\n") ContextUtils.getContext(),
"\n${DateUtils.format18(Date())}########onActivityResumed() called with: activity = [$activity]\n"
)
} }
} }
override fun onActivityPaused(activity: Activity) { override fun onActivityPaused(activity: Activity) {
XLog.d(DateUtils.format18(Date()) + " onActivityPaused") XLog.d(DateUtils.format18(Date()) + " onActivityPaused")
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
LogFileUtils.writeLog(ContextUtils.getContext(), LogFileUtils.writeLog(
"\n${DateUtils.format18(Date())}########onActivityPaused() called with: activity = [$activity]\n") ContextUtils.getContext(),
"\n${DateUtils.format18(Date())}########onActivityPaused() called with: activity = [$activity]\n"
)
} }
} }
override fun onActivityStopped(activity: Activity) { override fun onActivityStopped(activity: Activity) {
XLog.d(DateUtils.format18(Date()) + " onActivityStopped") XLog.d(DateUtils.format18(Date()) + " onActivityStopped")
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
LogFileUtils.writeLog(ContextUtils.getContext(), LogFileUtils.writeLog(
"\n${DateUtils.format18(Date())}########onActivityStopped() called with: activity = [$activity]\n") ContextUtils.getContext(),
"\n${DateUtils.format18(Date())}########onActivityStopped() called with: activity = [$activity]\n"
)
} }
} }
override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) { override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) {
XLog.d(DateUtils.format18(Date()) + " onActivitySaveInstanceState") XLog.d(DateUtils.format18(Date()) + " onActivitySaveInstanceState")
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
val memoryStatus = "\ttotalMemory:${Runtime.getRuntime().totalMemory()}\tfreeMemory:${Runtime.getRuntime().freeMemory()}" val memoryStatus = "\ttotalMemory:${
LogFileUtils.writeLog(ContextUtils.getContext(), Runtime.getRuntime().totalMemory()
}\tfreeMemory:${Runtime.getRuntime().freeMemory()}"
LogFileUtils.writeLog(
ContextUtils.getContext(),
"\n${DateUtils.format18(Date())}########onActivitySaveInstanceState() called with:" + "\n${DateUtils.format18(Date())}########onActivitySaveInstanceState() called with:" +
" activity = [$activity]\nmemoryStatus: $memoryStatus") " activity = [$activity]\nmemoryStatus: $memoryStatus"
)
} }
} }
override fun onActivityDestroyed(activity: Activity) { override fun onActivityDestroyed(activity: Activity) {
XLog.d(DateUtils.format18(Date()) + " onActivityDestroyed") XLog.d(DateUtils.format18(Date()) + " onActivityDestroyed")
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
LogFileUtils.writeLog(ContextUtils.getContext(), LogFileUtils.writeLog(
"\n${DateUtils.format18(Date())}########onActivityDestroyed() called with: activity = [$activity]\n") ContextUtils.getContext(),
"\n${DateUtils.format18(Date())}########onActivityDestroyed() called with: activity = [$activity]\n"
)
} }
} }
}) })
......
...@@ -3,9 +3,9 @@ package com.miya.fastcashier.beans ...@@ -3,9 +3,9 @@ package com.miya.fastcashier.beans
import android.text.TextUtils import android.text.TextUtils
import androidx.room.Entity import androidx.room.Entity
import androidx.room.PrimaryKey import androidx.room.PrimaryKey
import com.fastcashier.lib_common.util.isEmpty
import com.miya.fastcashier.dao.DatabaseKeeper import com.miya.fastcashier.dao.DatabaseKeeper
import com.miya.fastcashier.service.AccountService import com.miya.fastcashier.service.AccountService
import com.miya.fastcashier.utils.isEmpty
import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse import com.sdy.miya.moblie.component.pay.platform.bean.PayServiceResponse
import java.lang.RuntimeException import java.lang.RuntimeException
......
...@@ -16,12 +16,12 @@ import com.blankj.utilcode.util.EncodeUtils; ...@@ -16,12 +16,12 @@ import com.blankj.utilcode.util.EncodeUtils;
import com.blankj.utilcode.util.LogUtils; import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.StringUtils; import com.blankj.utilcode.util.StringUtils;
import com.fastcashier.lib_common.BuildConfig; import com.fastcashier.lib_common.BuildConfig;
import com.fastcashier.lib_common.net.CommonCallback;
import com.miya.fastcashier.R; import com.miya.fastcashier.R;
import com.miya.fastcashier.beans.SelfCashierTerminalConfig; import com.miya.fastcashier.beans.SelfCashierTerminalConfig;
import com.miya.fastcashier.net.ApiConfig; import com.miya.fastcashier.net.ApiConfig;
import com.miya.fastcashier.net.ApiRequest; import com.miya.fastcashier.net.ApiRequest;
import com.miya.fastcashier.net.ApiService; import com.miya.fastcashier.net.ApiService;
import com.miya.fastcashier.net.CommonCallback;
import com.miya.fastcashier.service.AccountService; import com.miya.fastcashier.service.AccountService;
import com.miya.fastcashier.ui.BaseActivity; import com.miya.fastcashier.ui.BaseActivity;
import com.miya.fastcashier.utils.LogFileUtils; import com.miya.fastcashier.utils.LogFileUtils;
......
...@@ -7,6 +7,9 @@ import android.view.View ...@@ -7,6 +7,9 @@ import android.view.View
import android.view.WindowManager import android.view.WindowManager
import android.widget.TextView import android.widget.TextView
import com.fastcashier.lib_common.BuildConfig 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.R
import com.miya.fastcashier.databinding.DialogSystemParameterBinding import com.miya.fastcashier.databinding.DialogSystemParameterBinding
import com.miya.fastcashier.net.ApiConfig.baseUrl import com.miya.fastcashier.net.ApiConfig.baseUrl
......
package com.miya.fastcashier.net package com.miya.fastcashier.net
import android.util.Log 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.SelfCashierAccountInfo
import com.miya.fastcashier.beans.LoginRequest;
import com.miya.fastcashier.utils.LogFileUtils import com.miya.fastcashier.utils.LogFileUtils
import okhttp3.MultipartBody import okhttp3.MultipartBody
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
...@@ -34,7 +35,7 @@ class ApiRequest private constructor() { ...@@ -34,7 +35,7 @@ class ApiRequest private constructor() {
MiyaHttpLoggingInterceptor { MiyaHttpLoggingInterceptor {
Log.e("####", it) Log.e("####", it)
if (!LogFileUtils.isProhibitWrite) { if (!LogFileUtils.isProhibitWrite) {
LogFileUtils.writeLog(BaseApplication.getApplication(),it) LogFileUtils.writeLog(MiyaApplication.getApplication(),it)
} }
}.apply { level = MiyaHttpLoggingInterceptor.Level.BODY } }.apply { level = MiyaHttpLoggingInterceptor.Level.BODY }
......
package com.miya.fastcashier.service package com.miya.fastcashier.service
import android.text.TextUtils import android.text.TextUtils
import com.fastcashier.lib_common.util.isEmpty
import com.miya.fastcashier.beans.SelfCashierAccountInfo import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.beans.ViewOrderStatisticsInfo import com.miya.fastcashier.beans.ViewOrderStatisticsInfo
import com.miya.fastcashier.utils.DateUtils import com.miya.fastcashier.utils.DateUtils
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum
import com.miya.fastcashier.utils.StringPriceFormat import com.miya.fastcashier.utils.StringPriceFormat
import com.miya.fastcashier.utils.isEmpty
import com.miya.fastcashier.utils.manage.OrderRecordManageKit import com.miya.fastcashier.utils.manage.OrderRecordManageKit
import com.miya.print.IPrinter import com.miya.print.IPrinter
import com.miya.print.PrinterManager import com.miya.print.PrinterManager
......
...@@ -7,7 +7,6 @@ import android.widget.Toast ...@@ -7,7 +7,6 @@ import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import com.miya.fastcashier.BaseApplication
import com.miya.fastcashier.R import com.miya.fastcashier.R
import com.miya.fastcashier.databinding.ActivityMainBinding import com.miya.fastcashier.databinding.ActivityMainBinding
import com.miya.fastcashier.service.AccountService import com.miya.fastcashier.service.AccountService
......
...@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager ...@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.adapter.FragmentStateAdapter import androidx.viewpager2.adapter.FragmentStateAdapter
import com.elvishew.xlog.XLog import com.elvishew.xlog.XLog
import com.fastcashier.lib_common.util.dp2px
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.miya.fastcashier.R import com.miya.fastcashier.R
import com.miya.fastcashier.beans.ViewPayOrderData import com.miya.fastcashier.beans.ViewPayOrderData
......
...@@ -3,10 +3,11 @@ package com.miya.fastcashier.ui ...@@ -3,10 +3,11 @@ package com.miya.fastcashier.ui
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.Gravity import android.view.Gravity
import androidx.fragment.app.FragmentManager 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.R
import com.miya.fastcashier.databinding.ActivitySettingBinding import com.miya.fastcashier.databinding.ActivitySettingBinding
import com.miya.fastcashier.log.FunctionCenterActivity import com.miya.fastcashier.log.FunctionCenterActivity
...@@ -109,7 +110,7 @@ class SettingActivity : BaseActivity() { ...@@ -109,7 +110,7 @@ class SettingActivity : BaseActivity() {
alertDialog!!.dismiss() alertDialog!!.dismiss()
alertDialog = null alertDialog = null
run { run {
BaseApplication.getApplication().resetConfig() MiyaApplication.getApplication().resetConfig()
LoginActivity.start( LoginActivity.start(
this@SettingActivity, this@SettingActivity,
Intent.FLAG_ACTIVITY_CLEAR_TASK Intent.FLAG_ACTIVITY_CLEAR_TASK
......
...@@ -10,11 +10,11 @@ import android.widget.EditText ...@@ -10,11 +10,11 @@ import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import com.fastcashier.lib_common.util.dp2px
import com.miya.fastcashier.databinding.DialogAuthorizePasswordInputBinding import com.miya.fastcashier.databinding.DialogAuthorizePasswordInputBinding
import com.miya.fastcashier.ui.BaseActivity import com.miya.fastcashier.ui.BaseActivity
import com.miya.fastcashier.ui.RefundActivity import com.miya.fastcashier.ui.RefundActivity
import com.miya.fastcashier.utils.CenterToasty import com.miya.fastcashier.utils.CenterToasty
import com.miya.fastcashier.utils.dp2px
import com.miya.fastcashier.utils.manage.AccountPasswordManageKit import com.miya.fastcashier.utils.manage.AccountPasswordManageKit
class AuthorizePasswordInputDialog : DialogFragment(), View.OnClickListener { class AuthorizePasswordInputDialog : DialogFragment(), View.OnClickListener {
......
...@@ -4,12 +4,12 @@ import androidx.lifecycle.LiveData ...@@ -4,12 +4,12 @@ import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.fastcashier.lib_common.net.CommonCallback
import com.miya.fastcashier.R import com.miya.fastcashier.R
import com.miya.fastcashier.beans.LoginFormState import com.miya.fastcashier.beans.LoginFormState
import com.miya.fastcashier.beans.LoginRequest import com.miya.fastcashier.beans.LoginRequest
import com.miya.fastcashier.beans.SelfCashierAccountInfo import com.miya.fastcashier.beans.SelfCashierAccountInfo
import com.miya.fastcashier.net.ApiRequest import com.miya.fastcashier.net.ApiRequest
import com.miya.fastcashier.net.CommonCallback
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
......
...@@ -4,14 +4,12 @@ import android.text.TextUtils ...@@ -4,14 +4,12 @@ import android.text.TextUtils
import androidx.lifecycle.MutableLiveData import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.fastcashier.lib_common.util.isEmpty
import com.miya.fastcashier.dao.DatabaseKeeper import com.miya.fastcashier.dao.DatabaseKeeper
import com.miya.fastcashier.utils.DateUtils import com.miya.fastcashier.utils.DateUtils
import com.miya.fastcashier.utils.MiYaPayPlantformPayWayEnum 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.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.lang.Exception
import com.miya.fastcashier.beans.ViewPayOrderData as ViewPayOrderData1 import com.miya.fastcashier.beans.ViewPayOrderData as ViewPayOrderData1
class SearchOrderViewModel : ViewModel() { class SearchOrderViewModel : ViewModel() {
......
...@@ -41,6 +41,7 @@ dependencies { ...@@ -41,6 +41,7 @@ dependencies {
api 'androidx.core:core-ktx:1.3.1' api 'androidx.core:core-ktx:1.3.1'
api 'androidx.appcompat:appcompat: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 'com.google.android.material:material:1.2.1'
api 'androidx.constraintlayout:constraintlayout:2.0.1' api 'androidx.constraintlayout:constraintlayout:2.0.1'
api 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0' api 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
......
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
package com.miya.fastcashier.net package com.fastcashier.lib_common.net
import android.util.Log 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.fastcashier.lib_common.net.BaseResponse
import com.miya.fastcashier.BaseApplication.Companion.getApplication import com.fastcashier.lib_common.util.isNetworkConnected
import com.miya.fastcashier.R
import com.miya.fastcashier.utils.isNetworkConnected
import retrofit2.Call import retrofit2.Call
import retrofit2.Callback import retrofit2.Callback
import retrofit2.Response import retrofit2.Response
......
package com.miya.fastcashier.utils package com.fastcashier.lib_common.util
import android.content.Context import android.content.Context
import android.content.pm.PackageInfo import android.content.pm.PackageInfo
......
<?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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment