Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RvApp
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
lify
RvApp
Commits
8ef885d7
Commit
8ef885d7
authored
Mar 24, 2020
by
jianglx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改活动页面生成海报的逻辑,将之前H5页面改为原生页面。
修改供H5接口调用的头像和名字 有误的bug
parent
a8a7b575
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
230 additions
and
124 deletions
+230
-124
HomeFragment.java
...java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
+0
-1
PersonalInformationActivity.java
...a/com/rv/rvmine/traveler/PersonalInformationActivity.java
+4
-0
BillActivity.java
plugin_share/src/main/java/com/rv/share/BillActivity.java
+30
-75
WebViewActivity.java
plugin_share/src/main/java/com/rv/share/WebViewActivity.java
+4
-12
BillPresenter.java
...e/src/main/java/com/rv/share/presenter/BillPresenter.java
+65
-10
WebViewPresenter.java
...rc/main/java/com/rv/share/presenter/WebViewPresenter.java
+14
-15
RvWebView.java
plugin_share/src/main/java/com/rv/share/view/RvWebView.java
+39
-9
activity_bill.xml
plugin_share/src/main/res/layout/activity_bill.xml
+74
-2
No files found.
module_home/src/main/java/com/rv/home/rv/module/ui/main/home/HomeFragment.java
View file @
8ef885d7
...
@@ -2,7 +2,6 @@ package com.rv.home.rv.module.ui.main.home;
...
@@ -2,7 +2,6 @@ package com.rv.home.rv.module.ui.main.home;
import
android.Manifest
;
import
android.Manifest
;
import
android.annotation.SuppressLint
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.AlertDialog
;
import
android.app.AlertDialog
;
import
android.content.ComponentName
;
import
android.content.ComponentName
;
import
android.content.Context
;
import
android.content.Context
;
...
...
module_mine/src/main/java/com/rv/rvmine/traveler/PersonalInformationActivity.java
View file @
8ef885d7
...
@@ -15,6 +15,7 @@ import android.widget.TextView;
...
@@ -15,6 +15,7 @@ import android.widget.TextView;
import
com.base.utils.ui.image.round.RoundImageView
;
import
com.base.utils.ui.image.round.RoundImageView
;
import
com.frame.base.bus.RxBus
;
import
com.frame.base.bus.RxBus
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.frame.rv.config.RvFrameConfig
;
import
com.ruiwenliu.wrapper.SPConstance
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.base.presenter.PickerPresenter
;
import
com.ruiwenliu.wrapper.base.presenter.PickerPresenter
;
...
@@ -25,6 +26,7 @@ import com.ruiwenliu.wrapper.util.permission.RxPermission;
...
@@ -25,6 +26,7 @@ import com.ruiwenliu.wrapper.util.permission.RxPermission;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.component.dialog.PickerDialog
;
import
com.rv.component.dialog.PickerDialog
;
import
com.rv.component.utils.CacheEnum
;
import
com.rv.component.utils.CacheEnum
;
import
com.rv.component.utils.Cookie
;
import
com.rv.component.utils.RvCache
;
import
com.rv.component.utils.RvCache
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ui.main.home.bean.ImageUploadBean
;
import
com.rv.home.rv.module.ui.main.home.bean.ImageUploadBean
;
...
@@ -140,6 +142,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
...
@@ -140,6 +142,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
ivAvatarUrl
=
bean
.
getData
();
ivAvatarUrl
=
bean
.
getData
();
UserInfo
userInfo
=
new
UserInfo
();
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setHeadimgurl
(
ivAvatarUrl
);
userInfo
.
setHeadimgurl
(
ivAvatarUrl
);
Cookie
.
save
(
getApplicationContext
(),
SPConstance
.
USER_JSON_HEADERURL
,
ivAvatarUrl
);
upUserinfo
(
userInfo
,
true
);
upUserinfo
(
userInfo
,
true
);
break
;
break
;
case
1
:
case
1
:
...
@@ -172,6 +175,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
...
@@ -172,6 +175,7 @@ public class PersonalInformationActivity extends BaseStatusActivity<PickerPresen
tvNickname
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
colorMain
));
tvNickname
.
setTextColor
(
getResources
().
getColor
(
R
.
color
.
colorMain
));
UserInfo
userInfo
=
new
UserInfo
();
UserInfo
userInfo
=
new
UserInfo
();
userInfo
.
setNickname
(
nickName
);
userInfo
.
setNickname
(
nickName
);
Cookie
.
save
(
getApplicationContext
(),
SPConstance
.
USER_JSON_NICKANAME
,
nickName
);
upUserinfo
(
userInfo
,
false
);
upUserinfo
(
userInfo
,
false
);
}
}
}
}
...
...
plugin_share/src/main/java/com/rv/share/BillActivity.java
View file @
8ef885d7
...
@@ -12,14 +12,15 @@ import android.support.v4.content.ContextCompat;
...
@@ -12,14 +12,15 @@ import android.support.v4.content.ContextCompat;
import
android.support.v7.widget.CardView
;
import
android.support.v7.widget.CardView
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.base.utils.ui.image.round.RoundImageView
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseBean
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.base.BaseStatusActivity
;
import
com.ruiwenliu.wrapper.statusbar.StatusBarUtil
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.ruiwenliu.wrapper.weight.TitleView
;
import
com.rv.share.presenter.BillPresenter
;
import
com.rv.share.presenter.BillPresenter
;
import
com.rv.share.view.RvWebView
;
import
butterknife.BindView
;
import
butterknife.BindView
;
import
butterknife.OnClick
;
import
butterknife.OnClick
;
...
@@ -31,28 +32,29 @@ import butterknife.OnClick;
...
@@ -31,28 +32,29 @@ import butterknife.OnClick;
*/
*/
public
class
BillActivity
extends
BaseStatusActivity
<
BillPresenter
>
{
public
class
BillActivity
extends
BaseStatusActivity
<
BillPresenter
>
{
// @BindView(R2.id.tv_back_title)
// TextView tvBackTitle;
@BindView
(
R2
.
id
.
btn_share_bill
)
@BindView
(
R2
.
id
.
btn_share_bill
)
Button
btnShare
;
Button
btnShare
;
@BindView
(
R2
.
id
.
ll_webview
)
@BindView
(
R2
.
id
.
img_bill_top
)
CardView
llContent
;
ImageView
imgBillTop
;
@BindView
(
R2
.
id
.
ring_header
)
private
String
url
;
RoundImageView
ringHeader
;
private
RvWebView
rvWebView
;
@BindView
(
R2
.
id
.
tv_phone
)
TextView
tvPhone
;
public
static
Intent
getIntent
(
Context
var1
,
String
var2
)
{
@BindView
(
R2
.
id
.
img_qrcode
)
ImageView
imgQrCode
;
@BindView
(
R2
.
id
.
carview
)
CardView
cardView
;
private
String
imgUrl
;
private
String
codeUrl
;
public
static
Intent
getIntent
(
Context
var1
,
String
var2
,
String
var3
)
{
Intent
intent
=
new
Intent
(
var1
,
BillActivity
.
class
);
Intent
intent
=
new
Intent
(
var1
,
BillActivity
.
class
);
intent
.
putExtra
(
"billUrl"
,
var2
);
intent
.
putExtra
(
"codeUrl"
,
var2
);
intent
.
putExtra
(
"imgUrl"
,
var3
);
return
intent
;
return
intent
;
}
}
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// StatusBarUtil.setRootViewFitsSystemWindows(mActivity, false);
// }
@Override
@Override
protected
int
setLayout
()
{
protected
int
setLayout
()
{
return
R
.
layout
.
activity_bill
;
return
R
.
layout
.
activity_bill
;
...
@@ -62,30 +64,18 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
...
@@ -62,30 +64,18 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
@Override
@Override
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
protected
void
initView
(
Bundle
savedInstanceState
,
TitleView
titleView
,
Intent
intent
)
{
url
=
intent
.
getStringExtra
(
"billUrl"
);
codeUrl
=
intent
.
getStringExtra
(
"codeUrl"
);
imgUrl
=
intent
.
getStringExtra
(
"imgUrl"
);
titleView
.
setVisibility
(
View
.
VISIBLE
);
titleView
.
setVisibility
(
View
.
VISIBLE
);
titleView
.
setTitle
(
"生成海报"
);
titleView
.
setTitle
(
"生成海报"
);
rvWebView
=
new
RvWebView
(
getApplicationContext
(),
listener
);
llContent
.
addView
(
rvWebView
);
rvWebView
.
loadUrl
(
url
);
// llLongClick.setOnLongClickListener(new View.OnLongClickListener() {
// @Override
// public boolean onLongClick(View view) {
// mPresenter.showShareDialog(llBillContent);
// return false;
// }
// });
// Bitmap success = ZxingUtils.createQRImage(testUrl, DisplayUtil.dip2px(this, 80f), DisplayUtil.dip2px(this, 80f),
// BitmapFactory.decodeResource(getResources(), com.rv.home.R.mipmap.ic_launcher));
// imgZxing.setImageBitmap(success);
}
}
@Override
@Override
protected
void
loadData
(
Bundle
savedInstanceState
,
Intent
intent
)
{
protected
void
loadData
(
Bundle
savedInstanceState
,
Intent
intent
)
{
mPresenter
.
setHeader
(
ringHeader
);
mPresenter
.
setName
(
tvPhone
);
mPresenter
.
setCode
(
codeUrl
,
imgQrCode
);
mPresenter
.
setImgTop
(
imgUrl
,
imgBillTop
);
}
}
@Override
@Override
...
@@ -95,19 +85,6 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
...
@@ -95,19 +85,6 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
@Override
@Override
public
void
onDestroy
()
{
public
void
onDestroy
()
{
if
(
rvWebView
!=
null
)
{
llContent
.
removeAllViews
();
rvWebView
.
stopLoading
();
// 停止当前加载
rvWebView
.
clearMatches
();
// 清除网页查找的高亮匹配字符。
rvWebView
.
clearHistory
();
// 清除当前 WebView 访问的历史记录
rvWebView
.
clearSslPreferences
();
//清除ssl信息
rvWebView
.
clearCache
(
true
);
//清空网页访问留下的缓存数据。需要注意的时,由于缓存是全局的,所以只要是WebView用到的缓存都会被清空,即便其他地方也会使用到。该方法接受一个参数,从命名即可看出作用。若设为false,则只清空内存里的资源缓存,而不清空磁盘里的。
rvWebView
.
loadUrl
(
"about:blank"
);
// 清空当前加载
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
JELLY_BEAN_MR2
)
{
rvWebView
.
removeJavascriptInterface
(
"AndroidNative"
);
// 向 Web端注入 java 对象
}
rvWebView
.
destroy
();
// 生命周期销毁
}
super
.
onDestroy
();
super
.
onDestroy
();
}
}
...
@@ -117,42 +94,20 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
...
@@ -117,42 +94,20 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
if
(
id
==
R
.
id
.
btn_share_bill
)
{
if
(
id
==
R
.
id
.
btn_share_bill
)
{
preShare
();
preShare
();
}
else
if
(
id
==
R
.
id
.
btn_save_bill
)
{
}
else
if
(
id
==
R
.
id
.
btn_save_bill
)
{
mPresenter
.
saveBill
(
llContent
);
mPresenter
.
saveBill
(
cardView
);
}
}
}
private
RvWebView
.
WebViewListener
listener
=
new
RvWebView
.
WebViewListener
()
{
@Override
public
void
share
(
String
url
,
String
imgUrl
,
String
title
,
String
circleTitle
,
String
desc
)
{
}
}
@Override
public
void
share
(
String
url
,
String
title
,
String
desc
)
{
}
@Override
public
void
finish
()
{
}
@Override
public
void
showShareIcon
(
String
url
,
String
imgUrl
,
String
title
,
String
circleTitle
,
String
desc
)
{
}
};
/**
/**
* 预备下载 进行 6.0权限检查
* 预备下载 进行 6.0权限检查
*/
*/
private
void
preShare
()
{
private
void
preShare
()
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
M
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
M
)
{
mPresenter
.
showShareDialog
(
llContent
,
rvWeb
View
);
mPresenter
.
showShareDialog
(
card
View
);
}
else
{
}
else
{
if
(
ContextCompat
.
checkSelfPermission
(
this
,
if
(
ContextCompat
.
checkSelfPermission
(
this
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
mPresenter
.
showShareDialog
(
llContent
,
rvWeb
View
);
mPresenter
.
showShareDialog
(
card
View
);
}
else
{
//申请权限
}
else
{
//申请权限
ActivityCompat
.
requestPermissions
(
this
,
ActivityCompat
.
requestPermissions
(
this
,
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
1001
);
new
String
[]{
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
},
1001
);
...
@@ -166,7 +121,7 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
...
@@ -166,7 +121,7 @@ public class BillActivity extends BaseStatusActivity<BillPresenter> {
switch
(
requestCode
)
{
switch
(
requestCode
)
{
case
1001
:
case
1001
:
if
(
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
if
(
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
mPresenter
.
showShareDialog
(
llContent
,
rvWeb
View
);
mPresenter
.
showShareDialog
(
card
View
);
}
else
{
}
else
{
Toast
.
makeText
(
getApplicationContext
(),
"授权失败,无法分享海报"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getApplicationContext
(),
"授权失败,无法分享海报"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
...
...
plugin_share/src/main/java/com/rv/share/WebViewActivity.java
View file @
8ef885d7
...
@@ -140,12 +140,11 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
...
@@ -140,12 +140,11 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
private
RvWebView
.
WebViewListener
listener
=
new
RvWebView
.
WebViewListener
()
{
private
RvWebView
.
WebViewListener
listener
=
new
RvWebView
.
WebViewListener
()
{
@Override
@Override
public
void
share
(
final
String
url
,
final
String
i
mgUrl
,
final
String
title
,
final
String
circleTitle
,
final
String
desc
)
{
public
void
share
(
final
String
url
,
final
String
i
conUrl
,
final
String
title
,
final
String
circleTitle
,
final
String
desc
,
final
String
imgUrl
)
{
runOnUiThread
(
new
Runnable
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
String
billUrl
=
RvFrameConfig
.
HOST
+
"/h5/appHtml/view/poster.html"
;
mPresenter
.
showShareDialog
(
url
,
iconUrl
,
title
,
circleTitle
,
desc
,
imgUrl
);
mPresenter
.
showShareDialog
(
url
,
imgUrl
,
title
,
circleTitle
,
desc
,
billUrl
);
}
}
});
});
}
}
...
@@ -166,7 +165,7 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
...
@@ -166,7 +165,7 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
}
}
@Override
@Override
public
void
showShareIcon
(
final
String
url
,
final
String
i
mgUrl
,
final
String
title
,
final
String
circleTitle
,
final
String
desc
)
{
public
void
showShareIcon
(
final
String
url
,
final
String
i
conUrl
,
final
String
title
,
final
String
circleTitle
,
final
String
desc
,
final
String
imgUrl
)
{
runOnUiThread
(
new
Runnable
()
{
runOnUiThread
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
@@ -174,17 +173,10 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
...
@@ -174,17 +173,10 @@ public class WebViewActivity extends BaseStatusActivity<WebViewPresenter> {
ivTitleRight
.
setImageResource
(
R
.
drawable
.
tourism_rv_rentingcar_icon_share
);
ivTitleRight
.
setImageResource
(
R
.
drawable
.
tourism_rv_rentingcar_icon_share
);
}
}
});
});
String
billUrl
=
null
;
if
(!
TextUtils
.
isEmpty
(
url
)
&&
url
.
contains
(
"invitationCourtesyShare.html"
))
{
billUrl
=
RvFrameConfig
.
HOST
+
"/h5/appHtml/view/poster.html"
;
}
else
if
(!
TextUtils
.
isEmpty
(
url
)
&&
url
.
contains
(
"newPeopleH5.html"
))
{
billUrl
=
RvFrameConfig
.
HOST
+
"/h5/appHtml/view/newPeoplePoster.html"
;
}
final
String
finalBillUrl
=
billUrl
;
ivTitleRight
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
ivTitleRight
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
mPresenter
.
showShareDialog
(
url
,
i
mgUrl
,
title
,
circleTitle
,
desc
,
finalBill
Url
);
mPresenter
.
showShareDialog
(
url
,
i
conUrl
,
title
,
circleTitle
,
desc
,
img
Url
);
}
}
});
});
}
}
...
...
plugin_share/src/main/java/com/rv/share/presenter/BillPresenter.java
View file @
8ef885d7
...
@@ -5,14 +5,31 @@ import android.graphics.Bitmap;
...
@@ -5,14 +5,31 @@ import android.graphics.Bitmap;
import
android.graphics.Canvas
;
import
android.graphics.Canvas
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.support.v7.widget.CardView
;
import
android.support.v7.widget.CardView
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View
;
import
android.webkit.WebView
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
import
com.base.utils.ui.image.round.RoundImageView
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.ruiwenliu.wrapper.SPConstance
;
import
com.ruiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.ruiwenliu.wrapper.base.presenter.CommonPresenter
;
import
com.ruiwenliu.wrapper.bean.UserInfoBean
;
import
com.ruiwenliu.wrapper.util.glide.GlideManager
;
import
com.ruiwenliu.wrapper.util.glide.GlideOptions
;
import
com.rv.component.utils.CacheEnum
;
import
com.rv.component.utils.Cookie
;
import
com.rv.component.utils.DisplayUtil
;
import
com.rv.component.utils.RvCache
;
import
com.rv.component.utils.ShareUtils
;
import
com.rv.component.utils.ShareUtils
;
import
com.rv.component.utils.StorageUtils
;
import
com.rv.component.utils.StorageUtils
;
import
com.rv.component.utils.ZxingUtils
;
import
com.rv.share.R
;
import
com.rv.share.utils.TransformationUtils
;
import
com.rv.share.view.ShareChoiceDialog
;
import
com.rv.share.view.ShareChoiceDialog
;
import
com.umeng.socialize.ShareAction
;
import
com.umeng.socialize.ShareAction
;
import
com.umeng.socialize.UMShareListener
;
import
com.umeng.socialize.UMShareListener
;
...
@@ -31,10 +48,10 @@ public class BillPresenter extends CommonPresenter {
...
@@ -31,10 +48,10 @@ public class BillPresenter extends CommonPresenter {
private
CardView
view
=
null
;
private
CardView
view
=
null
;
private
Bitmap
bitmap
=
null
;
private
Bitmap
bitmap
=
null
;
private
UMImage
image
=
null
;
private
UMImage
image
=
null
;
private
WebView
webView
;
public
void
showShareDialog
(
CardView
llBillContent
,
WebView
webView
)
{
private
UserInfoBean
userInfoBean
=
(
UserInfoBean
)
RvCache
.
getInstance
().
get
(
CacheEnum
.
USER
);
this
.
webView
=
webView
;
public
void
showShareDialog
(
CardView
llBillContent
)
{
this
.
view
=
llBillContent
;
this
.
view
=
llBillContent
;
if
(
dialog
==
null
)
{
if
(
dialog
==
null
)
{
dialog
=
new
ShareChoiceDialog
.
Builder
(
getPresenterContext
())
dialog
=
new
ShareChoiceDialog
.
Builder
(
getPresenterContext
())
...
@@ -139,16 +156,10 @@ public class BillPresenter extends CommonPresenter {
...
@@ -139,16 +156,10 @@ public class BillPresenter extends CommonPresenter {
private
UMShareListener
shareListener
=
new
UMShareListener
()
{
private
UMShareListener
shareListener
=
new
UMShareListener
()
{
@Override
@Override
public
void
onStart
(
SHARE_MEDIA
share_media
)
{
public
void
onStart
(
SHARE_MEDIA
share_media
)
{
if
(
webView
!=
null
)
{
webView
.
loadUrl
(
"javascript:shareSuccess()"
);
}
}
}
@Override
@Override
public
void
onResult
(
SHARE_MEDIA
share_media
)
{
public
void
onResult
(
SHARE_MEDIA
share_media
)
{
if
(
webView
!=
null
)
{
webView
.
loadUrl
(
"javascript:shareSuccess()"
);
}
}
}
@Override
@Override
...
@@ -232,5 +243,49 @@ public class BillPresenter extends CommonPresenter {
...
@@ -232,5 +243,49 @@ public class BillPresenter extends CommonPresenter {
}
}
}
}
public
void
setHeader
(
RoundImageView
ringHeader
)
{
String
headUrl
;
if
(
userInfoBean
!=
null
&&
userInfoBean
.
getData
()
!=
null
)
{
headUrl
=
userInfoBean
.
getData
().
getHeadimgurl
();
}
else
{
headUrl
=
Cookie
.
getStringValue
(
getPresenterContext
(),
SPConstance
.
USER_JSON_HEADERURL
,
""
);
}
if
(!
TextUtils
.
isEmpty
(
headUrl
))
{
GlideManager
.
getInstance
(
getPresenterContext
()).
loadImage
(
headUrl
,
ringHeader
,
R
.
drawable
.
icon_bill_defult
);
}
}
public
void
setName
(
TextView
tvPhone
)
{
String
name
;
if
(
userInfoBean
!=
null
&&
userInfoBean
.
getData
()
!=
null
)
{
name
=
userInfoBean
.
getData
().
getNickname
();
}
else
{
name
=
!
TextUtils
.
isEmpty
(
Cookie
.
getStringValue
(
getPresenterContext
(),
SPConstance
.
USER_JSON_NICKANAME
,
""
))
?
Cookie
.
getStringValue
(
getPresenterContext
(),
SPConstance
.
USER_JSON_NICKANAME
,
""
)
:
Cookie
.
getStringValue
(
getPresenterContext
(),
SPConstance
.
USER_JSON_NAME
,
""
);
}
tvPhone
.
setText
(!
TextUtils
.
isEmpty
(
name
)
?
name
:
"滴房车"
);
}
public
void
setCode
(
String
codeUrl
,
ImageView
imgQrCode
)
{
if
(!
TextUtils
.
isEmpty
(
codeUrl
))
{
Bitmap
bitmap
=
ZxingUtils
.
createQRImage
(
codeUrl
,
DisplayUtil
.
dip2px
(
getPresenterContext
(),
100
),
DisplayUtil
.
dip2px
(
getPresenterContext
(),
100
),
null
);
imgQrCode
.
setImageBitmap
(
bitmap
);
}
}
public
void
setImgTop
(
String
imgUrl
,
ImageView
imgBillTop
)
{
if
(!
TextUtils
.
isEmpty
(
imgUrl
))
{
GlideOptions
options
=
GlideOptions
.
placeholderOf
(
com
.
ruiwenliu
.
wrapper
.
R
.
drawable
.
glide_icon_placeholder
).
error
(
com
.
ruiwenliu
.
wrapper
.
R
.
drawable
.
glide_icon_error
);
TransformationUtils
utils
=
new
TransformationUtils
(
imgBillTop
);
Glide
.
with
(
getPresenterContext
())
.
asBitmap
()
.
load
(
imgUrl
)
.
apply
(
options
)
.
apply
(
RequestOptions
.
bitmapTransform
(
new
RoundedCorners
(
20
)).
override
(
imgBillTop
.
getWidth
(),
imgBillTop
.
getHeight
())
.
disallowHardwareConfig
())
.
into
(
utils
);
}
}
}
}
plugin_share/src/main/java/com/rv/share/presenter/WebViewPresenter.java
View file @
8ef885d7
...
@@ -28,22 +28,22 @@ public class WebViewPresenter extends CommonPresenter {
...
@@ -28,22 +28,22 @@ public class WebViewPresenter extends CommonPresenter {
private
String
mUrl
=
null
;
private
String
mUrl
=
null
;
private
String
mTitle
=
null
;
private
String
mTitle
=
null
;
private
String
mDescript
=
null
;
private
String
mDescript
=
null
;
private
String
mImgUrl
;
private
String
iconUrl
;
private
String
imgUrl
;
private
String
mCircleTitle
;
private
String
mCircleTitle
;
private
RvWebView
webView
;
private
RvWebView
webView
;
private
String
billUrl
;
public
void
setWebView
(
RvWebView
webView
)
{
public
void
setWebView
(
RvWebView
webView
)
{
this
.
webView
=
webView
;
this
.
webView
=
webView
;
}
}
public
void
showShareDialog
(
String
url
,
String
imgUrl
,
String
title
,
String
circleTitle
,
String
descript
,
String
newPersonbillUrl
)
{
public
void
showShareDialog
(
String
url
,
String
iconUrl
,
String
title
,
String
circleTitle
,
String
descript
,
String
imgUrl
)
{
this
.
billUrl
=
newPersonbillUrl
;
this
.
mUrl
=
url
;
this
.
mUrl
=
url
;
this
.
mImgUrl
=
img
Url
;
this
.
iconUrl
=
icon
Url
;
this
.
mCircleTitle
=
circleTitle
;
this
.
mCircleTitle
=
circleTitle
;
this
.
mTitle
=
title
;
this
.
mTitle
=
title
;
this
.
mDescript
=
descript
;
this
.
mDescript
=
descript
;
this
.
imgUrl
=
imgUrl
;
if
(
dialog
==
null
)
{
if
(
dialog
==
null
)
{
dialog
=
new
ShareChoiceDialog
.
Builder
(
getPresenterContext
())
dialog
=
new
ShareChoiceDialog
.
Builder
(
getPresenterContext
())
.
setShareListener
(
myListener
)
.
setShareListener
(
myListener
)
...
@@ -65,8 +65,8 @@ public class WebViewPresenter extends CommonPresenter {
...
@@ -65,8 +65,8 @@ public class WebViewPresenter extends CommonPresenter {
shareAction
=
new
ShareAction
((
Activity
)
getPresenterContext
()).
setCallback
(
shareListener
);
shareAction
=
new
ShareAction
((
Activity
)
getPresenterContext
()).
setCallback
(
shareListener
);
}
}
UMImage
image
;
UMImage
image
;
if
(!
TextUtils
.
isEmpty
(
mImg
Url
))
{
if
(!
TextUtils
.
isEmpty
(
icon
Url
))
{
image
=
new
UMImage
(
getPresenterContext
(),
mImg
Url
);
image
=
new
UMImage
(
getPresenterContext
(),
icon
Url
);
}
else
{
}
else
{
image
=
new
UMImage
(
getPresenterContext
(),
R
.
drawable
.
icon_share
);
image
=
new
UMImage
(
getPresenterContext
(),
R
.
drawable
.
icon_share
);
}
}
...
@@ -90,8 +90,8 @@ public class WebViewPresenter extends CommonPresenter {
...
@@ -90,8 +90,8 @@ public class WebViewPresenter extends CommonPresenter {
}
}
UMImage
image
;
UMImage
image
;
if
(!
TextUtils
.
isEmpty
(
mImg
Url
))
{
if
(!
TextUtils
.
isEmpty
(
icon
Url
))
{
image
=
new
UMImage
(
getPresenterContext
(),
mImg
Url
);
image
=
new
UMImage
(
getPresenterContext
(),
icon
Url
);
}
else
{
}
else
{
image
=
new
UMImage
(
getPresenterContext
(),
R
.
drawable
.
icon_share
);
image
=
new
UMImage
(
getPresenterContext
(),
R
.
drawable
.
icon_share
);
}
}
...
@@ -126,8 +126,8 @@ public class WebViewPresenter extends CommonPresenter {
...
@@ -126,8 +126,8 @@ public class WebViewPresenter extends CommonPresenter {
shareAction
=
new
ShareAction
((
Activity
)
getPresenterContext
()).
setCallback
(
shareListener
);
shareAction
=
new
ShareAction
((
Activity
)
getPresenterContext
()).
setCallback
(
shareListener
);
}
}
UMImage
image
;
UMImage
image
;
if
(!
TextUtils
.
isEmpty
(
mImg
Url
))
{
if
(!
TextUtils
.
isEmpty
(
icon
Url
))
{
image
=
new
UMImage
(
getPresenterContext
(),
mImg
Url
);
image
=
new
UMImage
(
getPresenterContext
(),
icon
Url
);
}
else
{
}
else
{
image
=
new
UMImage
(
getPresenterContext
(),
R
.
drawable
.
icon_share
);
image
=
new
UMImage
(
getPresenterContext
(),
R
.
drawable
.
icon_share
);
}
}
...
@@ -191,7 +191,7 @@ public class WebViewPresenter extends CommonPresenter {
...
@@ -191,7 +191,7 @@ public class WebViewPresenter extends CommonPresenter {
@Override
@Override
public
void
wxShare
()
{
public
void
wxShare
()
{
if
(!
IsAppInstall
.
isWeixinAvilible
(
getPresenterContext
()))
{
if
(!
IsAppInstall
.
isWeixinAvilible
(
getPresenterContext
()))
{
Toast
.
makeText
(
getPresenterContext
(),
"亲,您微信还没有安装呢"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getPresenterContext
(),
"亲,您微信还没有安装呢"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
return
;
}
}
if
(!
TextUtils
.
isEmpty
(
mUrl
))
if
(!
TextUtils
.
isEmpty
(
mUrl
))
...
@@ -201,7 +201,7 @@ public class WebViewPresenter extends CommonPresenter {
...
@@ -201,7 +201,7 @@ public class WebViewPresenter extends CommonPresenter {
@Override
@Override
public
void
wxCShare
()
{
public
void
wxCShare
()
{
if
(!
IsAppInstall
.
isWeixinAvilible
(
getPresenterContext
()))
{
if
(!
IsAppInstall
.
isWeixinAvilible
(
getPresenterContext
()))
{
Toast
.
makeText
(
getPresenterContext
(),
"亲,您微信还没有安装呢"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
getPresenterContext
(),
"亲,您微信还没有安装呢"
,
Toast
.
LENGTH_SHORT
).
show
();
return
;
return
;
}
}
if
(!
TextUtils
.
isEmpty
(
mUrl
))
if
(!
TextUtils
.
isEmpty
(
mUrl
))
...
@@ -218,8 +218,7 @@ public class WebViewPresenter extends CommonPresenter {
...
@@ -218,8 +218,7 @@ public class WebViewPresenter extends CommonPresenter {
@Override
@Override
public
void
billShare
()
{
public
void
billShare
()
{
if
(!
TextUtils
.
isEmpty
(
billUrl
))
getPresenterContext
().
startActivity
(
BillActivity
.
getIntent
(
getPresenterContext
(),
mUrl
,
!
TextUtils
.
isEmpty
(
imgUrl
)
?
imgUrl
:
iconUrl
));
getPresenterContext
().
startActivity
(
BillActivity
.
getIntent
(
getPresenterContext
(),
billUrl
));
}
}
@Override
@Override
...
...
plugin_share/src/main/java/com/rv/share/view/RvWebView.java
View file @
8ef885d7
...
@@ -21,8 +21,11 @@ import android.widget.Toast;
...
@@ -21,8 +21,11 @@ import android.widget.Toast;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.frame.base.url.Constance
;
import
com.frame.base.url.Constance
;
import
com.ruiwenliu.wrapper.SPConstance
;
import
com.ruiwenliu.wrapper.SPConstance
;
import
com.ruiwenliu.wrapper.bean.UserInfoBean
;
import
com.rv.component.utils.CacheEnum
;
import
com.rv.component.utils.Cookie
;
import
com.rv.component.utils.Cookie
;
import
com.rv.component.utils.LogUtil
;
import
com.rv.component.utils.LogUtil
;
import
com.rv.component.utils.RvCache
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ApiConfig
;
import
com.rv.home.rv.module.ui.login.LoginRvActivity
;
import
com.rv.home.rv.module.ui.login.LoginRvActivity
;
import
com.yuyife.okgo.OkGoUtil
;
import
com.yuyife.okgo.OkGoUtil
;
...
@@ -33,10 +36,12 @@ public class RvWebView extends WebView {
...
@@ -33,10 +36,12 @@ public class RvWebView extends WebView {
private
ProgressBar
progressBar
;
private
ProgressBar
progressBar
;
private
WebViewListener
listener
;
private
WebViewListener
listener
;
private
UserInfoBean
userInfoBean
;
public
RvWebView
(
Context
context
,
WebViewListener
listener
)
{
public
RvWebView
(
Context
context
,
WebViewListener
listener
)
{
super
(
context
);
super
(
context
);
userInfoBean
=
(
UserInfoBean
)
RvCache
.
getInstance
().
get
(
CacheEnum
.
USER
);
this
.
listener
=
listener
;
this
.
listener
=
listener
;
progressBar
=
new
ProgressBar
(
context
,
null
,
android
.
R
.
attr
.
progressBarStyleHorizontal
);
progressBar
=
new
ProgressBar
(
context
,
null
,
android
.
R
.
attr
.
progressBarStyleHorizontal
);
progressBar
.
setLayoutParams
(
new
ViewGroup
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
3
));
//设置宽高属性
progressBar
.
setLayoutParams
(
new
ViewGroup
.
LayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
3
));
//设置宽高属性
...
@@ -153,14 +158,25 @@ public class RvWebView extends WebView {
...
@@ -153,14 +158,25 @@ public class RvWebView extends WebView {
@JavascriptInterface
@JavascriptInterface
public
String
getUserName
()
{
public
String
getUserName
()
{
String
name
=
!
TextUtils
.
isEmpty
(
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_NICKANAME
,
""
))
?
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_NICKANAME
,
""
)
String
name
;
if
(
userInfoBean
!=
null
&&
userInfoBean
.
getData
()
!=
null
)
{
name
=
userInfoBean
.
getData
().
getNickname
();
}
else
{
name
=
!
TextUtils
.
isEmpty
(
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_NICKANAME
,
""
))
?
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_NICKANAME
,
""
)
:
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_NAME
,
""
);
:
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_NAME
,
""
);
}
return
name
;
return
name
;
}
}
@JavascriptInterface
@JavascriptInterface
public
String
getHeadUrl
()
{
public
String
getHeadUrl
()
{
String
url
=
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_HEADERURL
,
""
);
String
url
;
if
(
userInfoBean
!=
null
&&
userInfoBean
.
getData
()
!=
null
)
{
url
=
userInfoBean
.
getData
().
getHeadimgurl
();
}
else
{
url
=
Cookie
.
getStringValue
(
getContext
(),
SPConstance
.
USER_JSON_HEADERURL
,
""
);
}
return
url
;
return
url
;
}
}
...
@@ -186,14 +202,28 @@ public class RvWebView extends WebView {
...
@@ -186,14 +202,28 @@ public class RvWebView extends WebView {
@JavascriptInterface
@JavascriptInterface
public
void
share
(
String
url
,
String
imgUrl
,
String
title
,
String
titleCircle
,
String
desc
)
{
public
void
share
(
String
url
,
String
imgUrl
,
String
title
,
String
titleCircle
,
String
desc
)
{
if
(
listener
!=
null
)
{
if
(
listener
!=
null
)
{
listener
.
share
(
url
,
imgUrl
,
title
,
titleCircle
,
TextUtils
.
isEmpty
(
desc
)
?
" "
:
desc
);
listener
.
share
(
url
,
imgUrl
,
title
,
titleCircle
,
TextUtils
.
isEmpty
(
desc
)
?
" "
:
desc
,
null
);
}
}
@JavascriptInterface
public
void
share
(
String
url
,
String
iconUrl
,
String
title
,
String
titleCircle
,
String
desc
,
String
imgUrl
)
{
if
(
listener
!=
null
)
{
listener
.
share
(
url
,
iconUrl
,
title
,
titleCircle
,
TextUtils
.
isEmpty
(
desc
)
?
" "
:
desc
,
imgUrl
);
}
}
@JavascriptInterface
public
void
showShareIcon
(
String
url
,
String
iconUrl
,
String
title
,
String
titleCircle
,
String
desc
,
String
imgUrl
)
{
if
(
listener
!=
null
)
{
listener
.
showShareIcon
(
url
,
iconUrl
,
title
,
titleCircle
,
TextUtils
.
isEmpty
(
desc
)
?
" "
:
desc
,
imgUrl
);
}
}
}
}
@JavascriptInterface
@JavascriptInterface
public
void
showShareIcon
(
String
url
,
String
i
mg
Url
,
String
title
,
String
titleCircle
,
String
desc
)
{
public
void
showShareIcon
(
String
url
,
String
i
con
Url
,
String
title
,
String
titleCircle
,
String
desc
)
{
if
(
listener
!=
null
)
{
if
(
listener
!=
null
)
{
listener
.
showShareIcon
(
url
,
i
mgUrl
,
title
,
titleCircle
,
TextUtils
.
isEmpty
(
desc
)
?
" "
:
desc
);
listener
.
showShareIcon
(
url
,
i
conUrl
,
title
,
titleCircle
,
TextUtils
.
isEmpty
(
desc
)
?
" "
:
desc
,
null
);
}
}
}
}
...
@@ -279,13 +309,13 @@ public class RvWebView extends WebView {
...
@@ -279,13 +309,13 @@ public class RvWebView extends WebView {
public
interface
WebViewListener
{
public
interface
WebViewListener
{
void
share
(
String
url
,
String
i
mgUrl
,
String
title
,
String
circleTitle
,
String
desc
);
void
share
(
String
url
,
String
i
conUrl
,
String
title
,
String
circleTitle
,
String
desc
,
String
imgUrl
);
void
share
(
String
url
,
String
title
,
String
desc
);
void
share
(
String
url
,
String
title
,
String
desc
);
void
finish
();
void
finish
();
void
showShareIcon
(
String
url
,
String
i
mgUrl
,
String
title
,
String
circleTitle
,
String
desc
);
void
showShareIcon
(
String
url
,
String
i
conUrl
,
String
title
,
String
circleTitle
,
String
desc
,
String
imgUrl
);
}
}
@Override
@Override
...
...
plugin_share/src/main/res/layout/activity_bill.xml
View file @
8ef885d7
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
</LinearLayout>
</LinearLayout>
<android.support.v7.widget.CardView
<android.support.v7.widget.CardView
android:id=
"@+id/
ll_web
view"
android:id=
"@+id/
car
view"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_15"
android:layout_marginLeft=
"@dimen/size_15"
...
@@ -57,7 +57,79 @@
...
@@ -57,7 +57,79 @@
android:layout_marginBottom=
"@dimen/size_80"
android:layout_marginBottom=
"@dimen/size_80"
android:background=
"@drawable/shape_rv_bg_bill"
android:background=
"@drawable/shape_rv_bg_bill"
android:orientation=
"vertical"
android:orientation=
"vertical"
app:cardCornerRadius=
"5dp"
/
>
app:cardCornerRadius=
"5dp"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_10"
android:layout_marginTop=
"@dimen/size_10"
android:layout_marginRight=
"@dimen/size_10"
android:layout_marginBottom=
"@dimen/size_5"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/img_bill_top"
android:scaleType=
"fitXY"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/dp_10"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<com.base.utils.ui.image.round.RoundImageView
android:id=
"@+id/ring_header"
android:src=
"@drawable/icon_bill_defult"
android:layout_width=
"@dimen/size_50"
android:layout_height=
"@dimen/size_50"
/>
<TextView
android:id=
"@+id/tv_phone"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/size_5"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:maxLines=
"2"
android:singleLine=
"false"
android:textColor=
"@color/textGray"
android:textSize=
"@dimen/text_15"
/>
<LinearLayout
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"right"
android:layout_marginLeft=
"@dimen/text_10"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/img_qrcode"
android:layout_width=
"@dimen/size_100"
android:layout_height=
"@dimen/size_100"
android:layout_marginLeft=
"@dimen/dp_10"
android:src=
"@drawable/icon_share_wx"
/>
</LinearLayout>
</LinearLayout>
<include
layout=
"@layout/common_line"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"@dimen/size_5"
android:gravity=
"center_vertical"
android:drawableLeft=
"@drawable/common_icon_logo_small"
android:drawablePadding=
"@dimen/size_3"
android:text=
"房车·让生活更美好"
android:textColor=
"@color/gray_B4B4B4"
android:textSize=
"@dimen/text_8"
/>
</LinearLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
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