Compare commits
27 Commits
feature-is
...
v5.14.3-63
| Author | SHA1 | Date | |
|---|---|---|---|
| 7712039804 | |||
| fee65172d1 | |||
| b09f0cde18 | |||
| cb355b2490 | |||
| 806ceee7e7 | |||
| 0cc8904852 | |||
| 1ffb58feea | |||
| 3ae27ebdb6 | |||
| aab422662a | |||
| 8193b9ec9f | |||
| 13929f4dc5 | |||
| 0ea0834140 | |||
| 7efdb5e432 | |||
| 681ba37c4e | |||
| d4d71d27ce | |||
| 987ab1ccc9 | |||
| 8863b02c7a | |||
| a94bb4dcb5 | |||
| 195d9343eb | |||
| 997bfdf93d | |||
| de712065f5 | |||
| 511449c709 | |||
| 03095b682b | |||
| 8437bfe1e3 | |||
| a169ce1989 | |||
| 9690429e95 | |||
| b1dff15234 |
@ -381,7 +381,6 @@ public class Config {
|
||||
mNightModeSetting = data.getNightMode();
|
||||
if (HaloApp.getInstance().isNewForThisVersion && mNightModeSetting != null && mNightModeSetting.getInstall()) {
|
||||
DarkModeUtils.INSTANCE.updateFollowSystemDarkModeToSp(true);
|
||||
DarkModeUtils.INSTANCE.updateAppDarkModeStatusToSp(true);
|
||||
DarkModeUtils.INSTANCE.initDarkMode();
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ import com.gh.common.util.PackageUtils;
|
||||
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
|
||||
import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.core.utils.SentryHelper;
|
||||
import com.gh.gamecenter.download.DownloadedGameIdAndPackageNameDao;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
@ -389,12 +390,16 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
* 清理不存在本地 APK 文件的任务
|
||||
*/
|
||||
public void clearTasksThatFileBeenDeleted() {
|
||||
for (DownloadEntity entity : getAllDownloadEntity()) {
|
||||
if (entity.getStatus() == DownloadStatus.done) {
|
||||
if (FileUtils.isEmptyFile(entity.getPath())) {
|
||||
cancel(entity.getUrl());
|
||||
try {
|
||||
for (DownloadEntity entity : getAllDownloadEntity()) {
|
||||
if (entity.getStatus() == DownloadStatus.done) {
|
||||
if (FileUtils.isEmptyFile(entity.getPath())) {
|
||||
cancel(entity.getUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SentryHelper.INSTANCE.onEvent("CLEAR_DELETED_TASK_ERROR", "exception_digest", e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Environment;
|
||||
import android.view.View;
|
||||
@ -117,7 +118,8 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
|
||||
appInfo.sourceDir = apk_path;
|
||||
appInfo.publicSourceDir = apk_path;
|
||||
Drawable apk_icon = appInfo.loadIcon(pm);
|
||||
apkEntity.setGameBm(BitmapUtils.drawableToBitmap(apk_icon, true));
|
||||
Bitmap originalBitmap = BitmapUtils.drawableToBitmap(apk_icon, true);
|
||||
apkEntity.setGameBm(BitmapUtils.compressBitmap(originalBitmap, 100));
|
||||
/** apk的绝对路劲 */
|
||||
apkEntity.setGamePath(apk_path);
|
||||
/** apk的版本名称 String */
|
||||
|
||||
@ -152,8 +152,18 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
NewLogUtils.logRecommendFeedForumClick(contentType, entity.id, entity.bbs.id, bbsType)
|
||||
}
|
||||
|
||||
MtaHelper.onEvent(getEventId(entrance), getKey(entrance), if (entity.bbs.name.isEmpty()) entity.community.name else entity.bbs.name)
|
||||
itemView.context.startActivity(ForumDetailActivity.getIntent(itemView.context, entity.community.id, entrance))
|
||||
MtaHelper.onEvent(
|
||||
getEventId(entrance),
|
||||
getKey(entrance),
|
||||
if (entity.bbs.name.isEmpty()) entity.community.name else entity.bbs.name
|
||||
)
|
||||
itemView.context.startActivity(
|
||||
ForumDetailActivity.getIntent(
|
||||
itemView.context,
|
||||
entity.community.id,
|
||||
entrance
|
||||
)
|
||||
)
|
||||
LogUtils.uploadAccessToBbs(entity.community.id, "文章外所属论坛")
|
||||
}
|
||||
|
||||
@ -208,11 +218,24 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
itemView.context.startActivity(intent)
|
||||
}
|
||||
"answer" -> {
|
||||
val intent = NewQuestionDetailActivity.getCommentIntent(it.context, entity.questions.id, entity.id, entrance, "")
|
||||
val intent = NewQuestionDetailActivity.getCommentIntent(
|
||||
it.context,
|
||||
entity.questions.id,
|
||||
entity.id,
|
||||
entrance,
|
||||
""
|
||||
)
|
||||
itemView.context.startActivity(intent)
|
||||
}
|
||||
"video" -> {
|
||||
itemView.context.startActivity(ForumVideoDetailActivity.getIntent(itemView.context, entity.id, entity.community.id, true))
|
||||
itemView.context.startActivity(
|
||||
ForumVideoDetailActivity.getIntent(
|
||||
itemView.context,
|
||||
entity.id,
|
||||
entity.community.id,
|
||||
true
|
||||
)
|
||||
)
|
||||
}
|
||||
else -> {
|
||||
val communityId = entity.community.id
|
||||
@ -300,7 +323,8 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
commentCount.setCompoundDrawables(commentIcon, null, null, null)
|
||||
commentCount.setTextColor(R.color.text_subtitleDesc.toColor(commentCount.context))
|
||||
} else {
|
||||
val commentCloseIcon = itemView.context.resources.getDrawable(R.drawable.community_comment_count_unavailable)
|
||||
val commentCloseIcon =
|
||||
itemView.context.resources.getDrawable(R.drawable.community_comment_count_unavailable)
|
||||
commentCloseIcon.setBounds(0, 0, commentCloseIcon.minimumWidth, commentCloseIcon.minimumHeight)
|
||||
commentCount.setCompoundDrawables(commentCloseIcon, null, null, null)
|
||||
commentCount.setTextColor(R.color.text_body.toColor(commentCount.context))
|
||||
@ -317,17 +341,24 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
RetrofitManager.getInstance()
|
||||
.api.voteVideo(entity.id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
//Utils.toast(getApplication(), "已点赞")
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
entity.me.isVoted = true
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
EnergyTaskHelper.postEnergyTask("vote_video", entity.id)
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
entity.me.isVoted = false
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
if (exception is HttpException) {
|
||||
ErrorHelper.handleError(
|
||||
itemView.context,
|
||||
exception.response()?.errorBody()?.string()
|
||||
)
|
||||
}
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
})
|
||||
@ -352,73 +383,75 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
EnergyTaskHelper.postEnergyTask("vote_answer", entity.id)
|
||||
}
|
||||
ToastUtils.showToast("已赞同")
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
} else if (403036 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
} else if (404001 == it) {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
} else {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = true
|
||||
} else {
|
||||
entity.me.isAnswerVoted = true
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
when (it) {
|
||||
403008 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
}
|
||||
403036 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
}
|
||||
404001 -> {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
}
|
||||
else -> {
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
playVoteAnimation()
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
fun cancelAnswerVote(entity: AnswerEntity) {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
|
||||
voteIcon.isChecked = false
|
||||
voteCount.setTextColor(R.color.text_subtitleDesc.toColor(voteCount.context))
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
|
||||
if (entity.type == "video") {
|
||||
RetrofitManager.getInstance()
|
||||
.api.undoVoteVideo(entity.id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
entity.me.isVoted = false
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
Utils.toast(itemView.context, "取消点赞")
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
super.onFailure(exception)
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
entity.me.isVoted = true
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
if (exception is HttpException) {
|
||||
ErrorHelper.handleError(
|
||||
itemView.context,
|
||||
exception.response()?.errorBody()?.string()
|
||||
)
|
||||
}
|
||||
setVoteAndCommentStyle(entity)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
val unVoteObservable = if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = false
|
||||
RetrofitManager.getInstance().api.postCommunityArticleUnVote(entity.id)
|
||||
} else {
|
||||
entity.me.isAnswerVoted = false
|
||||
|
||||
RetrofitManager.getInstance().api
|
||||
.postAnswerUnvote(entity.id)
|
||||
}
|
||||
@ -427,32 +460,42 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<VoteEntity>() {
|
||||
override fun onResponse(response: VoteEntity?) {
|
||||
entity.count.vote = entity.count.vote - 1
|
||||
if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = false
|
||||
} else {
|
||||
entity.me.isAnswerVoted = false
|
||||
}
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
Utils.toast(itemView.context, "取消赞同")
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
} else if (403036 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
} else if (404001 == it) {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
} else {
|
||||
entity.count.vote = entity.count.vote + 1
|
||||
if (entity.type == "community_article") {
|
||||
entity.me.isCommunityArticleVote = true
|
||||
} else {
|
||||
entity.me.isAnswerVoted = true
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
when (it) {
|
||||
403008 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
}
|
||||
403036 -> {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
|
||||
true
|
||||
}
|
||||
404001 -> {
|
||||
Utils.toast(itemView.context, "内容可能已被删除")
|
||||
entity.active = false
|
||||
setVoteAndCommentStyle(entity)
|
||||
true
|
||||
}
|
||||
else -> {
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
|
||||
setVoteAndCommentStyle(entity)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -477,7 +520,11 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
@ -518,7 +565,11 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(itemView.context, e?.response()?.errorBody()?.string(), false) {
|
||||
ErrorHelper.handleErrorWithCustomizedHandler(
|
||||
itemView.context,
|
||||
e?.response()?.errorBody()?.string(),
|
||||
false
|
||||
) {
|
||||
if (403008 == it) {
|
||||
Utils.toast(itemView.context, R.string.ask_vote_hint)
|
||||
true
|
||||
|
||||
@ -311,6 +311,13 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
|
||||
super.onResume()
|
||||
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
|
||||
EventBus.getDefault().post(EBReuse(COMMENT_RESUME))
|
||||
|
||||
if (::commentEt.isInitialized && commentEt.text.isNotEmpty()) {
|
||||
// 若不延迟,可能回来的时候不能获取焦点导致弹不起来
|
||||
mBaseHandler.postDelayed({
|
||||
Util_System_Keyboard.showSoftKeyboard(context, commentEt)
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
|
||||
@ -45,7 +45,7 @@ class SimulatorGameViewModel(application: Application) : AndroidViewModel(applic
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe({
|
||||
val localSimulatorList: List<SimulatorEntity> = AppDatabase.getInstance().simulatorGameDao().getSimulatorList()
|
||||
val localSimulatorList: List<SimulatorEntity> = mSimulatorGameDao.getSimulatorList()
|
||||
|
||||
if (it.isNotEmpty()) {
|
||||
when (it[0]) {
|
||||
@ -59,6 +59,11 @@ class SimulatorGameViewModel(application: Application) : AndroidViewModel(applic
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 若网络数据为空,本地数据不为空时同步本地数据到服务端 (避免本地数据与网络数据不一致的问题)
|
||||
if (localSimulatorList.isNotEmpty()) {
|
||||
SimulatorGameManager.recordDownloadSimulatorGames()
|
||||
}
|
||||
}
|
||||
}, {
|
||||
simulators.postValue(mResultSimulatorsList)
|
||||
|
||||
BIN
app/src/main/res/drawable-night-xxxhdpi/ic_selector_default.webp
Normal file
BIN
app/src/main/res/drawable-night-xxxhdpi/ic_selector_default.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 B |
BIN
app/src/main/res/drawable-xxxhdpi/ic_selector_default.webp
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/ic_selector_default.webp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 186 B |
@ -7,8 +7,8 @@ ext {
|
||||
targetSdkVersion = 28
|
||||
|
||||
// application info (每个大版本之间的 versionCode 增加 20)
|
||||
versionCode = 630
|
||||
versionName = "5.14.0"
|
||||
versionCode = 633
|
||||
versionName = "5.14.3"
|
||||
applicationId = "com.gh.gamecenter"
|
||||
|
||||
// AndroidX
|
||||
|
||||
@ -24,13 +24,17 @@ class CustomLayoutInflaterFactory(
|
||||
mAppCompatActivity.delegate.createView(parent, name, context, attrs)
|
||||
?: mAppCompatActivity.onCreateView(parent, name, context, attrs)
|
||||
?: mAppCompatActivity.layoutInflater.createView(name, null, attrs)
|
||||
} catch (e: ClassNotFoundException) {
|
||||
} catch (e: Exception) {
|
||||
try {
|
||||
mAppCompatActivity.layoutInflater.createView(name, "android.widget.", attrs)
|
||||
if (e is ClassNotFoundException) {
|
||||
mAppCompatActivity.layoutInflater.createView(name, "android.widget.", attrs)
|
||||
}
|
||||
} catch (e2: Exception) {
|
||||
e2.printStackTrace()
|
||||
return null
|
||||
}
|
||||
e.printStackTrace()
|
||||
return null
|
||||
}
|
||||
|
||||
val n = attrs.attributeCount
|
||||
|
||||
@ -80,6 +80,9 @@ import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.sentry.Breadcrumb;
|
||||
import io.sentry.Sentry;
|
||||
import io.sentry.SentryLevel;
|
||||
import kotlin.Pair;
|
||||
import pub.devrel.easypermissions.EasyPermissions;
|
||||
|
||||
@ -564,12 +567,19 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
|
||||
// 这里根据调用栈是否存在 DarkModeUtils 来确定是否为系统回调
|
||||
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
|
||||
for (StackTraceElement element : trace) {
|
||||
if (element.getClassName().contains(DarkModeUtils.class.getSimpleName())) {
|
||||
if (element.getClassName().equals(DarkModeUtils.class.getName())) {
|
||||
isCalledBySystem = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Breadcrumb breadcrumb = new Breadcrumb();
|
||||
breadcrumb.setCategory("onConfigurationChanged");
|
||||
breadcrumb.setMessage("IsCalledBySystem " + isCalledBySystem + ","
|
||||
+ this.getClass().getSimpleName() + " lifecycle is " + getLifecycle().getCurrentState());
|
||||
breadcrumb.setLevel(SentryLevel.INFO);
|
||||
Sentry.addBreadcrumb(breadcrumb);
|
||||
|
||||
if (BuildConfig.IS_DARK_MODE_ON && mIsDarkModeOn != DarkModeUtils.INSTANCE.isDarkModeOn(this)) {
|
||||
// 当且仅当页面处于可见状态时响应新的 UiMode,并将它传递下去
|
||||
// (在不可见的 activity 调用 onConfigurationChanged 方法有一定概率触发 ANR)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.gh.gamecenter.common.utils
|
||||
|
||||
import android.animation.Animator
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
@ -331,7 +332,8 @@ fun Fragment.ifLogin(entrance: String, action: (() -> Unit)? = null) {
|
||||
}
|
||||
|
||||
fun Context.ifLogin(entrance: String, action: (() -> Unit)? = null) {
|
||||
val checkLoginConfig = ARouter.getInstance().build(RouteConsts.provider.checkLogin).navigation() as? ICheckLoginProvider
|
||||
val checkLoginConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.checkLogin).navigation() as? ICheckLoginProvider
|
||||
checkLoginConfig?.checkLogin(this, entrance, action)
|
||||
}
|
||||
|
||||
@ -379,8 +381,10 @@ fun String.containHtmlTag(): Boolean {
|
||||
*/
|
||||
fun Fragment.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
|
||||
val userManagerProvider = ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
|
||||
val dialogUtils = ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
|
||||
val userManagerProvider =
|
||||
ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
|
||||
val dialogUtils =
|
||||
ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
|
||||
if (userManagerProvider?.userShouldTakeRegulationBaseOnLastRemind() == true) {
|
||||
dialogUtils?.showRegulationTestDialog(requireContext(),
|
||||
{ provider?.directToRegulationTestPage(requireContext()) },
|
||||
@ -392,8 +396,10 @@ fun Fragment.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
|
||||
|
||||
fun Context.showRegulationTestDialogIfNeeded(action: (() -> Unit)) {
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.directUtils).navigation() as? IDirectProvider
|
||||
val userManagerProvider = ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
|
||||
val dialogUtils = ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
|
||||
val userManagerProvider =
|
||||
ARouter.getInstance().build(RouteConsts.provider.userManager).navigation() as? IUserManagerProvider
|
||||
val dialogUtils =
|
||||
ARouter.getInstance().build(RouteConsts.provider.dialogUtils).navigation() as? IDialogUtilsProvider
|
||||
if (userManagerProvider?.userShouldTakeRegulationBaseOnLastRemind() == true) {
|
||||
dialogUtils?.showRegulationTestDialog(this,
|
||||
{ provider?.directToRegulationTestPage(this) },
|
||||
@ -864,8 +870,10 @@ fun CharSequence.interceptUrlSpanAndRoundImageSpan(clickedCallback: ((url: Strin
|
||||
|
||||
override fun onClick(widget: View) {
|
||||
clickedCallback?.invoke(it.url)
|
||||
val webActivityProvider = ARouter.getInstance().build(RouteConsts.provider.webActivity).navigation() as? IWebProvider
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.defaultUrlHandler).navigation() as IDefaultUrlHandlerProvider
|
||||
val webActivityProvider =
|
||||
ARouter.getInstance().build(RouteConsts.provider.webActivity).navigation() as? IWebProvider
|
||||
val provider = ARouter.getInstance().build(RouteConsts.provider.defaultUrlHandler)
|
||||
.navigation() as IDefaultUrlHandlerProvider
|
||||
if (!provider.interceptUrl(widget.context, it.url, "")) {
|
||||
webActivityProvider?.getIntent(widget.context, it.url, true)?.run {
|
||||
widget.context.startActivity(this)
|
||||
@ -992,8 +1000,10 @@ fun Context.doOnMainProcessOnly(callback: EmptyCallback) {
|
||||
* 虽然现在我们没有了友盟以后只是单进程APP,但在 debug 模式下还有 whatTheStack 这个进程如果不限定主进程会出现奇奇怪怪的问题 (BroadcastReceiver相关)
|
||||
*/
|
||||
inline fun Context.doOnMainProcessOnly(f: () -> Unit) {
|
||||
val buildConfig = ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
|
||||
val packageUtilsConfig = ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
|
||||
val buildConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
|
||||
val packageUtilsConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
|
||||
val processName = packageUtilsConfig?.obtainProcessName(this)
|
||||
if (processName == null || buildConfig?.getApplicationId() == processName) {
|
||||
f.invoke()
|
||||
@ -1005,8 +1015,10 @@ inline fun Context.doOnMainProcessOnly(f: () -> Unit) {
|
||||
}
|
||||
|
||||
inline fun doOnMainProcessOnly(f: () -> Unit) {
|
||||
val buildConfig = ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
|
||||
val packageUtilsConfig = ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
|
||||
val buildConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.buildConfig).navigation() as? IBuildConfigProvider
|
||||
val packageUtilsConfig =
|
||||
ARouter.getInstance().build(RouteConsts.provider.packageUtils).navigation() as? IPackageUtilsProvider
|
||||
val processName = packageUtilsConfig?.obtainProcessName(HaloApp.getInstance())
|
||||
if (processName == null || buildConfig?.getApplicationId() == processName) {
|
||||
f.invoke()
|
||||
@ -1251,9 +1263,19 @@ fun String.emojiCount(): Int {
|
||||
/**
|
||||
* WebView启用强制深色模式
|
||||
*/
|
||||
@SuppressLint("RequiresFeature")
|
||||
fun WebView.enableForceDark(isDarkModeOn: Boolean) {
|
||||
if (BuildConfig.IS_DARK_MODE_ON && WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
|
||||
WebSettingsCompat.setForceDark(settings, if (isDarkModeOn) WebSettingsCompat.FORCE_DARK_ON else WebSettingsCompat.FORCE_DARK_OFF)
|
||||
val isFeatureSupported = try {
|
||||
WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)
|
||||
} catch (throwable: Throwable) {
|
||||
throwable.printStackTrace()
|
||||
false
|
||||
}
|
||||
if (BuildConfig.IS_DARK_MODE_ON && isFeatureSupported) {
|
||||
WebSettingsCompat.setForceDark(
|
||||
settings,
|
||||
if (isDarkModeOn) WebSettingsCompat.FORCE_DARK_ON else WebSettingsCompat.FORCE_DARK_OFF
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user