Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Y
Ytt
Project
Project
Details
Activity
Releases
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
王雷
Ytt
Commits
86c66a4e
Commit
86c66a4e
authored
Apr 06, 2021
by
王雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1)商品详情页的二维码隐藏;
parent
baf4031f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
38 additions
and
10 deletions
+38
-10
gradle.xml
.idea/gradle.xml
+1
-0
build.gradle
app/build.gradle
+4
-2
app-release.apk
app/release/app-release.apk
+0
-0
output-metadata.json
app/release/output-metadata.json
+2
-2
DetailFragment.kt
app/src/main/java/com/qimai/yttgrass/DetailFragment.kt
+23
-6
MainActivity.kt
app/src/main/java/com/qimai/yttgrass/MainActivity.kt
+7
-0
fragment_goods_detail.xml
app/src/main/res/layout/fragment_goods_detail.xml
+1
-0
No files found.
.idea/gradle.xml
View file @
86c66a4e
...
...
@@ -19,5 +19,6 @@
<option
name=
"useQualifiedModuleNames"
value=
"true"
/>
</GradleProjectSettings>
</option>
<option
name=
"offlineMode"
value=
"true"
/>
</component>
</project>
\ No newline at end of file
app/build.gradle
View file @
86c66a4e
...
...
@@ -9,13 +9,15 @@ android {
compileSdkVersion
30
packagingOptions
{
exclude
'META-INF/*.kotlin_module'
exclude
'classes.dex'
exclude
'**.**'
}
defaultConfig
{
applicationId
"com.qimai.yttgrass"
minSdkVersion
21
targetSdkVersion
30
versionCode
2
versionName
"1.
1
"
versionCode
3
versionName
"1.
2
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
}
...
...
app/release/app-release.apk
View file @
86c66a4e
No preview for this file type
app/release/output-metadata.json
View file @
86c66a4e
...
...
@@ -10,8 +10,8 @@
{
"type"
:
"SINGLE"
,
"filters"
:
[],
"versionCode"
:
2
,
"versionName"
:
"1.
1
"
,
"versionCode"
:
3
,
"versionName"
:
"1.
2
"
,
"outputFile"
:
"app-release.apk"
}
]
...
...
app/src/main/java/com/qimai/yttgrass/DetailFragment.kt
View file @
86c66a4e
...
...
@@ -67,7 +67,11 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
}
else
{
ll_webview
.
visibility
=
View
.
VISIBLE
}
mVm
.
mGoodsInfo
?.
content
?.
let
{
getGoodsHtml
(
it
)
}
?.
let
{
mVm
.
mGoodsInfo
?.
content
?.
let
{
Log
.
d
(
TAG
,
"onActivityCreated111: it= $it"
)
val
info
=
it
.
replace
(
"<img"
,
"<img style='max-width:100%;height:auto;'"
)
getGoodsHtml
(
info
)
}
?.
let
{
Log
.
d
(
TAG
,
"onActivityCreated: it= $it"
)
webview
.
loadDataWithBaseURL
(
null
,
it
,
...
...
@@ -95,7 +99,8 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
tv_sub_introduction
.
visibility
=
View
.
GONE
}
if
(!
goodsId
.
isNullOrEmpty
())
{
mVm
.
getMiniProgramCode
(
goodsId
!!
).
observe
(
viewLifecycleOwner
,
Observer
{
//二维码图片暂不展示
/* mVm.getMiniProgramCode(goodsId!!).observe(viewLifecycleOwner, Observer {
when (it.status) {
Status.SUCCESS -> {
...
...
@@ -107,7 +112,7 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
Log.d(TAG, "onActivityCreated: error= ${it.message}")
}
}
})
})
*/
}
//把商品详情清理掉
mVm
.
mGoodsInfo
=
null
...
...
@@ -143,8 +148,8 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
override
fun
onPageFinished
(
p0
:
WebView
?,
p1
:
String
?)
{
super
.
onPageFinished
(
p0
,
p1
)
Log
.
d
(
TAG
,
"onPageFinished: "
)
imgReset
()
webview
.
loadUrl
(
"javascript:abc.resize(document.body.getBoundingClientRect().height)"
)
//
imgReset()
//
webview.loadUrl("javascript:abc.resize(document.body.getBoundingClientRect().height)")
}
override
fun
onReceivedError
(
...
...
@@ -273,7 +278,19 @@ class DetailFragment(contentLayoutId: Int = R.layout.fragment_goods_detail) :
}
private
fun
getGoodsHtml
(
content
:
String
):
String
{
return
"<html> <body>${content}</body></html>"
return
"<html> <body> <style>\n"
+
" * {\n"
+
" margin: 0;\n"
+
" padding: 0\n"
+
" }\n"
+
" p {\n"
+
" font-size: 0;\n"
+
" }\n"
+
" img{\n"
+
" width: 100%;\n"
+
" vertical-align: top;\n"
+
" }\n"
+
" </style>${content}</body></html>"
}
private
fun
countdown
()
{
...
...
app/src/main/java/com/qimai/yttgrass/MainActivity.kt
View file @
86c66a4e
...
...
@@ -11,6 +11,7 @@ import android.widget.Toast
import
androidx.appcompat.app.AppCompatActivity
import
androidx.lifecycle.Observer
import
androidx.lifecycle.ViewModelProvider
import
androidx.lifecycle.lifecycleScope
import
androidx.navigation.Navigation
import
androidx.navigation.Navigation.findNavController
import
com.qimai.android.fetch.Response.Status
...
...
@@ -19,6 +20,8 @@ import com.qimai.yttgrass.scan.ScanGun
import
com.qimai.yttgrass.vm.HomeVm
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.fragment_welcome.*
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
class
MainActivity
:
AppCompatActivity
()
{
private
var
mScanGun
:
ScanGun
?
=
null
...
...
@@ -31,6 +34,10 @@ class MainActivity : AppCompatActivity() {
hideBottomUIMenu
()
setContentView
(
R
.
layout
.
activity_main
)
initData
()
/* lifecycleScope.launch{
delay(3000)
getInfo("8801051154436")
}*/
}
/**
...
...
app/src/main/res/layout/fragment_goods_detail.xml
View file @
86c66a4e
...
...
@@ -130,6 +130,7 @@
android:layout_marginRight=
"30dp"
android:layout_marginBottom=
"30dp"
android:background=
"@color/white"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintDimensionRatio=
"1:1"
app:layout_constraintRight_toRightOf=
"parent"
...
...
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