Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
Y
YPPos
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱世闯
YPPos
Commits
14df108f
Commit
14df108f
authored
Oct 27, 2021
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增大屏自助收银
parent
b6ff6cd1
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
128 additions
and
62 deletions
+128
-62
HttpRequestManger.kt
...m/ypsx/yppos/http/repository/request/HttpRequestManger.kt
+1
-0
RegisterActivity.kt
.../main/java/com/ypsx/yppos/ui/activity/RegisterActivity.kt
+29
-40
SplashActivity.kt
...rc/main/java/com/ypsx/yppos/ui/activity/SplashActivity.kt
+1
-0
RequestRegisterViewModel.kt
.../ypsx/yppos/viewmodel/request/RequestRegisterViewModel.kt
+19
-9
build.gradle
self_yppos/build.gradle
+2
-2
ExampleInstrumentedTest.kt
...idTest/java/com/ypsx/ypselfpos/ExampleInstrumentedTest.kt
+2
-2
AndroidManifest.xml
self_yppos/src/main/AndroidManifest.xml
+5
-4
DeviceLoginActivity.kt
...ava/com/ypsx/ypselfpos/ui/activity/DeviceLoginActivity.kt
+12
-0
MainActivity.kt
.../main/java/com/ypsx/ypselfpos/ui/activity/MainActivity.kt
+2
-2
MemberLoginActivity.kt
...ava/com/ypsx/ypselfpos/ui/activity/MemberLoginActivity.kt
+12
-0
RegisterActivity.kt
...n/java/com/ypsx/ypselfpos/ui/activity/RegisterActivity.kt
+12
-0
SplashActivity.kt
...ain/java/com/ypsx/ypselfpos/ui/activity/SplashActivity.kt
+2
-2
activity_device_login.xml
self_yppos/src/main/res/layout/activity_device_login.xml
+9
-0
activity_member_login.xml
self_yppos/src/main/res/layout/activity_member_login.xml
+9
-0
activity_register.xml
self_yppos/src/main/res/layout/activity_register.xml
+9
-0
activity_splash.xml
self_yppos/src/main/res/layout/activity_splash.xml
+1
-0
ic_splash_image.png
self_yppos/src/main/res/mipmap-xxxhdpi/ic_splash_image.png
+0
-0
ic_splash_image.webp
self_yppos/src/main/res/mipmap-xxxhdpi/ic_splash_image.webp
+0
-0
ExampleUnitTest.kt
...yppos/src/test/java/com/ypsx/ypselfpos/ExampleUnitTest.kt
+1
-1
No files found.
app/src/main/java/com/ypsx/yppos/http/repository/request/HttpRequestManger.kt
View file @
14df108f
...
...
@@ -32,6 +32,7 @@ class HttpRequestManger {
*/
suspend
fun
applyPos
(
applyPosMachineRequest
:
ApplyPosMachineRequest
):
ApiResponse
<
PosMachineResponse
>
{
CacheUtil
.
setUpdateTimeBigger
(
""
)
CacheUtil
.
setLoginResponse
(
null
)
PosDatabase
.
clearAllTables
()
val
applyPosData
=
apiService
.
applyPos
(
applyPosMachineRequest
)
if
(
applyPosData
.
isSuccess
())
{
...
...
app/src/main/java/com/ypsx/yppos/ui/activity/RegisterActivity.kt
View file @
14df108f
...
...
@@ -2,6 +2,7 @@ package com.ypsx.yppos.ui.activity
import
android.os.Bundle
import
androidx.activity.viewModels
import
androidx.lifecycle.Observer
import
com.afollestad.materialdialogs.MaterialDialog
import
com.afollestad.materialdialogs.list.SingleChoiceListener
import
com.afollestad.materialdialogs.list.listItemsSingleChoice
...
...
@@ -24,6 +25,7 @@ import com.ypsx.common.app.base.BaseActivity
import
com.ypsx.common.app.ext.getIntent
import
com.ypsx.common.app.ext.showServerHostExt
import
com.ypsx.common.app.ext.startKtxActivityFinish
import
com.ypsx.yppos.utils.toast
import
com.ypsx.yppos.viewmodel.request.RequestRegisterViewModel
import
com.ypsx.yppos.viewmodel.state.RegisterViewModel
...
...
@@ -31,18 +33,11 @@ import com.ypsx.yppos.viewmodel.state.RegisterViewModel
* 注册页
*/
class
RegisterActivity
:
BaseActivity
<
RegisterViewModel
,
ActivityRegisterBinding
>()
{
private
var
exitTime
:
Long
=
0
private
var
clickNum
=
1
private
val
requestMeViewModel
:
RequestRegisterViewModel
by
viewModels
()
override
fun
layoutId
():
Int
=
R
.
layout
.
activity_register
private
val
hostMap
=
mapOf
(
"sit开发环境Host"
to
"https://sit-cpos.ypshengxian.com/"
,
"预发Host"
to
"https://pre-cpos.ypshengxian.com/"
,
"线上正式Host"
to
"https://cpos.ypshengxian.com/"
,
)
private
val
hosts
=
hostMap
.
values
.
toTypedArray
()
private
val
names
=
hostMap
.
keys
.
toList
()
override
fun
initView
(
savedInstanceState
:
Bundle
?)
{
mDatabind
.
vm
=
mViewModel
...
...
@@ -83,7 +78,8 @@ class RegisterActivity : BaseActivity<RegisterViewModel, ActivityRegisterBinding
)
XLog
.
d
(
"提交申请信息:${applyPosMachineRequest.toJson()}"
)
mViewModel
.
submitState
.
set
(
false
)
mViewModel
.
submitText
.
set
(
"审核中"
)
// showLoading("请求网络中...")
requestMeViewModel
.
applyPos
(
applyPosMachineRequest
)
}
...
...
@@ -116,7 +112,16 @@ class RegisterActivity : BaseActivity<RegisterViewModel, ActivityRegisterBinding
PosStatus
.
APPLY_FAILED
.
name
->
{
val
applyFailedMessage
=
data
.
applyFailedMessage
LogUtils
.
debugInfo
(
"错误原因:${applyFailedMessage}"
)
showError
(
"提示"
,
"您的审核未通过,请重新提交"
,
"我知道了"
)
// showError("提示", "您的审核未通过,请重新提交", "我知道了")
val
messagePopupWindow
=
MessagePopupWindow
(
this
)
messagePopupWindow
.
showPopupWindow
()
messagePopupWindow
.
setData
(
"提示"
,
"您的审核未通过,请重新提交"
,
sure
=
"我知道了"
,
gone
=
false
)
messagePopupWindow
.
setMessageClick
{
messagePopupWindow
.
dismiss
()
mViewModel
.
submitState
.
set
(
true
)
mViewModel
.
submitText
.
set
(
"提交申请"
)
requestMeViewModel
.
cancelJob
()
}
}
PosStatus
.
DISABLED
.
name
->
{
val
messagePopupWindow
=
MessagePopupWindow
(
this
)
...
...
@@ -124,8 +129,9 @@ class RegisterActivity : BaseActivity<RegisterViewModel, ActivityRegisterBinding
messagePopupWindow
.
setData
(
"提示"
,
"该POS机已停用,是否将删除本地数据"
,
"取消"
,
"确定"
,
false
)
messagePopupWindow
.
setMessageClick
{
messagePopupWindow
.
dismiss
()
CacheUtil
.
setUpdateTimeBigger
(
""
)
CacheUtil
.
setLoginResponse
(
null
)
mViewModel
.
submitState
.
set
(
true
)
mViewModel
.
submitText
.
set
(
"提交申请"
)
requestMeViewModel
.
cancelJob
()
}
}
}
...
...
@@ -133,6 +139,16 @@ class RegisterActivity : BaseActivity<RegisterViewModel, ActivityRegisterBinding
})
requestMeViewModel
.
posState
.
observe
(
this
,
Observer
{
if
(
it
.
isSuccess
)
{
it
.
errorMsg
.
toast
()
mViewModel
.
submitState
.
set
(
true
)
mViewModel
.
submitText
.
set
(
"提交申请"
)
requestMeViewModel
.
cancelJob
()
}
})
}
private
fun
startLogin
()
{
...
...
@@ -157,32 +173,5 @@ class RegisterActivity : BaseActivity<RegisterViewModel, ActivityRegisterBinding
}
private
fun
showServerHostPopWindow
()
{
//选中的host
val
checkHost
=
CacheUtil
.
getHost
()
var
checkedIndex
=
hosts
.
indexOf
(
checkHost
)
if
(
checkedIndex
<
0
)
checkedIndex
=
names
.
size
-
1
//也就是研发Native那个
//启用输入的host
MaterialDialog
(
this
).
title
(
text
=
"切换Server接口"
)
.
cancelable
(
false
)
.
cancelOnTouchOutside
(
false
)
.
listItemsSingleChoice
(
items
=
names
,
initialSelection
=
checkedIndex
,
selection
=
object
:
SingleChoiceListener
{
override
fun
invoke
(
dialog
:
MaterialDialog
,
index
:
Int
,
text
:
CharSequence
)
{
//如果选择了研发native,index就会超过host的index
if
(
index
<
hosts
.
size
)
{
CacheUtil
.
setHost
(
hosts
[
index
])
CacheUtil
.
clearAll
()
PosDatabase
.
clearAllTables
()
PosApp
.
instance
.
restartApplication
()
}
}
})
.
positiveButton
(
text
=
"确定"
)
.
negativeButton
(
text
=
"取消"
)
.
show
()
}
}
\ No newline at end of file
app/src/main/java/com/ypsx/yppos/ui/activity/SplashActivity.kt
View file @
14df108f
...
...
@@ -163,6 +163,7 @@ class SplashActivity : BaseActivity<BaseViewModel, ActivitySplashBinding>() {
PosStatus
.
APPLY
.
name
->
{
val
arrayOf
=
arrayOf
(
Pair
<
String
,
Any
>(
"state"
,
true
),
Pair
<
String
,
Any
>(
"posId"
,
data
.
id
))
startKtxActivity
<
RegisterActivity
>(
values
=
arrayOf
)
finish
()
}
PosStatus
.
ACTIVE
.
name
->
{
startLogin
()
...
...
app/src/main/java/com/ypsx/yppos/viewmodel/request/RequestRegisterViewModel.kt
View file @
14df108f
...
...
@@ -11,29 +11,34 @@ import com.ypsx.yppos.http.data.request.ApplyPosMachineRequest
import
com.ypsx.yppos.http.repository.request.HttpRequestCoroutine
import
com.ypsx.yppos.room.repository.PosConfigRepository
import
com.ypsx.base.util.eXLog
import
com.ypsx.yppos.http.state.UpdateUiState
import
kotlinx.coroutines.Job
class
RequestRegisterViewModel
:
BaseViewModel
()
{
var
posDetails
=
MutableLiveData
<
PosMachineResponse
>()
var
posState
=
MutableLiveData
<
UpdateUiState
<
String
>>()
private
var
job1
:
Job
?
=
null
private
var
job2
:
Job
?
=
null
fun
applyPos
(
applyPosMachineRequest
:
ApplyPosMachineRequest
)
{
request
({
HttpRequestCoroutine
.
applyPos
(
applyPosMachineRequest
)
},
{
job1
=
request
({
HttpRequestCoroutine
.
applyPos
(
applyPosMachineRequest
)
},
{
posDetails
.
postValue
(
it
)
},
{
val
errorMsg
=
it
.
errorMsg
errorMsg
.
toast
(
)
LogUtils
.
debugInfo
(
errorMsg
)
},
isShowDialog
=
true
)
posState
.
postValue
(
UpdateUiState
(
false
,
""
,
errorMsg
)
)
},
isShowDialog
=
true
)
}
fun
getById
(
id
:
String
)
{
request
({
HttpRequestCoroutine
.
getById
(
id
)
},
{
job2
=
request
({
HttpRequestCoroutine
.
getById
(
id
)
},
{
posDetails
.
postValue
(
it
)
},{
it
.
errorMsg
.
eXLog
()
},
isShowDialog
=
true
)
},
{
it
.
errorMsg
.
eXLog
()
posState
.
postValue
(
UpdateUiState
(
false
,
""
,
it
.
errorMsg
))
},
isShowDialog
=
true
)
}
fun
savePosConfig
(
posMachineResponse
:
PosMachineResponse
)
{
...
...
@@ -43,4 +48,9 @@ class RequestRegisterViewModel : BaseViewModel() {
LogUtils
.
debugInfo
(
"保存数据库PosConfig失败"
)
})
}
fun
cancelJob
()
{
job1
!!
.
cancel
()
job2
!!
.
cancel
()
}
}
\ No newline at end of file
self_yppos/build.gradle
View file @
14df108f
...
...
@@ -8,11 +8,11 @@ android {
buildToolsVersion
"30.0.3"
defaultConfig
{
applicationId
"com.ypsx.
self_yp
pos"
applicationId
"com.ypsx.
ypself
pos"
minSdkVersion
21
targetSdkVersion
30
versionCode
1
versionName
"1.0"
versionName
"1.0
0.000
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
...
...
self_yppos/src/androidTest/java/com/ypsx/
self_yp
pos/ExampleInstrumentedTest.kt
→
self_yppos/src/androidTest/java/com/ypsx/
ypself
pos/ExampleInstrumentedTest.kt
View file @
14df108f
package
com.ypsx.
self_yp
pos
package
com.ypsx.
ypself
pos
import
androidx.test.platform.app.InstrumentationRegistry
import
androidx.test.ext.junit.runners.AndroidJUnit4
...
...
@@ -19,6 +19,6 @@ class ExampleInstrumentedTest {
fun
useAppContext
()
{
// Context of the app under test.
val
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
targetContext
assertEquals
(
"com.ypsx.
self_yp
pos"
,
appContext
.
packageName
)
assertEquals
(
"com.ypsx.
ypself
pos"
,
appContext
.
packageName
)
}
}
\ No newline at end of file
self_yppos/src/main/AndroidManifest.xml
View file @
14df108f
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.ypsx.
self_yp
pos"
>
package=
"com.ypsx.
ypself
pos"
>
<application
android:allowBackup=
"true"
...
...
@@ -9,6 +9,9 @@
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.YPPos"
>
<activity
android:name=
".ui.activity.MemberLoginActivity"
></activity>
<activity
android:name=
".ui.activity.DeviceLoginActivity"
/>
<activity
android:name=
".ui.activity.RegisterActivity"
/>
<activity
android:name=
".ui.activity.SplashActivity"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
...
...
@@ -16,9 +19,7 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".ui.activity.MainActivity"
>
</activity>
<activity
android:name=
".ui.activity.MainActivity"
/>
</application>
</manifest>
\ No newline at end of file
self_yppos/src/main/java/com/ypsx/ypselfpos/ui/activity/DeviceLoginActivity.kt
0 → 100644
View file @
14df108f
package
com.ypsx.ypselfpos.ui.activity
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
com.ypsx.ypselfpos.R
class
DeviceLoginActivity
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_device_login
)
}
}
\ No newline at end of file
self_yppos/src/main/java/com/ypsx/
self_yp
pos/ui/activity/MainActivity.kt
→
self_yppos/src/main/java/com/ypsx/
ypself
pos/ui/activity/MainActivity.kt
View file @
14df108f
package
com.ypsx.
self_yp
pos.ui.activity
package
com.ypsx.
ypself
pos.ui.activity
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
com.ypsx.
self_yp
pos.R
import
com.ypsx.
ypself
pos.R
class
MainActivity
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
...
self_yppos/src/main/java/com/ypsx/ypselfpos/ui/activity/MemberLoginActivity.kt
0 → 100644
View file @
14df108f
package
com.ypsx.ypselfpos.ui.activity
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
com.ypsx.ypselfpos.R
class
MemberLoginActivity
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_member_login
)
}
}
\ No newline at end of file
self_yppos/src/main/java/com/ypsx/ypselfpos/ui/activity/RegisterActivity.kt
0 → 100644
View file @
14df108f
package
com.ypsx.ypselfpos.ui.activity
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
com.ypsx.ypselfpos.R
class
RegisterActivity
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_register
)
}
}
\ No newline at end of file
self_yppos/src/main/java/com/ypsx/
self_yp
pos/ui/activity/SplashActivity.kt
→
self_yppos/src/main/java/com/ypsx/
ypself
pos/ui/activity/SplashActivity.kt
View file @
14df108f
package
com.ypsx.
self_yp
pos.ui.activity
package
com.ypsx.
ypself
pos.ui.activity
import
androidx.appcompat.app.AppCompatActivity
import
android.os.Bundle
import
com.ypsx.
self_yp
pos.R
import
com.ypsx.
ypself
pos.R
class
SplashActivity
:
AppCompatActivity
()
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
...
self_yppos/src/main/res/layout/activity_device_login.xml
0 → 100644
View file @
14df108f
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.activity.DeviceLoginActivity"
>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
self_yppos/src/main/res/layout/activity_member_login.xml
0 → 100644
View file @
14df108f
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.activity.MemberLoginActivity"
>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
self_yppos/src/main/res/layout/activity_register.xml
0 → 100644
View file @
14df108f
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".ui.activity.RegisterActivity"
>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
self_yppos/src/main/res/layout/activity_splash.xml
View file @
14df108f
...
...
@@ -4,6 +4,7 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@mipmap/ic_splash_image"
tools:context=
".ui.activity.SplashActivity"
>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
self_yppos/src/main/res/mipmap-xxxhdpi/ic_splash_image.png
deleted
100644 → 0
View file @
b6ff6cd1
This diff is collapsed.
Click to expand it.
self_yppos/src/main/res/mipmap-xxxhdpi/ic_splash_image.webp
0 → 100644
View file @
14df108f
File added
self_yppos/src/test/java/com/ypsx/
self_yp
pos/ExampleUnitTest.kt
→
self_yppos/src/test/java/com/ypsx/
ypself
pos/ExampleUnitTest.kt
View file @
14df108f
package
com.ypsx.
self_yp
pos
package
com.ypsx.
ypself
pos
import
org.junit.Test
...
...
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