Commit 7552ed23 by konghaorui

Merge branch 'feature/v3' of…

Merge branch 'feature/v3' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into feature/v3
parents 29848196 2aafb11b
...@@ -202,7 +202,7 @@ dependencies { ...@@ -202,7 +202,7 @@ dependencies {
// implementation project(':m-muse') implementation project(':m-muse')
implementation project(':m-im') implementation project(':m-im')
implementation project(':m-dynamic') implementation project(':m-dynamic')
......
...@@ -74,7 +74,7 @@ ext { ...@@ -74,7 +74,7 @@ ext {
"ydl-platform" : "0.0.29.3", "ydl-platform" : "0.0.29.3",
//第二步 若干 //第二步 若干
"ydl-webview" : "0.0.28.6", "ydl-webview" : "0.0.28.9",
"ydl-media" : "0.0.14.4", "ydl-media" : "0.0.14.4",
"ydl-pay" : "0.0.11.5", "ydl-pay" : "0.0.11.5",
"m-audioim" : "0.0.40.4", "m-audioim" : "0.0.40.4",
......
...@@ -48,7 +48,7 @@ class BigShotOneView : LinearLayout { ...@@ -48,7 +48,7 @@ class BigShotOneView : LinearLayout {
} }
fun setUrl(bean: ExpertSearchBigShotBean) { fun setUrl(bean: ExpertSearchBigShotBean) {
GlideApp.with(mContext).load(bean.topicImages[0]).into(consultant_one_img_1) GlideApp.with(mContext).load(bean.topicImages[0].imageUrl).into(consultant_one_img_1)
consultant_one_img_1.setOnClickListener { consultant_one_img_1.setOnClickListener {
val h5Params = H5Params(bean.specialTopicUrl, null) val h5Params = H5Params(bean.specialTopicUrl, null)
NewH5Activity.start(context, h5Params) NewH5Activity.start(context, h5Params)
......
...@@ -66,6 +66,12 @@ class RecommendListView : LinearLayout { ...@@ -66,6 +66,12 @@ class RecommendListView : LinearLayout {
orientation = VERTICAL orientation = VERTICAL
View.inflate(mContext, R.layout.consultant_expert_search_top_all_view, this) View.inflate(mContext, R.layout.consultant_expert_search_top_all_view, this)
//无数据则隐藏所有布局
recommendViewPager.visibility = View.GONE
recommendViewPagerIndicator.visibility = View.GONE
itemListView.visibility = View.GONE
requestData() requestData()
} }
...@@ -79,8 +85,20 @@ class RecommendListView : LinearLayout { ...@@ -79,8 +85,20 @@ class RecommendListView : LinearLayout {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer { .subscribe(Consumer {
if (null != mContext) { if (null != mContext) {
mSceneSpecialTopicList.addAll(it.sceneSpecialTopics) if (it.sceneSpecialTopics == null || it.sceneSpecialTopics.size == 0) {
mDoctorSpecialTopicsList.addAll(it.doctorSpecialTopics) recommendViewPager.visibility = View.GONE
recommendViewPagerIndicator.visibility = View.GONE
}else {
mSceneSpecialTopicList.addAll(it.sceneSpecialTopics)
recommendViewPager.visibility = View.VISIBLE
recommendViewPagerIndicator.visibility = View.VISIBLE
}
if (it.doctorSpecialTopics == null || it.doctorSpecialTopics.size == 0) {
itemListView.visibility = View.GONE
}else {
mDoctorSpecialTopicsList.addAll(it.doctorSpecialTopics)
itemListView.visibility = View.VISIBLE
}
setData() setData()
} }
...@@ -318,7 +336,7 @@ class RecommendListView : LinearLayout { ...@@ -318,7 +336,7 @@ class RecommendListView : LinearLayout {
val mView1 = BigShotTwoView(mContext!!) val mView1 = BigShotTwoView(mContext!!)
mView.setUrl(mDoctorSpecialTopicsList[0], mDoctorSpecialTopicsList[1], mDoctorSpecialTopicsList[2]) mView.setUrl(mDoctorSpecialTopicsList[0], mDoctorSpecialTopicsList[1], mDoctorSpecialTopicsList[2])
mView1.setUrl(mDoctorSpecialTopicsList[3], mDoctorSpecialTopicsList[3]) mView1.setUrl(mDoctorSpecialTopicsList[3], mDoctorSpecialTopicsList[4])
itemListView.addView(mView) itemListView.addView(mView)
itemListView.addView(mView1) itemListView.addView(mView1)
} }
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
android:background="#FAFAFA" /> android:background="#FAFAFA" />
<LinearLayout <LinearLayout
android:id="@+id/recommendViewPagerIndicator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="15dp" android:layout_height="15dp"
android:orientation="horizontal" android:orientation="horizontal"
......
...@@ -24,7 +24,7 @@ modular { ...@@ -24,7 +24,7 @@ modular {
groupId = "com.ydl" groupId = "com.ydl"
artifactId = "m-im-api" artifactId = "m-im-api"
//开发时注释掉版本号,发布api时打开 //开发时注释掉版本号,发布api时打开
version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"] // version = rootProject.ext.ydlPublishVersion[childProject.getName()+"-api"]
// API 层打包时需要引入的依赖 // API 层打包时需要引入的依赖
apiDependencies { apiDependencies {
implementation "com.google.code.gson:gson:2.8.2" implementation "com.google.code.gson:gson:2.8.2"
......
package com.yidianling.im.helper; package com.yidianling.im.helper;
import android.os.Build;
import android.support.annotation.RequiresApi;
import com.netease.nimlib.sdk.NIMClient; import com.netease.nimlib.sdk.NIMClient;
import com.netease.nimlib.sdk.NIMSDK; import com.netease.nimlib.sdk.NIMSDK;
import com.netease.nimlib.sdk.RequestCallbackWrapper; import com.netease.nimlib.sdk.RequestCallbackWrapper;
...@@ -11,10 +14,13 @@ import com.netease.nimlib.sdk.team.model.MemberChangeAttachment; ...@@ -11,10 +14,13 @@ import com.netease.nimlib.sdk.team.model.MemberChangeAttachment;
import com.yidianling.common.tools.LogUtil; import com.yidianling.common.tools.LogUtil;
import com.yidianling.im.event.UpdateTabUnreadNumEvent; import com.yidianling.im.event.UpdateTabUnreadNumEvent;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import de.greenrobot.event.EventBus; import de.greenrobot.event.EventBus;
import io.reactivex.Observable; import io.reactivex.Observable;
...@@ -41,6 +47,26 @@ public class MsgReceiveHelper { ...@@ -41,6 +47,26 @@ public class MsgReceiveHelper {
} }
} }
/**
* 获取所有未读数
* @return
*/
public static int getAllUnNum() {
Object[] list = unreadNumMap.values().toArray();
int sum = 0;
for (int i=0;i<list.length;i++) {
try {
sum += Integer.parseInt(list[0].toString());
}catch (Exception e) {
sum += 0;
}
}
return sum;
}
public static void onMessageReceived() { public static void onMessageReceived() {
reQueryUnreadNum(); reQueryUnreadNum();
......
...@@ -201,4 +201,8 @@ class IMServiceImpl : IImService { ...@@ -201,4 +201,8 @@ class IMServiceImpl : IImService {
override fun getUnReadByUid(uid: String): Int { override fun getUnReadByUid(uid: String): Int {
return MsgReceiveHelper.getUnNum(uid) return MsgReceiveHelper.getUnNum(uid)
} }
override fun getAllUnReadNum(): Int {
return MsgReceiveHelper.getAllUnNum()
}
} }
\ No newline at end of file
...@@ -53,7 +53,13 @@ interface IImService : IProvider { ...@@ -53,7 +53,13 @@ interface IImService : IProvider {
fun startChat(context : Activity ,toUid : String ,flag : Int , canTalk : Int) fun startChat(context : Activity ,toUid : String ,flag : Int , canTalk : Int)
/** /**
* 根据uid获取未读数 * 根据对方uid获取未读数
*/ */
fun getUnReadByUid(uid: String): Int fun getUnReadByUid(uid: String): Int
/**
* 获取自己的所有未读数
*/
fun getAllUnReadNum(): Int
} }
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent" android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center"> android:gravity="center">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="40dp" android:layout_marginLeft="40dp"
android:layout_marginRight="40dp" android:layout_marginRight="40dp"
android:orientation="vertical" android:orientation="vertical"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:background="@drawable/im_message_chat_setting_bg"> android:background="@drawable/im_message_chat_setting_bg">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="全部消息设为已读" android:text="全部消息设为已读"
android:textSize="18dp" android:textSize="18dp"
android:textStyle="bold" android:textStyle="bold"
android:textColor="#242424" android:textColor="#242424"
android:gravity="center" android:gravity="center"
android:layout_marginTop="24dp"/> android:layout_marginTop="24dp"/>
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="本操作会将私聊、通知、互动中的所有未读消息设为已读" android:text="本操作会将私聊、通知、互动中的所有未读消息设为已读"
android:layout_marginLeft="44dp" android:layout_marginLeft="44dp"
android:layout_marginRight="44dp" android:layout_marginRight="44dp"
android:textSize="13dp" android:textSize="13dp"
android:gravity="center" android:gravity="center"
android:textColor="#666666" android:textColor="#666666"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginBottom="24dp"/> android:layout_marginBottom="24dp"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="44dp" android:layout_height="44dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
android:id="@+id/cancel_btn" android:id="@+id/cancel_btn"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:text="取消" android:text="取消"
android:textSize="16dp" android:textSize="16dp"
android:textColor="#666666" android:textColor="#666666"
android:background="@drawable/im_message_chat_setting_cancel_btn_bg"/> android:background="@drawable/im_message_chat_setting_cancel_btn_bg"/>
<TextView <TextView
android:id="@+id/sure_btn" android:id="@+id/sure_btn"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center" android:gravity="center"
android:text="全部已读" android:text="全部已读"
android:textSize="16dp" android:textSize="16dp"
android:textColor="@color/im_sel_but_text_color" android:textColor="@color/white"
android:background="@drawable/im_message_chat_setting_sure_btn_bg"/> android:background="@drawable/im_message_chat_setting_sure_btn_bg"/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
package com.ydl.utils;
import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.PopupWindow;
import com.ydl.view.MoreClickView;
/**
* Created by Wi1ls on 2016/10/17;
*/
public class PopUtils {
public static PopupWindow showMoreItem(Context context, View view, int offX, int offY){
MoreClickView v= new MoreClickView(context);
WindowManager windowManager= (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
final PopupWindow popupWindow=new PopupWindow(v, windowManager.getDefaultDisplay().getWidth(),
windowManager.getDefaultDisplay().getHeight());
v.setPopupWindow(popupWindow);
popupWindow.setFocusable(false);
popupWindow.setOutsideTouchable(true);
popupWindow.setBackgroundDrawable(new BitmapDrawable());
popupWindow.showAtLocation(view, Gravity.CENTER,0,0);
return popupWindow;
}
}
package com.ydl.view
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.text.TextUtils
import android.util.AttributeSet
import android.view.View
import android.widget.PopupWindow
import android.widget.RelativeLayout
import com.ydl.webview.R
import com.ydl.ydlcommon.data.PlatformDataManager
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.router.YdlCommonRouterManager
import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.yidianling.im.api.service.IImService
import kotlinx.android.synthetic.main.web_ui_new_more.view.*
/**
* Created by Wi1ls on 2016/10/17;
*/
class MoreClickView @JvmOverloads constructor(private val mContext: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0) : RelativeLayout(mContext, attrs, defStyleAttr), View.OnClickListener {
private var mPopupWindow: PopupWindow? = null
private val work_time = if (PlatformDataManager.getRam().getGlobalInfo() == null) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time
private val tel = if (PlatformDataManager.getRam().getGlobalInfo() == null) "400-114-1010'" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel
init {
View.inflate(mContext, R.layout.web_ui_new_more, this)
init()
}
internal fun init() {
fl_main.setOnClickListener(this)
more_msg.setOnClickListener(this)
more_homepage.setOnClickListener(this)
more_service.setOnClickListener(this)
more_ray.setOnClickListener(this)
/* if (YdlCommonRouterManager.getYdlCommonRoute().isHasUnread()) {
msg_new.setVisibility(View.VISIBLE)
} else {
msg_new.setVisibility(View.INVISIBLE)
}*/
un_read_num.text = ModularServiceManager.provide(IImService::class.java).getAllUnReadNum().toString()
}
override fun onClick(view: View) {
if (mPopupWindow != null && mPopupWindow!!.isShowing) {
mPopupWindow!!.dismiss()
}
when (view.id) {
R.id.fl_main -> {
}
R.id.more_msg -> setMoreMsg()
R.id.more_homepage -> setMoreHomePage()
R.id.more_service -> setMoreService()
R.id.more_ray -> setMoreRay()
}
}
private fun setMoreMsg() {
if (PlatformDataManager.getRam().getChannelName().startsWith("ATK_3")) {
YdlCommonRouterManager.getYdlCommonRoute().startMain(context, 2, null)
} else {
YdlCommonRouterManager.getYdlCommonRoute().startMain(context, 3, null)
}
}
private fun setMoreHomePage() {
YdlCommonRouterManager.getYdlCommonRoute().startMain(context, 0, null)
}
private fun setMoreService() {
YdlCommonRouterManager.getYdlCommonRoute().setMoreService(context)
}
private fun setMoreRay() {
CommonDialog(context)
.setMessage("欢迎致电壹点灵客服热线\n" + PlatformDataManager.getRam().getGlobalInfo()?.info?.tel + "\n服务时间:" + work_time)
.setLeftOnclick("取消", null)
.setRightClick("拨打") {
if (null != tel && !TextUtils.isEmpty(tel)) {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$tel"))
context.startActivity(phoneIntent)
}
}.show()
}
private var callBack: CallPhoneCallBack? = null
fun setCallPhoneCallBack(callBack: CallPhoneCallBack) {
this.callBack = callBack
}
interface CallPhoneCallBack {
fun call(tel: String, action: String)
}
fun setPopupWindow(popupWindow: PopupWindow) {
mPopupWindow = popupWindow
}
}
...@@ -127,6 +127,8 @@ class H5JsBean { ...@@ -127,6 +127,8 @@ class H5JsBean {
//倾诉拨打电话使用参数 //倾诉拨打电话使用参数
var callType:String?=null var callType:String?=null
var switchStatus = 1
} }
} }
} }
...@@ -35,6 +35,7 @@ import com.tencent.smtt.sdk.WebView; ...@@ -35,6 +35,7 @@ import com.tencent.smtt.sdk.WebView;
import com.tencent.smtt.sdk.WebViewClient; import com.tencent.smtt.sdk.WebViewClient;
import com.umeng.socialize.UMShareAPI; import com.umeng.socialize.UMShareAPI;
import com.umeng.socialize.bean.SHARE_MEDIA; import com.umeng.socialize.bean.SHARE_MEDIA;
import com.ydl.utils.PopUtils;
import com.ydl.ydl_router.manager.YDLRouterManager; import com.ydl.ydl_router.manager.YDLRouterManager;
import com.ydl.ydlcommon.base.BaseActivity; import com.ydl.ydlcommon.base.BaseActivity;
import com.ydl.ydlcommon.base.BaseApp; import com.ydl.ydlcommon.base.BaseApp;
...@@ -44,7 +45,6 @@ import com.ydl.ydlcommon.ui.LogoLoadingView; ...@@ -44,7 +45,6 @@ import com.ydl.ydlcommon.ui.LogoLoadingView;
import com.ydl.ydlcommon.utils.BuryPointUtils; import com.ydl.ydlcommon.utils.BuryPointUtils;
import com.ydl.ydlcommon.utils.LogUtil; import com.ydl.ydlcommon.utils.LogUtil;
import com.ydl.ydlcommon.utils.NetWorkSpeedUtils; import com.ydl.ydlcommon.utils.NetWorkSpeedUtils;
import com.ydl.ydlcommon.utils.PopUtils;
import com.ydl.ydlcommon.utils.StatusBarUtils; import com.ydl.ydlcommon.utils.StatusBarUtils;
import com.ydl.ydlcommon.utils.TemporaryUtils; import com.ydl.ydlcommon.utils.TemporaryUtils;
import com.ydl.ydlcommon.utils.URLUtils; import com.ydl.ydlcommon.utils.URLUtils;
...@@ -248,7 +248,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -248,7 +248,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
*/ */
private void sendNetLossMessage() { private void sendNetLossMessage() {
if (null != mTimeOutHandler) if (null != mTimeOutHandler)
mTimeOutHandler.sendEmptyMessageDelayed(TIME_OUT_TYPE, timeOutLong); mTimeOutHandler.sendEmptyMessageDelayed(TIME_OUT_TYPE, timeOutLong);
} }
/** /**
...@@ -304,7 +304,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -304,7 +304,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
@NotNull @NotNull
@Override @Override
public StatusBarOptions getStatusViewOptions() { public StatusBarOptions getStatusViewOptions() {
return new StatusBarOptions(true,true); return new StatusBarOptions(true, true);
} }
@Override @Override
...@@ -331,7 +331,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -331,7 +331,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
} }
setUrlHeightParams(); setUrlHeightParams();
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
jtoJHandle = WebModularServiceUtils.Companion.getWebService().getJavascripHandler(this,tellData = tellData); jtoJHandle = WebModularServiceUtils.Companion.getWebService().getJavascripHandler(this, tellData = tellData);
appFrom = BaseApp.instance.getGlobalConfig().getAppFrom(); appFrom = BaseApp.instance.getGlobalConfig().getAppFrom();
init(); init();
...@@ -396,11 +396,11 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -396,11 +396,11 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
return pinjie(resultUrl); return pinjie(resultUrl);
} }
private String pinjie(String jumpUrl){ private String pinjie(String jumpUrl) {
if (jumpUrl.contains("hideNavBar=1")){ if (jumpUrl.contains("hideNavBar=1")) {
hideJavaTitleBar(); hideJavaTitleBar();
return jumpUrl; return jumpUrl;
}else if (jumpUrl.contains("hideNavBar=2")){ } else if (jumpUrl.contains("hideNavBar=2")) {
showTitleBar(); showTitleBar();
return jumpUrl; return jumpUrl;
} }
...@@ -500,7 +500,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -500,7 +500,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
} }
} }
public void showTitleBar(){ public void showTitleBar() {
tb_title.setVisibility(VISIBLE); tb_title.setVisibility(VISIBLE);
if (null != getStatusView()) { if (null != getStatusView()) {
...@@ -634,16 +634,18 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -634,16 +634,18 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
Boolean overridePayUrl = shouldOverridePayUrl(view, url); Boolean overridePayUrl = shouldOverridePayUrl(view, url);
if(overridePayUrl != null) { if (overridePayUrl != null) {
return overridePayUrl; return overridePayUrl;
} }
if (!TextUtils.isEmpty(url) && url.startsWith("http")) {
if (YDLRouterManager.Companion.router(url)) {
} else {
loadUrl(setUrlHeightParams(url)); loadUrl(setUrlHeightParams(url));
} } else {
if (YDLRouterManager.Companion.router(url)) {
} else {
loadUrl(setUrlHeightParams(url));
}
}
return true; return true;
} }
...@@ -710,14 +712,20 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -710,14 +712,20 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
@Override @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) { public boolean shouldOverrideUrlLoading(WebView view, String url) {
Boolean overridePayUrl = shouldOverridePayUrl(view, url); Boolean overridePayUrl = shouldOverridePayUrl(view, url);
if(overridePayUrl!=null) { if (overridePayUrl != null) {
return overridePayUrl; return overridePayUrl;
} }
if (YDLRouterManager.Companion.router(url)) {
} else { if (!TextUtils.isEmpty(url) && url.startsWith("http")) {
loadUrl(setUrlHeightParams(url)); loadUrl(setUrlHeightParams(url));
} else {
if (YDLRouterManager.Companion.router(url)) {
} else {
loadUrl(setUrlHeightParams(url));
}
} }
return true; return true;
...@@ -755,7 +763,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -755,7 +763,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title.setImageVis(1); tb_title.setImageVis(1);
} }
} else { } else {
tb_title.setImage(getResources().getDrawable(YDLConstants.FROM_YDL.equals(appFrom)?R.drawable.platform_toolbar_back :R.drawable.platform_toolbar_back_yellow)); tb_title.setImage(getResources().getDrawable(YDLConstants.FROM_YDL.equals(appFrom) ? R.drawable.platform_toolbar_back : R.drawable.platform_toolbar_back_yellow));
tb_title.setmLeftText(""); tb_title.setmLeftText("");
tb_title.setImageListener(v -> { tb_title.setImageListener(v -> {
if (h5Params.getShowUrlTitle()) { if (h5Params.getShowUrlTitle()) {
...@@ -831,7 +839,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -831,7 +839,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
return true; return true;
} }
} else if (url.startsWith("alipays://") || url.startsWith("alipay")) { } else if (url.startsWith("alipays://") || url.startsWith("alipay")) {
try{ try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true; return true;
} catch (Exception e) { } catch (Exception e) {
...@@ -848,7 +856,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -848,7 +856,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
// 处理微信 H5 支付跳转时验证请求头 referer 失效 // 处理微信 H5 支付跳转时验证请求头 referer 失效
// 验证不通过会出现“商家参数格式有误,请联系商家解决” // 验证不通过会出现“商家参数格式有误,请联系商家解决”
if (url.contains("wx.tenpay.com")){ if (url.contains("wx.tenpay.com")) {
// 申请微信 H5 支付时填写的域名 // 申请微信 H5 支付时填写的域名
// 比如经常用来测试网络连通性的 http://www.baidu.com // 比如经常用来测试网络连通性的 http://www.baidu.com
...@@ -857,12 +865,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -857,12 +865,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
String redirectUrlStr = parse.getQueryParameter("redirect_url"); String redirectUrlStr = parse.getQueryParameter("redirect_url");
Uri redirectUrl = Uri.parse(redirectUrlStr); Uri redirectUrl = Uri.parse(redirectUrlStr);
// 申请微信 H5 支付时填写的域名 // 申请微信 H5 支付时填写的域名
String referer = redirectUrl.getScheme()+"://"+redirectUrl.getHost(); String referer = redirectUrl.getScheme() + "://" + redirectUrl.getHost();
// 兼容 Android 4.4.3 和 4.4.4 两个系统版本设置 referer 无效的问题 // 兼容 Android 4.4.3 和 4.4.4 两个系统版本设置 referer 无效的问题
if (("4.4.3".equals(Build.VERSION.RELEASE)) if (("4.4.3".equals(Build.VERSION.RELEASE))
|| ("4.4.4".equals(Build.VERSION.RELEASE))) { || ("4.4.4".equals(Build.VERSION.RELEASE))) {
if (firstVisitWXH5PayUrl){ if (firstVisitWXH5PayUrl) {
view.loadDataWithBaseURL(referer, "<script>window.location.href=\"" + url + "\";</script>", view.loadDataWithBaseURL(referer, "<script>window.location.href=\"" + url + "\";</script>",
"text/html", "utf-8", null); "text/html", "utf-8", null);
// 修改标记位状态,避免循环调用 // 修改标记位状态,避免循环调用
...@@ -878,7 +886,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -878,7 +886,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
view.loadUrl(url, map); view.loadUrl(url, map);
return true; return true;
} }
}else if(url.contains("alipay")) { } else if (url.contains("alipay")) {
return false; return false;
} }
...@@ -907,11 +915,11 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -907,11 +915,11 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
} }
public void onEvent(RefreshWebEvent event) { public void onEvent(RefreshWebEvent event) {
if(event.isClearHistory) { if (event.isClearHistory) {
wv_content.clearCache(true); wv_content.clearCache(true);
wv_content.clearHistory(); wv_content.clearHistory();
loadUrl(h5Params.getUrl()); loadUrl(h5Params.getUrl());
}else{ } else {
//刷新页面 //刷新页面
loadUrl(h5Params.getUrl()); loadUrl(h5Params.getUrl());
shouldClearHistory = true; shouldClearHistory = true;
...@@ -977,7 +985,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -977,7 +985,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
} }
String resultUrl = h5Params.getSuffix() ? TemporaryUtils.getSuffix(url) : url; String resultUrl = h5Params.getSuffix() ? TemporaryUtils.getSuffix(url) : url;
Log.e("AAAA",resultUrl); Log.e("AAAA", resultUrl);
wv_content.loadUrl(resultUrl); wv_content.loadUrl(resultUrl);
pointBI(resultUrl); pointBI(resultUrl);
} }
...@@ -994,7 +1002,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -994,7 +1002,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private void initHead() { private void initHead() {
// header // header
final MaterialHeader header = new MaterialHeader(this); final MaterialHeader header = new MaterialHeader(this);
int[] colors = new int[]{getResources().getColor(YDLConstants.FROM_YDL.equals(appFrom)?R.color.platform_google_green :R.color.platform_google_yellow)}; int[] colors = new int[]{getResources().getColor(YDLConstants.FROM_YDL.equals(appFrom) ? R.color.platform_google_green : R.color.platform_google_yellow)};
header.setColorSchemeColors(colors); header.setColorSchemeColors(colors);
header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2)); header.setLayoutParams(new PtrFrameLayout.LayoutParams(-1, -2));
int padding = (int) getResources().getDimension(R.dimen.platform_default_dis_size); int padding = (int) getResources().getDimension(R.dimen.platform_default_dis_size);
...@@ -1284,6 +1292,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -1284,6 +1292,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
} }
private void toTrend(String url) { private void toTrend(String url) {
WebModularServiceUtils.Companion.getDynamicService().publishArticleToTrend(NewH5Activity.this, url, cover, shareTitle); WebModularServiceUtils.Companion.getDynamicService().publishArticleToTrend(NewH5Activity.this, url, cover, shareTitle);
} }
} }
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="7dp"/>
<solid android:color="#FF5040"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/fl_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="150dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="right"
android:elevation="4dp"
android:background="@color/platform_white"
android:layout_marginTop="55dp"
android:layout_marginRight="5dp">
<LinearLayout
android:id="@+id/more_msg"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="19dp"
android:layout_marginRight="15dp"
android:src="@drawable/platform_ic_pop_news"/>
<TextView
android:id="@+id/tv_msg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17sp"
android:text="消息"
android:textColor="#333333"/>
<TextView
android:id="@+id/un_read_num"
android:layout_width="wrap_content"
android:layout_height="14dp"
android:textSize="10dp"
tools:text="10"
android:textColor="#ffffff"
android:paddingLeft="3dp"
android:paddingRight="3dp"
android:gravity="center"
android:background="@drawable/web_message_num_bg"
android:layout_marginLeft="5dp"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#e5e5e5"
android:layout_marginRight="2dp"/>
<LinearLayout
android:id="@+id/more_homepage"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="19dp"
android:layout_marginRight="15dp"
android:src="@drawable/platform_ic_pop_home"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17sp"
android:text="首页"
android:textColor="#333333"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#e5e5e5"
android:layout_marginRight="2dp"/>
<LinearLayout
android:id="@+id/more_service"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="19dp"
android:layout_marginRight="15dp"
android:src="@drawable/platform_ic_pop_kefu"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17sp"
android:text="在线客服"
android:textColor="#333333"/>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#e5e5e5"
android:layout_marginRight="2dp"/>
<LinearLayout
android:id="@+id/more_ray"
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="19dp"
android:layout_marginRight="15dp"
android:src="@drawable/platform_ic_pop_phone"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="17sp"
android:text="免费热线"
android:textColor="#333333"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment