Commit fb8af712 by 王佳洋

Merge branch '333' into feat/wjy/合规

# Conflicts:
#	ydl-platform/src/main/res/values/colors.xml
parents e742fa88 8259f321
...@@ -59,8 +59,8 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener { ...@@ -59,8 +59,8 @@ class FeedBackActivity : BaseActivity(), View.OnClickListener {
private var isPhoneNull = true private var isPhoneNull = true
private var imgFiles: MutableList<File>? = null private var imgFiles: MutableList<File>? = null
internal var work_time = if (PlatformDataManager.getRam().getGlobalInfo() == null) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time private var work_time = if (PlatformDataManager.getRam().getGlobalInfo() == null) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time
internal var tel = if (PlatformDataManager.getRam().getGlobalInfo() == null) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel private var tel = if (PlatformDataManager.getRam().getGlobalInfo() == null) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel
override fun getStatusViewOptions(): StatusBarOptions { override fun getStatusViewOptions(): StatusBarOptions {
return StatusBarOptions(true, true) return StatusBarOptions(true, true)
} }
......
...@@ -135,5 +135,5 @@ ...@@ -135,5 +135,5 @@
<color name="color_C3C4CA">#C3C4CA</color> <color name="color_C3C4CA">#C3C4CA</color>
<color name="color_2E2E30">#2E2E30</color> <color name="color_2E2E30">#2E2E30</color>
<color name="color_191919">#191919</color> <color name="color_191919">#191919</color>
<color name="color_E5E5E5">#E5E5E5</color>
</resources> </resources>
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;
import com.ydl.webview.IJavascriptHandler;
/**
* Created by Wi1ls on 2016/10/17;
*/
public class PopUtils {
public static PopupWindow showMoreItem(Context context, View view, IJavascriptHandler jtoJHandle){
MoreClickView v= new MoreClickView(context,jtoJHandle);
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;
}
}
...@@ -20,12 +20,17 @@ import kotlinx.android.synthetic.main.web_ui_new_more.view.* ...@@ -20,12 +20,17 @@ import kotlinx.android.synthetic.main.web_ui_new_more.view.*
/** /**
* Created by Wi1ls on 2016/10/17; * Created by Wi1ls on 2016/10/17;
*/ */
class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : RelativeLayout(context), View.OnClickListener { class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : RelativeLayout(context),
private var mJtoJHandle: IJavascriptHandler?= jtoJHandle View.OnClickListener {
private var mJtoJHandle: IJavascriptHandler? = jtoJHandle
private var mPopupWindow: PopupWindow? = null 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 work_time = if (PlatformDataManager.getRam()
private val tel = if (PlatformDataManager.getRam().getGlobalInfo() == null) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel .getGlobalInfo() == null
) "早8:30-凌晨2:00" else PlatformDataManager.getRam().getGlobalInfo()?.info?.work_time
private val tel = if (PlatformDataManager.getRam()
.getGlobalInfo() == null
) "400-765-1010" else PlatformDataManager.getRam().getGlobalInfo()?.info?.tel
init { init {
View.inflate(context, R.layout.web_ui_new_more, this) View.inflate(context, R.layout.web_ui_new_more, this)
...@@ -33,38 +38,41 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative ...@@ -33,38 +38,41 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
} }
internal fun init() { internal fun init() {
fl_main.setOnClickListener(this) if (mJtoJHandle?.setMoreMsg() != null) {
if(mJtoJHandle?.setMoreMsg()!=null){
more_msg.setOnClickListener(mJtoJHandle?.setMoreMsg()) more_msg.setOnClickListener(mJtoJHandle?.setMoreMsg())
}else{ } else {
more_msg.setOnClickListener(this) more_msg.setOnClickListener(this)
} }
if(mJtoJHandle?.setMoreHomePage()!=null){ if (mJtoJHandle?.setMoreHomePage() != null) {
more_homepage.setOnClickListener(mJtoJHandle?.setMoreHomePage()) more_homepage.setOnClickListener(mJtoJHandle?.setMoreHomePage())
}else{ } else {
more_homepage.setOnClickListener(this) more_homepage.setOnClickListener(this)
} }
if(mJtoJHandle?.setMoreService()!=null){ if (mJtoJHandle?.setMoreService() != null) {
more_service.setOnClickListener(mJtoJHandle?.setMoreService()) more_service.setOnClickListener(mJtoJHandle?.setMoreService())
}else{ } else {
more_service.setOnClickListener(this) more_service.setOnClickListener(this)
} }
if(mJtoJHandle?.setMoreCall()!=null){ if (mJtoJHandle?.setMoreCall() != null) {
more_ray.setOnClickListener(mJtoJHandle?.setMoreCall()) more_ray.setOnClickListener(mJtoJHandle?.setMoreCall())
}else{ } else {
more_ray.setOnClickListener(this) more_ray.setOnClickListener(this)
} }
if (mJtoJHandle?.setMoreCall() != null) {
more_feed.setOnClickListener(mJtoJHandle?.setMoreCall())
} else {
more_feed.setOnClickListener(this)
}
/* if (YdlCommonRouterManager.getYdlCommonRoute().isHasUnread()) { /* if (YdlCommonRouterManager.getYdlCommonRoute().isHasUnread()) {
msg_new.setVisibility(View.VISIBLE) msg_new.setVisibility(View.VISIBLE)
} else { } else {
msg_new.setVisibility(View.INVISIBLE) msg_new.setVisibility(View.INVISIBLE)
}*/ }*/
var unreadNum = ModularServiceManager.provide(IImService::class.java).getAllUnReadNum() val unreadNum = ModularServiceManager.provide(IImService::class.java).getAllUnReadNum()
if (unreadNum <= 0) { if (unreadNum <= 0) {
un_read_num.visibility = View.GONE un_read_num.visibility = View.GONE
} } else {
else {
if (unreadNum > 99) { if (unreadNum > 99) {
un_read_num.text = "${unreadNum}+" un_read_num.text = "${unreadNum}+"
} else { } else {
...@@ -80,8 +88,6 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative ...@@ -80,8 +88,6 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
mPopupWindow!!.dismiss() mPopupWindow!!.dismiss()
} }
when (view.id) { when (view.id) {
R.id.fl_main -> {
}
R.id.more_msg -> { R.id.more_msg -> {
setMoreMsg() setMoreMsg()
} }
...@@ -92,7 +98,7 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative ...@@ -92,7 +98,7 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
setMoreService() setMoreService()
} }
R.id.more_ray -> { R.id.more_ray -> {
setMoreRay() setMoreRay()
} }
} }
...@@ -116,24 +122,14 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative ...@@ -116,24 +122,14 @@ class MoreClickView(context: Context, jtoJHandle: IJavascriptHandler) : Relative
private fun setMoreRay() { private fun setMoreRay() {
CommonDialog(context) CommonDialog(context)
.setMessage("欢迎致电壹点灵客服热线\n$tel\n服务时间:$work_time") .setMessage("欢迎致电壹点灵客服热线\n$tel\n服务时间:$work_time")
.setLeftOnclick("取消", null) .setLeftOnclick("取消", null)
.setRightClick("拨打") { .setRightClick("拨打") {
if (null != tel && !TextUtils.isEmpty(tel)) { if (null != tel && !TextUtils.isEmpty(tel)) {
val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$tel")) val phoneIntent = Intent(Intent.ACTION_DIAL, Uri.parse("tel:$tel"))
context.startActivity(phoneIntent) context.startActivity(phoneIntent)
} }
}.show() }.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) { fun setPopupWindow(popupWindow: PopupWindow) {
......
...@@ -15,8 +15,10 @@ import android.os.Bundle; ...@@ -15,8 +15,10 @@ import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.view.WindowManager;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.PopupWindow; import android.widget.PopupWindow;
...@@ -34,10 +36,10 @@ import com.tencent.smtt.sdk.WebView; ...@@ -34,10 +36,10 @@ 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.utils.ProxyCheckUtils; import com.ydl.utils.ProxyCheckUtils;
import com.ydl.utils.WebUrlParamsUtils; import com.ydl.utils.WebUrlParamsUtils;
import com.ydl.view.ArticleDialogFragment; import com.ydl.view.ArticleDialogFragment;
import com.ydl.view.MoreClickView;
import com.ydl.view.ShareMeditationDialog; import com.ydl.view.ShareMeditationDialog;
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;
...@@ -131,8 +133,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -131,8 +133,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private ShareMeditationDialog shareMeditationDialog; private ShareMeditationDialog shareMeditationDialog;
private ArticleDialogFragment commentArticleDialog; private ArticleDialogFragment commentArticleDialog;
protected PopupWindow popupWindow;
protected ValueCallback<Uri> uploadMessage; protected ValueCallback<Uri> uploadMessage;
protected ValueCallback<Uri[]> uploadMessageAboveL; protected ValueCallback<Uri[]> uploadMessageAboveL;
private boolean shouldClearHistory = false; private boolean shouldClearHistory = false;
...@@ -536,8 +536,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -536,8 +536,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
} }
public void openRightTopMenu() { public void openRightTopMenu() {
popupWindow = PopUtils.showMoreItem(this, MoreClickView moreView = new MoreClickView(this, jtoJHandle);
tb_title.getRootView(), jtoJHandle); PopupWindow popupWindow = new PopupWindow(moreView, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);
moreView.setPopupWindow(popupWindow);
popupWindow.setOutsideTouchable(true);
popupWindow.setFocusable(true); // 防止外部点击事件穿透
popupWindow.showAtLocation(tb_title, Gravity.TOP | Gravity.END, 0, 0);
} }
public void openShareMenu(H5JsBean.H5JsCmd.Params params) { public void openShareMenu(H5JsBean.H5JsCmd.Params params) {
...@@ -641,8 +645,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler { ...@@ -641,8 +645,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
purl = intent.getStringExtra("purl"); purl = intent.getStringExtra("purl");
//要加"more"按钮 //要加"more"按钮
if (h5Params.isShowMenu()) { if (h5Params.isShowMenu()) {
tb_title.setRightImageListener(v -> popupWindow = PopUtils.showMoreItem(this, tb_title.setRightImageListener(v -> openRightTopMenu());
tb_title.getRootView(), jtoJHandle));
tb_title.setRightImageIfShouldSee(); tb_title.setRightImageIfShouldSee();
} else { } else {
tb_title.setRightImageIfNoSee(); tb_title.setRightImageIfNoSee();
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="8dp"/>
<solid android:color="@android:color/white"/>
</shape>
\ 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