fix:【光环助手】夜间模式测试问题汇总(3-4) https://jira.shanqu.cc/browse/GHZS-578

This commit is contained in:
叶子维
2022-12-16 15:37:40 +08:00
parent 7c76753815
commit c2f32aafff
5 changed files with 32 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import android.app.Activity
import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.text.TextUtils
import android.view.View
@ -214,6 +215,8 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
mKeyboardHeightProvider = KeyboardHeightProvider(this)
mRichEditor.post { mKeyboardHeightProvider?.start() }
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
mRichEditor.setEditorBackgroundColor(R.color.background_white.toColor(this))
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
// 防止个别手机在Js里无法获取粘贴内容
mRichEditor.addJavascriptInterface(OnPasteListener(), "onPasteListener")
mRichEditor.addJavascriptInterface(OnCursorChangeListener(), "OnCursorChangeListener")
@ -750,6 +753,8 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> : ToolBarAct
super.onDarkModeChanged()
updateStatusBarColor(R.color.background_white, R.color.background_white)
mRichEditor.enableForceDark(DarkModeUtils.isDarkModeOn(this))
mRichEditor.setEditorBackgroundColor(R.color.background_white.toColor(this))
mRichEditor.setEditorFontColor(if (mIsDarkModeOn) Color.parseColor("#C2C2C2") else Color.parseColor("#4A4A4A"))
}
companion object {

View File

@ -442,6 +442,11 @@ public class RichEditor extends WebView {
exec("javascript:RE.setTextColor('" + hex + "');");
}
public void setEditorFontColor(int color) {
String hex = convertHexColorString(color);
exec("javascript:RE.setBaseTextColor('" + hex + "');");
}
public void insertPlaceholderImage(String id) {
exec("javascript:RE.prepareInsert();");
exec("javascript:RE.insertPlaceholderImage('" + id + "');");

View File

@ -11,12 +11,12 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.common.util.MessageShareUtils;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.common.util.QRCodeUtils;
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.utils.ShareUtils;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.tencent.tauth.Tencent;
/**
@ -52,7 +52,7 @@ public class ShareGhActivity extends ToolBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
mGhQrcode = findViewById(R.id.gh_address_qrcode);
mGhAddress = findViewById(R.id.gh_address_tv);
mContentLl = findViewById(R.id.content_ll);
@ -71,4 +71,10 @@ public class ShareGhActivity extends ToolBarActivity {
, getString(R.string.gh_icon_url), "玩手游不用肝的感觉真好"
, "绿色安全的手游加速助手", ShareUtils.ShareEntrance.shareGh, "");
}
@Override
protected void onDarkModeChanged() {
super.onDarkModeChanged();
ExtensionsKt.updateStatusBarColor(this, R.color.background_white, R.color.background_white);
}
}

View File

@ -113,6 +113,7 @@ class ArticleEditActivity : BaseRichEditorActivity<ArticleEditViewModel>(), Keyb
@SuppressLint("ClickableViewAccessibility")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
updateStatusBarColor(R.color.background_white, R.color.background_white)
mBinding = ActivityCommunityArticleEditBinding.bind(mContentView)
setToolbarMenu(R.menu.menu_answer_post)
mMenuDraft = getMenuItem(R.id.menu_draft)
@ -638,6 +639,11 @@ class ArticleEditActivity : BaseRichEditorActivity<ArticleEditViewModel>(), Keyb
override fun getVideoGuideKey(): String = Constants.SP_ARTICLE_VIDEO_GUIDE
override fun onDarkModeChanged() {
super.onDarkModeChanged()
updateStatusBarColor(R.color.background_white, R.color.background_white)
}
companion object {
const val SAVE_DRAFTS_INTERVAL_TIME = 15000
const val ARTICLE_DRAFT_REQUEST_CODE = 105

View File

@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_white"
android:orientation="vertical">
<include layout="@layout/reuse_toolbar" />
@ -9,13 +10,13 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:scrollbars="none">
<LinearLayout
android:id="@+id/content_ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/background_white"
android:gravity="center_horizontal"
android:orientation="vertical">
@ -28,10 +29,11 @@
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="6dp"
android:gravity="center_horizontal"
android:text="光环助手官网" />
android:text="光环助手官网"
android:textColor="@color/text_title" />
<TextView
android:id="@+id/gh_address_tv"
@ -46,8 +48,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="38dp"
android:layout_marginRight="38dp"
android:layout_marginTop="15dp"
android:layout_marginRight="38dp"
android:maxLines="1"
android:text="--------------------------------------------------------------------------------------------------"
android:textColor="@color/content" />