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
7b072ec1
Commit
7b072ec1
authored
Jun 22, 2022
by
赵鹏翔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改主界面版本处理
parent
310b9de6
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
16 deletions
+37
-16
MainActivity.kt
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
+10
-13
activity_main.xml
app/src/main/res/layout/activity_main.xml
+12
-2
AndroidManifest.xml
lib_common/src/main/AndroidManifest.xml
+1
-0
BaseFunction.kt
...main/java/com/fastcashier/lib_common/util/BaseFunction.kt
+14
-1
No files found.
app/src/main/java/com/miya/fastcashier/ui/MainActivity.kt
View file @
7b072ec1
...
@@ -15,6 +15,9 @@ import com.fastcashier.lib_common.function.print.PrintService
...
@@ -15,6 +15,9 @@ import com.fastcashier.lib_common.function.print.PrintService
import
com.fastcashier.lib_common.ui.dialog.CommonDialog
import
com.fastcashier.lib_common.ui.dialog.CommonDialog
import
com.fastcashier.lib_common.util.DateUtils
import
com.fastcashier.lib_common.util.DateUtils
import
com.fastcashier.lib_common.util.clickWithTrigger
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.R
import
com.miya.fastcashier.databinding.ActivityMainBinding
import
com.miya.fastcashier.databinding.ActivityMainBinding
import
com.miya.fastcashier.ui.dialog.AuthorizePasswordInputDialog
import
com.miya.fastcashier.ui.dialog.AuthorizePasswordInputDialog
...
@@ -48,23 +51,17 @@ class MainActivity : BaseActivity() {
...
@@ -48,23 +51,17 @@ class MainActivity : BaseActivity() {
setContentView
(
binding
.
root
)
setContentView
(
binding
.
root
)
viewModel
=
ViewModelProvider
(
this
).
get
(
MainViewModel
::
class
.
java
)
viewModel
=
ViewModelProvider
(
this
).
get
(
MainViewModel
::
class
.
java
)
val
llPay
=
binding
.
llPay
binding
.
tvStoreName
.
text
=
AccountService
.
getAccountInfo
()
?.
shopInfo
?.
storeName
val
llRefund
=
binding
.
llRefund
binding
.
tvSlog
.
text
=
AccountService
.
getUserName
()
val
tvPrintLast
=
binding
.
tvPrintLast
binding
.
tvVersion
.
text
=
getVersionName
(
this
)
val
ivSetting
=
binding
.
ivSetting
val
tvStoreName
=
binding
.
tvStoreName
val
tvSlog
=
binding
.
tvSlog
tvStoreName
.
text
=
AccountService
.
getAccountInfo
()
?.
shopInfo
?.
storeName
binding
.
llPay
.
clickWithTrigger
{
tvSlog
.
text
=
AccountService
.
getUserName
()
llPay
.
clickWithTrigger
{
PriceInputActivity
.
start
(
this
@MainActivity
)
PriceInputActivity
.
start
(
this
@MainActivity
)
}
}
llRefund
.
clickWithTrigger
{
binding
.
llRefund
.
clickWithTrigger
{
toRefund
()
toRefund
()
}
}
tvPrintLast
.
clickWithTrigger
{
binding
.
tvPrintLast
.
clickWithTrigger
{
try
{
try
{
PrintService
.
printLastOrderInfo
()
PrintService
.
printLastOrderInfo
()
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
@@ -75,7 +72,7 @@ class MainActivity : BaseActivity() {
...
@@ -75,7 +72,7 @@ class MainActivity : BaseActivity() {
SearchOrderActivity
.
start
(
this
@MainActivity
)
SearchOrderActivity
.
start
(
this
@MainActivity
)
}
}
ivSetting
.
clickWithTrigger
{
binding
.
ivSetting
.
clickWithTrigger
{
SettingActivity
.
start
(
this
@MainActivity
)
SettingActivity
.
start
(
this
@MainActivity
)
}
}
...
...
app/src/main/res/layout/activity_main.xml
View file @
7b072ec1
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
android:layout_marginTop=
"23dp"
android:layout_marginTop=
"23dp"
android:ellipsize=
"end"
android:ellipsize=
"end"
android:maxLines=
"1"
android:maxLines=
"1"
android:text=
"匡威-杭州滨江店
!
"
android:text=
"匡威-杭州滨江店"
android:textColor=
"@color/white"
android:textColor=
"@color/white"
android:textSize=
"36sp"
android:textSize=
"36sp"
app:layout_constraintEnd_toStartOf=
"@+id/ivSetting"
app:layout_constraintEnd_toStartOf=
"@+id/ivSetting"
...
@@ -244,8 +244,18 @@
...
@@ -244,8 +244,18 @@
<ImageView
<ImageView
android:layout_width=
"220dp"
android:layout_width=
"220dp"
android:layout_height=
"40dp"
android:layout_height=
"40dp"
android:layout_marginBottom=
"
24
dp"
android:layout_marginBottom=
"
10
dp"
android:background=
"@mipmap/app_home_bottom_store_logo"
android:background=
"@mipmap/app_home_bottom_store_logo"
app:layout_constraintBottom_toTopOf=
"@id/tv_version"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_version"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"10dp"
android:textSize=
"26sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
app:layout_constraintStart_toStartOf=
"parent"
/>
...
...
lib_common/src/main/AndroidManifest.xml
View file @
7b072ec1
...
@@ -2,4 +2,5 @@
...
@@ -2,4 +2,5 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.fastcashier.lib_common"
>
package=
"com.fastcashier.lib_common"
>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
</manifest>
</manifest>
\ No newline at end of file
lib_common/src/main/java/com/fastcashier/lib_common/util/BaseFunction.kt
View file @
7b072ec1
...
@@ -96,7 +96,7 @@ fun getVersion(context: Context): String? {
...
@@ -96,7 +96,7 @@ fun getVersion(context: Context): String? {
var
version
=
""
var
version
=
""
try
{
try
{
packageInfo
=
packageManager
.
getPackageInfo
(
context
.
packageName
,
0
)
packageInfo
=
packageManager
.
getPackageInfo
(
context
.
packageName
,
0
)
version
=
"${packageInfo.versionCode}_
v
${packageInfo.versionName}"
version
=
"${packageInfo.versionCode}_
V
${packageInfo.versionName}"
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
e
.
printStackTrace
()
e
.
printStackTrace
()
}
}
...
@@ -116,6 +116,19 @@ fun getVersionCode(context: Context): String? {
...
@@ -116,6 +116,19 @@ fun getVersionCode(context: Context): String? {
return
version
return
version
}
}
fun
getVersionName
(
context
:
Context
):
String
?
{
val
packageManager
=
context
.
packageManager
val
packageInfo
:
PackageInfo
var
versionName
=
""
try
{
packageInfo
=
packageManager
.
getPackageInfo
(
context
.
packageName
,
0
)
versionName
=
"V${packageInfo.versionName}"
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
e
.
printStackTrace
()
}
return
versionName
}
/**
/**
* 判断是否有网络连接
* 判断是否有网络连接
* @param context
* @param context
...
...
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