Commit c55c3337 by 徐健

backup

parent 8e10c2a9
......@@ -20,8 +20,8 @@ import java.util.List;
public final class DemoGlobalConfig implements IConfigModule {
String APP_DOMAIN = "https://api.github.com/";
// public static String appEnv = YDLConstants.ENV_AUTO_TEST;
public static String appEnv = YDLConstants.ENV_TEST;
// public static String appEnv = YDLConstants.ENV_PROD;
// public static String appEnv = YDLConstants.ENV_TEST;
public static String appEnv = YDLConstants.ENV_PROD;
@Override
public void injectAppLifecycle(@NotNull Context context, @NotNull List<IAppLifecycles> lifecycles) {
......
......@@ -2,6 +2,7 @@ package com.ydl.component.service.web;
import android.app.Activity;
import com.ydl.webview.H5JsBean;
import com.ydl.webview.NewH5Activity;
......@@ -413,4 +414,22 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
}
@Override
public void shouldShowTitleBar(boolean isShowTitleBar) {
if (mContext instanceof NewH5Activity) {
if (isShowTitleBar) {
((NewH5Activity) mContext).showTitleBar();
} else {
((NewH5Activity) mContext).hideJavaTitleBar();
}
}
}
@Override
public void setSelfPageType(int selfType) {
if (mContext instanceof NewH5Activity) {
((NewH5Activity) mContext).setSelfPageType(selfType);
}
}
}
......@@ -367,6 +367,16 @@ class WebJavascriptHandler : IJavascriptHandler{
"chatUnread" -> {
wvEnventPro?.sendUnReadNum(jsData.cmd!!.params?.callBack, jsData.cmd!!.params?.uid.toString())
}
"showTitleBar" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.shouldShowTitleBar(it.isShowTitleBar!!)
}
}
"setSelfPageType" -> {
jsData.cmd!!.params?.let {
wvEnventPro?.setSelfPageType(it.selfPageType)
}
}
}
}
}
......@@ -175,4 +175,11 @@ public interface WebViewClientClickListener {
// void storePic();
void sendUnReadNum(String callbackFuncName, String uid);
//是否展示标题栏
void shouldShowTitleBar(boolean isShowTitleBar);
//设置当前页面类型
void setSelfPageType(int selfType);
}
ext {
kotlin_version = "1.3.21"
dev_mode = true
dev_mode = false
ydl_app = [
appName : "心理咨询壹点灵",
......@@ -69,10 +69,10 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.30",
"ydl-platform" : "0.0.31.1",
//第二步 若干
"ydl-webview" : "0.0.29",
"ydl-webview" : "0.0.30.1",
"ydl-media" : "0.0.15",
"ydl-pay" : "0.0.12",
"m-audioim" : "0.0.41",
......@@ -115,10 +115,10 @@ ext {
//-------------- 功能组件 --------------
//第一步
"ydl-platform" : "0.0.30",
"ydl-platform" : "0.0.31.1",
//第二步 若干
"ydl-webview" : "0.0.29",
"ydl-webview" : "0.0.30.1",
"ydl-media" : "0.0.15",
"ydl-pay" : "0.0.12",
"m-audioim" : "0.0.41",
......
......@@ -82,6 +82,8 @@ import com.yidianling.user.api.service.IUserService;
import org.jetbrains.annotations.NotNull;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
......
......@@ -220,6 +220,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginBottom="70dp">
<LinearLayout
android:layout_width="0dp"
......@@ -240,6 +241,10 @@
android:textColor="#242424"
android:textSize="14dp"/>
</LinearLayout>
<ImageView
android:layout_width="16dp"
android:layout_height="8dp"
android:src="@drawable/im_expert_service_to_right_icon"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
......@@ -259,6 +264,10 @@
android:textColor="#242424"
android:textSize="14dp"/>
</LinearLayout>
<ImageView
android:layout_width="16dp"
android:layout_height="8dp"
android:src="@drawable/im_expert_service_to_right_icon"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
......@@ -278,6 +287,10 @@
android:textColor="#242424"
android:textSize="14dp"/>
</LinearLayout>
<ImageView
android:layout_width="16dp"
android:layout_height="8dp"
android:src="@drawable/im_expert_service_to_right_icon"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
......@@ -332,7 +345,7 @@
android:id="@+id/consult_service_service_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="320"
android:text="0"
android:textColor="#FF5040"
android:textSize="20dp"
android:textStyle="bold" />
......
......@@ -66,7 +66,7 @@
android:id="@+id/service_item_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="320"
android:text="0"
android:textColor="#FF5040"
android:textSize="16dp"
android:textStyle="bold"
......@@ -77,7 +77,7 @@
android:id="@+id/service_item_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/60分钟"
android:text="/0分钟"
android:textColor="#999999"
android:textSize="12dp" />
<TextView
......@@ -101,7 +101,7 @@
android:id="@+id/service_item_feddbackrate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="99.9%"
android:text="0%"
android:layout_marginLeft="1dp"
android:textColor="#1A1A1A"
android:textSize="12dp" />
......@@ -133,7 +133,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:text="销量2244"
android:text="销量0"
android:textColor="#999999"
android:textSize="10dp" />
</LinearLayout>
......
package com.ydl.ydlcommon.view.dialog
import android.app.Dialog
import android.content.Context
import android.os.Bundle
import android.view.Gravity
import android.view.WindowManager
import com.ydl.ydlcommon.R
import kotlinx.android.synthetic.main.platform_ydl_common_dialog_layout.*
class YDLCommonDialog(context: Context, private var listener: OnYDLCommonDialogListener?): Dialog(context, R.style.platform_dialog_default_style) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.platform_ydl_common_dialog_layout)
val params = window.attributes
params.width = WindowManager.LayoutParams.MATCH_PARENT
params.height = WindowManager.LayoutParams.WRAP_CONTENT
window.setGravity(Gravity.CENTER)
window.attributes = params
ydl_common_dialog_cancel.setOnClickListener {
listener?.onCancel()
}
ydl_common_dialog_sure.setOnClickListener {
listener?.onSure()
}
}
/**
* 标题
*/
fun setTitle(title: String): YDLCommonDialog {
ydl_common_dialog_title.text = title
return this
}
/**
* 内容
*/
fun setDesc(desc: String): YDLCommonDialog {
ydl_common_dialog_desc.text = desc
return this
}
/**
* 左侧按钮
*/
fun setCancelText(cancelText: String): YDLCommonDialog {
ydl_common_dialog_cancel.text = cancelText
return this
}
/**
* 右侧按钮
*/
fun setSureText(sureText: String): YDLCommonDialog {
ydl_common_dialog_sure.text = sureText
return this
}
/**
* 根据app包设置右侧按钮主题色,*****************必须调用*****************
*/
fun setTheme(flavor: String): YDLCommonDialog {
if (flavor == "ydl") {
ydl_common_dialog_sure.setBackgroundResource(R.drawable.platform_ydl_common_dialog_sure_btn_ydl_bg)
}else {
ydl_common_dialog_sure.setBackgroundResource(R.drawable.platform_ydl_common_dialog_sure_btn_xlzx_bg)
}
return this
}
interface OnYDLCommonDialogListener {
fun onCancel()
fun onSure()
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp"/>
<solid
android:color="#ffffff"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:width="0.5dp"
android:color="#D8D8D8" />
<corners android:bottomLeftRadius="8dp"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#fdbd00"
android:startColor="#FFEC8C"/>
<corners android:bottomRightRadius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:endColor="#1DA1F2"
android:startColor="#23B2FA"/>
<corners android:bottomRightRadius="8dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:orientation="vertical"
android:gravity="center_horizontal"
android:background="@drawable/platform_ydl_common_dialog_bg">
<TextView
android:id="@+id/ydl_common_dialog_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="全部消息设为已读"
android:textSize="16dp"
android:textStyle="bold"
android:textColor="#242424"
android:gravity="center"
android:layout_marginTop="34dp"/>
<TextView
android:id="@+id/ydl_common_dialog_desc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="本操作会将私聊、通知、互动中的所有未读消息设为已读"
android:layout_marginLeft="44dp"
android:layout_marginRight="44dp"
android:textSize="14dp"
android:gravity="center"
android:textColor="#242424"
android:layout_marginTop="8dp"
android:layout_marginBottom="24dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="44dp"
android:orientation="horizontal">
<TextView
android:id="@+id/ydl_common_dialog_cancel"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center"
tools:text="取消"
android:textSize="16dp"
android:textColor="#666666"
android:background="@drawable/platform_ydl_common_dialog_cancel_btn_bg"/>
<TextView
android:id="@+id/ydl_common_dialog_sure"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:gravity="center"
tools:text="全部已读"
android:textSize="16dp"
android:textColor="@color/white"
android:background="@drawable/platform_ydl_common_dialog_sure_btn_ydl_bg"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
......@@ -23,6 +23,14 @@
<!--四边边距都为0的dialog-->
<style name="platform_dialog_default_style" parent="@android:style/Theme.Dialog">
<item name="android:windowBackground">@color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
<!-- 仿ios普通对话框 -->
<style name="platform_normaldialog_style" parent="@android:style/Theme.Dialog">
......
......@@ -20,9 +20,11 @@ class H5JsBean {
class Params {
var callBack: String = "" // 用于回调的js方法名
var isShowTitleBar: Boolean = false //是否展示标题栏
var selfPageType: Int = -1 //当前h5页面
var user_url: String? = null // 修改预约时间用户网址
var doc_url: String? = null // 修改预约时间专家网址
var dsmId: Int = 0 // 修改预约时间参数
......
......@@ -48,6 +48,8 @@ import com.ydl.ydlcommon.utils.StatusBarUtils;
import com.ydl.ydlcommon.utils.TemporaryUtils;
import com.ydl.ydlcommon.utils.URLUtils;
import com.ydl.ydlcommon.view.TitleBar;
import com.ydl.ydlcommon.view.dialog.CommonDialog;
import com.ydl.ydlcommon.view.dialog.YDLCommonDialog;
import com.ydl.ydlcommon.view.dialog.YDLShareDialog;
import com.yidianling.common.tools.RxDeviceTool;
import com.yidianling.common.tools.RxImageTool;
......@@ -151,6 +153,36 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
boolean firstVisitWXH5PayUrl = true;
private String WX_H5_PAY_HOST = "http://testnewm.ydl.com";
/**
* 当前页面类型
*/
private int selfPageType = -1;
private int TEST_QUESTIONS_PAGE_TYPE = 1000001; //测评题页面
private YDLCommonDialog testQuestionsPageReturnDialog = null;
/**
* 设置当前h5页面类型
*
* @param pageType
*/
public void setSelfPageType(int pageType) {
selfPageType = pageType;
// 如果是测试题页面
if (selfPageType == TEST_QUESTIONS_PAGE_TYPE) {
if (null != tb_title) {
tb_title.setLeftImageListener(v -> {
showTestQuestionPageReturnDialog();
});
tb_title.setOnLeftTextClick((view, isActive) -> {
if (isActive) {
showTestQuestionPageReturnDialog();
}
});
}
}
}
public static void start(Context context, H5Params h5Params1) {
if (null == context) {
......@@ -493,18 +525,21 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
//js修改UI的操作需要放在UI线程中更新
public void hideJavaTitleBar() {
tb_title.setVisibility(View.GONE);
if (null != getStatusView()) {
getStatusView().setVisibility(View.GONE);
}
runOnUiThread(() -> {
tb_title.setVisibility(View.GONE);
if (null != getStatusView()) {
getStatusView().setVisibility(View.GONE);
}
});
}
public void showTitleBar() {
tb_title.setVisibility(VISIBLE);
if (null != getStatusView()) {
getStatusView().setVisibility(VISIBLE);
}
runOnUiThread(() -> {
tb_title.setVisibility(VISIBLE);
if (null != getStatusView()) {
getStatusView().setVisibility(VISIBLE);
}
});
}
public void closeWebKit() {
......@@ -1101,7 +1136,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
super.finish();
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
//CookieManager.getInstance().removeSessionCookie();
//CookieManager.getInstance().removeSessionCookie();
}
private void openImageChooserActivity() {
......@@ -1172,8 +1207,22 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
/**
* 判断是否是测评题页面,如果是,则走测评题页面的返回逻辑
*/
if (keyCode == KeyEvent.KEYCODE_BACK) {
/**
* 是否是测评题目页面
*/
if (selfPageType == TEST_QUESTIONS_PAGE_TYPE) {
showTestQuestionPageReturnDialog();
return false;
}
/**
* 增加逻辑:在高级题测试页面,按物理返回键直接finish当前页面,不走webview.goback()逻辑
*/
if (h5Params.isControlBack()) {
......@@ -1185,6 +1234,30 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
return super.onKeyDown(keyCode, event);
}
/**
* 测评题返回的时候,弹窗提示用户
*/
public void showTestQuestionPageReturnDialog() {
if (null == testQuestionsPageReturnDialog) {
testQuestionsPageReturnDialog = new YDLCommonDialog(this, new YDLCommonDialog.OnYDLCommonDialogListener() {
@Override
public void onCancel() {
finish();
}
@Override
public void onSure() {
testQuestionsPageReturnDialog.dismiss();
}
}).setTitle("你确定要退出测试吗?")
.setDesc("98%的人都说结果很有用哦")
.setCancelText("退出")
.setSureText("继续测试")
.setTheme(BuildConfig.FLAVOR);
}
testQuestionsPageReturnDialog.show();
}
@Override
protected void onDestroy() {
cancelSendNetLossMessage();
......
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