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
Show 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
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
...
...
@@ -48,23 +51,17 @@ class MainActivity : BaseActivity() {
setContentView
(
binding
.
root
)
viewModel
=
ViewModelProvider
(
this
).
get
(
MainViewModel
::
class
.
java
)
val
llPay
=
binding
.
llPay
val
llRefund
=
binding
.
llRefund
val
tvPrintLast
=
binding
.
tvPrintLast
val
ivSetting
=
binding
.
ivSetting
val
tvStoreName
=
binding
.
tvStoreName
val
tvSlog
=
binding
.
tvSlog
binding
.
tvStoreName
.
text
=
AccountService
.
getAccountInfo
()
?.
shopInfo
?.
storeName
binding
.
tvSlog
.
text
=
AccountService
.
getUserName
()
binding
.
tvVersion
.
text
=
getVersionName
(
this
)
tvStoreName
.
text
=
AccountService
.
getAccountInfo
()
?.
shopInfo
?.
storeName
tvSlog
.
text
=
AccountService
.
getUserName
()
llPay
.
clickWithTrigger
{
binding
.
llPay
.
clickWithTrigger
{
PriceInputActivity
.
start
(
this
@MainActivity
)
}
llRefund
.
clickWithTrigger
{
binding
.
llRefund
.
clickWithTrigger
{
toRefund
()
}
tvPrintLast
.
clickWithTrigger
{
binding
.
tvPrintLast
.
clickWithTrigger
{
try
{
PrintService
.
printLastOrderInfo
()
}
catch
(
e
:
Exception
)
{
...
...
@@ -75,7 +72,7 @@ class MainActivity : BaseActivity() {
SearchOrderActivity
.
start
(
this
@MainActivity
)
}
ivSetting
.
clickWithTrigger
{
binding
.
ivSetting
.
clickWithTrigger
{
SettingActivity
.
start
(
this
@MainActivity
)
}
...
...
app/src/main/res/layout/activity_main.xml
View file @
7b072ec1
...
...
@@ -57,7 +57,7 @@
android:layout_marginTop=
"23dp"
android:ellipsize=
"end"
android:maxLines=
"1"
android:text=
"匡威-杭州滨江店
!
"
android:text=
"匡威-杭州滨江店"
android:textColor=
"@color/white"
android:textSize=
"36sp"
app:layout_constraintEnd_toStartOf=
"@+id/ivSetting"
...
...
@@ -244,8 +244,18 @@
<ImageView
android:layout_width=
"220dp"
android:layout_height=
"40dp"
android:layout_marginBottom=
"
24
dp"
android:layout_marginBottom=
"
10
dp"
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_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
/>
...
...
lib_common/src/main/AndroidManifest.xml
View file @
7b072ec1
...
...
@@ -2,4 +2,5 @@
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.fastcashier.lib_common"
>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
</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? {
var
version
=
""
try
{
packageInfo
=
packageManager
.
getPackageInfo
(
context
.
packageName
,
0
)
version
=
"${packageInfo.versionCode}_
v
${packageInfo.versionName}"
version
=
"${packageInfo.versionCode}_
V
${packageInfo.versionName}"
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
e
.
printStackTrace
()
}
...
...
@@ -116,6 +116,19 @@ fun getVersionCode(context: Context): String? {
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
...
...
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