Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
HBHAndroid
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
1
Merge Requests
1
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
杨秀秀
HBHAndroid
Commits
317a5933
Commit
317a5933
authored
Nov 07, 2023
by
david
Committed by
杨秀秀
Nov 21, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug修复
parent
255d0615
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
118 additions
and
10 deletions
+118
-10
ApiService.kt
.../src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
+4
-0
HomeRequest.java
...java/com/xx/hbhconsumer/data/http/requst/HomeRequest.java
+19
-0
NewsRequest.java
...java/com/xx/hbhconsumer/data/http/requst/NewsRequest.java
+14
-0
HomeFragment.java
...rc/main/java/com/xx/hbhconsumer/ui/home/HomeFragment.java
+1
-1
HomeViewModel.java
...c/main/java/com/xx/hbhconsumer/ui/home/HomeViewModel.java
+23
-5
NewsDetailActivity.java
...n/java/com/xx/hbhconsumer/ui/news/NewsDetailActivity.java
+12
-0
NewsDetailViewModel.java
.../java/com/xx/hbhconsumer/ui/news/NewsDetailViewModel.java
+20
-0
NewsListViewModel.java
...in/java/com/xx/hbhconsumer/ui/news/NewsListViewModel.java
+25
-4
No files found.
consumer/src/main/java/com/xx/hbhconsumer/data/http/ApiService.kt
View file @
317a5933
...
...
@@ -338,6 +338,10 @@ interface ApiService {
@PUT
(
"app/order/consumer-app/close/{businessId}"
)
fun
closeOrder
(
@Path
(
"businessId"
)
businessId
:
String
):
Observable
<
BaseResponse
<
Boolean
>>
@Headers
(
"Content-type:application/json"
)
@PUT
(
"app/information/addView"
)
fun
addView
(
@Body
requestBody
:
RequestBody
):
Observable
<
BaseResponse
<
String
>>
@Headers
(
"Content-type:application/json"
)
@POST
(
"app/order/consumer-app/claimed-coupon"
)
...
...
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/HomeRequest.java
View file @
317a5933
...
...
@@ -33,6 +33,17 @@ public class HomeRequest extends BaseRespons {
return
getApiService
().
getMessageList
(
0
,
page
);
}
/**
* 获取广告列表
* @return
*/
public
Observable
<
BaseResponse
<
String
>>
addView
(
String
businessId
)
{
AddViewRequestBody
addViewRequestBody
=
new
AddViewRequestBody
(
businessId
);
ApiParams
<
AddViewRequestBody
>
apiParams
=
new
ApiParams
<
AddViewRequestBody
>();
RequestBody
body
=
apiParams
.
setParams
(
addViewRequestBody
);
return
getApiService
().
addView
(
body
);
}
/**
* 获取广告列表
* @return
...
...
@@ -83,6 +94,14 @@ public class HomeRequest extends BaseRespons {
}
}
public
class
AddViewRequestBody
{
public
String
businessId
;
public
AddViewRequestBody
(
String
businessId
)
{
this
.
businessId
=
businessId
;
}
}
/**
* "activityShop": 传店铺类型 1-河西 2-滨海
* "isPublish": 传APP类型 1-消费者 2-企业 3-商户
...
...
consumer/src/main/java/com/xx/hbhconsumer/data/http/requst/NewsRequest.java
View file @
317a5933
...
...
@@ -26,6 +26,20 @@ public class NewsRequest extends BaseRespons {
return
getApiService
().
downloadFileWithUrlSync
(
url
);
}
public
Observable
<
BaseResponse
<
String
>>
addView
(
String
businessId
)
{
AddViewRequestBody
addViewRequestBody
=
new
AddViewRequestBody
(
businessId
);
ApiParams
<
AddViewRequestBody
>
apiParams
=
new
ApiParams
<
AddViewRequestBody
>();
RequestBody
body
=
apiParams
.
setParams
(
addViewRequestBody
);
return
getApiService
().
addView
(
body
);
}
public
class
AddViewRequestBody
{
public
String
businessId
;
public
AddViewRequestBody
(
String
businessId
)
{
this
.
businessId
=
businessId
;
}
}
public
class
QueryAppInformationListRequestBody
{
public
String
appSide
;
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/home/HomeFragment.java
View file @
317a5933
...
...
@@ -110,7 +110,7 @@ public class HomeFragment extends BaseFragment<FragmentHomeBinding, HomeViewMode
}
else
if
(
"2"
.
equals
(
data
.
getRotographType
()))
{
viewModel
.
goNewsDetail
(
data
.
getUrlId
());
}
else
if
(
"3"
.
equals
(
data
.
getRotographType
()))
{
viewModel
.
goPdfDetail
(
data
.
getUrlId
(),
data
.
getInformationTitle
());
viewModel
.
goPdfDetail
(
data
.
get
BusinessId
(),
data
.
get
UrlId
(),
data
.
getInformationTitle
());
}
}
});
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/home/HomeViewModel.java
View file @
317a5933
...
...
@@ -107,11 +107,29 @@ public class HomeViewModel extends BaseViewModel<HomeRequest> {
startActivity
(
NewsDetailActivity
.
class
,
bundle
);
}
public
void
goPdfDetail
(
String
url
,
String
name
)
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"url"
,
url
);
bundle
.
putString
(
"name"
,
name
);
startActivity
(
PDFWebViewActivity
.
class
,
bundle
);
public
void
goPdfDetail
(
String
businessId
,
String
url
,
String
name
)
{
model
.
addView
(
businessId
)
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
HomeViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}).
subscribe
(
new
ApiDisposableObserver
<
String
>()
{
@Override
public
void
onSuccess
(
String
messageBeanList
)
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"url"
,
url
);
bundle
.
putString
(
"name"
,
name
);
startActivity
(
PDFWebViewActivity
.
class
,
bundle
);
}
@Override
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
public
void
getMessageList
()
{
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/news/NewsDetailActivity.java
View file @
317a5933
...
...
@@ -8,6 +8,8 @@ import android.webkit.JavascriptInterface;
import
androidx.core.app.ActivityCompat
;
import
com.tencent.smtt.sdk.WebChromeClient
;
import
com.tencent.smtt.sdk.WebView
;
import
com.xx.hbhconsumer.R
;
import
com.xx.hbhconsumer.data.http.requst.NewsRequest
;
import
com.xx.hbhconsumer.databinding.ActivityNewsDetailBinding
;
...
...
@@ -27,11 +29,21 @@ public class NewsDetailActivity extends BaseActivity<ActivityNewsDetailBinding,
@Override
public
void
initData
()
{
super
.
initData
();
String
newsUrl
=
getIntent
().
getStringExtra
(
"newsUrl"
);
String
url
=
RetrofitClient
.
baseH5Url
+
newsUrl
;
// set debug mode
DWebView
.
setWebContentsDebuggingEnabled
(
true
);
binding
.
webview
.
addJavascriptObject
(
new
JavaScriptInterfaceApi
(),
null
);
binding
.
webview
.
setWebChromeClient
(
new
WebChromeClient
(){
@Override
public
void
onProgressChanged
(
WebView
webView
,
int
i
)
{
super
.
onProgressChanged
(
webView
,
i
);
if
(
i
==
100
)
{
viewModel
.
hideDialog
();
}
}
});
binding
.
webview
.
loadUrl
(
url
);
}
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/news/NewsDetailViewModel.java
View file @
317a5933
...
...
@@ -29,6 +29,26 @@ public class NewsDetailViewModel extends BaseViewModel<NewsRequest> {
public
NewsDetailViewModel
(
@NonNull
Application
application
,
NewsRequest
model
)
{
super
(
application
,
model
);
}
@Override
public
void
onCreate
()
{
super
.
onCreate
();
showDialog
(
"正在请求..."
);
}
public
void
hideDialog
()
{
dismissDialog
();
}
@Override
public
void
onStart
()
{
super
.
onStart
();
}
@Override
public
void
onResume
()
{
super
.
onResume
();
}
public
void
downloadFile
(
String
url
)
{
try
{
...
...
consumer/src/main/java/com/xx/hbhconsumer/ui/news/NewsListViewModel.java
View file @
317a5933
...
...
@@ -9,6 +9,7 @@ import androidx.lifecycle.MutableLiveData;
import
com.xx.hbhconsumer.data.http.requst.NewsRequest
;
import
com.xx.hbhconsumer.data.http.respons.AppInformationBean
;
import
com.xx.hbhconsumer.data.http.respons.Children
;
import
com.xx.hbhconsumer.ui.home.HomeViewModel
;
import
com.xx.hbhconsumer.ui.pdf.PDFWebViewActivity
;
import
java.util.ArrayList
;
...
...
@@ -32,10 +33,30 @@ public class NewsListViewModel extends BaseViewModel<NewsRequest> {
public
void
goNewsDetail
(
Children
children
)
{
if
(
"1"
.
equals
(
children
.
isView
()))
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"url"
,
children
.
getFileUrl
());
bundle
.
putString
(
"name"
,
children
.
getInformationTitle
());
startActivity
(
PDFWebViewActivity
.
class
,
bundle
);
model
.
addView
(
children
.
getBusinessId
())
.
compose
(
RxUtils
.
schedulersTransformer
())
//线程调度
.
doOnSubscribe
(
NewsListViewModel
.
this
)
.
doOnSubscribe
(
new
Consumer
<
Disposable
>()
{
@Override
public
void
accept
(
Disposable
disposable
)
throws
Exception
{
}
}).
subscribe
(
new
ApiDisposableObserver
<
String
>()
{
@Override
public
void
onSuccess
(
String
messageBeanList
)
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"url"
,
children
.
getFileUrl
());
bundle
.
putString
(
"name"
,
children
.
getInformationTitle
());
startActivity
(
PDFWebViewActivity
.
class
,
bundle
);
}
@Override
public
void
onError
(
String
Error
)
{
dismissDialog
();
}
});
}
else
{
Bundle
bundle
=
new
Bundle
();
bundle
.
putString
(
"newsUrl"
,
children
.
getInformationUrl
());
...
...
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