Compare commits
155 Commits
fix/va-tes
...
fix/blank_
| Author | SHA1 | Date | |
|---|---|---|---|
| c3bc85dd56 | |||
| 945e034f88 | |||
| a5ca88729a | |||
| d4bb3835cf | |||
| 3c63b74900 | |||
| 712cd21f6e | |||
| 2b9098faa7 | |||
| c0fde44534 | |||
| 785f99f0ef | |||
| dbd733aec6 | |||
| e30557e261 | |||
| e4352590e9 | |||
| 4f68a52d54 | |||
| 93f87c8022 | |||
| a77beed7db | |||
| 112ddfda13 | |||
| 14cf39f10b | |||
| d775e804fd | |||
| d65062af26 | |||
| 2522bf5654 | |||
| 92177ae5f2 | |||
| 21ab15a907 | |||
| 5bea92c08e | |||
| da6725e444 | |||
| 2a2e887ddf | |||
| cc39a754db | |||
| b14cd3d143 | |||
| dc5b354861 | |||
| 64462ebdbe | |||
| 2e63257523 | |||
| c69d117ee7 | |||
| ddccb25559 | |||
| 913ea39302 | |||
| 1002d02f12 | |||
| fa663cd2f6 | |||
| 19af061311 | |||
| d643795fa3 | |||
| 44d93b7527 | |||
| c3d55d4ff9 | |||
| d6f35c5942 | |||
| c53c1b8228 | |||
| 61b967e533 | |||
| b1f2d0a303 | |||
| bb906f0bb8 | |||
| 6f242dcc95 | |||
| b47a64c63d | |||
| 948df2582c | |||
| 35edcf1d68 | |||
| 286d7650f2 | |||
| e566ab838f | |||
| cae720d4ec | |||
| 925516724f | |||
| a5f807c038 | |||
| f442a70bd3 | |||
| 9b3dab9897 | |||
| d939aae901 | |||
| 028974ec0d | |||
| ecd4610186 | |||
| 21e5f2c98d | |||
| 71c0cfe350 | |||
| 3b8b60bc6b | |||
| ac59158dbb | |||
| 5becdf2095 | |||
| a88b49344f | |||
| f34646cde8 | |||
| bc4bb9b7c6 | |||
| 9e8ffce772 | |||
| 008985489a | |||
| 2f3fbd3e7c | |||
| abef224830 | |||
| 8feb9b788e | |||
| 0a059deb44 | |||
| 448160d255 | |||
| 533f93a340 | |||
| d80b8a97a3 | |||
| f2e6d98788 | |||
| 238a83c5fe | |||
| ca71f23363 | |||
| c96b41c621 | |||
| 9afb35bbb9 | |||
| e8ee63d52c | |||
| 90359cfffd | |||
| a3da883033 | |||
| a9f1437a52 | |||
| 8c95286fe5 | |||
| 8a835a94e3 | |||
| 14ec4aed3a | |||
| 07f956a1f0 | |||
| 6ef8d04e57 | |||
| 30248ef205 | |||
| 87b9bb0bf3 | |||
| b346882bfa | |||
| eeddb5ea51 | |||
| 2ccdd93e47 | |||
| d98466f60f | |||
| 2afc2bc9d6 | |||
| 243b0ccbd4 | |||
| 78f9aa3ee4 | |||
| f355eae99b | |||
| 3c1af6e02d | |||
| 57a8b96f56 | |||
| 71265e0ea7 | |||
| b007e63b5e | |||
| c281ea7ac5 | |||
| f34ad0675d | |||
| 36abcc9f19 | |||
| d6443a401a | |||
| 6c8ea6ffb2 | |||
| ae878eddf1 | |||
| ece519115b | |||
| b9e0a8e37a | |||
| 34ca8896ae | |||
| d6e19bfaff | |||
| 943fb4d4e0 | |||
| 2c5471d524 | |||
| cf527db60e | |||
| f261991a55 | |||
| 0f9f0b7c9a | |||
| c29efbefd7 | |||
| ab66621751 | |||
| af262c624a | |||
| d2813ecbda | |||
| 0ea932e36d | |||
| 68151ed6f9 | |||
| e6d2361008 | |||
| 570b777c8e | |||
| 0e557b2246 | |||
| f155440814 | |||
| 62ba9fc7bf | |||
| 4637aa8808 | |||
| 81998e3aad | |||
| 82a8aa03ba | |||
| c876711578 | |||
| 41fcee7f4d | |||
| 0ccbc4d581 | |||
| 56151bc38d | |||
| f05fc73e3a | |||
| ca3c545f26 | |||
| 226539328e | |||
| bb7db78b0c | |||
| ede62c5363 | |||
| 12bb6824ea | |||
| 15c0950754 | |||
| f86b7fe12a | |||
| d12cdbd34b | |||
| 8436d4eda3 | |||
| be832037a7 | |||
| b620257825 | |||
| 6c88cace99 | |||
| f875fa1b14 | |||
| 8076c3a70a | |||
| bebab317a3 | |||
| c450ca570d | |||
| d239b0755f | |||
| 0a187b2242 |
@ -372,8 +372,6 @@ dependencies {
|
||||
// debugImplementation "com.gu.android:toolargetool:${toolargetool}" // 需要使用调试时才启用
|
||||
debugImplementation "com.github.nichbar:WhatTheStack:${whatTheStack}"
|
||||
|
||||
ksp project(":feature:route_doc")
|
||||
|
||||
implementation "androidx.multidex:multidex:${multiDex}"
|
||||
implementation "androidx.fragment:fragment-ktx:${fragment}"
|
||||
|
||||
@ -449,14 +447,14 @@ dependencies {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
|
||||
// implementation(project(':module_setting')) {
|
||||
implementation(project(':module_setting')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
|
||||
// implementation(project(':module_setting_compose')) {
|
||||
// exclude group: 'androidx.swiperefreshlayout'
|
||||
// }
|
||||
|
||||
implementation(project(':module_setting_compose')) {
|
||||
exclude group: 'androidx.swiperefreshlayout'
|
||||
}
|
||||
|
||||
if (!gradle.ext.excludeOptionalModules || gradle.ext.enablePkg) {
|
||||
implementation(project(':feature:pkg'))
|
||||
}
|
||||
@ -512,6 +510,10 @@ dependencies {
|
||||
implementation(project(':feature:sentry'))
|
||||
}
|
||||
|
||||
if (gradle.ext.enableRouteDoc) {
|
||||
ksp project(":feature:route_doc")
|
||||
}
|
||||
|
||||
implementation(project(':feature:media_select'))
|
||||
|
||||
implementation(project(":module_va_api"))
|
||||
|
||||
@ -68,6 +68,9 @@
|
||||
<!-- 悬浮窗 -->
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
|
||||
<!-- 适配 双开/分身 游戏授权登录 -->
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
|
||||
|
||||
<uses-sdk tools:overrideLibrary="
|
||||
com.shuyu.gsyvideoplayer,
|
||||
com.shuyu.gsyvideoplayer.lib,
|
||||
@ -517,10 +520,6 @@
|
||||
android:name=".video.data.VideoDataActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".video.poster.PosterEditActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<activity
|
||||
android:name=".forum.detail.ForumDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
@ -640,6 +639,7 @@
|
||||
<activity
|
||||
android:name="com.gh.gamecenter.SkipCompatActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:theme="@style/Theme.AppCompat.Light.Fullscreen.Transparent">
|
||||
<intent-filter>
|
||||
<data android:scheme="ghzhushou" />
|
||||
@ -663,7 +663,8 @@
|
||||
android:name=".authorization.AuthorizationActivity"
|
||||
android:exported="true"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="portrait">
|
||||
android:screenOrientation="portrait"
|
||||
android:taskAffinity=".auth">
|
||||
<intent-filter>
|
||||
<data android:scheme="ghzhushou_authorization" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
@ -809,6 +810,10 @@
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppCompatTheme.APP" />
|
||||
|
||||
<activity
|
||||
android:name=".video.poster.PosterEditActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
|
||||
<!-- <activity-->
|
||||
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
|
||||
<!-- android:launchMode="singleTask"-->
|
||||
@ -864,10 +869,6 @@
|
||||
<!-- tools:node="remove" />-->
|
||||
<!-- </provider>-->
|
||||
|
||||
<service android:name="com.gh.gamecenter.install.InstallService" />
|
||||
|
||||
<service android:name="com.gh.download.suspendwindow.DownloadSuspendWindowService" />
|
||||
|
||||
<receiver
|
||||
android:name="com.gh.gamecenter.receiver.DownloadReceiver"
|
||||
android:exported="false">
|
||||
|
||||
@ -44,6 +44,10 @@ class SplashAdVideoView @JvmOverloads constructor(
|
||||
return R.layout.layout_splash_ad_video
|
||||
}
|
||||
|
||||
override fun touchSurfaceMoveFullLogic(absDeltaX: Float, absDeltaY: Float) {
|
||||
// no nothing
|
||||
}
|
||||
|
||||
override fun onAutoCompletion() {
|
||||
setStateAndUi(CURRENT_STATE_AUTO_COMPLETE);
|
||||
|
||||
|
||||
@ -21,26 +21,31 @@ import com.gh.common.view.RichEditor
|
||||
import com.gh.gamecenter.CropImageActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.LocalVideoEntity
|
||||
import com.gh.gamecenter.feature.selector.LocalMediaActivity
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.qa.editor.*
|
||||
import com.gh.gamecenter.entity.GamesCollectionEntity
|
||||
import com.gh.gamecenter.entity.MyVideoEntity
|
||||
import com.gh.gamecenter.entity.VideoEntity
|
||||
import com.gh.gamecenter.feature.entity.AnswerEntity
|
||||
import com.gh.gamecenter.feature.entity.ArticleEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.selector.ChooseType
|
||||
import com.gh.gamecenter.feature.selector.LocalMediaActivity
|
||||
import com.gh.gamecenter.qa.editor.*
|
||||
import com.gh.gamecenter.qa.entity.EditorInsertEntity
|
||||
import com.gh.gamecenter.video.poster.PosterEditActivity
|
||||
import com.gh.gamecenter.video.poster.video.VideoPosterFragment
|
||||
import com.gh.gamecenter.video.upload.UploadManager
|
||||
import com.google.gson.JsonObject
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Util_System_Keyboard
|
||||
import com.lightgame.utils.Utils
|
||||
import com.lightgame.view.CheckableImageView
|
||||
import com.therouter.TheRouter
|
||||
import io.reactivex.disposables.Disposable
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
@ -229,6 +234,7 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
|
||||
@SuppressLint("AddJavascriptInterface", "ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
VideoPosterFragment.createVideoCoverFile(this)
|
||||
findView()
|
||||
onRichClick()
|
||||
mViewModel = provideViewModel()
|
||||
@ -739,9 +745,9 @@ abstract class BaseRichEditorActivity<VM : BaseRichEditorViewModel> constructor(
|
||||
mViewModel.id = id
|
||||
mViewModel.videoId = videoId
|
||||
val videoEntity = VideoEntity(url = url)
|
||||
val intent =
|
||||
PosterEditActivity.getIntentByVideo(this@BaseRichEditorActivity, videoEntity)
|
||||
startActivityForResult(intent, REQUEST_CODE_IMAGE_CROP)
|
||||
TheRouter.build(RouteConsts.activity.videoCoverEditActivity)
|
||||
.withParcelable(EntranceConsts.KEY_VIDEO_ENTITY, videoEntity)
|
||||
.navigation(this@BaseRichEditorActivity, REQUEST_CODE_IMAGE_CROP)
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
|
||||
@ -17,7 +17,7 @@ import kotlin.concurrent.fixedRateTimer
|
||||
|
||||
object FixedRateJobHelper {
|
||||
private const val CHECKER_PERIOD: Long = 15 * 1000L
|
||||
private const val TIME_PERIOD: Long = 10 * 60 * 1000L
|
||||
private const val TIME_PERIOD: Long = 24 * 60 * 60 * 1000L
|
||||
private const val LOGHUB_PERIOD: Long = 2 * 60 * 1000L
|
||||
private const val EXPOSURE_PERIOD: Long = 1 * 60 * 1000L
|
||||
private const val REGION_SETTING_PERIOD: Long = 60 * 1000L
|
||||
@ -35,7 +35,7 @@ object FixedRateJobHelper {
|
||||
// 时间检查,每15秒检查一次
|
||||
fixedRateTimer("Global-Fixed-Rate-Timer", initialDelay = 100, period = CHECKER_PERIOD) {
|
||||
val elapsedTime = mExecuteCount * CHECKER_PERIOD
|
||||
// 时间校对,10分钟一次
|
||||
// 时间校对,24 小时一次
|
||||
if (elapsedTime % TIME_PERIOD == 0L) {
|
||||
RetrofitManager.getInstance().api.time
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@ -114,8 +114,6 @@ public class Config {
|
||||
if (!TextUtils.isEmpty(json)) {
|
||||
mSettingsEntity = GsonUtils.fromJson(json, SettingsEntity.class);
|
||||
}
|
||||
|
||||
mSettingsEntity.setGameSmooth("off");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -263,8 +261,7 @@ public class Config {
|
||||
public void onSuccess(VSetting data) {
|
||||
mVSetting = data;
|
||||
SPUtils.setString(Constants.SP_V_SETTINGS, GsonUtils.toJson(data));
|
||||
|
||||
VHelper.init(HaloApp.getInstance());
|
||||
VHelper.checkVspaceUpdate(HaloApp.getInstance());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -15,10 +15,10 @@ import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.gh.common.chain.BrowserInstallHandler;
|
||||
import com.gh.common.chain.DownloadChainBuilder;
|
||||
import com.gh.common.chain.DownloadChainHandler;
|
||||
import com.gh.common.chain.CheckDownloadHandler;
|
||||
import com.gh.common.chain.CheckStoragePermissionHandler;
|
||||
import com.gh.common.chain.DownloadChainBuilder;
|
||||
import com.gh.common.chain.DownloadChainHandler;
|
||||
import com.gh.common.chain.DownloadDialogHelperHandler;
|
||||
import com.gh.common.chain.GamePermissionHandler;
|
||||
import com.gh.common.chain.LandPageAddressHandler;
|
||||
@ -287,19 +287,11 @@ public class BindingAdapters {
|
||||
});
|
||||
break;
|
||||
case RESERVED:
|
||||
if ("download".equals(gameEntity.getReserveStatus())) {
|
||||
ReservationHelper.showDeleteReservationDialog(progressBar.getContext(), () -> {
|
||||
ReservationHelper.deleteReservation(gameEntity, () -> {
|
||||
updateReservation(progressBar, gameEntity);
|
||||
});
|
||||
ReservationHelper.showCancelReservationDialog(progressBar.getContext(),gameEntity, () -> {
|
||||
ReservationHelper.cancelReservation(gameEntity, () -> {
|
||||
updateReservation(progressBar, gameEntity);
|
||||
});
|
||||
} else {
|
||||
ReservationHelper.showCancelReservationDialog(progressBar.getContext(),gameEntity, () -> {
|
||||
ReservationHelper.cancelReservation(gameEntity, () -> {
|
||||
updateReservation(progressBar, gameEntity);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
case H5_GAME:
|
||||
LinkEntity linkEntity = gameEntity.getH5Link();
|
||||
@ -345,9 +337,9 @@ public class BindingAdapters {
|
||||
}
|
||||
progressBar.setButtonStyle(DownloadButton.ButtonStyle.H5_GAME);
|
||||
} else {
|
||||
if (offStatus != null && "dialog".equals(offStatus)) {
|
||||
if (("dialog".equals(offStatus) || "third_party".equals(offStatus))) {
|
||||
progressBar.setText("查看");
|
||||
progressBar.setButtonStyle(DownloadButton.ButtonStyle.NONE);
|
||||
progressBar.setButtonStyle(DownloadButton.ButtonStyle.NONE_WITH_HINT);
|
||||
} else if ("updating".equals(offStatus)) {
|
||||
progressBar.setText("更新中");
|
||||
progressBar.setButtonStyle(DownloadButton.ButtonStyle.UPDATING);
|
||||
|
||||
@ -31,6 +31,7 @@ class ExposureListener(var fragment: Fragment, var exposable: IExposable) : Recy
|
||||
override fun onFragmentPaused(fm: FragmentManager, f: Fragment) {
|
||||
if (fragment == f) {
|
||||
visibleState?.let { commitExposure(it) }
|
||||
visibleState?.let { commitWXCPMExposure(it) }
|
||||
throttleBus.clear()
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
package com.gh.common.fragment
|
||||
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import java.lang.reflect.Field
|
||||
|
||||
fun FragmentManager.popBackStackAllowStateLoss() {
|
||||
popBackStackAllowStateLoss(-1, 0)
|
||||
}
|
||||
|
||||
fun FragmentManager.popBackStackAllowStateLoss(id: Int, flags: Int) {
|
||||
if (!isStateSaved) {
|
||||
popBackStack(id, flags)
|
||||
} else {
|
||||
hook { popBackStack(id, flags) }
|
||||
}
|
||||
}
|
||||
|
||||
fun FragmentManager.popBackStackAllowStateLoss(name: String?, flags: Int) {
|
||||
if (!isStateSaved) {
|
||||
popBackStack(name, flags)
|
||||
} else {
|
||||
hook { popBackStack(name, flags) }
|
||||
}
|
||||
}
|
||||
|
||||
fun FragmentManager.popBackStackImmediateAllowStateLoss() = popBackStackAllowStateLoss(-1, 0)
|
||||
|
||||
fun FragmentManager.popBackStackImmediateAllowStateLoss(id: Int, flags: Int) =
|
||||
if (!isStateSaved) {
|
||||
popBackStackImmediate(id, flags)
|
||||
} else {
|
||||
hook { popBackStackImmediate(id, flags) }
|
||||
}
|
||||
|
||||
fun FragmentManager.popBackStackImmediateAllowStateLoss(name: String?, flags: Int): Boolean =
|
||||
if (!isStateSaved) {
|
||||
popBackStackImmediate(name, flags)
|
||||
} else {
|
||||
hook { popBackStackImmediate(name, flags) }
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过反射将FragmentManager的mStateSaved和mStopped设为false,否则Activity在回调onSavedInstance以后,
|
||||
* 调用Fragment的popBackStack和popBackStackImmediate方法会触发“java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState”的异常。
|
||||
* @see <a href="https://sentry.shanqu.cc/organizations/lightgame/issues/418688/?project=22">Sentry-418688</a>
|
||||
*/
|
||||
private fun <T> FragmentManager.hook(callback: FragmentManager.() -> T): T {
|
||||
val mStateSavedField = getField(this::class.java,"mStateSaved")
|
||||
val stateSaved = mStateSavedField.get(this);
|
||||
mStateSavedField.set(this, false)
|
||||
val mStoppedField = getField(this::class.java,"mStopped")
|
||||
val stopped = mStateSavedField.get(this);
|
||||
mStoppedField.set(this, false)
|
||||
val result = callback.invoke(this)
|
||||
mStateSavedField.set(this, stateSaved)
|
||||
mStoppedField.set(this, stopped)
|
||||
return result
|
||||
}
|
||||
|
||||
@Throws(NoSuchFieldException::class)
|
||||
private fun getField(clazz: Class<*>, name: String): Field {
|
||||
var cls: Class<*>? = clazz
|
||||
while (cls != null) {
|
||||
try {
|
||||
val declaredField = cls.getDeclaredField(name)
|
||||
declaredField.isAccessible = true
|
||||
return declaredField
|
||||
} catch (e: NoSuchFieldException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
cls = cls.superclass
|
||||
}
|
||||
throw NoSuchFieldException()
|
||||
}
|
||||
@ -1,12 +1,9 @@
|
||||
package com.gh.common.iinterface
|
||||
|
||||
interface ISmartRefreshContent {
|
||||
/**
|
||||
* 启用/关闭 页面滑动
|
||||
* @param isScrollEnabled 是否启用
|
||||
*/
|
||||
fun setScrollEnabled(isScrollEnabled: Boolean)
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||
import com.scwang.smartrefresh.layout.constant.RefreshState
|
||||
|
||||
interface ISmartRefreshContent {
|
||||
fun onRefresh()
|
||||
|
||||
/**
|
||||
@ -14,4 +11,6 @@ interface ISmartRefreshContent {
|
||||
* @param isSwipeRefreshEnabled 是否启用
|
||||
*/
|
||||
fun setSwipeRefreshEnabled(isSwipeRefreshEnabled: Boolean)
|
||||
|
||||
fun onStateChanged(refreshLayout: RefreshLayout, oldState: RefreshState, newState: RefreshState)
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import com.gh.gamecenter.CropImageActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.core.provider.ICropImageProvider
|
||||
import com.gh.gamecenter.personalhome.background.BackgroundClipActivity
|
||||
import com.halo.assistant.fragment.user.UserPortraitCropImageActivity
|
||||
import com.lightgame.utils.Utils
|
||||
import com.zhihu.matisse.internal.utils.PathUtils
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
class CropImageProviderImpl : ICropImageProvider {
|
||||
override fun getCropImageIntent(data: List<Uri>, imageType: Int, entrance: String, context: Context): Intent? {
|
||||
if (data.isEmpty()) {
|
||||
return null
|
||||
}
|
||||
val picturePath = PathUtils.getPath(context, data[0])
|
||||
Utils.log("picturePath = $picturePath")
|
||||
return when (imageType) {
|
||||
|
||||
IMAGE_TYPE_AVATAR -> {// 上传头像
|
||||
UserPortraitCropImageActivity.getIntent(
|
||||
context,
|
||||
picturePath,
|
||||
"我的光环(选择头像)"
|
||||
)
|
||||
}
|
||||
|
||||
IMAGE_TYPE_GAME_COLLECTION_COVER -> {// 游戏单封面
|
||||
CropImageActivity.getIntent(
|
||||
context,
|
||||
picturePath,
|
||||
142 / 328F,
|
||||
false,
|
||||
R.layout.layout_game_collection_crop_image_assist,
|
||||
entrance
|
||||
)
|
||||
}
|
||||
|
||||
IMAGE_TYPE_PERSONAL_BACKGROUND -> { // 用户主页背景
|
||||
BackgroundClipActivity.getIntent(context, picturePath, entrance)
|
||||
}
|
||||
|
||||
else ->
|
||||
null
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val IMAGE_TYPE_AVATAR = 1
|
||||
const val IMAGE_TYPE_GAME_COLLECTION_COVER = 2
|
||||
const val IMAGE_TYPE_PERSONAL_BACKGROUND = 3
|
||||
}
|
||||
}
|
||||
@ -112,6 +112,12 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
"本地下载"
|
||||
}
|
||||
|
||||
// 小游戏的启动不需要上报下载点击事件
|
||||
// @see https://jira.shanqu.cc/browse/GHZSCY-7013
|
||||
if (boundedObject is GameEntity && boundedObject.isMiniGame()) {
|
||||
return
|
||||
}
|
||||
|
||||
// 上报神策点击事件
|
||||
val customPageKV = customPageTrackData?.toKV() ?: arrayOf()
|
||||
SensorsBridge.trackEventWithExposureSource(
|
||||
@ -121,7 +127,7 @@ class DownloadButtonClickedProviderImpl : IDownloadButtonClickedProvider {
|
||||
"game_name", gameName,
|
||||
"game_type", gameTypeInChinese,
|
||||
"download_status", downloadStatusInChinese,
|
||||
"button_name", downloadButton.text,
|
||||
"button_name", text,
|
||||
"game_schema_type", gameSchemaType,
|
||||
"download_type", downloadType,
|
||||
"page_name", GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
|
||||
@ -2,18 +2,16 @@ package com.gh.common.provider
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.therouter.router.Route
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.feature.provider.IGameCollectionDetailProvider
|
||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||
|
||||
@com.therouter.inject.ServiceProvider
|
||||
class GameCollectionDetailProviderImpl : IGameCollectionDetailProvider {
|
||||
override fun getIntent(context: Context, gameCollectionId: String, isFromSquare: Boolean): Intent {
|
||||
return GameCollectionDetailActivity.getIntent(context, gameCollectionId, isFromSquare)
|
||||
override fun getIntent(context: Context, gameCollectionId: String, isFromSquare: Boolean, entrance: String): Intent {
|
||||
return GameCollectionDetailActivity.getIntent(context, gameCollectionId, isFromSquare, entrance)
|
||||
}
|
||||
|
||||
override fun getSpecifiedCommentIntent(context: Context, gameCollectionId: String, topCommentId: String): Intent {
|
||||
return GameCollectionDetailActivity.getSpecifiedCommentIntent(context, gameCollectionId, topCommentId)
|
||||
override fun getSpecifiedCommentIntent(context: Context, gameCollectionId: String, topCommentId: String, entrance: String): Intent {
|
||||
return GameCollectionDetailActivity.getSpecifiedCommentIntent(context, gameCollectionId, topCommentId, entrance)
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,8 @@ import android.annotation.SuppressLint
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.sqlite.SQLiteDiskIOException
|
||||
import android.database.sqlite.SQLiteException
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.text.TextUtils
|
||||
@ -284,7 +286,11 @@ object SimulatorGameManager {
|
||||
entity.isRecentlyPlayed = it.id == gameId
|
||||
simulatorGameRecordList.add(entity)
|
||||
}
|
||||
simulatorGameDao.addSimulatorGameList(simulatorGameRecordList)
|
||||
try {
|
||||
simulatorGameDao.addSimulatorGameList(simulatorGameRecordList)
|
||||
} catch (e: SQLiteException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.RouteConsts;
|
||||
import com.gh.gamecenter.common.exposure.meta.MetaUtil;
|
||||
import com.gh.gamecenter.common.retrofit.BiResponse;
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge;
|
||||
import com.gh.gamecenter.core.AppExecutor;
|
||||
import com.gh.gamecenter.core.provider.ISentryProvider;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
@ -39,6 +40,11 @@ import io.reactivex.schedulers.Schedulers;
|
||||
*/
|
||||
public class DataUtils {
|
||||
|
||||
// 神策 OAID 是否已绑定
|
||||
private static boolean isSensorOAIDBounded = false;
|
||||
// 原始的 OAID 是否已成功获取
|
||||
private static boolean originalOAIDIsReceived = false;
|
||||
|
||||
private DataUtils() {
|
||||
throw new IllegalStateException("Utility class");
|
||||
}
|
||||
@ -65,7 +71,6 @@ public class DataUtils {
|
||||
// 默认用 APP 级已存储的 GID 来使用,不使用外部 GID
|
||||
String savedGid = SPUtils.getString(Constants.GID);
|
||||
if (!TextUtils.isEmpty(savedGid)) {
|
||||
HaloApp.getInstance().setGid(savedGid);
|
||||
onGidReceived(savedGid);
|
||||
} else {
|
||||
GidHelper.getInstance().registerDevice(HaloApp.getInstance().getApplication(), new GidCallback() {
|
||||
@ -89,6 +94,8 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
private static void onGidReceived(String gid) {
|
||||
bindValidOaidToSensor(false);
|
||||
|
||||
HaloApp.getInstance().setGid(gid);
|
||||
// 更新广告配置
|
||||
AdDelegateHelper.INSTANCE.requestAdConfig(false, "", null);
|
||||
@ -111,6 +118,35 @@ public class DataUtils {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 为神策绑定有效的 OAID
|
||||
*/
|
||||
public static void bindValidOaidToSensor(boolean fromOaidResult) {
|
||||
if (isSensorOAIDBounded) return;
|
||||
|
||||
String oaid = HaloApp.getInstance().getOAID();
|
||||
|
||||
// 来自于 oaid 获取回调,或者说原始 oaid 已经获取成功
|
||||
if (fromOaidResult || originalOAIDIsReceived) {
|
||||
originalOAIDIsReceived = true;
|
||||
// 遇到异常的 OAID
|
||||
if (Constants.INVALID_OAID_1.equals(oaid)
|
||||
|| Constants.INVALID_OAID_2.equals(oaid)
|
||||
|| Constants.INVALID_OAID_3.equals(oaid)
|
||||
|| TextUtils.isEmpty(oaid)) {
|
||||
// 若 gid 不为空,那么整合 gid 作为 oaid https://jira.shanqu.cc/browse/GHZSCY-7004
|
||||
if (HaloApp.getInstance().getGid() != null) {
|
||||
oaid = "GID" + HaloApp.getInstance().getGid();
|
||||
SensorsBridge.INSTANCE.setOAID(oaid);
|
||||
isSensorOAIDBounded = true;
|
||||
}
|
||||
} else {
|
||||
SensorsBridge.INSTANCE.setOAID(oaid);
|
||||
isSensorOAIDBounded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应用 gid 绑定的实名信息
|
||||
*/
|
||||
|
||||
@ -139,6 +139,7 @@ public class DetailDownloadUtils {
|
||||
// 游戏包含多 APK 的情况
|
||||
viewHolder.getMultiVersionDownloadTv().setText("选择下载你的版本" + (TextUtils.isEmpty(downloadAddWord) ? "" : "-" + downloadAddWord));
|
||||
viewHolder.getMultiVersionDownloadTv().setVisibility(View.VISIBLE);
|
||||
viewHolder.getDownloadPb().setTag(com.gh.gamecenter.feature.R.string.download, viewHolder.getMultiVersionDownloadTv().getText());
|
||||
viewHolder.getDownloadPb().setText("");
|
||||
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.NORMAL);
|
||||
DownloadEntity downloadEntity = DownloadManager.getInstance().getDownloadEntitySnapshot(gameEntity);
|
||||
@ -457,7 +458,7 @@ public class DetailDownloadUtils {
|
||||
}
|
||||
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.H5_GAME);
|
||||
} else {
|
||||
if ("dialog".equals(gameEntity.getDownloadOffStatus())) {
|
||||
if ("dialog".equals(gameEntity.getDownloadOffStatus()) || "third_party".equals(gameEntity.getDownloadOffStatus())) {
|
||||
viewHolder.getDownloadPb().setText(TextUtils.isEmpty(gameEntity.getDownloadOffText()) ? "查看详情" : gameEntity.getDownloadOffText());
|
||||
viewHolder.getDownloadPb().setButtonStyle(DownloadButton.ButtonStyle.NONE_WITH_HINT);
|
||||
} else if ("updating".equals(gameEntity.getDownloadOffStatus())) {
|
||||
|
||||
@ -11,7 +11,6 @@ import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.os.bundleOf
|
||||
import com.therouter.TheRouter
|
||||
import com.gh.ad.AdPluginDownloadHelper
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureManager.log
|
||||
@ -57,7 +56,6 @@ import com.gh.gamecenter.gamecollection.hotlist.GameCollectionHotListActivity
|
||||
import com.gh.gamecenter.gamecollection.hotlist.GameCollectionListDetailActivity
|
||||
import com.gh.gamecenter.gamecollection.square.GameCollectionSquareActivity
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarActivity
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersCalendarManagementActivity
|
||||
import com.gh.gamecenter.gamedetail.fuli.kaifu.ServersSubscribedGameListActivity
|
||||
import com.gh.gamecenter.gamedetail.history.HistoryApkListActivity
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
|
||||
@ -77,7 +75,6 @@ import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity
|
||||
import com.gh.gamecenter.qa.subject.CommunitySubjectActivity
|
||||
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
import com.gh.gamecenter.servers.GameServerTestActivity
|
||||
import com.gh.gamecenter.servers.GameServersActivity
|
||||
import com.gh.gamecenter.servers.gametest2.GameServerTestV2Activity
|
||||
@ -98,6 +95,7 @@ import com.halo.assistant.fragment.WebFragment
|
||||
import com.lightgame.utils.Utils
|
||||
import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram
|
||||
import com.tencent.mm.opensdk.openapi.WXAPIFactory
|
||||
import com.therouter.TheRouter
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import retrofit2.HttpException
|
||||
@ -178,7 +176,23 @@ object DirectUtils {
|
||||
"qa",
|
||||
"feedback",
|
||||
"toolkit",
|
||||
"float_window_game"
|
||||
"float_window_game",
|
||||
"my_halo",
|
||||
"my_game",
|
||||
"server_manager",
|
||||
"receiving_information",
|
||||
"game_archive",
|
||||
"game_dynamics",
|
||||
"game_upload",
|
||||
"certification",
|
||||
"wechat_reminder",
|
||||
"apk_clean",
|
||||
"personal_center",
|
||||
"video_upload",
|
||||
"account_security",
|
||||
"simulator",
|
||||
"teen_mode",
|
||||
"message_center",
|
||||
)
|
||||
|
||||
fun directToLinkPage(
|
||||
@ -383,8 +397,8 @@ object DirectUtils {
|
||||
}
|
||||
}
|
||||
|
||||
"authentication" -> {
|
||||
context.startActivity(ShellActivity.getIntent(context, ShellActivity.Type.REAL_NAME_INFO, null))
|
||||
"authentication", "certification" -> {
|
||||
directToRealName(context)
|
||||
}
|
||||
|
||||
"user_background" -> {
|
||||
@ -442,7 +456,7 @@ object DirectUtils {
|
||||
} ?: ""
|
||||
}
|
||||
|
||||
"halo_tab" -> directToHomeMyHaloTab(context)
|
||||
"my_halo", "halo_tab" -> directToHomeMyHaloTab(context)
|
||||
|
||||
"common_collection" -> directToCommonCollectionDetail(
|
||||
context,
|
||||
@ -524,7 +538,8 @@ object DirectUtils {
|
||||
ToolbarWrapperActivity.getMultiTabNavIntent(
|
||||
context,
|
||||
linkEntity.link ?: "",
|
||||
linkEntity.text ?: ""
|
||||
linkEntity.text ?: "",
|
||||
entrance
|
||||
)
|
||||
)
|
||||
|
||||
@ -532,16 +547,20 @@ object DirectUtils {
|
||||
ToolbarWrapperActivity.getCustomPageIntent(
|
||||
context,
|
||||
linkEntity.link ?: "",
|
||||
linkEntity.text ?: ""
|
||||
linkEntity.text ?: "",
|
||||
entrance
|
||||
)
|
||||
)
|
||||
|
||||
// 选中首页底部 tab
|
||||
"bottom_tab" -> {
|
||||
val intent = Intent(context, MainActivity::class.java).apply {
|
||||
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
if (HaloApp.getInstance().isRunningForeground) {
|
||||
val intent = Intent(context, MainActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
context.startActivity(intent)
|
||||
} else {
|
||||
jumpActivity(context, Bundle())
|
||||
}
|
||||
context.startActivity(intent)
|
||||
|
||||
if (linkEntity is LaunchRedirect) {
|
||||
MainWrapperRepository.getInstance().sendSelectTabEvent(linkEntity)
|
||||
@ -568,6 +587,32 @@ object DirectUtils {
|
||||
}
|
||||
}
|
||||
|
||||
"my_game" -> directToMyGame(0, entrance)
|
||||
|
||||
"server_manager" -> directToServersCalendarManagement(entrance)
|
||||
|
||||
"receiving_information" -> directToDeliveryInfo(entrance)
|
||||
|
||||
"game_archive" -> directToGameArchive(entrance)
|
||||
|
||||
"game_dynamics" -> directToConcernInfo(context, entrance)
|
||||
|
||||
"wechat_reminder" -> CheckLoginUtils.checkLogin(context, entrance) {
|
||||
context.startActivity(WebActivity.getBindWechatIntent(context))
|
||||
}
|
||||
|
||||
"apk_clean" -> directToCleanApk(context, entrance)
|
||||
|
||||
"personal_center" -> directToUserInfo(entrance)
|
||||
|
||||
"simulator" -> directToSimulatorGame(entrance)
|
||||
|
||||
"account_security" -> directToAccountSecurity(entrance)
|
||||
|
||||
"teen_mode" -> directToTeenMode(entrance)
|
||||
|
||||
"message_center" -> directToMessageCenter(0, entrance)
|
||||
|
||||
"" -> {
|
||||
// do nothing
|
||||
}
|
||||
@ -2083,13 +2128,17 @@ object DirectUtils {
|
||||
|
||||
/**
|
||||
* 跳转到开服订阅页面
|
||||
* @param context 上下文
|
||||
*/
|
||||
@JvmStatic
|
||||
fun directToServersCalendarManagement(context: Context, entrance: String) {
|
||||
CheckLoginUtils.checkLogin(context, entrance) {
|
||||
context.startActivity(ServersCalendarManagementActivity.getIntent(context))
|
||||
}
|
||||
fun directToServersCalendarManagement(entrance: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.serversCalendarManagementActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.REQUIRE_LOGIN, "true")
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, entrance)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.navigation()
|
||||
}
|
||||
|
||||
fun directToSearch(
|
||||
@ -2149,4 +2198,100 @@ object DirectUtils {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToMyGame(defaultTabIndex: Int, source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.myGameActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.withInt(BaseActivity_TabLayout.PAGE_INDEX, defaultTabIndex)
|
||||
.navigation()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToDeliveryInfo(source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.deliveryInfoActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.REQUIRE_LOGIN, "true")
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.navigation()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToGameArchive(source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.gameArchiveListActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.navigation()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToSimulatorGame(source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.simulatorGameActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.navigation()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToTeenMode(source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.teenagerModeActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.navigation()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToUserInfo(source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.userInfoActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.REQUIRE_LOGIN, "true")
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.navigation()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToCleanApk(context: Context, source: String) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.cleanApkActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
PermissionHelper.checkManageAllFilesOrStoragePermissionBeforeAction(context) {
|
||||
TheRouter.build(uri.toString())
|
||||
.navigation()
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToAccountSecurity(source: String, isLogoutStyle: Boolean = false) {
|
||||
val uri = Uri.Builder()
|
||||
.path(RouteConsts.activity.securityActivity)
|
||||
.appendQueryParameter(RouteConsts.QueryParams.REQUIRE_LOGIN, "true")
|
||||
.appendQueryParameter(RouteConsts.QueryParams.SOURCE, source)
|
||||
.build()
|
||||
|
||||
TheRouter.build(uri.toString())
|
||||
.withString(KEY_ENTRANCE, source)
|
||||
.withBoolean(KEY_DISPLAY_TYPE, isLogoutStyle)
|
||||
.navigation()
|
||||
}
|
||||
}
|
||||
@ -280,9 +280,9 @@ object DownloadItemUtils {
|
||||
isClickable = true
|
||||
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||
} else {
|
||||
if ("dialog" == offStatus) {
|
||||
if ("dialog" == offStatus || "third_party" == offStatus) {
|
||||
text = context.getString(com.gh.gamecenter.feature.R.string.check)
|
||||
buttonStyle = DownloadButton.ButtonStyle.NORMAL
|
||||
buttonStyle = DownloadButton.ButtonStyle.NONE_WITH_HINT
|
||||
} else if ("updating" == offStatus) {
|
||||
text = context.getString(com.gh.gamecenter.feature.R.string.updating)
|
||||
buttonStyle = DownloadButton.ButtonStyle.UPDATING
|
||||
@ -839,34 +839,25 @@ object DownloadItemUtils {
|
||||
} else {
|
||||
allStateClickCallback?.onCallback()
|
||||
clickCallback?.onCallback()
|
||||
if ("download" == gameEntity.reserveStatus) {
|
||||
ReservationHelper.showDeleteReservationDialog(context) {
|
||||
ReservationHelper.deleteReservation(gameEntity) {
|
||||
adapter?.notifyItemChanged(position)
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
ReservationHelper.showCancelReservationDialog(context, gameEntity, {
|
||||
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
||||
"确定取消",
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: ""
|
||||
)
|
||||
ReservationHelper.cancelReservation(gameEntity) {
|
||||
adapter?.notifyItemChanged(position)
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
} else {
|
||||
ReservationHelper.showCancelReservationDialog(context, gameEntity,{
|
||||
}, object : CancelListener {
|
||||
override fun onCancel() {
|
||||
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
||||
"确定取消",
|
||||
"关闭弹窗",
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: ""
|
||||
)
|
||||
ReservationHelper.cancelReservation(gameEntity) {
|
||||
adapter?.notifyItemChanged(position)
|
||||
refreshCallback?.onCallback()
|
||||
}
|
||||
}, object : CancelListener {
|
||||
override fun onCancel() {
|
||||
NewFlatLogUtils.logMyGameCancelReserveDialogClick(
|
||||
"关闭弹窗",
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: ""
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
@ -135,12 +135,16 @@ object GameUtils {
|
||||
// 畅玩状态优先,且畅玩实体不为空时将 downloadEntity 置为畅玩实体
|
||||
if (performAsVGame && vGameDownloadEntity != null) {
|
||||
downloadEntity = vGameDownloadEntity
|
||||
} else if (!performAsVGame && !isFromList && downloadEntity?.isVGameDownloadInDualDownloadMode() == true) {
|
||||
// 下载的任务是由畅玩触发的,游戏详情页不需判定为需要安装
|
||||
downloadEntity = null
|
||||
} else if (performAsVGame && !isFromList && downloadEntity?.isLocalDownloadInDualDownloadMode() == true) {
|
||||
// 下载的任务是由下载安装触发的,游戏详情页不需判定为需要安装
|
||||
downloadEntity = null
|
||||
} else if (!isFromList) {
|
||||
if (!performAsVGame
|
||||
&& gameEntity.isDualBtnModeEnabled()
|
||||
&& downloadEntity?.isVGameDownloadInDualDownloadMode() == true) {
|
||||
// 下载的任务是由畅玩触发的,并且双下载按钮启用,游戏详情页不需判定为需要安装
|
||||
downloadEntity = null
|
||||
} else if (performAsVGame && downloadEntity?.isLocalDownloadInDualDownloadMode() == true) {
|
||||
// 下载的任务是由下载安装触发的,游戏详情页不需判定为需要安装
|
||||
downloadEntity = null
|
||||
}
|
||||
}
|
||||
|
||||
if (downloadEntity != null) {
|
||||
|
||||
@ -18,7 +18,6 @@ import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.MD5Utils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.install.InstallService
|
||||
import com.gh.vspace.VHelper
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DownloadEntity
|
||||
@ -194,12 +193,6 @@ object PackageInstaller {
|
||||
private fun install(context: Context, pkgPath: String, pkgName: String?) {
|
||||
HaloApp.put(Constants.LAST_INSTALL_GAME, pkgPath)
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU && Build.MANUFACTURER.lowercase().contains("xiaomi")) {
|
||||
val foregroundServiceIntent = Intent(context, InstallService::class.java)
|
||||
foregroundServiceIntent.putExtra(InstallService.KEY_SERVICE_ACTION, InstallService.START_FOREGROUND)
|
||||
context.startForegroundService(foregroundServiceIntent)
|
||||
}
|
||||
|
||||
val installIntent = getInstallIntent(context, pkgPath)
|
||||
context.startActivity(installIntent)
|
||||
|
||||
@ -284,7 +277,12 @@ object PackageInstaller {
|
||||
installIntent.setDataAndType(uri, "application/vnd.android.package-archive")
|
||||
}
|
||||
|
||||
updateSystemInstallerIfAvailable(context, installIntent)
|
||||
// 优选系统的安装器(遇到 Exception 就回落到正常的安装器)
|
||||
try {
|
||||
updateSystemInstallerIfAvailable(context, installIntent)
|
||||
} catch (ignored: Exception) {
|
||||
// ignored
|
||||
}
|
||||
|
||||
InstallUtils.getInstance()
|
||||
.addInstall(PackageUtils.getPackageNameByPath(context, path))
|
||||
|
||||
@ -7,7 +7,7 @@ import com.gh.gamecenter.common.utils.isVGameDownloadInDualDownloadMode
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.entity.GameInstall
|
||||
import com.gh.gamecenter.packagehelper.PackageRepository
|
||||
import com.gh.gamecenter.manager.PackagesManager
|
||||
import com.gh.vspace.VHelper
|
||||
|
||||
object PackageLauncher {
|
||||
@ -91,7 +91,7 @@ object PackageLauncher {
|
||||
val gameInstall = if (gameEntity != null) {
|
||||
GameInstall.transformGameInstall(gameEntity, packageName)
|
||||
} else {
|
||||
PackageRepository.gameInstalled.find { it.packageName == packageName }
|
||||
PackagesManager.getInstalledList().find { it.packageName == packageName }
|
||||
}
|
||||
|
||||
if (gameInstall != null) {
|
||||
|
||||
@ -14,7 +14,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.PowerManager;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AndroidException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@ -29,9 +28,9 @@ import com.gh.gamecenter.BuildConfig;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.utils.ExtensionsKt;
|
||||
import com.gh.gamecenter.core.utils.MD5Utils;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.feature.entity.ApkEntity;
|
||||
import com.gh.gamecenter.feature.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.GameUpdateEntity;
|
||||
import com.gh.gamecenter.feature.utils.SentryHelper;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.gh.vspace.VHelper;
|
||||
@ -542,10 +541,8 @@ public class PackageUtils {
|
||||
try {
|
||||
Intent intent = context.getApplicationContext().getPackageManager().getLaunchIntentForPackage(packageName);
|
||||
return intent != null;
|
||||
} catch (IllegalArgumentException exception) {
|
||||
// 一些设备调用获取 intent 的时候会触发 Parcel.readException !
|
||||
exception.printStackTrace();
|
||||
return false;
|
||||
} catch (Exception exception) {
|
||||
return PackageHelper.INSTANCE.getLocalPackageNameSet().contains(packageName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -645,6 +642,19 @@ public class PackageUtils {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取应用的名称
|
||||
*/
|
||||
public static CharSequence getNameByPackageName(Context context, String packageName) {
|
||||
try {
|
||||
PackageManager packageManager = context.getApplicationContext().getPackageManager();
|
||||
return packageManager.getApplicationLabel(packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 获取应用的 icon
|
||||
|
||||
@ -29,53 +29,31 @@ import okhttp3.ResponseBody
|
||||
|
||||
object ReservationHelper {
|
||||
|
||||
@JvmStatic
|
||||
fun deleteReservation(game: GameEntity, refreshCallback: EmptyCallback) {
|
||||
deleteOrCancelReservation(game, true, refreshCallback)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun cancelReservation(game: GameEntity, refreshCallback: EmptyCallback) {
|
||||
deleteOrCancelReservation(game, false, refreshCallback)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun deleteOrCancelReservation(
|
||||
@JvmStatic
|
||||
fun cancelReservation(
|
||||
game: GameEntity,
|
||||
deleteReservation: Boolean,
|
||||
refreshCallback: EmptyCallback
|
||||
) {
|
||||
|
||||
val retrofit = RetrofitManager.getInstance()
|
||||
val single = if (deleteReservation) {
|
||||
retrofit.newApi
|
||||
.deleteGameReservation(
|
||||
game.id,
|
||||
getReserveRequestBody(game, context = HaloApp.getInstance().application)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
} else {
|
||||
retrofit.newApi
|
||||
.cancelGameReservation(
|
||||
game.id,
|
||||
getReserveRequestBody(game, context = HaloApp.getInstance().application)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
}
|
||||
retrofit.newApi
|
||||
.cancelGameReservation(
|
||||
game.id,
|
||||
getReserveRequestBody(game, context = HaloApp.getInstance().application)
|
||||
)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
ReservationRepository.removeReservationFromMemoryAndRefresh(game.id)
|
||||
refreshCallback.onCallback()
|
||||
}
|
||||
|
||||
single.subscribe(object : BiResponse<ResponseBody>() {
|
||||
override fun onSuccess(data: ResponseBody) {
|
||||
ReservationRepository.removeReservationFromMemoryAndRefresh(game.id)
|
||||
refreshCallback.onCallback()
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
Utils.toast(HaloApp.getInstance().application, exception.message)
|
||||
exception.printStackTrace()
|
||||
}
|
||||
})
|
||||
override fun onFailure(exception: Exception) {
|
||||
Utils.toast(HaloApp.getInstance().application, exception.message)
|
||||
exception.printStackTrace()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
@ -146,21 +124,6 @@ object ReservationHelper {
|
||||
})
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showDeleteReservationDialog(context: Context, emptyCallback: EmptyCallback) {
|
||||
DialogUtils.showCancelOrDeleteReservationDialog(
|
||||
context,
|
||||
"删除预约",
|
||||
"游戏已上线,你可以删除此预约记录,确定删除吗?",
|
||||
"确定删除",
|
||||
"暂不删除", object : ConfirmListener {
|
||||
override fun onConfirm() {
|
||||
emptyCallback.onCallback()
|
||||
}
|
||||
}, null
|
||||
)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun showCancelReservationDialog(context: Context, game: GameEntity?, emptyCallback: EmptyCallback) {
|
||||
showCancelReservationDialog(context, game, emptyCallback, null)
|
||||
|
||||
@ -2,6 +2,7 @@ package com.gh.download.simple
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.database.sqlite.SQLiteException
|
||||
import android.database.sqlite.SQLiteFullException
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.lg.download.*
|
||||
import com.lg.download.listener.InnerDownloadListener
|
||||
@ -174,6 +175,9 @@ object DownloadMessageHandler : InnerDownloadListener {
|
||||
DownloadError.CONTENT_LENGTH_IS_ZERO -> {
|
||||
ToastUtils.toast("下载链接异常,请检查")
|
||||
}
|
||||
DownloadError.DISK_IS_FULL -> {
|
||||
ToastUtils.toast("磁盘已满,请清理空间后获得更好的体验")
|
||||
}
|
||||
else -> {
|
||||
// 想怎么处理就怎么处理
|
||||
}
|
||||
@ -264,18 +268,30 @@ object DownloadMessageHandler : InnerDownloadListener {
|
||||
}
|
||||
|
||||
fun insertDownloadToDatabase(downloadEntity: SimpleDownloadEntity) {
|
||||
mDownloadDao.insertDownloadEntity(downloadEntity)
|
||||
updateDownloadList()
|
||||
try {
|
||||
mDownloadDao.insertDownloadEntity(downloadEntity)
|
||||
updateDownloadList()
|
||||
} catch (e: SQLiteException) {
|
||||
if (e is SQLiteFullException) {
|
||||
ToastUtils.showToast("磁盘已满,请清理空间获得更好的体验")
|
||||
}
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
fun updateDownloadToDatabase(
|
||||
downloadEntity: SimpleDownloadEntity,
|
||||
updateDownloadList: Boolean = false
|
||||
) {
|
||||
mDownloadDao.updateDownloadEntity(downloadEntity)
|
||||
try {
|
||||
mDownloadDao.updateDownloadEntity(downloadEntity)
|
||||
|
||||
if (updateDownloadList) {
|
||||
updateDownloadList()
|
||||
if (updateDownloadList) {
|
||||
updateDownloadList()
|
||||
}
|
||||
} catch (e: SQLiteFullException) {
|
||||
// 底层的下载服务遇到 SQLiteFullException 时会自动暂停下载任务,上层这里就不用纠结处理方式了
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,26 +3,25 @@ package com.gh.gamecenter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity;
|
||||
import com.gh.gamecenter.common.utils.BitmapUtils;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.utils.BitmapUtils;
|
||||
import com.gh.gamecenter.common.view.CropImageCustom;
|
||||
import com.gh.gamecenter.common.view.cropbox.CropBoxStyle;
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* 裁剪图片
|
||||
*/
|
||||
@ -32,6 +31,8 @@ public class CropImageActivity extends ToolBarActivity {
|
||||
|
||||
public static final String RESULT_CLIP_PATH = "result_clip_path";
|
||||
|
||||
public static final String RESULT_ORIGINAL_PATH = "result_original_path";
|
||||
|
||||
private SoftReference<Bitmap> reference;
|
||||
|
||||
protected boolean mBlackTheme = false;
|
||||
@ -51,7 +52,7 @@ public class CropImageActivity extends ToolBarActivity {
|
||||
Intent intent = new Intent(context, CropImageActivity.class);
|
||||
intent.putExtra(EntranceConsts.KEY_PATH, picturePath);
|
||||
intent.putExtra(EntranceConsts.KEY_ENTRANCE, entrance);
|
||||
intent.putExtra(EntranceConsts.KEY_IMAGE_CROP_RATIO, cropRatio);
|
||||
intent.putExtra(EntranceConsts.KEY_IMAGE_CROP_STYLE, new CropBoxStyle.Rectangle(cropRatio));
|
||||
intent.putExtra(EntranceConsts.KEY_BLACK_THEME, isBlackTheme);
|
||||
intent.putExtra(EntranceConsts.KEY_ASSIST_RES, assistRes);
|
||||
return intent;
|
||||
@ -68,20 +69,14 @@ public class CropImageActivity extends ToolBarActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mCropImageCustom = findViewById(R.id.cropimage_custom);
|
||||
View statusBarView = findViewById(R.id.status_bar);
|
||||
TextView tvCancel = findViewById(R.id.tv_cancel);
|
||||
TextView tvSubmit = findViewById(R.id.tv_submit);
|
||||
|
||||
mTitleTv.setTextColor(mBlackTheme ? Color.WHITE : Color.BLACK);
|
||||
mToolbar.setBackgroundColor(getResources().getColor(mBlackTheme ? com.gh.gamecenter.common.R.color.text_28282E : com.gh.gamecenter.common.R.color.white));
|
||||
statusBarView.setBackgroundColor(getResources().getColor(mBlackTheme ? com.gh.gamecenter.common.R.color.text_28282E : com.gh.gamecenter.common.R.color.white));
|
||||
|
||||
setNavigationTitle(getString(R.string.title_crop_image));
|
||||
setToolbarMenu(R.menu.menu_positive);
|
||||
MenuItem menuItem = getMenuItem(R.id.layout_menu_positive);
|
||||
TextView menuButton = menuItem.getActionView().findViewById(R.id.menu_answer_post);
|
||||
menuButton.setTextColor(getResources().getColor(com.gh.gamecenter.common.R.color.text_theme));
|
||||
|
||||
float ratio = getIntent().getFloatExtra(EntranceConsts.KEY_IMAGE_CROP_RATIO, 1F);
|
||||
mCropImageCustom.setCropRatio(ratio);
|
||||
CropBoxStyle boxStyle = getIntent().getParcelableExtra(EntranceConsts.KEY_IMAGE_CROP_STYLE);
|
||||
if (boxStyle == null) {
|
||||
boxStyle = new CropBoxStyle.Rectangle(1F);
|
||||
}
|
||||
mCropImageCustom.setCropBoxStyle(boxStyle);
|
||||
|
||||
int assistRes = getIntent().getIntExtra(EntranceConsts.KEY_ASSIST_RES, -1);
|
||||
if (assistRes > 0) {
|
||||
@ -89,8 +84,21 @@ public class CropImageActivity extends ToolBarActivity {
|
||||
addAssistView(view);
|
||||
}
|
||||
|
||||
DisplayUtils.setLightStatusBar(this, !mBlackTheme);
|
||||
DisplayUtils.setStatusBarColor(this, com.gh.gamecenter.common.R.color.transparent, !mBlackTheme);
|
||||
DisplayUtils.setLightStatusBar(this, false);
|
||||
DisplayUtils.setStatusBarColor(this, com.gh.gamecenter.common.R.color.transparent, false);
|
||||
|
||||
tvCancel.setOnClickListener(v -> finish());
|
||||
|
||||
tvSubmit.setOnClickListener(v -> saveImage());
|
||||
}
|
||||
|
||||
protected void saveImage() {
|
||||
Intent data = new Intent();
|
||||
String clipPath = getCacheDir().getAbsolutePath() + File.separator + System.currentTimeMillis() + ".jpg";
|
||||
mCropImageCustom.savePicture(clipPath);
|
||||
data.putExtra(RESULT_CLIP_PATH, clipPath);
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -98,20 +106,6 @@ public class CropImageActivity extends ToolBarActivity {
|
||||
return mBlackTheme ? com.gh.gamecenter.common.R.drawable.ic_toolbar_back_white : com.gh.gamecenter.common.R.drawable.ic_bar_back;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
if (item.getItemId() == R.id.layout_menu_positive) {
|
||||
Intent data = new Intent();
|
||||
String clipPath = getCacheDir().getAbsolutePath() + File.separator + System.currentTimeMillis() + ".jpg";
|
||||
mCropImageCustom.savePicture(clipPath);
|
||||
|
||||
data.putExtra(RESULT_CLIP_PATH, clipPath);
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
}
|
||||
return super.onMenuItemClick(item);
|
||||
}
|
||||
|
||||
public void addAssistView(View view) {
|
||||
mCropImageCustom.addAssistView(view);
|
||||
}
|
||||
|
||||
@ -166,8 +166,13 @@ public class MainActivity extends BaseActivity {
|
||||
private final Handler handler = new Handler();
|
||||
private boolean mShouldShowAd = false; // 是否显示广告
|
||||
|
||||
private Bundle mTempSavedInstanceState;
|
||||
private boolean mFragmentIsCreated = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
mTempSavedInstanceState = savedInstanceState;
|
||||
|
||||
mShouldShowAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null
|
||||
&& !HaloApp.getInstance().isAlreadyUpAndRunning;
|
||||
HaloApp.getInstance().isAlreadyUpAndRunning = true;
|
||||
@ -175,21 +180,12 @@ public class MainActivity extends BaseActivity {
|
||||
mMainWrapperViewModel = new ViewModelProvider(this, new MainWrapperViewModel.Factory(HaloApp.getInstance()))
|
||||
.get(MainWrapperViewModel.class);
|
||||
|
||||
DisplayUtils.transparentStatusBar(this);
|
||||
DisplayUtils.updateGlobalScreen(this);
|
||||
|
||||
super.onCreate(savedInstanceState);
|
||||
setStatusBarColor(Color.TRANSPARENT);
|
||||
|
||||
Fragment fragmentFromFM = getSupportFragmentManager().findFragmentById(com.gh.gamecenter.selector.R.id.layout_activity_content);
|
||||
|
||||
mMainWrapperFragment = fragmentFromFM != null ? (MainWrapperFragment) fragmentFromFM : new MainWrapperFragment();
|
||||
if (savedInstanceState != null) {
|
||||
mMainWrapperFragment.setArguments(savedInstanceState);
|
||||
} else if (getIntent() != null) {
|
||||
mMainWrapperFragment.setArguments(getIntent().getExtras());
|
||||
}
|
||||
replaceFragment(mMainWrapperFragment);
|
||||
|
||||
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (HaloApp.getInstance().isNewForThisVersion) {
|
||||
LunchType lunchType = HaloApp.getInstance().getLaunchType();
|
||||
@ -215,7 +211,6 @@ public class MainActivity extends BaseActivity {
|
||||
DataUtils.getGid();
|
||||
}
|
||||
|
||||
|
||||
mPackageViewModel = ViewModelProviders.of(this, new PackageViewModel.Factory()).get(PackageViewModel.class);
|
||||
|
||||
final boolean containsErrorMsg = com.gh.gamecenter.common.constant.Config.isContainsErrorMsg();
|
||||
@ -273,6 +268,7 @@ public class MainActivity extends BaseActivity {
|
||||
if (mShouldShowAd) {
|
||||
showAd();
|
||||
} else {
|
||||
doInitMainFragment(mTempSavedInstanceState);
|
||||
hideTextAd();
|
||||
hideSplashAd();
|
||||
}
|
||||
@ -328,6 +324,23 @@ public class MainActivity extends BaseActivity {
|
||||
CertificationSwitchHelper.getCertificationSwitch();
|
||||
}
|
||||
|
||||
private void doInitMainFragment(Bundle savedInstanceState) {
|
||||
if (mFragmentIsCreated) return;
|
||||
|
||||
mTempSavedInstanceState = null;
|
||||
Fragment fragmentFromFM = getSupportFragmentManager().findFragmentById(com.gh.gamecenter.selector.R.id.layout_activity_content);
|
||||
|
||||
mMainWrapperFragment = fragmentFromFM != null ? (MainWrapperFragment) fragmentFromFM : new MainWrapperFragment();
|
||||
if (savedInstanceState != null) {
|
||||
mMainWrapperFragment.setArguments(savedInstanceState);
|
||||
} else if (getIntent() != null) {
|
||||
mMainWrapperFragment.setArguments(getIntent().getExtras());
|
||||
}
|
||||
replaceFragment(mMainWrapperFragment);
|
||||
|
||||
mFragmentIsCreated = true;
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void getTeenagerMode() {
|
||||
RetrofitManager.getInstance()
|
||||
@ -543,6 +556,12 @@ public class MainActivity extends BaseActivity {
|
||||
if (msg.what == COUNTDOWN_AD || msg.what == COUNTDOWN_SDK_AD) {
|
||||
mCountdownCount++;
|
||||
int maxCount;
|
||||
|
||||
// 第三秒的时候初始化 Fragment
|
||||
if (mCountdownCount == 3) {
|
||||
doInitMainFragment(mTempSavedInstanceState);
|
||||
}
|
||||
|
||||
if (msg.what == COUNTDOWN_AD) {
|
||||
maxCount = mCountdownMaxCount;
|
||||
} else {
|
||||
@ -633,10 +652,11 @@ public class MainActivity extends BaseActivity {
|
||||
ExtensionsKt.removeFromParent(startSdkAdIcpContainer, true);
|
||||
}
|
||||
|
||||
onSplashHidden();
|
||||
onAdHidden();
|
||||
}
|
||||
|
||||
private void onSplashHidden() {
|
||||
private void onAdHidden() {
|
||||
doInitMainFragment(mTempSavedInstanceState);
|
||||
// 通知全局弹窗可以进行显示
|
||||
AppExecutor.getUiExecutor().execute(GlobalPriorityChainHelper.INSTANCE::start);
|
||||
}
|
||||
@ -854,7 +874,9 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 && !mMainWrapperFragment.onHandleBackPressed()) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0
|
||||
&& mMainWrapperFragment != null
|
||||
&& !mMainWrapperFragment.onHandleBackPressed()) {
|
||||
DownloadEntity downloadEntity = null;
|
||||
for (DownloadEntity entity : DownloadManager.getInstance().getAllDownloadEntityExcludeSilentTask()) {
|
||||
if (entity.getStatus().equals(DownloadStatus.done)) {
|
||||
@ -1045,6 +1067,7 @@ public class MainActivity extends BaseActivity {
|
||||
blackList.add(R.id.historyTv);
|
||||
blackList.add(R.id.myCollectionTv);
|
||||
blackList.add(R.id.searchTv);
|
||||
blackList.add(R.id.subject_tab);
|
||||
updateStaticView(view, blackList);
|
||||
|
||||
View communityHomeWrapper = view.findViewById(R.id.communityHomeContainer);
|
||||
|
||||
@ -15,6 +15,7 @@ import androidx.core.widget.doAfterTextChanged
|
||||
import androidx.core.widget.doOnTextChanged
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentTransaction
|
||||
import com.gh.common.fragment.popBackStackAllowStateLoss
|
||||
import com.gh.common.util.DataCollectionUtils
|
||||
import com.gh.common.util.LogUtils
|
||||
import com.gh.gamecenter.DisplayType.*
|
||||
@ -190,6 +191,7 @@ open class SearchActivity : BaseActivity() {
|
||||
when (type) {
|
||||
SearchType.AUTO -> handleAutoSearch(key)
|
||||
SearchType.DEFAULT -> handleDefaultSearch(key)
|
||||
SearchType.DISCOVERY -> handleDiscoverySearch(key)
|
||||
SearchType.RANK -> handleRankSearch(key)
|
||||
SearchType.HOT -> handleHotSearch(key)
|
||||
SearchType.HISTORY -> handleHistorySearch(key)
|
||||
@ -243,6 +245,22 @@ open class SearchActivity : BaseActivity() {
|
||||
)
|
||||
}
|
||||
|
||||
protected open fun handleDiscoverySearch(key: String?) {
|
||||
mSearchKey = key
|
||||
searchEt.setText(key)
|
||||
searchEt.setSelection(searchEt.text.length)
|
||||
updateDisplayType(GAME_DETAIL)
|
||||
LogUtils.uploadSearchGame("searching", "搜索页", key, "搜索发现")
|
||||
|
||||
SensorsBridge.trackSearchButtonClick(
|
||||
GlobalActivityManager.getCurrentPageEntity().pageId,
|
||||
GlobalActivityManager.getCurrentPageEntity().pageName,
|
||||
key ?: "",
|
||||
TRACK_SEARCH_TYPE_DISCOVERY,
|
||||
mSourceEntrance
|
||||
)
|
||||
}
|
||||
|
||||
protected open fun handleDefaultSearch(key: String?) {
|
||||
mSearchKey = key
|
||||
searchEt.setText(key)
|
||||
@ -381,7 +399,7 @@ open class SearchActivity : BaseActivity() {
|
||||
}
|
||||
|
||||
protected fun popBackToFragment(tag: String) {
|
||||
supportFragmentManager.popBackStack(tag, 0)
|
||||
supportFragmentManager.popBackStackAllowStateLoss(tag, 0)
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@ -390,6 +408,7 @@ open class SearchActivity : BaseActivity() {
|
||||
SearchType.HISTORY.value -> search(SearchType.HISTORY, search.key)
|
||||
SearchType.HOT.value -> search(SearchType.HOT, search.key)
|
||||
SearchType.RANK.value -> search(SearchType.RANK, search.key)
|
||||
SearchType.DISCOVERY.value -> search(SearchType.DISCOVERY, search.key)
|
||||
|
||||
"click" -> DataCollectionUtils.uploadSearchClick(
|
||||
this, mSearchKey, mSearchType.value, "搜索页面",
|
||||
@ -434,6 +453,7 @@ open class SearchActivity : BaseActivity() {
|
||||
const val TRACK_SEARCH_TYPE_DEFAULT = "默认搜索"
|
||||
const val TRACK_SEARCH_TYPE_HISTORY = "历史搜索"
|
||||
const val TRACK_SEARCH_TYPE_RANK = "榜单搜索"
|
||||
const val TRACK_SEARCH_TYPE_DISCOVERY = "搜索发现"
|
||||
|
||||
@JvmStatic
|
||||
fun toTrackSearchType(type: String) = when (type) {
|
||||
@ -441,6 +461,7 @@ open class SearchActivity : BaseActivity() {
|
||||
SearchType.MANUAL.value -> TRACK_SEARCH_TYPE_INPUT
|
||||
SearchType.HISTORY.value -> TRACK_SEARCH_TYPE_HISTORY
|
||||
SearchType.RANK.value -> TRACK_SEARCH_TYPE_RANK
|
||||
SearchType.DISCOVERY.value -> TRACK_SEARCH_TYPE_DISCOVERY
|
||||
else -> TRACK_SEARCH_TYPE_DEFAULT
|
||||
}
|
||||
|
||||
@ -490,7 +511,8 @@ enum class SearchType(var value: String) {
|
||||
HISTORY("history"),
|
||||
MANUAL("initiative"),
|
||||
HOT("remen"),
|
||||
RANK("rank");
|
||||
RANK("rank"),
|
||||
DISCOVERY("dicovery");
|
||||
|
||||
fun toChinese() = when (this) {
|
||||
AUTO -> "自动搜索"
|
||||
@ -499,6 +521,7 @@ enum class SearchType(var value: String) {
|
||||
MANUAL -> "主动搜索"
|
||||
HOT -> "热门搜索"
|
||||
RANK -> "榜单搜索"
|
||||
DISCOVERY -> "搜索发现"
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
@ -62,16 +62,16 @@ import com.gh.gamecenter.common.base.activity.BaseActivity;
|
||||
import com.gh.gamecenter.common.constant.Constants;
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts;
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity;
|
||||
import com.gh.gamecenter.common.entity.LinkEntity;
|
||||
import com.gh.gamecenter.common.entity.LaunchRedirect;
|
||||
import com.gh.gamecenter.common.entity.SimpleGameEntity;
|
||||
import com.gh.gamecenter.core.utils.GsonUtils;
|
||||
import com.gh.gamecenter.core.utils.ToastUtils;
|
||||
import com.gh.gamecenter.entity.SubjectData;
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity;
|
||||
import com.gh.gamecenter.entity.VideoLinkEntity;
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper;
|
||||
import com.gh.gamecenter.feature.utils.PlatformUtils;
|
||||
import com.gh.gamecenter.login.view.LoginActivity;
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper;
|
||||
import com.gh.gamecenter.video.detail.VideoDetailContainerViewModel;
|
||||
import com.gh.gamecenter.video.videomanager.VideoManagerActivity;
|
||||
import com.gh.vspace.VHelper;
|
||||
@ -356,8 +356,8 @@ public class SkipActivity extends BaseActivity {
|
||||
if (!TextUtils.isEmpty(dataString)) {
|
||||
byte[] linkData = Base64.decode(dataString, Base64.DEFAULT);
|
||||
String linkDataString = new String(linkData, "UTF-8");
|
||||
LinkEntity le = GsonUtils.INSTANCE.getGson().fromJson(linkDataString, LinkEntity.class);
|
||||
DirectUtils.directToLinkPage(this, le, entrance, "", "");
|
||||
LaunchRedirect launchRedirect = GsonUtils.fromJson(linkDataString, LaunchRedirect.class);
|
||||
DirectUtils.directToLinkPage(this, launchRedirect, entrance, "", "");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -282,11 +282,11 @@ class SplashScreenActivity : BaseActivity(), ISplashScreen {
|
||||
SensorsBridge.init(HaloApp.getInstance(), HaloApp.getInstance().channel)
|
||||
SensorsBridge.setOAID(HaloApp.getInstance().oaid)
|
||||
|
||||
val pushProvider = TheRouter.get(IPushProvider::class.java)
|
||||
val registrationId = pushProvider?.getRegistrationId(this)
|
||||
if (!registrationId.isNullOrEmpty()) {
|
||||
SensorsBridge.profileAppend(KEY_REGISTRATION_ID, registrationId)
|
||||
}
|
||||
// val pushProvider = ARouter.getInstance().build(RouteConsts.provider.push).navigation() as? IPushProvider
|
||||
// val registrationId = pushProvider?.getRegistrationId(this)
|
||||
// if (!registrationId.isNullOrEmpty()) {
|
||||
// SensorsBridge.profileSet(KEY_REGISTRATION_ID, registrationId)
|
||||
// }
|
||||
}
|
||||
|
||||
private fun prefetchData() {
|
||||
|
||||
@ -4,12 +4,15 @@ import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.halo.assistant.fragment.user.UserInfoFragment
|
||||
import com.therouter.router.Route
|
||||
|
||||
/**
|
||||
* 编辑资料
|
||||
*/
|
||||
@Route(
|
||||
path = RouteConsts.activity.userInfoActivity,
|
||||
description = "个人中心"
|
||||
)
|
||||
class UserInfoActivity : ToolBarActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
@ -17,6 +20,14 @@ class UserInfoActivity : ToolBarActivity() {
|
||||
updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
|
||||
}
|
||||
|
||||
override fun provideNormalIntent(): Intent {
|
||||
return getTargetIntent(
|
||||
this,
|
||||
UserInfoActivity::class.java,
|
||||
UserInfoFragment::class.java
|
||||
)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getIntent(context: Context?): Intent? {
|
||||
return getTargetIntent(
|
||||
|
||||
@ -271,14 +271,20 @@ class DetailViewHolder(
|
||||
ButtonStyle.NONE_WITH_HINT, ButtonStyle.NONE -> {
|
||||
val offStatus = mGameEntity.downloadOffStatus
|
||||
if (offStatus != null && "off" != offStatus) {
|
||||
if ("dialog" == offStatus) {
|
||||
showOffServiceDialog(mGameEntity.downloadOffDialog) {
|
||||
when (offStatus) {
|
||||
"dialog" -> {
|
||||
showOffServiceDialog(mGameEntity.downloadOffDialog) {
|
||||
showLandPageAddressDialogIfNeeded()
|
||||
}
|
||||
}
|
||||
"toast" -> {
|
||||
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING))
|
||||
ToastUtils.toast("该游戏因故暂不提供下载,具体详情可在相关评论中查看,敬请谅解~")
|
||||
showLandPageAddressDialogIfNeeded()
|
||||
}
|
||||
"third_party" -> {
|
||||
showLandPageAddressDialogIfNeeded()
|
||||
}
|
||||
} else if ("toast" == offStatus) {
|
||||
EventBus.getDefault().post(EBReuse(GameDetailFragment.SKIP_RATING))
|
||||
ToastUtils.toast("该游戏因故暂不提供下载,具体详情可在相关评论中查看,敬请谅解~")
|
||||
showLandPageAddressDialogIfNeeded()
|
||||
}
|
||||
} else {
|
||||
ToastUtils.toast("该游戏已关闭下载")
|
||||
@ -455,17 +461,9 @@ class DetailViewHolder(
|
||||
}
|
||||
|
||||
ButtonStyle.RESERVED -> {
|
||||
if ("download" == mGameEntity.reserveStatus) {
|
||||
ReservationHelper.showDeleteReservationDialog(mViewHolder.context) {
|
||||
ReservationHelper.deleteReservation(mGameEntity) {
|
||||
DetailDownloadUtils.updateViewHolder(mViewHolder)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ReservationHelper.showCancelReservationDialog(mViewHolder.context, mGameEntity) {
|
||||
ReservationHelper.cancelReservation(mGameEntity) {
|
||||
DetailDownloadUtils.updateViewHolder(mViewHolder)
|
||||
}
|
||||
ReservationHelper.showCancelReservationDialog(mViewHolder.context, mGameEntity) {
|
||||
ReservationHelper.cancelReservation(mGameEntity) {
|
||||
DetailDownloadUtils.updateViewHolder(mViewHolder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
package com.gh.gamecenter.authorization
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.UserHandle
|
||||
import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.common.util.DialogUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.common.util.PackageUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
@ -16,6 +19,7 @@ import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.databinding.ActivityAuthorizationBinding
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.login.user.UserRepository
|
||||
import com.gh.gamecenter.login.view.LoginActivity
|
||||
import com.gh.vspace.VHelper
|
||||
import com.lightgame.utils.Utils
|
||||
@ -68,6 +72,13 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
//授权token
|
||||
private var mToken = ""
|
||||
|
||||
/**
|
||||
* 游戏UID (适配双开/分身游戏)
|
||||
*/
|
||||
private var gameUid = -1
|
||||
|
||||
private var loadingDialog: Dialog? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.activity_authorization
|
||||
}
|
||||
@ -80,11 +91,16 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
mBinding = ActivityAuthorizationBinding.bind(mContentView)
|
||||
checkParam()
|
||||
initView()
|
||||
mBinding.authorizeBtn.postDelayed({
|
||||
mBaseHandler.post {
|
||||
if (loadingDialog == null) {
|
||||
loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
|
||||
}
|
||||
}
|
||||
UserRepository.getInstance().loginUserInfo.observe(this) {
|
||||
checkLogin {
|
||||
initUserInfo()
|
||||
}
|
||||
}, 500)
|
||||
}
|
||||
NewFlatLogUtils.logLoginFromGHZSShow(
|
||||
gameId = gameId,
|
||||
gameName = gameName
|
||||
@ -97,14 +113,21 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
}
|
||||
|
||||
private fun initData() {
|
||||
if (mToken.isNotEmpty() || isFinishing) return
|
||||
val loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
|
||||
if (mToken.isNotEmpty() || isFinishing) {
|
||||
loadingDialog?.dismiss()
|
||||
return
|
||||
}
|
||||
if (loadingDialog == null) {
|
||||
loadingDialog = DialogUtils.showWaitDialog(this, "请稍后...")
|
||||
} else if (loadingDialog?.isShowing == false) {
|
||||
loadingDialog?.show()
|
||||
}
|
||||
mViewModel.getAccessToken(listOf(mContent), {
|
||||
mToken = it
|
||||
loadingDialog.dismiss()
|
||||
loadingDialog?.dismiss()
|
||||
}, {
|
||||
toast("获取token失败")
|
||||
loadingDialog.dismiss()
|
||||
loadingDialog?.dismiss()
|
||||
})
|
||||
}
|
||||
|
||||
@ -143,6 +166,7 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
mContent = uri.getQueryParameter(EntranceConsts.KEY_CONTENT) ?: ""
|
||||
gameId = uri.getQueryParameter(EntranceConsts.KEY_GAME_ID) ?: ""
|
||||
gameName = uri.getQueryParameter(EntranceConsts.KEY_GAME_NAME) ?: ""
|
||||
gameUid = uri.getQueryParameter(EntranceConsts.KEY_UID)?.toIntOrNull() ?: -1
|
||||
if (mRemotePkgName == null) {
|
||||
finish()
|
||||
return
|
||||
@ -152,8 +176,8 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
private fun initView() {
|
||||
//通过包名获取app图标和名称
|
||||
val pkgName = mRemotePkgName ?: return
|
||||
val icon = packageManager.getApplicationIcon(pkgName)
|
||||
val name = packageManager.getApplicationLabel(packageManager.getApplicationInfo(pkgName, 0))
|
||||
val icon = PackageUtils.getIconByPackageName(this, pkgName)
|
||||
val name = PackageUtils.getNameByPackageName(this, pkgName)
|
||||
mBinding.authorizeAppIcon.setImageDrawable(icon)
|
||||
mBinding.authorizeAppName.text = name
|
||||
mBinding.authorizeBtn.setOnClickListener {
|
||||
@ -217,7 +241,11 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
intent.putExtra(EntranceConsts.KEY_USER_ID, userId)
|
||||
intent.putExtra(EntranceConsts.KEY_USER_NAME, username)
|
||||
intent.putExtra(EntranceConsts.KEY_USER_AVATAR, userAvatar)
|
||||
sendBroadcast(intent)
|
||||
if (gameUid != -1 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
sendBroadcastAsUser(intent, UserHandle.getUserHandleForUid(gameUid))
|
||||
} else {
|
||||
sendBroadcast(intent)
|
||||
}
|
||||
logAuthResult(true)
|
||||
backToLaunchApp()
|
||||
finish()
|
||||
@ -242,10 +270,10 @@ class AuthorizationActivity : ToolBarActivity() {
|
||||
VHelper.launch(this, gamePkg, ignoreGApps = true, showLoading = showLoading)
|
||||
return
|
||||
}
|
||||
val remotePkgName = this.mRemotePkgName
|
||||
if (remotePkgName != null) {// 跳转回其他授权app
|
||||
startActivity(packageManager.getLaunchIntentForPackage(remotePkgName))
|
||||
}
|
||||
// val remotePkgName = this.mRemotePkgName
|
||||
// if (remotePkgName != null) {// 跳转回其他授权app
|
||||
// startActivity(packageManager.getLaunchIntentForPackage(remotePkgName))
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
|
||||
@ -132,6 +132,13 @@ class GamesCollectionAdapter(
|
||||
)
|
||||
mExposureEventArray?.put(position, exposureEvent)
|
||||
|
||||
val path = when (mViewModel.type) {
|
||||
GamesCollectionFragment.TYPE_COLLECT -> "我的收藏-游戏单"
|
||||
GamesCollectionFragment.TYPE_HISTORY -> "浏览记录-游戏单"
|
||||
GamesCollectionFragment.TYPE_USER -> "个人主页-游戏单"
|
||||
else -> ""
|
||||
}
|
||||
|
||||
holder.binding.run {
|
||||
ImageUtils.display(poster, itemEntity.cover)
|
||||
nameTv.text = itemEntity.title
|
||||
@ -249,12 +256,6 @@ class GamesCollectionAdapter(
|
||||
}
|
||||
|
||||
userIcon.setOnClickListener {
|
||||
val path = when (mViewModel.type) {
|
||||
GamesCollectionFragment.TYPE_COLLECT -> "我的收藏-游戏单"
|
||||
GamesCollectionFragment.TYPE_HISTORY -> "浏览记录-游戏单"
|
||||
GamesCollectionFragment.TYPE_USER -> "个人主页-游戏单"
|
||||
else -> ""
|
||||
}
|
||||
DirectUtils.directToHomeActivity(mContext, itemEntity.user?.id, "", path)
|
||||
}
|
||||
userName.setOnClickListener { userIcon.performClick() }
|
||||
@ -266,7 +267,8 @@ class GamesCollectionAdapter(
|
||||
mContext,
|
||||
itemEntity.id,
|
||||
isScrollToCommentArea = true,
|
||||
exposureSourceList = ArrayList(exposureEvent.source)
|
||||
exposureSourceList = ArrayList(exposureEvent.source),
|
||||
entrance = path
|
||||
)
|
||||
)
|
||||
}
|
||||
@ -329,7 +331,8 @@ class GamesCollectionAdapter(
|
||||
GameCollectionDetailActivity.getIntent(
|
||||
mContext,
|
||||
itemEntity.id,
|
||||
exposureSourceList = ArrayList(exposureEvent.source)
|
||||
exposureSourceList = ArrayList(exposureEvent.source),
|
||||
entrance = path
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.gh.gamecenter.entity
|
||||
|
||||
import com.gh.gamecenter.feature.entity.SimpleGame
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
class GameServerTestTopGame(
|
||||
@SerializedName("_id")
|
||||
var id: String = "",
|
||||
var game: SimpleGame? = null,
|
||||
@SerializedName("column_test_v2_icon")
|
||||
var icon: String = "",
|
||||
@SerializedName("event_description")
|
||||
var description: String = "",
|
||||
@SerializedName("event_date")
|
||||
var date: String = ""
|
||||
)
|
||||
@ -18,7 +18,13 @@ data class SearchSubjectEntity(
|
||||
@SerializedName("ad_icon_active")
|
||||
val adIconActive: Boolean = false,
|
||||
// 本地字段,标记是否为微信小游戏CPM专题
|
||||
var isWGameSubjectCPM: Boolean = false
|
||||
var isWGameSubjectCPM: Boolean = false,
|
||||
val type: String = ""
|
||||
) : Parcelable {
|
||||
|
||||
companion object {
|
||||
const val TYPE_WECHAT_GAME_CPM_COLUMN = "wechat_game_cpm_column"
|
||||
}
|
||||
|
||||
fun getFilterGame() = RegionSettingHelper.filterGame(games)
|
||||
}
|
||||
@ -288,7 +288,8 @@ class ForumContentSearchListFragment : LazyListFragment<AnswerEntity, ForumConte
|
||||
mSearchKey,
|
||||
SearchActivity.toTrackSearchType(mSearchType),
|
||||
contentId ?: "",
|
||||
title ?: ""
|
||||
title ?: "",
|
||||
sequence
|
||||
)
|
||||
|
||||
NewFlatLogUtils.logSearchContentClick(
|
||||
|
||||
@ -39,8 +39,8 @@ class ForumOrUserSearchDefaultFragment : SearchDefaultFragment() {
|
||||
|
||||
override fun initView() {
|
||||
mBinding = FragmentSearchDefaultBinding.bind(mCachedView)
|
||||
mBinding.hotTagHeadContainer.root.visibility = View.GONE
|
||||
mBinding.hotTagFlexContainer.visibility = View.GONE
|
||||
mBinding.hotAndDiscoveryTagHeadContainer.root.visibility = View.GONE
|
||||
mBinding.hotAndDiscoveryTagFlexContainer.visibility = View.GONE
|
||||
if (mEntrance == "论坛首页" || mEntrance == "搜索栏") {
|
||||
mBinding.hotHeadContainer.headTitle.text = "热门论坛"
|
||||
mViewModel.getForumSearchHotContent()
|
||||
|
||||
@ -40,7 +40,8 @@ class UserSearchListFragment : LazyListFragment<FollowersOrFansEntity, UserSearc
|
||||
mSearchKey,
|
||||
SearchActivity.toTrackSearchType(mSearchType),
|
||||
mListViewModel.sourceEntrance,
|
||||
userId
|
||||
userId,
|
||||
position
|
||||
)
|
||||
NewFlatLogUtils.logSearchUserClick(
|
||||
SearchType.fromString(mSearchType).toChinese(),
|
||||
|
||||
@ -4,14 +4,18 @@ import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.lifecycle.ViewModelProviders
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.baselist.LazyListFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts.KEY_SHOW_SUBJECT_TAB
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.json.json
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.observeNonNull
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.databinding.FragmentColumnCollectionDetailBinding
|
||||
import com.gh.gamecenter.entity.GameColumnCollection
|
||||
import com.gh.gamecenter.entity.SubjectData
|
||||
import com.gh.gamecenter.subject.tab.SubjectTabFragment
|
||||
|
||||
@ -55,11 +59,37 @@ class ColumnCollectionDetailFragment : LazyListFragment<LinkEntity, ColumnCollec
|
||||
mListViewModel.getGameColumnCollection()
|
||||
mListViewModel.columnCollection.observeNonNull(this) {
|
||||
setNavigationTitle(it.name)
|
||||
|
||||
mCachedView?.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_surface.toColor(requireContext()))
|
||||
logPageShow(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun logPageShow(entity: GameColumnCollection) {
|
||||
val tabIndex = arguments?.getInt(EntranceConsts.KEY_TAB_INDEX, -1) ?: -1
|
||||
val tabName = arguments?.getString(EntranceConsts.KEY_TAB_NAME, "") ?: ""
|
||||
val multiTabNavId = arguments?.getString(EntranceConsts.KEY_MULTI_TAB_NAV_ID, "") ?: ""
|
||||
val multiTabNavName = arguments?.getString(EntranceConsts.KEY_MULTI_TAB_NAV_NAME, "") ?: ""
|
||||
val bottomTabName = arguments?.getString(EntranceConsts.KEY_BOTTOM_TAB_NAME, "") ?: ""
|
||||
mBaseHandler.postDelayed({
|
||||
SensorsBridge.trackEvent("ColumnCollectionDetailPageShow", json {
|
||||
"column_collection_name" to entity.name
|
||||
"column_collection_id" to entity.id
|
||||
"page_name" to GlobalActivityManager.getCurrentPageEntity().pageName
|
||||
"page_id" to GlobalActivityManager.getCurrentPageEntity().pageId
|
||||
"page_business_id" to GlobalActivityManager.getCurrentPageEntity().pageBusinessId
|
||||
"last_page_name" to GlobalActivityManager.getLastPageEntity().pageName
|
||||
"last_page_id" to GlobalActivityManager.getLastPageEntity().pageId
|
||||
"last_page_business_id" to GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||
"bottom_tab" to bottomTabName
|
||||
"several_tab_page_name" to multiTabNavName
|
||||
"several_tab_page_id" to multiTabNavId
|
||||
"position" to tabIndex
|
||||
"tab_content" to tabName
|
||||
"source_entrance" to mEntrance
|
||||
})
|
||||
}, 3000L)
|
||||
}
|
||||
|
||||
override fun onChanged(list: MutableList<LinkEntity>?) {
|
||||
if (list != null && list.isNotEmpty()) {
|
||||
showSubjectTab(list)
|
||||
|
||||
@ -11,18 +11,22 @@ import com.gh.common.exposure.ExposureListener
|
||||
import com.gh.common.exposure.IExposable
|
||||
import com.gh.common.util.NewLogUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.baselist.LazyListFragment
|
||||
import com.gh.gamecenter.common.baselist.ListAdapter
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.entity.LinkEntity
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.json.json
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.viewModelProvider
|
||||
import com.gh.gamecenter.common.view.FixGridLayoutManager
|
||||
import com.gh.gamecenter.common.view.GridSpacingItemDecoration
|
||||
import com.gh.gamecenter.common.view.VerticalItemDecoration
|
||||
import com.gh.gamecenter.databinding.FragmentListBaseSkeletonBinding
|
||||
import com.gh.gamecenter.entity.CommonCollectionEntity
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageItem.Companion.COMMON_CONTENT_COLLECTION_LAYOUT_HORIZONTAL_SLIDE_BANNER
|
||||
|
||||
@ -120,6 +124,8 @@ class CustomCommonCollectionDetailFragment : LazyListFragment<LinkEntity, Custom
|
||||
}
|
||||
mListRv?.removeItemDecorationAt(0)
|
||||
mListRv?.addItemDecoration(itemDecoration)
|
||||
|
||||
logPageShow(it)
|
||||
}
|
||||
mListViewModel.loadExceptionLiveData.observe(viewLifecycleOwner) {
|
||||
if (it != null && it.code() == 404) {
|
||||
@ -154,6 +160,32 @@ class CustomCommonCollectionDetailFragment : LazyListFragment<LinkEntity, Custom
|
||||
})
|
||||
}
|
||||
|
||||
private fun logPageShow(entity: CommonCollectionEntity) {
|
||||
val tabIndex = arguments?.getInt(EntranceConsts.KEY_TAB_INDEX, -1) ?: -1
|
||||
val tabName = arguments?.getString(EntranceConsts.KEY_TAB_NAME, "") ?: ""
|
||||
val multiTabNavId = arguments?.getString(EntranceConsts.KEY_MULTI_TAB_NAV_ID, "") ?: ""
|
||||
val multiTabNavName = arguments?.getString(EntranceConsts.KEY_MULTI_TAB_NAV_NAME, "") ?: ""
|
||||
val bottomTabName = arguments?.getString(EntranceConsts.KEY_BOTTOM_TAB_NAME, "") ?: ""
|
||||
mBaseHandler.postDelayed({
|
||||
SensorsBridge.trackEvent("LinkContentCollectionDetailPageShow", json {
|
||||
"link_content_collection_name" to entity.name
|
||||
"link_content_collection_id" to entity.id
|
||||
"page_name" to GlobalActivityManager.getCurrentPageEntity().pageName
|
||||
"page_id" to GlobalActivityManager.getCurrentPageEntity().pageId
|
||||
"page_business_id" to GlobalActivityManager.getCurrentPageEntity().pageBusinessId
|
||||
"last_page_name" to GlobalActivityManager.getLastPageEntity().pageName
|
||||
"last_page_id" to GlobalActivityManager.getLastPageEntity().pageId
|
||||
"last_page_business_id" to GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||
"bottom_tab" to bottomTabName
|
||||
"several_tab_page_name" to multiTabNavName
|
||||
"several_tab_page_id" to multiTabNavId
|
||||
"position" to tabIndex
|
||||
"tab_content" to tabName
|
||||
"source_entrance" to mEntrance
|
||||
})
|
||||
}, 3000L)
|
||||
}
|
||||
|
||||
override fun getItemDecoration(): RecyclerView.ItemDecoration =
|
||||
when (mCollectionStyle) {
|
||||
"1-2" ->
|
||||
|
||||
@ -49,21 +49,24 @@ class GameCollectionDetailActivity : ToolBarActivity() {
|
||||
fun getIntent(
|
||||
context: Context,
|
||||
gameCollectionId: String,
|
||||
isFromSquare: Boolean = false
|
||||
isFromSquare: Boolean = false,
|
||||
entrance: String = ""
|
||||
): Intent {
|
||||
return getIntent(context, gameCollectionId, "", isFromSquare, false)
|
||||
return getIntent(context, gameCollectionId, "", isFromSquare, false, entrance = entrance)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getSpecifiedCommentIntent(
|
||||
context: Context,
|
||||
gameCollectionId: String,
|
||||
topCommentId: String
|
||||
topCommentId: String,
|
||||
entrance: String
|
||||
): Intent {
|
||||
return getIntent(
|
||||
context, gameCollectionId, topCommentId,
|
||||
isFromSquare = false,
|
||||
isScrollToCommentArea = true
|
||||
isScrollToCommentArea = true,
|
||||
entrance = entrance
|
||||
)
|
||||
}
|
||||
|
||||
@ -74,13 +77,15 @@ class GameCollectionDetailActivity : ToolBarActivity() {
|
||||
topCommentId: String = "",
|
||||
isFromSquare: Boolean = false,
|
||||
isScrollToCommentArea: Boolean = false,
|
||||
exposureSourceList: ArrayList<ExposureSource>? = null
|
||||
exposureSourceList: ArrayList<ExposureSource>? = null,
|
||||
entrance: String = ""
|
||||
): Intent {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(EntranceConsts.KEY_GAME_COLLECTION_ID, gameCollectionId)
|
||||
bundle.putString(EntranceConsts.KEY_TOP_COMMENT_ID, topCommentId)
|
||||
bundle.putBoolean(EntranceConsts.KEY_IS_FROM_SQUARE, isFromSquare)
|
||||
bundle.putBoolean(EntranceConsts.KEY_SCROLL_TO_COMMENT_AREA, isScrollToCommentArea)
|
||||
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
if (exposureSourceList != null) {
|
||||
bundle.putParcelableArrayList(EntranceConsts.KEY_EXPOSURE_SOURCE_LIST, exposureSourceList)
|
||||
}
|
||||
|
||||
@ -851,6 +851,7 @@ class GameCollectionDetailFragment :
|
||||
trackEvent.put("game_collect_title", mGameCollectionTitle)
|
||||
trackEvent.put("game_collect_id", mGameCollectionId)
|
||||
trackEvent.put("stay_length", mElapsedHelper?.elapsedTime)
|
||||
trackEvent.put("source_entrance", mEntrance)
|
||||
} catch (e: JSONException) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import androidx.recyclerview.widget.DefaultItemAnimator
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.exposure.ExposureListener
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.common.base.GlobalActivityManager
|
||||
import com.gh.gamecenter.common.baselist.ListFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
@ -58,6 +59,7 @@ class GameCollectionHotListFragment : ListFragment<GameCollectionListItemData, G
|
||||
if (requireActivity() is GameCollectionListDetailActivity) {
|
||||
mBasicExposureSourceList.add(ExposureSource("游戏单合集", mGameCollectionListEntity?.id ?: ""))
|
||||
mBasicExposureSourceList.add(ExposureSource("合集详情", ""))
|
||||
logPageShow()
|
||||
} else {
|
||||
mBasicExposureSourceList.add(ExposureSource("游戏单热榜", ""))
|
||||
mBasicExposureSourceList.add(ExposureSource("游戏单合集", mGameCollectionListEntity?.id ?: ""))
|
||||
@ -68,6 +70,32 @@ class GameCollectionHotListFragment : ListFragment<GameCollectionListItemData, G
|
||||
}
|
||||
}
|
||||
|
||||
private fun logPageShow() {
|
||||
val tabIndex = arguments?.getInt(EntranceConsts.KEY_TAB_INDEX, -1) ?: -1
|
||||
val tabName = arguments?.getString(EntranceConsts.KEY_TAB_NAME, "") ?: ""
|
||||
val multiTabNavId = arguments?.getString(EntranceConsts.KEY_MULTI_TAB_NAV_ID, "") ?: ""
|
||||
val multiTabNavName = arguments?.getString(EntranceConsts.KEY_MULTI_TAB_NAV_NAME, "") ?: ""
|
||||
val bottomTabName = arguments?.getString(EntranceConsts.KEY_BOTTOM_TAB_NAME, "") ?: ""
|
||||
mBaseHandler.postDelayed({
|
||||
SensorsBridge.trackEvent("GameListCollectionDetailPageShow", json {
|
||||
"game_list_collection_name" to mGameCollectionListEntity?.name
|
||||
"game_list_collection_id" to mGameCollectionListEntity?.id
|
||||
"page_name" to GlobalActivityManager.getCurrentPageEntity().pageName
|
||||
"page_id" to GlobalActivityManager.getCurrentPageEntity().pageId
|
||||
"page_business_id" to GlobalActivityManager.getCurrentPageEntity().pageBusinessId
|
||||
"last_page_name" to GlobalActivityManager.getLastPageEntity().pageName
|
||||
"last_page_id" to GlobalActivityManager.getLastPageEntity().pageId
|
||||
"last_page_business_id" to GlobalActivityManager.getLastPageEntity().pageBusinessId
|
||||
"bottom_tab" to bottomTabName
|
||||
"several_tab_page_name" to multiTabNavName
|
||||
"several_tab_page_id" to multiTabNavId
|
||||
"position" to tabIndex
|
||||
"tab_content" to tabName
|
||||
"source_entrance" to mEntrance
|
||||
})
|
||||
}, 3000L)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
if (mListRefresh != null) {
|
||||
mListRefresh!!.setColorSchemeResources(com.gh.gamecenter.common.R.color.primary_theme)
|
||||
|
||||
@ -76,7 +76,8 @@ class MyGameCollectionViewHolder(
|
||||
binding.root.context.startActivity(
|
||||
GameCollectionDetailActivity.getIntent(
|
||||
binding.root.context,
|
||||
entity.id
|
||||
entity.id,
|
||||
entrance = path
|
||||
)
|
||||
)
|
||||
} else {
|
||||
|
||||
@ -11,6 +11,7 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.os.bundleOf
|
||||
import com.gh.common.provider.CropImageProviderImpl.Companion.IMAGE_TYPE_GAME_COLLECTION_COVER
|
||||
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.common.util.NewLogUtils
|
||||
@ -45,7 +46,8 @@ class ChooseGameCollectionCoverTypeDialog : BaseDialogFragment() {
|
||||
requireContext(),
|
||||
ChooseType.IMAGE,
|
||||
1,
|
||||
"创建游戏单"
|
||||
"创建游戏单",
|
||||
IMAGE_TYPE_GAME_COLLECTION_COVER
|
||||
), REQUEST_CODE_IMAGE
|
||||
)
|
||||
}
|
||||
@ -101,7 +103,8 @@ class ChooseGameCollectionCoverTypeDialog : BaseDialogFragment() {
|
||||
com.gh.gamecenter.common.R.drawable.bg_choose_option_selector.toDrawable(requireContext())
|
||||
defaultUploadContainer.background =
|
||||
com.gh.gamecenter.common.R.drawable.bg_choose_option_selector.toDrawable(requireContext())
|
||||
cancelBtn.background = com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999.toDrawable(requireContext())
|
||||
cancelBtn.background =
|
||||
com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999.toDrawable(requireContext())
|
||||
recommentTv.background = R.drawable.bg_game_collection_cover_tag.toDrawable(requireContext())
|
||||
titleTv.setTextColor(com.gh.gamecenter.common.R.color.text_tertiary.toColor(requireContext()))
|
||||
localUploadTitleTv.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(requireContext()))
|
||||
|
||||
@ -313,14 +313,14 @@ class GameCollectionEditActivity : ToolBarActivity(), ChooseGamesAdapter.ItemDra
|
||||
val games = mChooseGamesViewModel.chooseGamesLiveData.value ?: arrayListOf()
|
||||
if (mIsCreateGameCollection) {
|
||||
SensorsBridge.trackEvent("GameCollectCreateSuccess", json {
|
||||
"game_collect_status" to if(mBinding.selfOnlyCb.isChecked) "仅自己可见" else "公开"
|
||||
"game_collect_status" to if (mBinding.selfOnlyCb.isChecked) "仅自己可见" else "公开"
|
||||
"game_num" to games.size
|
||||
"game_collect_title" to mBinding.gameCollectionTitleEt.text.toString().trim()
|
||||
"game_collect_id" to it.data as String
|
||||
})
|
||||
} else if (mViewModel.gameCollectionPatch != null) {
|
||||
SensorsBridge.trackEvent("GameCollectEditSuccess", json {
|
||||
"game_collect_status" to if(mBinding.selfOnlyCb.isChecked) "仅自己可见" else "公开"
|
||||
"game_collect_status" to if (mBinding.selfOnlyCb.isChecked) "仅自己可见" else "公开"
|
||||
"game_num" to games.size
|
||||
"game_collect_title" to mBinding.gameCollectionTitleEt.text.toString().trim()
|
||||
"game_collect_id" to mViewModel.gameCollectionPatch?.id
|
||||
@ -355,7 +355,7 @@ class GameCollectionEditActivity : ToolBarActivity(), ChooseGamesAdapter.ItemDra
|
||||
CheckLoginUtils.checkLogin(this, mEntrance) {}
|
||||
return@observe
|
||||
}
|
||||
ErrorHelper.handleError(this, errorMsg, false, "发布游戏单", "社区实名") {
|
||||
ErrorHelper.handleError(this, errorMsg, false, "发布游戏单", "社区实名") {
|
||||
if (::mMenuPost.isInitialized) {
|
||||
onMenuItemClick(mMenuPost)
|
||||
}
|
||||
@ -433,18 +433,6 @@ class GameCollectionEditActivity : ToolBarActivity(), ChooseGamesAdapter.ItemDra
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (data == null || resultCode != Activity.RESULT_OK) return
|
||||
when (requestCode) {
|
||||
REQUEST_CODE_IMAGE_CROP -> {
|
||||
val imagePath = data.getStringExtra(CropImageActivity.RESULT_CLIP_PATH) ?: ""
|
||||
mViewModel.imageUrl = ""
|
||||
mViewModel.imagePath = imagePath
|
||||
if (imagePath.isEmpty()) {
|
||||
mBinding.uploadPictureTv.text = "点击上传图片"
|
||||
} else {
|
||||
mBinding.uploadPictureTv.text = "图片上传中..."
|
||||
mViewModel.uploadPoster()
|
||||
}
|
||||
initPosterUI()
|
||||
}
|
||||
REQUEST_CHOOSE_TAG -> {
|
||||
val tags = data.getParcelableArrayListExtra<TagInfoEntity>(GameCollectionTagSelectFragment.SELECTED_TAG)
|
||||
?: arrayListOf()
|
||||
@ -457,20 +445,16 @@ class GameCollectionEditActivity : ToolBarActivity(), ChooseGamesAdapter.ItemDra
|
||||
fun onActivityDialogResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
if (resultCode == Activity.RESULT_OK && data != null) {
|
||||
if (requestCode == REQUEST_CODE_IMAGE) {
|
||||
val selectedPaths = Matisse.obtainResult(data)
|
||||
if (!selectedPaths.isNullOrEmpty()) {
|
||||
val path = PathUtils.getPath(this, selectedPaths[0])
|
||||
val intent =
|
||||
CropImageActivity.getIntent(
|
||||
this,
|
||||
path,
|
||||
142 / 328F,
|
||||
false,
|
||||
R.layout.layout_game_collection_crop_image_assist,
|
||||
mEntrance
|
||||
)
|
||||
startActivityForResult(intent, REQUEST_CODE_IMAGE_CROP)
|
||||
val imagePath = data.getStringExtra(CropImageActivity.RESULT_CLIP_PATH) ?: ""
|
||||
mViewModel.imageUrl = ""
|
||||
mViewModel.imagePath = imagePath
|
||||
if (imagePath.isEmpty()) {
|
||||
mBinding.uploadPictureTv.text = "点击上传图片"
|
||||
} else {
|
||||
mBinding.uploadPictureTv.text = "图片上传中..."
|
||||
mViewModel.uploadPoster()
|
||||
}
|
||||
initPosterUI()
|
||||
} else if (requestCode == ChooseGameCollectionDefaultCoverDialog.REQUEST_CODE_DEFAULT_IMAGE) {
|
||||
val entity = data.getParcelableExtra<GameCollectionCoverEntity>(EntranceConsts.KEY_DATA)
|
||||
if (entity != null) {
|
||||
@ -731,9 +715,17 @@ class GameCollectionEditActivity : ToolBarActivity(), ChooseGamesAdapter.ItemDra
|
||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||
)
|
||||
} else {
|
||||
DialogHelper.showDialog(this, "温馨提示", "游戏单会在1-2个工作日内审核完成,您可以在“我的光环-我的游戏单”查看进度", "继续提交", "取消", {
|
||||
mViewModel.uploadContent(this, requestMap)
|
||||
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
|
||||
DialogHelper.showDialog(
|
||||
this,
|
||||
"温馨提示",
|
||||
"游戏单会在1-2个工作日内审核完成,您可以在“我的光环-我的游戏单”查看进度",
|
||||
"继续提交",
|
||||
"取消",
|
||||
{
|
||||
mViewModel.uploadContent(this, requestMap)
|
||||
},
|
||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -804,7 +796,8 @@ class GameCollectionEditActivity : ToolBarActivity(), ChooseGamesAdapter.ItemDra
|
||||
activityDivider.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_divider.toColor(this@GameCollectionEditActivity))
|
||||
titleDivider.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_divider.toColor(this@GameCollectionEditActivity))
|
||||
introduceDivider.setBackgroundColor(com.gh.gamecenter.common.R.color.ui_divider.toColor(this@GameCollectionEditActivity))
|
||||
placeholderView.background = com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_8.toDrawable(this@GameCollectionEditActivity)
|
||||
placeholderView.background =
|
||||
com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_8.toDrawable(this@GameCollectionEditActivity)
|
||||
selfOnlyCb.background =
|
||||
R.drawable.border_round_stroke_0dot5_eee_999.toDrawable(this@GameCollectionEditActivity)
|
||||
uploadPictureTv.setTextColor(com.gh.gamecenter.common.R.color.text_instance.toColor(this@GameCollectionEditActivity))
|
||||
@ -912,7 +905,6 @@ class GameCollectionEditActivity : ToolBarActivity(), ChooseGamesAdapter.ItemDra
|
||||
companion object {
|
||||
|
||||
const val REQUEST_CODE_IMAGE = 100
|
||||
const val REQUEST_CODE_IMAGE_CROP = 101
|
||||
const val REQUEST_CHOOSE_GAMES = 102
|
||||
const val REQUEST_CHOOSE_TAG = 103
|
||||
const val REQUEST_CHOOSE_ACTIVITY = 105
|
||||
|
||||
@ -596,7 +596,8 @@ class GameCollectionSquareAdapter(
|
||||
context,
|
||||
gamesCollectionEntity.id,
|
||||
isFromSquare = true,
|
||||
exposureSourceList = ArrayList(exposureSource)
|
||||
exposureSourceList = ArrayList(exposureSource),
|
||||
entrance = "游戏单广场"
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ class GameCollectionSquareFragment : LazyListFragment<GamesCollectionEntity, Gam
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (data == null || resultCode != Activity.RESULT_OK) return
|
||||
if (data == null || resultCode != Activity.RESULT_OK || !::mViewModel.isInitialized) return
|
||||
if (requestCode == REQUEST_SELECT_TAG) {
|
||||
val tagInfoEntity = data.getParcelableExtra<TagInfoEntity>(GameCollectionTagSelectFragment.SELECTED_TAG)
|
||||
val tagCategory = data.getStringExtra(GameCollectionTagSelectFragment.SELECTED_TAG_CATEGORY)
|
||||
|
||||
@ -866,10 +866,11 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
|
||||
|
||||
showConcernIconAtBottomBarIfAvailable()
|
||||
|
||||
val downloadEntitySnapshot = DownloadManager.getInstance().getDownloadEntitySnapshot(mGameEntity)
|
||||
val downloadEntitySnapshot = DownloadManager.getInstance().getDownloadEntitySnapshot(mGameEntity)
|
||||
|
||||
if (isSpecialDownloadDialogAvailable(downloadEntitySnapshot)
|
||||
&& downloadEntitySnapshot != null) {
|
||||
&& downloadEntitySnapshot != null
|
||||
) {
|
||||
updateSpecialDownloadDialogIcon(true)
|
||||
}
|
||||
|
||||
@ -1855,19 +1856,10 @@ class GameDetailFragment : BaseLazyFragment(), IScrollable {
|
||||
|
||||
)
|
||||
} else {
|
||||
if ("download" == mGameEntity?.reserveStatus) {
|
||||
ReservationHelper.showDeleteReservationDialog(requireContext()) {
|
||||
ReservationHelper.deleteReservation(mGameEntity!!) {
|
||||
DetailDownloadUtils.updateViewHolder(detailViewHolder)
|
||||
showReserveBtn(isShowReserveBtn())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ReservationHelper.showCancelReservationDialog(requireContext(), mGameEntity) {
|
||||
ReservationHelper.cancelReservation(mGameEntity!!) {
|
||||
DetailDownloadUtils.updateViewHolder(detailViewHolder)
|
||||
showReserveBtn(isShowReserveBtn())
|
||||
}
|
||||
ReservationHelper.showCancelReservationDialog(requireContext(), mGameEntity) {
|
||||
ReservationHelper.cancelReservation(mGameEntity!!) {
|
||||
DetailDownloadUtils.updateViewHolder(detailViewHolder)
|
||||
showReserveBtn(isShowReserveBtn())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -983,14 +983,17 @@ class DescAdapter(
|
||||
setExpandMaxLines(maxDesLines)
|
||||
setIsExpanded(Int.MAX_VALUE == maxDesLines)
|
||||
if (customColumn.isHtmlDes == true) {
|
||||
val decoratedDesBrief = (customColumn.desBrief ?: "").dropFontColorInDarkMode(contentTv.context)
|
||||
val decoratedDes = (customColumn.des ?: "").dropFontColorInDarkMode(contentTv.context)
|
||||
|
||||
shrankSpanned = HtmlCompat.fromHtml(
|
||||
customColumn.desBrief ?: "",
|
||||
decoratedDesBrief,
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT,
|
||||
PicassoImageGetter(contentTv),
|
||||
ExtraTagHandler()
|
||||
)
|
||||
expandedSpanned = HtmlCompat.fromHtml(
|
||||
customColumn.des ?: "",
|
||||
decoratedDes,
|
||||
HtmlCompat.FROM_HTML_MODE_COMPACT,
|
||||
PicassoImageGetter(contentTv),
|
||||
ExtraTagHandler()
|
||||
|
||||
@ -6,11 +6,14 @@ import android.os.Bundle
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.therouter.router.Route
|
||||
|
||||
/**
|
||||
* 开服订阅
|
||||
*/
|
||||
@Route(
|
||||
path = RouteConsts.activity.serversCalendarManagementActivity,
|
||||
description = "开服订阅"
|
||||
)
|
||||
class ServersCalendarManagementActivity : BaseActivity_TabLayout() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
@ -25,10 +25,10 @@ import com.gh.gamecenter.common.utils.toPx
|
||||
import com.gh.gamecenter.core.iinterface.IScrollable
|
||||
import com.gh.gamecenter.core.utils.MtaHelper
|
||||
import com.gh.gamecenter.core.utils.SpanBuilder
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.RatingComment
|
||||
import com.gh.gamecenter.eventbus.EBStar
|
||||
import com.gh.gamecenter.eventbus.EBTypeChange
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.gamedetail.GameDetailFragment
|
||||
import com.halo.assistant.HaloApp
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -60,7 +60,7 @@ class RatingFragment : LazyListFragment<RatingComment, RatingViewModel>(), IScro
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == RATING_EDIT_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
mListViewModel.initData()
|
||||
mListViewModel?.initData()
|
||||
} else if (
|
||||
(requestCode == RATING_REPLAY_REQUEST || requestCode == RATING_PATCH_REQUEST)
|
||||
&& resultCode == Activity.RESULT_OK
|
||||
|
||||
@ -3,7 +3,11 @@ package com.gh.gamecenter.home.custom
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.core.view.updateLayoutParams
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
@ -54,6 +58,7 @@ import com.gh.gamecenter.feature.entity.PageLocation
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
import com.gh.gamecenter.feature.exposure.ExposureType
|
||||
import com.gh.gamecenter.feature.minigame.MiniGameItemHelper
|
||||
import com.gh.gamecenter.feature.utils.SentryHelper
|
||||
import com.gh.gamecenter.game.commoncollection.detail.CustomCommonCollectionDetailActivity
|
||||
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
|
||||
import com.gh.gamecenter.home.PageConfigure
|
||||
@ -69,6 +74,9 @@ import com.gh.gamecenter.wrapper.SearchToolbarTabWrapperViewModel
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.scwang.smartrefresh.layout.api.RefreshLayout
|
||||
import com.scwang.smartrefresh.layout.constant.RefreshState
|
||||
import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
@ -179,6 +187,22 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
|
||||
viewModel.init(pageConfigure, searchToolbarTabWrapperViewModel, pageLocation)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
binding = try {
|
||||
FragmentCustomBinding.inflate(layoutInflater)
|
||||
} catch (e: Exception) {
|
||||
SentryHelper.onEvent(
|
||||
"VIEW_BINDING_BIND_ERROR",
|
||||
"digest", e.localizedMessage,
|
||||
"gid", HaloApp.getInstance().gid
|
||||
)
|
||||
// 玄学,重试一次,该闪退闪退
|
||||
FragmentCustomBinding.inflate(layoutInflater)
|
||||
}
|
||||
mCachedView = binding.root
|
||||
return mCachedView
|
||||
}
|
||||
|
||||
override fun getRealLayoutId() = R.layout.fragment_custom
|
||||
|
||||
override fun onFragmentFirstVisible() {
|
||||
@ -275,6 +299,9 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
|
||||
if (searchBarBinding == null) {
|
||||
binding.reuseSearchBarStub.setOnInflateListener { _, inflated ->
|
||||
searchBarBinding = LayoutSearchBarBinding.bind(inflated)
|
||||
binding.gameRefresh.updateLayoutParams<RelativeLayout.LayoutParams> {
|
||||
addRule(RelativeLayout.BELOW, R.id.reuseSearchBar)
|
||||
}
|
||||
initSearchBar(it)
|
||||
}
|
||||
binding.reuseSearchBarStub.inflate()
|
||||
@ -469,7 +496,8 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
|
||||
pageLocation.tabPosition,
|
||||
pageLocation.tabContent,
|
||||
pageLocation.pageId,
|
||||
pageLocation.pageName
|
||||
pageLocation.pageName,
|
||||
mEntrance
|
||||
)
|
||||
|
||||
viewModel.loadData()
|
||||
@ -488,8 +516,6 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
|
||||
override fun initRealView() {
|
||||
super.initRealView()
|
||||
|
||||
binding = FragmentCustomBinding.bind(mCachedView)
|
||||
|
||||
scrollCalculatorHelper = ScrollCalculatorHelper(binding.gameList, R.id.autoVideoView, 0, false)
|
||||
|
||||
buildPriorityChain()
|
||||
@ -743,7 +769,7 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
|
||||
}
|
||||
}
|
||||
|
||||
override fun setScrollEnabled(isScrollEnabled: Boolean) {
|
||||
private fun setScrollEnabled(isScrollEnabled: Boolean) {
|
||||
if (::layoutManager.isInitialized) {
|
||||
layoutManager.isScrollVerticallyEnabled = isScrollEnabled
|
||||
}
|
||||
@ -759,6 +785,32 @@ class CustomPageFragment : LazyFragment(), ISmartRefreshContent, IScrollable {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStateChanged(refreshLayout: RefreshLayout, oldState: RefreshState, newState: RefreshState) {
|
||||
if (oldState == RefreshState.None && newState == RefreshState.PullDownToRefresh) {
|
||||
pauseVideo()
|
||||
} else if ((oldState == RefreshState.TwoLevelFinish || oldState == RefreshState.RefreshFinish) && newState == RefreshState.None) {
|
||||
val currentPlayer = scrollCalculatorHelper.currentPlayer
|
||||
if (currentPlayer == null) {
|
||||
scrollCalculatorHelper.playIfValid()
|
||||
} else if (currentPlayer.currentState == GSYVideoView.CURRENT_STATE_PAUSE) {
|
||||
resumeVideo()
|
||||
}
|
||||
}
|
||||
|
||||
when (newState) {
|
||||
RefreshState.TwoLevel -> {
|
||||
setScrollEnabled(false)
|
||||
}
|
||||
RefreshState.None -> {
|
||||
setScrollEnabled(true)
|
||||
}
|
||||
|
||||
else -> {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun scrollToTop() {
|
||||
if (::binding.isInitialized) {
|
||||
binding.gameList.stopScroll()
|
||||
|
||||
@ -93,7 +93,12 @@ class CustomPageViewModel(
|
||||
|
||||
private var searchToolbarTabWrapperViewModel: SearchToolbarTabWrapperViewModel? = null
|
||||
|
||||
private val subjectChangedMap: ArrayMap<String, List<GameEntity>> = ArrayMap()
|
||||
private val subjectChangedMap: ArrayMap<SubjectChanged, List<GameEntity>> = ArrayMap()
|
||||
|
||||
/**
|
||||
* 微信CPM专题当前的页码记录
|
||||
*/
|
||||
private val cpmSubjectChangedPageMap: ArrayMap<String, Int> = ArrayMap()
|
||||
|
||||
var slideDiscoveryGamesPage = -1
|
||||
|
||||
@ -358,9 +363,68 @@ class CustomPageViewModel(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onChangeABatch(subjectEntity: SubjectEntity) {
|
||||
override fun onChangeABatch(subjectEntity: SubjectEntity) =
|
||||
if (subjectEntity.isWechatColumnCPM) {
|
||||
onChangeWGameCPMABatch(subjectEntity)
|
||||
} else {
|
||||
onChangeNormalGameABatch(subjectEntity)
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信小游戏CPM的“换一批”功能实现
|
||||
*
|
||||
* @see <a href="https://jira.shanqu.cc/browse/GHZSCY-7167">【光环助手】CPM微信小游戏“换一批”功能优化</a>
|
||||
*/
|
||||
private fun onChangeWGameCPMABatch(subjectEntity: SubjectEntity) {
|
||||
val subjectId = subjectEntity.id ?: return
|
||||
val gameList = subjectChangedMap[subjectId]
|
||||
val page = cpmSubjectChangedPageMap[subjectId] ?: let {
|
||||
// 第一次点击“换一批”时,先缓存第一页的数据
|
||||
subjectChangedMap[SubjectChanged(subjectId, 1)] = subjectEntity.data
|
||||
2
|
||||
}
|
||||
val subjectChanged = SubjectChanged(subjectId, page)
|
||||
val gameList = subjectChangedMap[subjectChanged]
|
||||
if (gameList != null) {// 直接读取缓存数据
|
||||
notifyWGameCPMABatchChanged(gameList, subjectId, page)
|
||||
} else {
|
||||
repository.loadChangeSubjectWGameCPM(page)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : Response<List<GameEntity>>() {
|
||||
override fun onResponse(response: List<GameEntity>?) {
|
||||
if (response != null) {
|
||||
subjectChangedMap[subjectChanged] = response
|
||||
notifyWGameCPMABatchChanged(response, subjectId, page)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
Utils.toast(getApplication(), "网络异常")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun notifyWGameCPMABatchChanged(gameList: List<GameEntity>, subjectId: String, page: Int) {
|
||||
val nextPage: Int
|
||||
val cpmGameList = if(gameList.isEmpty()) {
|
||||
nextPage = 1// 已经到最后一页了,下一页是第一页
|
||||
subjectChangedMap[SubjectChanged(subjectId, 1)]!!
|
||||
} else {
|
||||
nextPage = page + 1
|
||||
gameList
|
||||
}
|
||||
cpmSubjectChangedPageMap[subjectId] = nextPage// 加载下一页数据
|
||||
changeSubjectCustomPageItem(subjectId, ArrayList(cpmGameList))
|
||||
}
|
||||
|
||||
/**
|
||||
* 光环游戏的“换一批”功能实现
|
||||
*/
|
||||
private fun onChangeNormalGameABatch(subjectEntity: SubjectEntity) {
|
||||
val subjectId = subjectEntity.id ?: return
|
||||
val subjectChanged = SubjectChanged(subjectId, 2)
|
||||
val gameList = subjectChangedMap[subjectChanged]
|
||||
if (gameList != null) {
|
||||
changeSubjectCustomPageItem(subjectId, getRandomGameList(subjectEntity.data, ArrayList(gameList)))
|
||||
} else {
|
||||
@ -370,7 +434,7 @@ class CustomPageViewModel(
|
||||
.subscribe(object : Response<List<GameEntity>>() {
|
||||
override fun onResponse(response: List<GameEntity>?) {
|
||||
if (response != null) {
|
||||
subjectChangedMap[subjectId] = response
|
||||
subjectChangedMap[subjectChanged] = response
|
||||
onChangeABatch(subjectEntity)
|
||||
}
|
||||
}
|
||||
@ -760,5 +824,26 @@ class CustomPageViewModel(
|
||||
repository.onClear()
|
||||
}
|
||||
|
||||
class SubjectChanged(
|
||||
val subjectId: String,
|
||||
val page: Int
|
||||
) {
|
||||
companion object {
|
||||
private const val HASH = 30
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return subjectId.hashCode() + page.hashCode() + HASH
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (other !is SubjectChanged) {
|
||||
return false
|
||||
}
|
||||
return other.subjectId == subjectId
|
||||
&& other.page == page
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -6,6 +6,8 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toBinding
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.common.utils.toDrawable
|
||||
import com.gh.gamecenter.databinding.RecyclerContentLabelLaneItemBinding
|
||||
import com.gh.gamecenter.home.custom.model.CustomPageData
|
||||
|
||||
@ -28,6 +30,10 @@ class ContentLabelLaneAdapter(
|
||||
override fun onBindViewHolder(holder: ContentLabelChildViewHolder, position: Int) {
|
||||
val item = getItem(position)
|
||||
with(holder.binding) {
|
||||
vBackground.background = R.drawable.bg_shape_content_label_lane_item.toDrawable(context)
|
||||
tvTitle.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(context))
|
||||
tvSubTitle.setTextColor(com.gh.gamecenter.common.R.color.primary_theme.toColor(context))
|
||||
|
||||
ivIcon.goneIf(item.image.isBlank()){
|
||||
ivIcon.displayGameIcon(item.image, null, null)
|
||||
}
|
||||
|
||||
@ -805,11 +805,13 @@ class CustomPageRepository private constructor(
|
||||
}
|
||||
|
||||
fun loadChangeSubjectGame(subjectEntity: SubjectEntity): Observable<List<GameEntity>> =
|
||||
if (subjectEntity.isWechatColumnCPM) {// 微信小游戏CPM专题的“换一批”接口
|
||||
wGameSubjectCPMRemoteDataSource.getRecommendCPMList(2, 10).toObservable()
|
||||
} else {
|
||||
remoteDataSource.loadChangeSubjectGame(subjectEntity)
|
||||
}
|
||||
remoteDataSource.loadChangeSubjectGame(subjectEntity)
|
||||
.map(RegionSettingHelper.filterGame)
|
||||
.map(ApkActiveUtils.filterMapperList)
|
||||
|
||||
fun loadChangeSubjectWGameCPM(page: Int): Observable<MutableList<GameEntity>> =
|
||||
wGameSubjectCPMRemoteDataSource.getEditorRecommendCPMList(page, 10)// 微信小游戏CPM专题的“换一批”接口
|
||||
.toObservable()
|
||||
.map(RegionSettingHelper.filterGame)
|
||||
.map(ApkActiveUtils.filterMapperList)
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ class SubjectTracker(private val pageLocation: PageLocation) {
|
||||
pageLocation.pageName,
|
||||
subject?.id ?: "",
|
||||
subject?.name ?: "",
|
||||
"最近在玩",
|
||||
"自定义页面",
|
||||
item.componentStyle,
|
||||
"",
|
||||
)
|
||||
|
||||
@ -363,7 +363,7 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
homeSlideCardItemBinding.cardIv.visibility = View.VISIBLE
|
||||
// 防止重复加载图片导致闪烁
|
||||
if (homeSubSlide.image != cardIv.getTag(R.string.tag_img_url_id)) {
|
||||
ImageUtils.display(cardIv, homeSubSlide.image, false, AlphaGradientProcess())
|
||||
ImageUtils.display(cardIv, homeSubSlide.image, true, AlphaGradientProcess())
|
||||
cardIv.setTag(R.string.tag_img_url_id, homeSubSlide.image)
|
||||
}
|
||||
ConstraintSet().apply {
|
||||
@ -398,7 +398,7 @@ class CommonContentHomeSlideWithCardsUi(
|
||||
descTv.text = homeSubSlide.cardDesc
|
||||
// 防止重复加载图片导致闪烁
|
||||
if (homeSubSlide.image != cardIv.getTag(R.string.tag_img_url_id)) {
|
||||
ImageUtils.display(cardIv, homeSubSlide.image, false, AlphaGradientProcess())
|
||||
ImageUtils.display(cardIv, homeSubSlide.image, true, AlphaGradientProcess())
|
||||
cardIv.setTag(R.string.tag_img_url_id, homeSubSlide.image)
|
||||
}
|
||||
ConstraintSet().apply {
|
||||
|
||||
@ -40,7 +40,7 @@ class CustomGameGallerySlideViewHolder(
|
||||
override fun bindView(item: CustomPageItem) {
|
||||
super.bindView(item)
|
||||
if (item is CustomSubjectItem) {
|
||||
|
||||
binding.cardView.setCardBackgroundColor(com.gh.gamecenter.common.R.color.ui_container_1.toColor(binding.root.context))
|
||||
if (item.data == cachedSubject) return
|
||||
|
||||
cachedSubject = item.data
|
||||
@ -77,7 +77,6 @@ class CustomGameGallerySlideViewHolder(
|
||||
val gameList = item.data.data ?: emptyList()
|
||||
(recyclerView.adapter as? GameGallerySlideAdapter)?.submitList(gameList)
|
||||
}
|
||||
binding.cardView.setCardBackgroundColor(com.gh.gamecenter.common.R.color.text_FAFAFA.toColor(binding.root.context))
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -192,9 +192,6 @@ class CustomGameItemViewHolder(
|
||||
adLabelTv: TextView? = null,
|
||||
canShowSubTitle: Boolean
|
||||
) {
|
||||
if (entity.id == gameSubtitleTv.getTag(com.gh.gamecenter.common.R.string.tag_game_name_id)) return
|
||||
gameSubtitleTv.setTag(com.gh.gamecenter.common.R.string.tag_game_name_id, entity.id)
|
||||
|
||||
var showSubtitle = false
|
||||
var showAdvancedDownload = false
|
||||
if (canShowSubTitle && entity.serverLabel == null && entity.subtitle.isNotEmpty() && !entity.advanceDownload) {
|
||||
@ -214,6 +211,9 @@ class CustomGameItemViewHolder(
|
||||
setColor("#${entity.subtitleStyle?.background}".hexStringToIntColor())
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(context))
|
||||
background = R.drawable.bg_advance_download_game_subtitle.toDrawable(context)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -226,6 +226,10 @@ class CustomGameItemViewHolder(
|
||||
background = R.drawable.bg_advance_download_game_subtitle.toDrawable(context)
|
||||
}
|
||||
}
|
||||
|
||||
if (entity.id == gameSubtitleTv.getTag(com.gh.gamecenter.common.R.string.tag_game_name_id)) return
|
||||
gameSubtitleTv.setTag(com.gh.gamecenter.common.R.string.tag_game_name_id, entity.id)
|
||||
|
||||
if (showSubtitle || showAdvancedDownload) {
|
||||
val minWidth =
|
||||
if (showSubtitle) SUBTITLE_MIN_WIDTH.dip2px() else if (showAdvancedDownload) ADVANCED_DOWNLOAD_WIDTH.dip2px() else 0
|
||||
|
||||
@ -109,7 +109,9 @@ class CustomHomeGameItemViewHolder(
|
||||
item.linkColumn?.id ?: ""
|
||||
)
|
||||
}
|
||||
binding.gameBrief.text = game.recommendText
|
||||
binding.gameBrief.goneIf(game.recommendText.isEmpty()) {
|
||||
binding.gameBrief.text = game.recommendText
|
||||
}
|
||||
binding.gameImage.visibleIf(game.showImage) {
|
||||
if (game.isWechatMiniGame()) {
|
||||
ImageUtils.display(binding.gameImage, game.banner)
|
||||
|
||||
@ -62,7 +62,11 @@ class HomeGameTestV2GameListViewHolder(
|
||||
)
|
||||
|
||||
//开服日期
|
||||
val gameTimeText = getGameTimeText(gameEntity)
|
||||
val gameTimeText = if (gameEntity.openTest?.startPending == true) {
|
||||
gameEntity.openTest?.startText ?: ""
|
||||
} else {
|
||||
getGameTimeText(gameEntity)
|
||||
}
|
||||
gameDes.text = gameTimeText
|
||||
gameDes.isVisible = gameTimeText.isNotEmpty()
|
||||
|
||||
|
||||
@ -41,6 +41,8 @@ class AutomaticVideoView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||
var thumbImage: SimpleDraweeView = findViewById(R.id.thumbImage)
|
||||
var containerView: RadiusCardView = findViewById(R.id.container)
|
||||
var detailBtn: TextView? = null
|
||||
var isMute = true
|
||||
private var mIsFirstPlay = true
|
||||
private var mMuteDisposable: Disposable? = null
|
||||
private var mMaskDisposable: Disposable? = null
|
||||
private val mUUID = UUID.randomUUID().toString()
|
||||
@ -89,10 +91,11 @@ class AutomaticVideoView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||
mVideoAllCallBack.onClickStartThumb(mOriginUrl, mTitle, this)
|
||||
}
|
||||
prepareVideo()
|
||||
val topVideoVoiceStatus = SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true)
|
||||
if (topVideoVoiceStatus) {
|
||||
violenceUpdateMuteStatus()
|
||||
if (mIsFirstPlay) {
|
||||
isMute = SPUtils.getBoolean(Constants.SP_VIDEO_PLAY_MUTE, true)
|
||||
mIsFirstPlay = false
|
||||
}
|
||||
violenceUpdateMuteStatus()
|
||||
resetDetailMask()
|
||||
}
|
||||
|
||||
@ -106,15 +109,21 @@ class AutomaticVideoView @JvmOverloads constructor(context: Context, attrs: Attr
|
||||
mMuteDisposable?.dispose()
|
||||
mMuteDisposable = null
|
||||
}
|
||||
mute()
|
||||
if (isMute) {
|
||||
mute()
|
||||
} else {
|
||||
unMute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun mute() {
|
||||
isMute = true
|
||||
CustomManager.getCustomManager(getKey()).isNeedMute = true
|
||||
}
|
||||
|
||||
fun unMute() {
|
||||
isMute = false
|
||||
CustomManager.getCustomManager(getKey()).isNeedMute = false
|
||||
}
|
||||
|
||||
|
||||
@ -29,7 +29,10 @@ class ScrollCalculatorHelper(
|
||||
|
||||
fun enableAndPlayIfValid() {
|
||||
isEnabled = true
|
||||
playIfValid()
|
||||
}
|
||||
|
||||
fun playIfValid() {
|
||||
if (mListRv.isAttachedToWindow
|
||||
&& mListRv.scrollState == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
playVideo(mListRv)
|
||||
|
||||
@ -1,93 +0,0 @@
|
||||
package com.gh.gamecenter.install
|
||||
|
||||
import android.app.Notification
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.app.Service
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import androidx.core.app.NotificationCompat
|
||||
import com.lightgame.download.ForegroundNotificationManager
|
||||
import com.lightgame.utils.Utils
|
||||
import java.util.*
|
||||
|
||||
class InstallService : Service() {
|
||||
|
||||
private var mForegroundTimer: Timer? = null
|
||||
private var mForegroundNotificationManager: ForegroundNotificationManager? = null
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
mForegroundNotificationManager = ForegroundNotificationManager(this, this.application)
|
||||
Utils.log(InstallService::class.java.simpleName, "onCreate")
|
||||
}
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
Utils.log(InstallService::class.java.simpleName, "onStartCommand")
|
||||
val notificationId = 9999
|
||||
if (intent != null && intent.extras != null) {
|
||||
val serviceAction = intent.getStringExtra(KEY_SERVICE_ACTION)
|
||||
if (START_FOREGROUND == serviceAction) {
|
||||
startForegroundIfNeeded(notificationId)
|
||||
} else if (STOP_FOREGROUND == serviceAction) {
|
||||
startForegroundIfNeeded(notificationId)
|
||||
stopForegroundIfNeeded(notificationId)
|
||||
}
|
||||
} else {
|
||||
startForegroundIfNeeded(notificationId)
|
||||
stopForegroundIfNeeded(notificationId)
|
||||
}
|
||||
|
||||
// 不需要 intent 为空的重建
|
||||
return START_NOT_STICKY
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent?): IBinder? {
|
||||
return null
|
||||
}
|
||||
|
||||
private fun startForegroundIfNeeded(notificationId: Int) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val channel =
|
||||
NotificationChannel(SERVICE_CHANNEL_ID, SERVICE_CHANNEL_ID, NotificationManager.IMPORTANCE_LOW)
|
||||
val manager = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
manager.createNotificationChannel(channel)
|
||||
val notification: Notification = NotificationCompat.Builder(this, SERVICE_CHANNEL_ID)
|
||||
.setSmallIcon(com.lightgame.R.drawable.ic_download_notification)
|
||||
.setContentTitle("光环助手安装服务")
|
||||
.build()
|
||||
mForegroundNotificationManager?.notify(notificationId, notification)
|
||||
|
||||
mForegroundTimer?.cancel()
|
||||
mForegroundTimer = Timer()
|
||||
|
||||
val task: TimerTask = object : TimerTask() {
|
||||
override fun run() {
|
||||
stopForegroundIfNeeded(notificationId)
|
||||
}
|
||||
}
|
||||
|
||||
mForegroundTimer?.schedule(task, FOREGROUND_COUNT_DOWN_TIME)
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopForegroundIfNeeded(notificationId: Int) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mForegroundNotificationManager?.cancel(notificationId)
|
||||
|
||||
mForegroundTimer?.cancel()
|
||||
mForegroundTimer = null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
companion object {
|
||||
private const val SERVICE_CHANNEL_ID = "安装服务"
|
||||
private const val FOREGROUND_COUNT_DOWN_TIME = 20 * 1000L
|
||||
|
||||
const val START_FOREGROUND = "start_foreground"
|
||||
const val STOP_FOREGROUND = "stop_foreground"
|
||||
const val KEY_SERVICE_ACTION = "service_action"
|
||||
}
|
||||
}
|
||||
@ -59,7 +59,7 @@ class MiniGameSearchDefaultRankAdapter(
|
||||
_id = rank.id,
|
||||
mName = rank.name,
|
||||
miniGameAppId = rank.link.link ?: "",
|
||||
miniGameType = Constants.WECHAT_MINI_GAME,
|
||||
miniGameCategory = Constants.WECHAT_MINI_GAME,
|
||||
usage = rank.usage ?: 0
|
||||
)
|
||||
holder.binding.playCount.visibility = View.VISIBLE
|
||||
|
||||
@ -21,11 +21,15 @@ class MiniGameSearchResultRepository(
|
||||
return api.getSearchMiniGameList(key, page, 20)
|
||||
}
|
||||
|
||||
override fun getSearchMiniGameCPM(key: String?): Observable<List<GameEntity>> {
|
||||
return Observable.just(emptyList())
|
||||
}
|
||||
|
||||
override fun getSearchSubject(key: String?, page: Int): Observable<List<SearchSubjectEntity>> {
|
||||
return Observable.just(emptyList())
|
||||
}
|
||||
|
||||
override fun getWGameCPMGameList(): Single<MutableList<GameEntity>> {
|
||||
return mWGameSubjectCPMDataSource.getRecommendCPMList(1)
|
||||
return mWGameSubjectCPMDataSource.getUserRecommendCPMList()
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,7 @@ class WGameSubjectCPMListRepository(
|
||||
) : ISubjectListRepository {
|
||||
|
||||
override fun getColumn(column_id: String?, page: Int, sort: String?, order: String?): Single<MutableList<GameEntity>> {
|
||||
return dataSource.getRecommendCPMList(page)
|
||||
return dataSource.getEditorRecommendCPMList(page)
|
||||
}
|
||||
|
||||
override fun getColumnSettings(column_id: String?): Observable<SubjectSettingEntity> {
|
||||
|
||||
@ -14,7 +14,51 @@ class WGameSubjectCPMRemoteDataSource(
|
||||
private val api: WGameCPMApiService = RetrofitManager.getInstance().wGameCPMApi
|
||||
) {
|
||||
|
||||
fun getRecommendCPMList(page: Int, pageSize: Int = 10): Single<MutableList<GameEntity>> {
|
||||
fun getEditorRecommendCPMList(page: Int, pageSize: Int = 10): Single<MutableList<GameEntity>> {
|
||||
val meta = MetaUtil.getMeta()
|
||||
val request = mapOf(
|
||||
"head" to mapOf(
|
||||
"busiAppid" to Config.WGAME_CPM_BUSIAPPID,
|
||||
"oaid" to (meta.oaid ?: ""),
|
||||
"manufacturer" to (meta.manufacturer ?: ""),
|
||||
"mode" to (meta.model ?: ""),
|
||||
"androidId" to (MetaUtil.getAndroidId()),
|
||||
"imei" to (MetaUtil.getIMEI())
|
||||
),
|
||||
"body" to mapOf(
|
||||
"page" to page - 1,
|
||||
"pageSize" to pageSize,
|
||||
)
|
||||
)
|
||||
return api.getEditorRecommendList(request.toRequestBody())
|
||||
.map {
|
||||
if (it.ret == 0) {
|
||||
it.appInfoList.map { info ->
|
||||
GameEntity(
|
||||
mName = info.appName,
|
||||
mIcon = info.logo,
|
||||
mBrief = info.briefIntro,
|
||||
miniGameUid = info.appID,
|
||||
miniGameAppId = info.userName,
|
||||
miniGameCategory = Constants.WECHAT_MINI_GAME,
|
||||
profit = Constants.WECHAT_MINI_GAME_PROFIT_CPM,
|
||||
miniGameAppStatus = 2,
|
||||
miniGameAppPath = info.wechatAppPath,
|
||||
miniGameExtData = info.extData,
|
||||
miniGameRecommendId = info.recommendID,
|
||||
mTagStyle = arrayListOf(
|
||||
TagStyleEntity(name = info.categoryName),
|
||||
TagStyleEntity(name = info.subcategoryName)
|
||||
)
|
||||
)
|
||||
}.toMutableList()
|
||||
} else {
|
||||
mutableListOf()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun getUserRecommendCPMList(page: Int = 1, pageSize: Int = 10): Single<MutableList<GameEntity>> {
|
||||
val meta = MetaUtil.getMeta()
|
||||
val request = mapOf(
|
||||
"head" to mapOf(
|
||||
@ -40,7 +84,8 @@ class WGameSubjectCPMRemoteDataSource(
|
||||
mBrief = info.briefIntro,
|
||||
miniGameUid = info.appID,
|
||||
miniGameAppId = info.userName,
|
||||
miniGameType = Constants.WECHAT_MINI_GAME_CPM,
|
||||
miniGameCategory = Constants.WECHAT_MINI_GAME,
|
||||
profit = Constants.WECHAT_MINI_GAME_PROFIT_CPM,
|
||||
miniGameAppStatus = 2,
|
||||
miniGameAppPath = info.wechatAppPath,
|
||||
miniGameExtData = info.extData,
|
||||
|
||||
@ -19,6 +19,7 @@ import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout.PAGE_INDEX
|
||||
import com.gh.gamecenter.common.base.adapter.FragmentAdapter
|
||||
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.common.view.BugFixedPopupWindow
|
||||
import com.gh.gamecenter.common.view.TabIndicatorView
|
||||
@ -28,10 +29,12 @@ import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.databinding.PopupMyGameGuideBinding
|
||||
import com.gh.gamecenter.gamecollection.publish.GameCollectionEditActivity
|
||||
import com.google.android.material.tabs.TabLayout
|
||||
import com.therouter.router.Route
|
||||
|
||||
/**
|
||||
* 我的游戏
|
||||
*/
|
||||
@Route(
|
||||
path = RouteConsts.activity.myGameActivity,
|
||||
description = "我的游戏"
|
||||
)
|
||||
class MyGameActivity : BaseActivity() {
|
||||
|
||||
private val viewModel by viewModels<MyGameActivityViewModel>()
|
||||
|
||||
@ -3,13 +3,16 @@ package com.gh.gamecenter.personal
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.ToolBarActivity
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.therouter.router.Route
|
||||
|
||||
/**
|
||||
* 收货信息
|
||||
*/
|
||||
@Route(
|
||||
path = RouteConsts.activity.deliveryInfoActivity,
|
||||
description = "收货信息"
|
||||
)
|
||||
class DeliveryInfoActivity : ToolBarActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
@ -217,7 +217,7 @@ class HaloPersonalBannerAdapter(context: Context) : BaseRecyclerAdapter<Recycler
|
||||
}
|
||||
|
||||
"开服管理" -> {// 开服管理
|
||||
DirectUtils.directToServersCalendarManagement(mContext, "我的光环-活动位")
|
||||
DirectUtils.directToServersCalendarManagement("我的光环-活动位")
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
@ -209,7 +209,7 @@ class HaloPersonalFunctionAdapter(context: Context) : BaseRecyclerAdapter<Recycl
|
||||
}
|
||||
|
||||
"开服管理" -> {// 开服管理
|
||||
DirectUtils.directToServersCalendarManagement(mContext, "我的光环-更多功能")
|
||||
DirectUtils.directToServersCalendarManagement("我的光环-更多功能")
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
@ -243,7 +243,7 @@ class HaloPersonalRecommendAdapter(val context: Context) : BaseRecyclerAdapter<R
|
||||
}
|
||||
|
||||
"开服管理" -> {// 开服管理
|
||||
DirectUtils.directToServersCalendarManagement(mContext, "我的光环-推荐位")
|
||||
DirectUtils.directToServersCalendarManagement("我的光环-推荐位")
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
@ -6,14 +6,16 @@ import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.os.Bundle
|
||||
import android.widget.ImageView
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
|
||||
import com.gh.gamecenter.common.utils.BitmapUtils
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.common.provider.CropImageProviderImpl.Companion.IMAGE_TYPE_PERSONAL_BACKGROUND
|
||||
import com.gh.gamecenter.CropImageActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.BitmapUtils
|
||||
import com.gh.gamecenter.common.view.cropbox.CropBoxStyle
|
||||
import com.gh.gamecenter.core.runOnIoThread
|
||||
import com.gh.gamecenter.core.utils.DisplayUtils
|
||||
import com.gh.gamecenter.databinding.ActivityBackgroundClipBinding
|
||||
import java.io.File
|
||||
import java.lang.ref.SoftReference
|
||||
@ -33,7 +35,6 @@ class BackgroundClipActivity : BaseActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
DisplayUtils.transparentStatusBar(this)
|
||||
mBinding = ActivityBackgroundClipBinding.bind(mContentView)
|
||||
mBinding.cropImageIv.setCropRatio(392 / 360F)
|
||||
|
||||
mBinding.cancelTv.setOnClickListener {
|
||||
finish()
|
||||
@ -84,6 +85,8 @@ class BackgroundClipActivity : BaseActivity() {
|
||||
val intent = Intent(context, BackgroundClipActivity::class.java)
|
||||
intent.putExtra(EntranceConsts.KEY_PATH, picturePath)
|
||||
intent.putExtra(EntranceConsts.KEY_ENTRANCE, entrance)
|
||||
intent.putExtra(EntranceConsts.KEY_IMAGE_CROP_STYLE, CropBoxStyle.Rectangle(356F / 328))
|
||||
intent.putExtra(EntranceConsts.KEY_IMAGE_TYPE, IMAGE_TYPE_PERSONAL_BACKGROUND)
|
||||
return intent
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import android.view.View
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.gh.common.provider.CropImageProviderImpl.Companion.IMAGE_TYPE_PERSONAL_BACKGROUND
|
||||
import com.gh.gamecenter.CropImageActivity
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
|
||||
@ -78,7 +79,8 @@ class PersonalityBackgroundFragment : ToolbarFragment() {
|
||||
requireContext(),
|
||||
ChooseType.IMAGE,
|
||||
1,
|
||||
"个性背景"
|
||||
"个性背景",
|
||||
IMAGE_TYPE_PERSONAL_BACKGROUND
|
||||
), MEDIA_STORE_REQUEST
|
||||
)
|
||||
}
|
||||
@ -89,19 +91,15 @@ class PersonalityBackgroundFragment : ToolbarFragment() {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
|
||||
if (requestCode == MEDIA_STORE_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
val selectedPaths = Matisse.obtainPathResult(data)
|
||||
if (!selectedPaths.isNullOrEmpty()) {
|
||||
val intent = BackgroundClipActivity.getIntent(requireContext(), selectedPaths[0], mEntrance)
|
||||
startActivityForResult(intent, REQUEST_CODE_IMAGE_CROP)
|
||||
}
|
||||
} else if (requestCode == REQUEST_CODE_IMAGE_CROP && resultCode == Activity.RESULT_OK) {
|
||||
if (data != null) {
|
||||
val imagePath = data.getStringExtra(CropImageActivity.RESULT_CLIP_PATH)
|
||||
val intent = BackgroundPreviewActivity.getIntent(
|
||||
requireContext(), imagePath
|
||||
?: "", null
|
||||
)
|
||||
requireActivity().startActivityForResult(intent, CHANGE_BACKGROUND_SUCCESS)
|
||||
if (imagePath != null) {
|
||||
val intent = BackgroundPreviewActivity.getIntent(
|
||||
requireContext(), imagePath
|
||||
?: "", null
|
||||
)
|
||||
requireActivity().startActivityForResult(intent, CHANGE_BACKGROUND_SUCCESS)
|
||||
}
|
||||
}
|
||||
} else if (requestCode == CHANGE_BACKGROUND_SUCCESS && resultCode == Activity.RESULT_OK) {
|
||||
requireActivity().finish()
|
||||
@ -119,7 +117,6 @@ class PersonalityBackgroundFragment : ToolbarFragment() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val REQUEST_CODE_IMAGE_CROP = 100
|
||||
const val MEDIA_STORE_REQUEST = 101
|
||||
const val CHANGE_BACKGROUND_SUCCESS = 102
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter.provider
|
||||
import android.content.*
|
||||
import android.database.Cursor
|
||||
import android.database.sqlite.SQLiteDatabase
|
||||
import android.database.sqlite.SQLiteException
|
||||
import android.database.sqlite.SQLiteFullException
|
||||
import android.database.sqlite.SQLiteOpenHelper
|
||||
import android.net.Uri
|
||||
@ -12,6 +13,7 @@ import com.gh.gamecenter.BuildConfig
|
||||
import com.gh.gamecenter.common.constant.Constants
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.gh.gamecenter.core.utils.SPUtils
|
||||
import com.gh.gamecenter.core.utils.ToastUtils
|
||||
import com.gh.gamecenter.login.entity.UserInfoEntity
|
||||
import com.gh.gamecenter.login.user.UserRepository
|
||||
import com.halo.assistant.HaloApp
|
||||
@ -77,7 +79,12 @@ class GhContentProvider : ContentProvider() {
|
||||
}
|
||||
|
||||
override fun onCreate(): Boolean {
|
||||
initProviderSqliteHelper(context);
|
||||
try {
|
||||
val context = context ?: return false
|
||||
initProviderSqliteHelper(context)
|
||||
} catch (e: SQLiteException) {
|
||||
ToastUtils.toast("数据库内存已满,无法同步")
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@ import com.gh.gamecenter.qa.editor.GameActivity
|
||||
import com.gh.gamecenter.qa.entity.ArticleDetailEntity
|
||||
import com.gh.gamecenter.qa.questions.edit.TagsSelectFragment
|
||||
import com.gh.gamecenter.qa.video.publish.VideoPublishFragment
|
||||
import com.gh.gamecenter.video.poster.video.VideoPosterFragment
|
||||
import com.lightgame.utils.Util_System_Keyboard
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -123,6 +124,7 @@ class ArticleEditActivity : BaseRichEditorActivity<ArticleEditViewModel>(), Keyb
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
VideoPosterFragment.clearVideoCoverCache(this)
|
||||
updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
|
||||
mBinding = ActivityCommunityArticleEditBinding.bind(mContentView)
|
||||
setToolbarMenu(R.menu.menu_answer_post)
|
||||
@ -651,8 +653,14 @@ class ArticleEditActivity : BaseRichEditorActivity<ArticleEditViewModel>(), Keyb
|
||||
|
||||
private fun setForumUI() {
|
||||
mBinding.forumIconView.visibility = View.VISIBLE
|
||||
mBinding.forumContainer.background = ContextCompat.getDrawable(this, com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999)
|
||||
mBinding.articleGameName.setTextColor(ContextCompat.getColor(this, com.gh.gamecenter.common.R.color.text_secondary))
|
||||
mBinding.forumContainer.background =
|
||||
ContextCompat.getDrawable(this, com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999)
|
||||
mBinding.articleGameName.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
this,
|
||||
com.gh.gamecenter.common.R.color.text_secondary
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun setSectionUI(isEmpty: Boolean) {
|
||||
|
||||
@ -76,7 +76,8 @@ class ChooseForumContainerFragment : LazyListFragment<ForumEntity, ChooseForumCo
|
||||
SearchActivity.toTrackSearchType(mSearchType),
|
||||
forumEntity.id,
|
||||
HtmlUtils.stripHtml(forumEntity.name),
|
||||
forumEntity.typeChinese
|
||||
forumEntity.typeChinese,
|
||||
position
|
||||
)
|
||||
}
|
||||
) { enity, position ->
|
||||
|
||||
@ -12,15 +12,13 @@ import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.widget.TextViewCompat
|
||||
import com.gh.common.util.NewLogUtils
|
||||
import com.gh.gamecenter.common.base.fragment.BaseDraggableDialogFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.entity.NormalShareEntity
|
||||
import com.gh.gamecenter.common.eventbus.EBShare
|
||||
import com.gh.gamecenter.common.utils.ShareUtils
|
||||
import com.gh.gamecenter.common.utils.debounceActionWithInterval
|
||||
import com.gh.gamecenter.common.utils.dip2px
|
||||
import com.gh.gamecenter.common.utils.setDrawableTop
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.databinding.DialogGameDetailMoreBinding
|
||||
import com.gh.gamecenter.entity.MenuItemEntity
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -32,6 +30,7 @@ class MoreFunctionPanelDialog : BaseDraggableDialogFragment() {
|
||||
private var mTitle: String = ""
|
||||
private var mParentTag: String = ""
|
||||
private var mStatus: String = ""
|
||||
private var titleStyle: Int = MORE_DIALOG_TITLE_STYLE_CENTER_BOLD
|
||||
private var mShareEntity: NormalShareEntity? = null
|
||||
private var mShareUtils: ShareUtils? = null
|
||||
|
||||
@ -43,6 +42,7 @@ class MoreFunctionPanelDialog : BaseDraggableDialogFragment() {
|
||||
mStatus = getString(KEY_STATUS) ?: ""
|
||||
mShareEntity = getParcelable(KEY_SHARE)
|
||||
mParentTag = getString(EntranceConsts.KEY_PARENT_TAG) ?: ""
|
||||
titleStyle = getInt(KEY_TITLE_STYLE)
|
||||
}
|
||||
mShareUtils = getShareUtils()
|
||||
}
|
||||
@ -59,11 +59,30 @@ class MoreFunctionPanelDialog : BaseDraggableDialogFragment() {
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
binding.gameNameTv.text = mTitle
|
||||
binding.gameNameTv.gravity = Gravity.CENTER
|
||||
binding.gameIconView.visibility = View.GONE
|
||||
binding.feedbackTv.visibility = View.GONE
|
||||
binding.copyrightTv.visibility = View.GONE
|
||||
|
||||
when (titleStyle) {
|
||||
MORE_DIALOG_TITLE_STYLE_CENTER_BOLD -> {
|
||||
TextViewCompat.setTextAppearance(binding.gameNameTv, com.gh.gamecenter.common.R.style.TextBody2B)
|
||||
binding.gameNameTv.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(requireContext()))
|
||||
binding.gameNameTv.gravity = Gravity.CENTER
|
||||
}
|
||||
|
||||
MORE_DIALOG_TITLE_STYLE_LEFT_BOLD -> {
|
||||
TextViewCompat.setTextAppearance(binding.gameNameTv, com.gh.gamecenter.common.R.style.TextBody2B)
|
||||
binding.gameNameTv.setTextColor(com.gh.gamecenter.common.R.color.text_primary.toColor(requireContext()))
|
||||
binding.gameNameTv.gravity = Gravity.START
|
||||
}
|
||||
|
||||
MORE_DIALOG_TITLE_STYLE_CENTER_NORMAL -> {
|
||||
TextViewCompat.setTextAppearance(binding.gameNameTv, com.gh.gamecenter.common.R.style.TextBody2)
|
||||
binding.gameNameTv.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
binding.gameNameTv.gravity = Gravity.CENTER
|
||||
}
|
||||
}
|
||||
|
||||
binding.shareWechatTv.setOnClickListener {
|
||||
debounceActionWithInterval(it.id, 2000) {
|
||||
if (checkStatusIsPass()) {
|
||||
@ -142,10 +161,12 @@ class MoreFunctionPanelDialog : BaseDraggableDialogFragment() {
|
||||
toast("内容审核中,不支持分享")
|
||||
false
|
||||
}
|
||||
|
||||
"fail" -> {
|
||||
toast("内容审核不通过,不支持分享")
|
||||
false
|
||||
}
|
||||
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
@ -227,8 +248,13 @@ class MoreFunctionPanelDialog : BaseDraggableDialogFragment() {
|
||||
const val KEY_TITLE = "title"
|
||||
const val KEY_SHARE = "share"
|
||||
const val KEY_STATUS = "status"
|
||||
const val KEY_TITLE_STYLE = "title_style"
|
||||
const val REQUEST_CODE = 1101
|
||||
|
||||
const val MORE_DIALOG_TITLE_STYLE_CENTER_BOLD = 0 // 居中-加粗
|
||||
const val MORE_DIALOG_TITLE_STYLE_LEFT_BOLD = 1 // 左对齐-加粗
|
||||
const val MORE_DIALOG_TITLE_STYLE_CENTER_NORMAL = 2 // 居中
|
||||
|
||||
@JvmStatic
|
||||
fun showMoreDialog(
|
||||
activity: AppCompatActivity,
|
||||
@ -236,7 +262,8 @@ class MoreFunctionPanelDialog : BaseDraggableDialogFragment() {
|
||||
title: String,
|
||||
share: NormalShareEntity,
|
||||
status: String,
|
||||
parentTag: String
|
||||
parentTag: String,
|
||||
titleStyle: Int = MORE_DIALOG_TITLE_STYLE_CENTER_BOLD
|
||||
) {
|
||||
MoreFunctionPanelDialog().apply {
|
||||
arguments = Bundle().apply {
|
||||
@ -245,6 +272,7 @@ class MoreFunctionPanelDialog : BaseDraggableDialogFragment() {
|
||||
putParcelable(KEY_SHARE, share)
|
||||
putString(KEY_STATUS, status)
|
||||
putString(EntranceConsts.KEY_PARENT_TAG, parentTag)
|
||||
putInt(KEY_TITLE_STYLE, titleStyle)
|
||||
}
|
||||
}.show(
|
||||
activity.supportFragmentManager,
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
package com.gh.gamecenter.qa.editor
|
||||
|
||||
import android.content.Context
|
||||
import android.webkit.JavascriptInterface
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.common.util.*
|
||||
import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.view.RichEditor
|
||||
import com.gh.gamecenter.GameDetailActivity
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.common.utils.clickToastByStatus
|
||||
import com.gh.gamecenter.common.utils.tryWithDefaultCatch
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.utils.GsonUtils
|
||||
import com.gh.gamecenter.entity.MyVideoEntity
|
||||
import com.gh.gamecenter.gamecollection.detail.GameCollectionDetailActivity
|
||||
import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity
|
||||
@ -61,7 +60,7 @@ class OnLinkClickListener(
|
||||
)
|
||||
}
|
||||
"game_collection" -> {
|
||||
context.startActivity(GameCollectionDetailActivity.getIntent(context, insertEntity.id ?: ""))
|
||||
context.startActivity(GameCollectionDetailActivity.getIntent(context, insertEntity.id ?: "", entrance = entrance))
|
||||
}
|
||||
"video" -> {
|
||||
DirectUtils.directToVideoDetail(context, insertEntity.id ?: "", entrance, "$path-链接")
|
||||
|
||||
@ -50,6 +50,7 @@ import com.gh.gamecenter.qa.entity.QuestionsDetailEntity
|
||||
import com.gh.gamecenter.qa.questions.draft.QuestionDraftActivity
|
||||
import com.gh.gamecenter.qa.questions.edit.tip.QuestionTitleTipAdapter
|
||||
import com.gh.gamecenter.qa.video.publish.VideoPublishFragment
|
||||
import com.gh.gamecenter.video.poster.video.VideoPosterFragment
|
||||
import com.lightgame.utils.Util_System_Keyboard
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@ -147,6 +148,7 @@ class QuestionEditActivity : BaseRichEditorActivity<QuestionEditViewModel>(),
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
VideoPosterFragment.clearVideoCoverCache(this)
|
||||
updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
|
||||
setToolbarMenu(R.menu.menu_question_post)
|
||||
mToolbar.navigationIcon = null
|
||||
@ -280,12 +282,14 @@ class QuestionEditActivity : BaseRichEditorActivity<QuestionEditViewModel>(),
|
||||
detailEntity != null -> { // 问题编辑
|
||||
setPatchContent(detailEntity)
|
||||
}
|
||||
|
||||
draftEntity != null -> { //草稿编辑
|
||||
mViewModel.questionDraftEntity = draftEntity
|
||||
setQuestionDraft(draftEntity)
|
||||
mViewModel.getQuestionDraftContent(draftEntity.id)
|
||||
mBaseHandler.sendEmptyMessageDelayed(1, SAVE_DRAFTS_INTERVAL_TIME.toLong())
|
||||
}
|
||||
|
||||
else -> { // 新增问题
|
||||
var searchKey = intent.getStringExtra(EntranceConsts.KEY_QUESTIONS_SEARCH_KEY)
|
||||
if (!searchKey.isNullOrEmpty() && searchKey.length > QuestionEditViewModel.QUESTION_TITLE_MAX_LENGTH)
|
||||
@ -468,6 +472,7 @@ class QuestionEditActivity : BaseRichEditorActivity<QuestionEditViewModel>(),
|
||||
finish()
|
||||
}
|
||||
}
|
||||
|
||||
SaveDraftType.AUTO -> {
|
||||
if (pair.second) {
|
||||
if (mPostDraftsCount >= SAVE_DRAFTS_TOAST_COUNT) {
|
||||
@ -478,6 +483,7 @@ class QuestionEditActivity : BaseRichEditorActivity<QuestionEditViewModel>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SaveDraftType.SKIP -> {
|
||||
if (pair.second) {
|
||||
Utils.toast(this, "问题已保存到草稿箱")
|
||||
@ -690,7 +696,12 @@ class QuestionEditActivity : BaseRichEditorActivity<QuestionEditViewModel>(),
|
||||
return false
|
||||
}
|
||||
DialogHelper.showDialog(
|
||||
this, "提示", "确定退出修改?已编辑的内容将丢失", "继续编辑", " 退出", cancelClickCallback = { finish() },
|
||||
this,
|
||||
"提示",
|
||||
"确定退出修改?已编辑的内容将丢失",
|
||||
"继续编辑",
|
||||
" 退出",
|
||||
cancelClickCallback = { finish() },
|
||||
extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true)
|
||||
)
|
||||
return true
|
||||
@ -847,7 +858,12 @@ class QuestionEditActivity : BaseRichEditorActivity<QuestionEditViewModel>(),
|
||||
mBinding.forumIconView.visibility = View.VISIBLE
|
||||
mBinding.forumContainer.background =
|
||||
ContextCompat.getDrawable(this, com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999)
|
||||
mBinding.chooseForumTv.setTextColor(ContextCompat.getColor(this, com.gh.gamecenter.common.R.color.text_secondary))
|
||||
mBinding.chooseForumTv.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
this,
|
||||
com.gh.gamecenter.common.R.color.text_secondary
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun setSectionUI(isEmpty: Boolean) {
|
||||
|
||||
@ -13,6 +13,7 @@ import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.feature.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.qa.BbsType
|
||||
import com.gh.gamecenter.video.poster.video.VideoPosterFragment
|
||||
|
||||
/**
|
||||
* 发视频
|
||||
@ -22,6 +23,7 @@ class VideoPublishActivity : ToolBarActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
VideoPosterFragment.clearVideoCoverCache(this)
|
||||
updateStatusBarColor(com.gh.gamecenter.common.R.color.ui_surface, com.gh.gamecenter.common.R.color.ui_surface)
|
||||
mToolbar.navigationIcon = null
|
||||
findViewById<View>(R.id.backBtn).setOnClickListener { onBackPressed() }
|
||||
|
||||
@ -23,20 +23,24 @@ import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.ToolbarFragment
|
||||
import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.entity.CommunityEntity
|
||||
import com.gh.gamecenter.common.entity.LocalVideoEntity
|
||||
import com.gh.gamecenter.common.entity.NotificationUgc
|
||||
import com.gh.gamecenter.common.mvvm.Status
|
||||
import com.gh.gamecenter.feature.selector.LocalMediaActivity
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.AppExecutor
|
||||
import com.gh.gamecenter.core.runOnUiThread
|
||||
import com.gh.gamecenter.core.utils.*
|
||||
import com.gh.gamecenter.databinding.FragmentVideoPublishBinding
|
||||
import com.gh.gamecenter.entity.*
|
||||
import com.gh.gamecenter.entity.ActivityLabelEntity
|
||||
import com.gh.gamecenter.entity.ForumDetailEntity
|
||||
import com.gh.gamecenter.entity.VideoDraftEntity
|
||||
import com.gh.gamecenter.entity.VideoEntity
|
||||
import com.gh.gamecenter.feature.entity.ForumVideoEntity
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.selector.ChooseType
|
||||
import com.gh.gamecenter.feature.selector.LocalMediaActivity
|
||||
import com.gh.gamecenter.login.user.UserManager
|
||||
import com.gh.gamecenter.qa.BbsType
|
||||
import com.gh.gamecenter.qa.dialog.ChooseActivityDialogFragment
|
||||
@ -44,12 +48,12 @@ import com.gh.gamecenter.qa.dialog.ChooseForumActivity
|
||||
import com.gh.gamecenter.qa.dialog.ChooseSectionDialogFragment
|
||||
import com.gh.gamecenter.qa.dialog.InputUrlDialogFragment
|
||||
import com.gh.gamecenter.qa.editor.GameActivity
|
||||
import com.gh.gamecenter.video.poster.PosterEditActivity
|
||||
import com.gh.gamecenter.video.upload.OnUploadListener
|
||||
import com.gh.gamecenter.video.upload.UploadManager
|
||||
import com.gh.gamecenter.video.upload.view.VideoFileEntity
|
||||
import com.gh.gamecenter.video.videomanager.VideoDraftActivity
|
||||
import com.lightgame.utils.Util_System_Keyboard
|
||||
import com.therouter.TheRouter
|
||||
import java.io.File
|
||||
|
||||
class VideoPublishFragment : ToolbarFragment(), KeyboardHeightObserver {
|
||||
@ -661,7 +665,8 @@ class VideoPublishFragment : ToolbarFragment(), KeyboardHeightObserver {
|
||||
|
||||
private fun setForumUI() {
|
||||
mBinding.forumIconView.visibility = View.VISIBLE
|
||||
mBinding.forumContainer.background = com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999.toDrawable(requireContext())
|
||||
mBinding.forumContainer.background =
|
||||
com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999.toDrawable(requireContext())
|
||||
mBinding.chooseForumTv.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
}
|
||||
|
||||
@ -757,29 +762,24 @@ class VideoPublishFragment : ToolbarFragment(), KeyboardHeightObserver {
|
||||
private fun startMediaStore() {
|
||||
try {
|
||||
PermissionHelper.checkStoragePermissionBeforeAction(requireContext()) {
|
||||
var intent: Intent? = null
|
||||
val postcard = TheRouter.build(RouteConsts.activity.videoCoverEditActivity)
|
||||
when {
|
||||
mVideoFileEntity?.url?.isNotEmpty() == true -> {
|
||||
val videoEntity = VideoEntity(
|
||||
length = mVideoFileEntity?.length ?: 0, url = mVideoFileEntity?.url ?: ""
|
||||
)
|
||||
intent = PosterEditActivity.getIntentByVideo(
|
||||
requireContext(),
|
||||
videoEntity
|
||||
)
|
||||
postcard.withParcelable(EntranceConsts.KEY_VIDEO_ENTITY, videoEntity)
|
||||
}
|
||||
|
||||
mVideoFileEntity?.path?.isNotEmpty() == true -> {
|
||||
intent = PosterEditActivity.getIntentByPath(
|
||||
requireContext(), mVideoFileEntity?.url ?: ""
|
||||
)
|
||||
postcard.withString(EntranceConsts.KEY_PATH_VIDEO, mVideoFileEntity?.url ?: "")
|
||||
}
|
||||
|
||||
else -> {
|
||||
throwExceptionInDebug("video not found")
|
||||
}
|
||||
}
|
||||
startActivityForResult(intent, REQUEST_CODE_IMAGE_CROP)
|
||||
postcard.navigation(requireActivity(), REQUEST_CODE_IMAGE_CROP)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
toast(R.string.media_image_hint)
|
||||
@ -966,9 +966,11 @@ class VideoPublishFragment : ToolbarFragment(), KeyboardHeightObserver {
|
||||
super.onDarkModeChanged()
|
||||
setSectionUI(mViewModel.selectSection == null)
|
||||
mBinding.activityTv.setTextColor(
|
||||
if (mViewModel.selectActivityLabelEntity != null) com.gh.gamecenter.common.R.color.text_FA8500.toColor(requireContext()) else com.gh.gamecenter.common.R.color.text_primary.toColor(
|
||||
requireContext()
|
||||
)
|
||||
if (mViewModel.selectActivityLabelEntity != null) {
|
||||
com.gh.gamecenter.common.R.color.text_FA8500.toColor(requireContext())
|
||||
} else {
|
||||
com.gh.gamecenter.common.R.color.text_primary.toColor(requireContext())
|
||||
}
|
||||
)
|
||||
mBinding.forumContainer.background =
|
||||
if (mViewModel.communityEntity == null) R.drawable.button_round_primary_light.toDrawable(requireContext()) else com.gh.gamecenter.common.R.drawable.bg_shape_f5_radius_999.toDrawable(
|
||||
|
||||
@ -19,7 +19,6 @@ import com.gh.gamecenter.core.utils.SPUtils;
|
||||
import com.gh.gamecenter.entity.NewApiSettingsEntity;
|
||||
import com.gh.gamecenter.eventbus.EBPackage;
|
||||
import com.gh.gamecenter.feature.entity.GameInstall;
|
||||
import com.gh.gamecenter.install.InstallService;
|
||||
import com.gh.gamecenter.manager.PackagesManager;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
@ -27,8 +26,6 @@ import com.lightgame.utils.Utils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 监听安装包变更
|
||||
*/
|
||||
@ -49,14 +46,6 @@ public class PackageChangeBroadcastReceiver extends BroadcastReceiver {
|
||||
PackageHelper.INSTANCE.dumpInstalledListCache();
|
||||
ExtensionsKt.doOnMainProcessOnly(() -> {
|
||||
Utils.log(TAG, "onReceive->" + intent.getAction() + "==" + intent.getDataString());
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU
|
||||
&& Build.MANUFACTURER.toLowerCase(Locale.CHINA).contains("xiaomi")) {
|
||||
Intent foregroundServiceIntent = new Intent(context, InstallService.class);
|
||||
foregroundServiceIntent.putExtra(InstallService.KEY_SERVICE_ACTION, InstallService.STOP_FOREGROUND);
|
||||
context.startForegroundService(foregroundServiceIntent);
|
||||
}
|
||||
|
||||
// 接收安装广播
|
||||
if (intent.getAction().equals(mActions.getAdd())) {
|
||||
String packageName = intent.getDataString();
|
||||
|
||||
@ -48,6 +48,7 @@ import com.gh.gamecenter.entity.GameColumnCollection;
|
||||
import com.gh.gamecenter.entity.GameData;
|
||||
import com.gh.gamecenter.entity.GameDigestEntity;
|
||||
import com.gh.gamecenter.entity.GameGuidePopupEntity;
|
||||
import com.gh.gamecenter.entity.GameServerTestTopGame;
|
||||
import com.gh.gamecenter.entity.GameServerTestV2Entity;
|
||||
import com.gh.gamecenter.entity.GameVideoInfo;
|
||||
import com.gh.gamecenter.entity.GamesCollectionDetailEntity;
|
||||
@ -84,7 +85,6 @@ import com.gh.gamecenter.entity.SignEntity;
|
||||
import com.gh.gamecenter.entity.SpecialCatalogEntity;
|
||||
import com.gh.gamecenter.entity.StartPointEntity;
|
||||
import com.gh.gamecenter.entity.SubjectEntity;
|
||||
import com.gh.gamecenter.entity.SubjectRecommendEntity;
|
||||
import com.gh.gamecenter.entity.SubjectRefreshEntity;
|
||||
import com.gh.gamecenter.entity.SubjectSettingEntity;
|
||||
import com.gh.gamecenter.entity.TagEntity;
|
||||
@ -146,7 +146,6 @@ import com.gh.gamecenter.qa.entity.QuestionsIndexEntity;
|
||||
import com.gh.gamecenter.qa.entity.TopCommunityCategory;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.protobuf.Any;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -318,6 +317,12 @@ public interface ApiService {
|
||||
@GET
|
||||
Observable<List<GameEntity>> getSearchGame(@Url String url);
|
||||
|
||||
/**
|
||||
* 搜索CPM微信小游戏
|
||||
*/
|
||||
@GET("mini_game/search/configs")
|
||||
Observable<List<GameEntity>> getSearchWechatMiniCPMGame(@Query("keyword") String key);
|
||||
|
||||
/**
|
||||
* 游戏搜索的专题数据
|
||||
*/
|
||||
@ -3425,4 +3430,9 @@ public interface ApiService {
|
||||
@GET("game_lists/search")
|
||||
Single<List<CustomPageData.LinkColumnCollection.CustomSubjectEntity>> searchGameList(@Query("keyword") String keyword, @Query("page") int page);
|
||||
|
||||
/**
|
||||
* 新游开测-置顶游戏
|
||||
*/
|
||||
@GET("app/column_test_v2/{link_id}/top_games")
|
||||
Observable<List<GameServerTestTopGame>> getServerTestV2TopGames(@Path("link_id") String linkId);
|
||||
}
|
||||
@ -7,12 +7,15 @@ import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.common.base.activity.BaseActivity_TabLayout
|
||||
import com.gh.gamecenter.common.constant.RouteConsts
|
||||
import com.gh.gamecenter.common.utils.SensorsBridge
|
||||
import com.gh.gamecenter.common.utils.updateStatusBarColor
|
||||
import com.therouter.router.Route
|
||||
|
||||
/**
|
||||
* 游戏存档
|
||||
*/
|
||||
@Route(
|
||||
path = RouteConsts.activity.gameArchiveListActivity,
|
||||
description = "游戏存档"
|
||||
)
|
||||
class GameArchiveListActivity : BaseActivity_TabLayout() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
@ -8,6 +8,8 @@ import io.reactivex.Single
|
||||
interface ISearchGameResultRepository {
|
||||
fun getSearchGame(key: String?, page: Int): Observable<List<GameEntity>>
|
||||
|
||||
fun getSearchMiniGameCPM(key: String?): Observable<List<GameEntity>>
|
||||
|
||||
fun getSearchSubject(key: String?, page: Int): Observable<List<SearchSubjectEntity>>
|
||||
|
||||
fun getWGameCPMGameList(): Single<MutableList<GameEntity>>
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
package com.gh.gamecenter.search
|
||||
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Shader
|
||||
import android.graphics.Typeface
|
||||
import android.graphics.*
|
||||
import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.ShapeDrawable
|
||||
import android.graphics.drawable.shapes.RoundRectShape
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
@ -14,6 +13,7 @@ import android.widget.CheckedTextView
|
||||
import android.widget.TextView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import com.gh.common.constant.Config
|
||||
import com.gh.common.exposure.ExposureManager
|
||||
@ -22,6 +22,7 @@ import com.gh.common.util.DirectUtils
|
||||
import com.gh.common.util.NewFlatLogUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
import com.gh.gamecenter.SearchType
|
||||
import com.gh.gamecenter.common.base.fragment.BaseFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
@ -35,6 +36,7 @@ import com.gh.gamecenter.databinding.TabItemSearchDefaultRankBinding
|
||||
import com.gh.gamecenter.db.ISearchHistoryDao
|
||||
import com.gh.gamecenter.db.SearchHistoryDao
|
||||
import com.gh.gamecenter.eventbus.EBSearch
|
||||
import com.gh.gamecenter.feature.entity.DiscoveryTagEntity
|
||||
import com.gh.gamecenter.feature.entity.HotTagEntity
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
@ -48,6 +50,7 @@ import org.json.JSONObject
|
||||
open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
|
||||
private var mHotTagList: List<HotTagEntity>? = null
|
||||
private var mDiscoveryTagList: List<DiscoveryTagEntity>? = null
|
||||
protected var mRankList: List<SettingsEntity.Search.RankList>? = null
|
||||
|
||||
protected lateinit var mBinding: FragmentSearchDefaultBinding
|
||||
@ -64,10 +67,11 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
// FlexboxLayout:maxLine 不符合需求
|
||||
protected val mFlexMaxHeight = DisplayUtils.dip2px(57F)
|
||||
|
||||
protected val mHotAndDiscoveryFlexMaxHeight = DisplayUtils.dip2px(88F)
|
||||
|
||||
private val mDao by lazy { provideDao() }
|
||||
|
||||
private val mHotTagClickListener: (Int) -> Unit = {
|
||||
val tag = mHotTagList!![it]
|
||||
private val mHotTagClickListener: (HotTagEntity) -> Unit = { tag ->
|
||||
NewFlatLogUtils.logSearchHotTagClick(
|
||||
tag.name ?: "",
|
||||
tag.type ?: "",
|
||||
@ -90,6 +94,29 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
DirectUtils.directToLinkPage(requireContext(), tag, "(搜索-${tag.name})", "", exposureEvent) // 不需要path
|
||||
}
|
||||
|
||||
private val mDiscoveryTagClickListener: (DiscoveryTagEntity, Int) -> Unit = { tag, position ->
|
||||
val keyword = tag.keyword
|
||||
if (keyword.isNotEmpty()) {
|
||||
PageSwitchDataHelper.pushCurrentPageData(
|
||||
hashMapOf(
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_TYPE, "游戏搜索-搜索发现"),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_ID, tag.id ?: ""),
|
||||
Pair(PageSwitchDataHelper.PAGE_BUSINESS_NAME, tag.text ?: " ")
|
||||
)
|
||||
)
|
||||
SensorsBridge.trackEvent("SearchLabelClick", "label_name", tag.text ?: "", "label_id", tag.id ?: "")
|
||||
SensorsBridge.trackSearchDiscoveryClick(
|
||||
labelName = tag.text ?: "",
|
||||
labelId = tag.id ?: "",
|
||||
searchContent = keyword,
|
||||
position = position
|
||||
)
|
||||
mViewModel?.add(keyword)
|
||||
EventBus.getDefault().post(EBSearch(SearchType.DISCOVERY.value, keyword))
|
||||
Util_System_Keyboard.hideSoftKeyboardByIBinder(context, mBinding.historyFlex.windowToken)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.fragment_search_default
|
||||
}
|
||||
@ -141,15 +168,23 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
mViewModel?.isExistRankList = mRankList?.isNotEmpty() == true
|
||||
|
||||
mHotTagList = Config.getSettings()?.search?.hotTag
|
||||
mViewModel?.isExistHotTag = mHotTagList?.isNotEmpty() == true
|
||||
mDiscoveryTagList = Config.getSettings()?.search?.discoveryTag
|
||||
mViewModel?.isExistHotAndDiscoveryTag =
|
||||
mHotTagList?.isNotEmpty() == true || mDiscoveryTagList?.isNotEmpty() == true
|
||||
|
||||
updateHistorySearchView(null)
|
||||
mViewModel?.historySearchLiveData?.observe(viewLifecycleOwner) {
|
||||
updateHistorySearchView(it)
|
||||
}
|
||||
|
||||
mBinding.hotTagFlexContainer.setLimitHeight(mFlexMaxHeight)
|
||||
createFlexContent(mBinding.hotTagFlex, getTagListString(), true, clickListener = mHotTagClickListener)
|
||||
mBinding.hotAndDiscoveryTagFlexContainer.setLimitHeight(mHotAndDiscoveryFlexMaxHeight)
|
||||
createHotAndDiscoveryFlexContent(
|
||||
mBinding.hotAndDiscoveryTagFlex,
|
||||
getHotTagList(),
|
||||
getDiscoveryTagList(),
|
||||
hotTagClickListener = mHotTagClickListener,
|
||||
discoveryTagClickListener = mDiscoveryTagClickListener
|
||||
)
|
||||
initHeadView()
|
||||
initRankViewPager()
|
||||
}
|
||||
@ -181,9 +216,9 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
mBinding.hotHeadContainer.headTitle.text = getString(R.string.search_hot)
|
||||
mBinding.hotHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.hotHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.hotTagHeadContainer.headTitle.text = getString(R.string.search_hot_tag)
|
||||
mBinding.hotTagHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.hotTagHeadContainer.headActionTv.visibility = View.GONE
|
||||
mBinding.hotAndDiscoveryTagHeadContainer.headTitle.text = getString(R.string.search_discovery_tag)
|
||||
mBinding.hotAndDiscoveryTagHeadContainer.headTitle.textSize = 16F
|
||||
mBinding.hotAndDiscoveryTagHeadContainer.headActionTv.visibility = View.GONE
|
||||
}
|
||||
|
||||
protected open fun initRankViewPager() {
|
||||
@ -318,8 +353,8 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
mBinding.historyHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE
|
||||
mBinding.historyFlex.visibility = if (mViewModel?.isExistHistory == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotTagHeadContainer.root.layoutParams =
|
||||
(mBinding.hotTagHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
mBinding.hotAndDiscoveryTagHeadContainer.root.layoutParams =
|
||||
(mBinding.hotAndDiscoveryTagHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
setMargins(
|
||||
0,
|
||||
if (mViewModel?.isExistHistory == true) 16F.dip2px() else 0,
|
||||
@ -331,14 +366,15 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
(mBinding.hotHeadContainer.root.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
setMargins(
|
||||
0,
|
||||
if (mViewModel?.isExistHistory == false && mViewModel?.isExistHotTag == false) 16F.dip2px() else 0,
|
||||
if (mViewModel?.isExistHistory == false && mViewModel?.isExistHotAndDiscoveryTag == false) 16F.dip2px() else 0,
|
||||
0,
|
||||
0
|
||||
)
|
||||
}
|
||||
mBinding.hotTagHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotTagFlex.visibility = if (mViewModel?.isExistHotTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotAndDiscoveryTagHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHotAndDiscoveryTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotAndDiscoveryTagFlex.visibility =
|
||||
if (mViewModel?.isExistHotAndDiscoveryTag == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotHeadContainer.root.visibility =
|
||||
if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
mBinding.hotList.visibility = if (mViewModel?.isExistHotSearch == true) View.VISIBLE else View.GONE
|
||||
@ -361,20 +397,31 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getTagListString(): List<String> {
|
||||
val list = ArrayList<String>()
|
||||
private fun getHotTagList(): List<HotTagEntity> {
|
||||
val list = ArrayList<HotTagEntity>()
|
||||
if (mHotTagList != null) {
|
||||
for (entity in mHotTagList!!) {
|
||||
entity.name?.let { list.add(it) }
|
||||
if (list.size == 8) break // 最多显示8个热门标签
|
||||
entity.name?.let { list.add(entity) }
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
private fun getDiscoveryTagList(): List<DiscoveryTagEntity> {
|
||||
val list = ArrayList<DiscoveryTagEntity>()
|
||||
if (mDiscoveryTagList != null) {
|
||||
for (entity in mDiscoveryTagList!!) {
|
||||
entity.text?.let { list.add(entity) }
|
||||
}
|
||||
}
|
||||
return list
|
||||
}
|
||||
|
||||
|
||||
fun createFlexContent(
|
||||
flexView: FlexboxLayout,
|
||||
contentList: List<String>?,
|
||||
isHotTag: Boolean = false,
|
||||
clickListener: (Int) -> Unit
|
||||
) {
|
||||
|
||||
@ -388,16 +435,12 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
val params = FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, 24F.dip2px())
|
||||
flexCell.layoutParams = params
|
||||
|
||||
if (isHotTag && !mHotTagList.isNullOrEmpty() && mHotTagList!![index].isGuessSearch) {
|
||||
createSmartHotTagStyle(flexCell, contentList[index])
|
||||
} else {
|
||||
flexCell.setSingleLine()
|
||||
flexCell.ellipsize = TextUtils.TruncateAt.END
|
||||
flexCell.gravity = Gravity.CENTER
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(contentList[index], 6)
|
||||
flexCell.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
}
|
||||
flexCell.setSingleLine()
|
||||
flexCell.ellipsize = TextUtils.TruncateAt.END
|
||||
flexCell.gravity = Gravity.CENTER
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(contentList[index], 6)
|
||||
flexCell.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
flexCell.setPadding(8F.dip2px(), 0, 8F.dip2px(), 0)
|
||||
flexCell.background = if (mIsDarkModeOn) GradientDrawable().apply {
|
||||
setStroke(0.5F.dip2px(), Color.parseColor("#21FFFFFF"))
|
||||
@ -409,16 +452,84 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSmartHotTagStyle(flexCell: TextView, name: String) {
|
||||
flexCell.setDrawableStart(R.drawable.ic_smart_search)
|
||||
private fun createHotAndDiscoveryFlexContent(
|
||||
flexView: FlexboxLayout,
|
||||
hotTagList: List<HotTagEntity>,
|
||||
discoveryTagList: List<DiscoveryTagEntity>,
|
||||
hotTagClickListener: (HotTagEntity) -> Unit,
|
||||
discoveryTagClickListener: (DiscoveryTagEntity, Int) -> Unit
|
||||
) {
|
||||
if (hotTagList.isEmpty() && discoveryTagList.isEmpty()) return
|
||||
|
||||
flexView.removeAllViews()
|
||||
|
||||
createHotFlexContent(flexView, hotTagList, hotTagClickListener)
|
||||
|
||||
createDiscoveryFlexContent(flexView, discoveryTagList, discoveryTagClickListener)
|
||||
}
|
||||
|
||||
private fun createHotFlexContent(
|
||||
flexView: FlexboxLayout,
|
||||
contentList: List<HotTagEntity>?,
|
||||
clickListener: (HotTagEntity) -> Unit
|
||||
) {
|
||||
if (contentList.isNullOrEmpty()) return
|
||||
|
||||
for (index in 0 until contentList.count()) {
|
||||
val flexCell = TextView(context)
|
||||
flexView.addView(flexCell)
|
||||
|
||||
flexCell.layoutParams = FlexboxLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, 24F.dip2px()
|
||||
)
|
||||
|
||||
createSmartHotTagStyle(flexCell, contentList[index])
|
||||
|
||||
flexCell.setOnClickListener {
|
||||
clickListener.invoke(contentList[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createDiscoveryFlexContent(
|
||||
flexView: FlexboxLayout,
|
||||
contentList: List<DiscoveryTagEntity>?,
|
||||
clickListener: (DiscoveryTagEntity, Int) -> Unit
|
||||
) {
|
||||
if (contentList.isNullOrEmpty()) return
|
||||
|
||||
for (index in 0 until contentList.count()) {
|
||||
val flexCell = TextView(context)
|
||||
flexView.addView(flexCell)
|
||||
|
||||
flexCell.layoutParams = FlexboxLayout.LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, 24F.dip2px()
|
||||
)
|
||||
|
||||
createSmartDiscoverTagStyle(flexCell, contentList[index])
|
||||
|
||||
flexCell.setPadding(8F.dip2px(), 0, 8F.dip2px(), 0)
|
||||
flexCell.background = if (mIsDarkModeOn) GradientDrawable().apply {
|
||||
setStroke(0.5F.dip2px(), Color.parseColor("#21FFFFFF"))
|
||||
cornerRadius = 999F
|
||||
} else DrawableView.getStrokeDrawable(com.gh.gamecenter.common.R.color.text_dddddd, 0.5F)
|
||||
flexCell.setOnClickListener {
|
||||
clickListener.invoke(contentList[index], index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun createSmartHotTagStyle(flexCell: TextView, entity: HotTagEntity) {
|
||||
flexCell.compoundDrawablePadding = 4F.dip2px()
|
||||
flexCell.gravity = Gravity.CENTER_VERTICAL
|
||||
flexCell.typeface = Typeface.DEFAULT_BOLD
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(name, 6)
|
||||
flexCell.setTextColor(Color.WHITE)
|
||||
flexCell.text = StringUtils.shrinkStringWithDot(entity.name, 6)
|
||||
flexCell.setPadding(8F.dip2px(), 0, 8F.dip2px(), 0)
|
||||
val colors =
|
||||
intArrayOf(com.gh.gamecenter.common.R.color.text_FFB749.toColor(requireContext()), com.gh.gamecenter.common.R.color.text_FF6D3C.toColor(requireContext()))
|
||||
intArrayOf(
|
||||
com.gh.gamecenter.common.R.color.text_FFB749.toColor(requireContext()),
|
||||
com.gh.gamecenter.common.R.color.text_FF6D3C.toColor(requireContext())
|
||||
)
|
||||
val position = floatArrayOf(0F, 1F)
|
||||
val linearGradient = LinearGradient(
|
||||
0F,
|
||||
@ -429,10 +540,53 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
position,
|
||||
Shader.TileMode.CLAMP
|
||||
)
|
||||
flexCell.paint.shader = linearGradient
|
||||
val shapeRadius = floatArrayOf(999F, 999F, 999F, 999F, 999F, 999F, 999F, 999F)
|
||||
val strokeWidth = 0.5F.dip2px().toFloat()
|
||||
val shape = RoundRectShape(shapeRadius, RectF(strokeWidth, strokeWidth, strokeWidth, strokeWidth), shapeRadius)
|
||||
flexCell.background = ShapeDrawable(shape).apply {
|
||||
paint.shader = linearGradient
|
||||
}
|
||||
if (entity.isGuessSearch) {
|
||||
flexCell.setTextColor(Color.WHITE)
|
||||
flexCell.typeface = Typeface.DEFAULT_BOLD
|
||||
flexCell.setDrawableStart(R.drawable.ic_smart_search)
|
||||
flexCell.paint.shader = linearGradient
|
||||
} else {
|
||||
flexCell.setTextColor(
|
||||
ContextCompat.getColor(
|
||||
requireContext(),
|
||||
com.gh.gamecenter.common.R.color.text_secondary
|
||||
)
|
||||
)
|
||||
}
|
||||
flexCell.invalidate()
|
||||
}
|
||||
|
||||
private fun createSmartDiscoverTagStyle(flexCell: TextView, entity: DiscoveryTagEntity) {
|
||||
val labelIcon = when (entity.recommendType) {
|
||||
"hot" -> R.drawable.ic_search_hot
|
||||
"new" -> R.drawable.ic_search_new
|
||||
"surge", "rise" -> R.drawable.ic_search_rise
|
||||
"update" -> R.drawable.ic_search_update
|
||||
else -> -1
|
||||
}
|
||||
if (labelIcon != -1) {
|
||||
flexCell.setDrawableEnd(labelIcon.toDrawable())
|
||||
flexCell.compoundDrawablePadding = 4F.dip2px()
|
||||
}
|
||||
flexCell.setSingleLine()
|
||||
flexCell.ellipsize = TextUtils.TruncateAt.END
|
||||
flexCell.gravity = Gravity.CENTER
|
||||
flexCell.textSize = 12F
|
||||
flexCell.text = entity.text
|
||||
flexCell.setTextColor(com.gh.gamecenter.common.R.color.text_secondary.toColor(requireContext()))
|
||||
flexCell.setPadding(8F.dip2px(), 0, 8F.dip2px(), 0)
|
||||
flexCell.background = if (mIsDarkModeOn) GradientDrawable().apply {
|
||||
setStroke(0.5F.dip2px(), Color.parseColor("#21FFFFFF"))
|
||||
cornerRadius = 999F
|
||||
} else DrawableView.getStrokeDrawable(com.gh.gamecenter.common.R.color.text_dddddd, 0.5F)
|
||||
}
|
||||
|
||||
private fun postExposureEvent(index: Int) {
|
||||
mRankList?.safelyGetInRelease(index)?.content?.forEach {
|
||||
if (it.link.type == "game") {
|
||||
@ -451,7 +605,13 @@ open class SearchDefaultFragment : BaseFragment<Any>() {
|
||||
notifyItemRangeChanged(0, itemCount)
|
||||
}
|
||||
mViewModel?.historySearchLiveData?.value?.let { updateHistorySearchView(it) }
|
||||
createFlexContent(mBinding.hotTagFlex, getTagListString(), true, clickListener = mHotTagClickListener)
|
||||
createHotAndDiscoveryFlexContent(
|
||||
mBinding.hotAndDiscoveryTagFlex,
|
||||
getHotTagList(),
|
||||
getDiscoveryTagList(),
|
||||
hotTagClickListener = mHotTagClickListener,
|
||||
discoveryTagClickListener = mDiscoveryTagClickListener
|
||||
)
|
||||
}
|
||||
|
||||
protected open fun provideDao(): ISearchHistoryDao =
|
||||
|
||||
@ -11,7 +11,7 @@ class SearchDefaultViewModel(private val dao: ISearchHistoryDao) : ViewModel() {
|
||||
it
|
||||
}
|
||||
var isExistHotSearch: Boolean = false
|
||||
var isExistHotTag: Boolean = false
|
||||
var isExistHotAndDiscoveryTag: Boolean = false
|
||||
var isExistHistory: Boolean = false
|
||||
var isExistRankList: Boolean = false
|
||||
|
||||
|
||||
@ -86,7 +86,7 @@ class SearchSubjectItemViewHolder(var binding: SearchSubjectItemBinding) : Recyc
|
||||
|
||||
binding.run {
|
||||
subjectRv.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
|
||||
subjectRv.adapter = SearchSubjectAdapter(context, entity.getFilterGame(), "($type-专题)", key) {
|
||||
subjectRv.adapter = SearchSubjectAdapter(context, entity.getFilterGame(), entity.columnId, entity.name, "($type-专题)", key) {
|
||||
dao?.add(key)
|
||||
if (itemData.adConfig != null) {
|
||||
NewFlatLogUtils.logClickGameAd(
|
||||
|
||||
@ -108,6 +108,7 @@ class SearchGameResultAdapter(
|
||||
return when {
|
||||
oldItem?.subject != null && newItem?.subject != null -> {
|
||||
oldItem.subject.columnId == newItem.subject.columnId
|
||||
&& oldItem.subject.games == newItem.subject.games
|
||||
}
|
||||
|
||||
oldItem?.game != null && newItem?.game != null -> {
|
||||
@ -122,6 +123,7 @@ class SearchGameResultAdapter(
|
||||
return when {
|
||||
oldItem?.subject != null && newItem?.subject != null -> {
|
||||
oldItem.subject.columnId == newItem.subject.columnId
|
||||
&& oldItem.subject.games == newItem.subject.games
|
||||
}
|
||||
|
||||
oldItem?.game != null && newItem?.game != null -> {
|
||||
@ -170,39 +172,50 @@ class SearchGameResultAdapter(
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when (holder) {
|
||||
is SearchSubjectItemViewHolder -> {
|
||||
holder.binding.run {
|
||||
when {
|
||||
position == 0 -> topDivider.visibility = View.GONE
|
||||
position > 0 -> {
|
||||
val gameEntity = mEntityList[position - 1].game
|
||||
if (gameEntity != null) {
|
||||
val isShowTag = gameEntity.contentTag != null
|
||||
&& (gameEntity.contentTag!!.custom.isNotEmpty()
|
||||
|| gameEntity.contentTag!!.zone.link.isNotEmpty()
|
||||
|| gameEntity.contentTag!!.isLibaoExists
|
||||
|| gameEntity.contentTag!!.server)
|
||||
val isShowTagByMirror =
|
||||
if (gameEntity.shouldUseMirrorInfo()) isShowTag && gameEntity.obtainMirrorData()?.contentTagStatus == "on" else isShowTag
|
||||
if (isShowTagByMirror) {
|
||||
topDivider.visibility = View.GONE
|
||||
val itemData = mEntityList[position]
|
||||
if (itemData.subject == null || itemData.subject.games.isEmpty()) {
|
||||
holder.binding.topDivider.visibility = View.GONE
|
||||
holder.binding.bottomDivider.visibility = View.GONE
|
||||
holder.binding.headContainer.root.visibility = View.GONE
|
||||
holder.binding.subjectRv.visibility = View.GONE
|
||||
} else {
|
||||
holder.binding.headContainer.root.visibility = View.VISIBLE
|
||||
holder.binding.subjectRv.visibility = View.VISIBLE
|
||||
|
||||
holder.binding.run {
|
||||
when {
|
||||
position == 0 -> topDivider.visibility = View.GONE
|
||||
position > 0 -> {
|
||||
val gameEntity = mEntityList[position - 1].game
|
||||
if (gameEntity != null) {
|
||||
val isShowTag = gameEntity.contentTag != null
|
||||
&& (gameEntity.contentTag!!.custom.isNotEmpty()
|
||||
|| gameEntity.contentTag!!.zone.link.isNotEmpty()
|
||||
|| gameEntity.contentTag!!.isLibaoExists
|
||||
|| gameEntity.contentTag!!.server)
|
||||
val isShowTagByMirror =
|
||||
if (gameEntity.shouldUseMirrorInfo()) isShowTag && gameEntity.obtainMirrorData()?.contentTagStatus == "on" else isShowTag
|
||||
if (isShowTagByMirror) {
|
||||
topDivider.visibility = View.GONE
|
||||
} else {
|
||||
topDivider.visibility = View.VISIBLE
|
||||
}
|
||||
} else {
|
||||
topDivider.visibility = View.VISIBLE
|
||||
topDivider.visibility = View.GONE
|
||||
}
|
||||
} else {
|
||||
topDivider.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
bottomDivider.visibility = View.VISIBLE
|
||||
}
|
||||
bottomDivider.visibility = View.VISIBLE
|
||||
holder.bindSubjectItem(
|
||||
mContext,
|
||||
itemData,
|
||||
SearchType.fromString(type).toChinese(),
|
||||
key,
|
||||
dao,
|
||||
sourceEntrance = sourceEntrance
|
||||
)
|
||||
}
|
||||
holder.bindSubjectItem(
|
||||
mContext,
|
||||
mEntityList[position],
|
||||
SearchType.fromString(type).toChinese(),
|
||||
key,
|
||||
dao,
|
||||
sourceEntrance = sourceEntrance
|
||||
)
|
||||
}
|
||||
|
||||
is SearchGameFirstItemViewHolder -> {
|
||||
@ -751,7 +764,8 @@ class SearchGameResultAdapter(
|
||||
SearchActivity.toTrackSearchType(type),
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: "",
|
||||
gameEntity.categoryChinese
|
||||
gameEntity.categoryChinese,
|
||||
position
|
||||
)
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.trackMiniGameClick(
|
||||
@ -768,7 +782,8 @@ class SearchGameResultAdapter(
|
||||
SearchActivity.toTrackSearchType(type),
|
||||
gameEntity.id,
|
||||
gameEntity.name ?: "",
|
||||
gameEntity.categoryChinese
|
||||
gameEntity.categoryChinese,
|
||||
position
|
||||
)
|
||||
GameDetailActivity.startGameDetailActivity(
|
||||
context, gameEntity,
|
||||
|
||||
@ -373,12 +373,15 @@ open class SearchGameResultFragment : ListFragment<GameEntity, SearchGameResultV
|
||||
}
|
||||
|
||||
fun setParams(key: String, type: String) {
|
||||
this.mKey = key
|
||||
this.mType = type
|
||||
mAdapter?.key = key
|
||||
mAdapter?.type = type
|
||||
mAdapter?.clearAdIdSet()
|
||||
mListViewModel?.updateSearchKeyWithType(key, type)
|
||||
|
||||
if (this.mKey == key) return
|
||||
|
||||
this.mKey = key
|
||||
mAdapter?.key = key
|
||||
mAdapter?.clearAdIdSet()
|
||||
mListViewModel?.clearSearchSubjects()
|
||||
mListViewModel?.load(LoadType.REFRESH)
|
||||
}
|
||||
|
||||
@ -10,13 +10,20 @@ import com.gh.gamecenter.retrofit.service.ApiService
|
||||
import com.halo.assistant.HaloApp
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.Single
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import java.net.URLEncoder
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class SearchGameResultRepository(
|
||||
private val mApi: ApiService = RetrofitManager.getInstance().api,
|
||||
private val mNewApi: ApiService = RetrofitManager.getInstance().newApi,
|
||||
private val mWGameSubjectCPMDataSource: WGameSubjectCPMRemoteDataSource = WGameSubjectCPMRemoteDataSource()
|
||||
) : ISearchGameResultRepository {
|
||||
|
||||
private var currentSearchKey: String? = null
|
||||
|
||||
private var currentMiniGameCPMSearchList: MutableList<GameEntity>? = null
|
||||
|
||||
override fun getSearchGame(
|
||||
key: String?,
|
||||
page: Int
|
||||
@ -31,11 +38,26 @@ class SearchGameResultRepository(
|
||||
)
|
||||
}
|
||||
|
||||
override fun getSearchMiniGameCPM(key: String?): Observable<List<GameEntity>> {
|
||||
val currentMiniGameCPMSearchList = currentMiniGameCPMSearchList
|
||||
if (key == currentSearchKey && currentMiniGameCPMSearchList != null) {
|
||||
return Observable.just(currentMiniGameCPMSearchList)
|
||||
}
|
||||
return mNewApi.getSearchWechatMiniCPMGame(key)
|
||||
.timeout(5, TimeUnit.SECONDS)
|
||||
.onErrorReturnItem(emptyList())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext {
|
||||
this.currentSearchKey = key
|
||||
this.currentMiniGameCPMSearchList = it
|
||||
}
|
||||
}
|
||||
|
||||
override fun getSearchSubject(key: String?, page: Int): Observable<List<SearchSubjectEntity>> {
|
||||
return mApi.getSearchSubject(key, page)
|
||||
}
|
||||
|
||||
override fun getWGameCPMGameList(): Single<MutableList<GameEntity>> {
|
||||
return mWGameSubjectCPMDataSource.getRecommendCPMList(1)
|
||||
return mWGameSubjectCPMDataSource.getUserRecommendCPMList()
|
||||
}
|
||||
}
|
||||
@ -67,49 +67,60 @@ class SearchGameResultViewModel(
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun decorateListAndPost(list: MutableList<GameEntity>) {
|
||||
val itemDataList = ArrayList(
|
||||
list.mapIndexed { index, game ->
|
||||
SearchItemData(game = game, gamePosition = index, isFirst = index == 0)
|
||||
}
|
||||
)
|
||||
val itemDataList = ArrayList<SearchItemData>()
|
||||
val combineGameList = list.toMutableList()
|
||||
|
||||
refreshWrongInstallStatus()
|
||||
|
||||
repository.getSearchSubject(mSearchKey, mPage)
|
||||
.map { dataList ->
|
||||
mSearchSubjects.addAll(dataList)
|
||||
var cpmSearchSubject: SearchSubjectEntity? = null
|
||||
mSearchSubjects.forEach {
|
||||
// 微信小游戏CPM专题需要等搜索广告位插入完成后再插入
|
||||
if (it.location == WGAME_CPM_SUBJECT_POSITION) {
|
||||
cpmSearchSubject = it.apply { isWGameSubjectCPM = true }
|
||||
repository.getSearchMiniGameCPM(mSearchKey)
|
||||
.zipWith(repository.getSearchSubject(mSearchKey, mPage)) { cpmGameList, subjectList -> // CPM游戏搜索结果列表合并
|
||||
for (cpmGame in cpmGameList) {
|
||||
if (cpmGame.location <= 0 || cpmGame.location > list.size) {
|
||||
combineGameList.add(cpmGame)
|
||||
} else {
|
||||
val item = SearchItemData(subject = it)
|
||||
if (it.location <= 0 || it.location > itemDataList.size) {
|
||||
itemDataList.add(item)
|
||||
} else {
|
||||
itemDataList.add(it.location - 1, item)
|
||||
}
|
||||
combineGameList.add(cpmGame.location - 1, cpmGame)
|
||||
}
|
||||
}
|
||||
cpmSearchSubject to dataList
|
||||
itemDataList.addAll(
|
||||
combineGameList.mapIndexed { index, game ->
|
||||
SearchItemData(game = game, gamePosition = index, isFirst = index == 0)
|
||||
}
|
||||
)
|
||||
subjectList
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ result ->
|
||||
.subscribe({ mutableList ->
|
||||
val cpmSearchSubjects = mutableListOf<SearchSubjectEntity>()
|
||||
mSearchSubjects.addAll(mutableList)
|
||||
mSearchSubjects.forEach {
|
||||
if (it.type == SearchSubjectEntity.TYPE_WECHAT_GAME_CPM_COLUMN) {
|
||||
cpmSearchSubjects.add(it.apply { isWGameSubjectCPM = true })
|
||||
}
|
||||
val item = SearchItemData(subject = it)
|
||||
if (it.location <= 0 || it.location > itemDataList.size) {
|
||||
itemDataList.add(item)
|
||||
} else {
|
||||
itemDataList.add(it.location - 1, item)
|
||||
}
|
||||
}
|
||||
// 处理初始化列表且游戏列表size为0的情况
|
||||
handleLoadStatusWhenGameListIsEmpty(list, itemDataList)
|
||||
|
||||
if (mIsManuallySearch) {
|
||||
if (mSearchKey == AdDelegateHelper.gameSearchKeyword) {
|
||||
updateAdConfigAndDecorateList(itemDataList, list, result.first)
|
||||
updateAdConfigAndDecorateList(itemDataList, list)
|
||||
} else {
|
||||
AdDelegateHelper.requestAdConfig(false, mSearchKey ?: "") {
|
||||
updateAdConfigAndDecorateList(itemDataList, list, result.first)
|
||||
updateAdConfigAndDecorateList(itemDataList, list)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
decorateWithWGameSubjectCPM(itemDataList, list, result.first)
|
||||
postResultList(itemDataList, list)
|
||||
}
|
||||
|
||||
if (cpmSearchSubjects.isNotEmpty()) {
|
||||
decorateListWithWGameCPM(cpmSearchSubjects, itemDataList, list)
|
||||
}
|
||||
}, {
|
||||
it.printStackTrace()
|
||||
@ -118,12 +129,50 @@ class SearchGameResultViewModel(
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求微信小游戏CPM接口获取专题游戏数据,并插入对应的专题项中,相关需求如下:
|
||||
* @see <a href="https://jira.shanqu.cc/browse/GHZSCY-6710">【光环助手】CPM微信小游戏API接入工作</a>
|
||||
* @see <a href="https://jira.shanqu.cc/browse/GHZSCY-6827">【光环助手】CPM微信小游戏一期优化</a>
|
||||
*/
|
||||
@SuppressLint("CheckResult")
|
||||
private fun updateAdConfigAndDecorateList(
|
||||
private fun decorateListWithWGameCPM(
|
||||
subjects: List<SearchSubjectEntity>,
|
||||
itemDataList: ArrayList<SearchItemData>,
|
||||
list: MutableList<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
list: MutableList<GameEntity>
|
||||
) {
|
||||
val subjectList = subjects.filterNot {
|
||||
it.games.isNotEmpty()
|
||||
}
|
||||
if (subjectList.isEmpty()) return
|
||||
val subjectSingleList = subjectList.map { subject ->
|
||||
repository.getWGameCPMGameList()
|
||||
.onErrorReturnItem(mutableListOf())
|
||||
.map { subject.columnId to it }
|
||||
}
|
||||
Single.zip(subjectSingleList) { it.map { item -> item as Pair<String, MutableList<GameEntity>> } }
|
||||
.map { dataList ->
|
||||
for (index in itemDataList.indices) {
|
||||
val itemData = itemDataList[index]
|
||||
val subject = itemData.subject ?: continue
|
||||
if (subject.games.isNotEmpty()) continue
|
||||
val pair = dataList.firstOrNull { data ->
|
||||
data.first == subject.columnId
|
||||
} ?: continue
|
||||
val newItemData = SearchItemData(
|
||||
subject = subject.copy(games = pair.second)
|
||||
)
|
||||
itemDataList[index] = newItemData
|
||||
}
|
||||
itemDataList
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ dataList -> postResultList(dataList, list) }, {})
|
||||
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun updateAdConfigAndDecorateList(itemDataList: ArrayList<SearchItemData>, list: MutableList<GameEntity>) {
|
||||
mGameSearchAdList =
|
||||
AdDelegateHelper.getGameSearchAdList().filter { AdDelegateHelper.shouldShowGameSearchAd(it) }.toArrayList()
|
||||
.apply { sortBy { it.position } }
|
||||
@ -137,7 +186,6 @@ class SearchGameResultViewModel(
|
||||
mAdPositionSet = adPositionSet
|
||||
|
||||
if (adPositionSet.isNotEmpty()) {
|
||||
val decoratedItemDataList = ArrayList(itemDataList)
|
||||
val ownerAdList = arrayListOf<AdConfig>()
|
||||
val thirdPartyAdList = arrayListOf<AdConfig>()
|
||||
|
||||
@ -175,18 +223,18 @@ class SearchGameResultViewModel(
|
||||
Single.zip(requestSingleList) {}
|
||||
.compose(singleToMain())
|
||||
.subscribe({
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list, cpmSubjectEntity)
|
||||
decorateListWithAd(itemDataList, list)
|
||||
}, {
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list, cpmSubjectEntity)
|
||||
decorateListWithAd(itemDataList, list)
|
||||
})
|
||||
} else {
|
||||
decorateListWithAd(itemDataList, decoratedItemDataList, list, cpmSubjectEntity)
|
||||
decorateListWithAd(itemDataList, list)
|
||||
}
|
||||
} else {
|
||||
decorateListWithThirdPartyAdOnly(decoratedItemDataList, thirdPartyAdList, list, cpmSubjectEntity)
|
||||
decorateListWithThirdPartyAdOnly(itemDataList, thirdPartyAdList, list)
|
||||
}
|
||||
} else {
|
||||
decorateWithWGameSubjectCPM(itemDataList, list, cpmSubjectEntity)
|
||||
postResultList(itemDataList, list)
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,27 +245,25 @@ class SearchGameResultViewModel(
|
||||
}
|
||||
|
||||
private fun decorateListWithThirdPartyAdOnly(
|
||||
decoratedItemDataList: ArrayList<SearchItemData>,
|
||||
itemDataList: ArrayList<SearchItemData>,
|
||||
thirdPartyAdList: List<AdConfig>,
|
||||
list: List<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
list: List<GameEntity>
|
||||
) {
|
||||
thirdPartyAdList.forEach {
|
||||
decoratedItemDataList.add(it.position - 1, SearchItemData(ad = it.thirdPartyAd, adConfig = it))
|
||||
itemDataList.add(it.position - 1, SearchItemData(ad = it.thirdPartyAd, adConfig = it))
|
||||
SPUtils.setLong(Constants.SP_LAST_GAME_SEARCH_AD_SHOW_TIME + it.position, System.currentTimeMillis())
|
||||
}
|
||||
decorateWithWGameSubjectCPM(decoratedItemDataList, list, cpmSubjectEntity)
|
||||
postResultList(itemDataList, list)
|
||||
}
|
||||
|
||||
private fun decorateListWithAd(
|
||||
itemDataList: ArrayList<SearchItemData>,
|
||||
decoratedItemDataList: ArrayList<SearchItemData>,
|
||||
list: List<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
list: List<GameEntity>
|
||||
) {
|
||||
val adGameOneIdSet = HashSet<String>() // 展示样式为单个游戏时记录游戏ID,避免重复
|
||||
val decoratedItemDataSize = itemDataList.size
|
||||
for ((index, position) in mAdPositionSet!!.withIndex()) {
|
||||
if (position < itemDataList.size + index + 1) {
|
||||
if (position < decoratedItemDataSize + index + 1) {
|
||||
val adConfig = mGameSearchAdList!!.safelyGetInRelease(index)
|
||||
val showThirdPartyAd = adConfig?.displayRule?.adSource == AdDelegateHelper.AD_TYPE_SDK
|
||||
val showOwnerAd = adConfig?.displayRule?.adSource == AdDelegateHelper.AD_TYPE_OWNER
|
||||
@ -225,7 +271,7 @@ class SearchGameResultViewModel(
|
||||
if ((showThirdPartyAd && adConfig?.thirdPartyAd != null)
|
||||
|| (showOwnerAd && adConfig?.ownerAd == null && adConfig?.thirdPartyAd != null && showOnFailed)
|
||||
) {
|
||||
decoratedItemDataList.add(position - 1, SearchItemData(ad = adConfig.thirdPartyAd, adConfig = adConfig))
|
||||
itemDataList.add(position - 1, SearchItemData(ad = adConfig.thirdPartyAd, adConfig = adConfig))
|
||||
SPUtils.setLong(
|
||||
Constants.SP_LAST_GAME_SEARCH_AD_SHOW_TIME + adConfig.position,
|
||||
System.currentTimeMillis()
|
||||
@ -237,7 +283,7 @@ class SearchGameResultViewModel(
|
||||
if (!gameList.isNullOrEmpty()) {
|
||||
if (adConfig.ownerAd.adSource?.displayStyle == "game_zone") {
|
||||
// 游戏专题
|
||||
decoratedItemDataList.add(
|
||||
itemDataList.add(
|
||||
position - 1,
|
||||
SearchItemData(
|
||||
subject = SearchSubjectEntity(
|
||||
@ -259,7 +305,7 @@ class SearchGameResultViewModel(
|
||||
}
|
||||
randomGameEntity?.id?.let { adGameOneIdSet.add(it) }
|
||||
|
||||
decoratedItemDataList.add(
|
||||
itemDataList.add(
|
||||
position - 1,
|
||||
SearchItemData(game = randomGameEntity, adConfig = adConfig)
|
||||
)
|
||||
@ -270,7 +316,7 @@ class SearchGameResultViewModel(
|
||||
)
|
||||
} else if (showOnFailed && adConfig.thirdPartyAd != null) {
|
||||
// 自有广告为空时,显示第三方广告
|
||||
decoratedItemDataList.add(position - 1, SearchItemData(ad = adConfig.thirdPartyAd, adConfig = adConfig))
|
||||
itemDataList.add(position - 1, SearchItemData(ad = adConfig.thirdPartyAd, adConfig = adConfig))
|
||||
SPUtils.setLong(
|
||||
Constants.SP_LAST_GAME_SEARCH_AD_SHOW_TIME + adConfig.position,
|
||||
System.currentTimeMillis()
|
||||
@ -281,41 +327,7 @@ class SearchGameResultViewModel(
|
||||
break
|
||||
}
|
||||
}
|
||||
decorateWithWGameSubjectCPM(decoratedItemDataList, list, cpmSubjectEntity)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun decorateWithWGameSubjectCPM(
|
||||
resultList: ArrayList<SearchItemData>,
|
||||
list: List<GameEntity>,
|
||||
cpmSubjectEntity: SearchSubjectEntity?
|
||||
) {
|
||||
// 微信小游戏CPM专题搜索结果存在,则请求CPM接口获取微信小游戏列表数据,并将列表数据插入缓存的CPM专题中,
|
||||
// 再根据location的值(固定为4)将CPM专题插入搜索结果列表中
|
||||
// 相关需求:https://jira.shanqu.cc/browse/GHZSCY-6710
|
||||
cpmSubjectEntity?.let { subject ->
|
||||
if (subject.games.isNotEmpty()) {
|
||||
Single.just(subject.games.toMutableList())
|
||||
} else {
|
||||
repository.getWGameCPMGameList()
|
||||
.onErrorReturnItem(mutableListOf())
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(
|
||||
{
|
||||
val cpmSearchItemData = SearchItemData(subject = subject.apply { games = it })
|
||||
if (subject.location <= 0 || subject.location > resultList.size) {
|
||||
resultList.add(cpmSearchItemData)
|
||||
} else {
|
||||
resultList.add(subject.location - 1, cpmSearchItemData)
|
||||
}
|
||||
postResultList(resultList, list)
|
||||
},
|
||||
{
|
||||
postResultList(resultList, list)
|
||||
})
|
||||
} ?: postResultList(resultList, list)
|
||||
postResultList(itemDataList, list)
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
@ -343,7 +355,7 @@ class SearchGameResultViewModel(
|
||||
}
|
||||
|
||||
private fun postResultList(resultList: ArrayList<SearchItemData>, list: List<GameEntity>) {
|
||||
mResultLiveData.postValue(resultList)
|
||||
mResultLiveData.postValue(resultList.toMutableList())
|
||||
if (mPage == 1) {
|
||||
if (repository is MiniGameSearchResultRepository) {
|
||||
SensorsBridge.trackMiniGameSearchResultReturn(
|
||||
@ -362,7 +374,6 @@ class SearchGameResultViewModel(
|
||||
mSearchKey ?: "",
|
||||
SearchActivity.toTrackSearchType(mSearchType),
|
||||
list.isNotEmpty()
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
@ -431,7 +442,6 @@ class SearchGameResultViewModel(
|
||||
|
||||
companion object {
|
||||
const val AD_SUBJECT_GAME_MAX_COUNT = 8
|
||||
const val WGAME_CPM_SUBJECT_POSITION = 4
|
||||
}
|
||||
|
||||
}
|
||||
@ -13,6 +13,8 @@ import com.lightgame.adapter.BaseRecyclerAdapter
|
||||
class SearchSubjectAdapter(
|
||||
context: Context,
|
||||
private val mList: List<GameEntity>,
|
||||
private val mColumnId: String,
|
||||
private val mColumnName: String,
|
||||
private val mEntrance: String,
|
||||
private val mKey: String,
|
||||
private val clickCallback: ((GameEntity) -> Unit)
|
||||
@ -40,7 +42,10 @@ class SearchSubjectAdapter(
|
||||
MiniGameItemHelper.launchMiniGame(gameEntity)
|
||||
MiniGameItemHelper.trackMiniGameClick(
|
||||
gameEntity = gameEntity,
|
||||
gameColumnId = mColumnId,
|
||||
gameColumnName = mColumnName,
|
||||
location = "小游戏搜索结果列表",
|
||||
position = position,
|
||||
searchContent = mKey,
|
||||
)
|
||||
} else {
|
||||
|
||||
@ -59,23 +59,26 @@ class SearchGameListAdapter(
|
||||
|
||||
override fun navigateToGameDetailPage(
|
||||
gameId: String,
|
||||
position: Int,
|
||||
collection: CustomPageData.LinkColumnCollection.CustomSubjectEntity
|
||||
) {
|
||||
viewModel.navigateToGameDetailPage(gameId, collection)
|
||||
viewModel.navigateToGameDetailPage(gameId, position, collection)
|
||||
}
|
||||
|
||||
override fun navigateToHomePage(
|
||||
userId: String,
|
||||
position: Int,
|
||||
collection: CustomPageData.LinkColumnCollection.CustomSubjectEntity
|
||||
) {
|
||||
viewModel.navigateToHomePage(userId, collection)
|
||||
viewModel.navigateToHomePage(userId, position, collection)
|
||||
}
|
||||
|
||||
override fun navigateGameCollectionDetailPage(
|
||||
position: Int,
|
||||
collection: CustomPageData.LinkColumnCollection.CustomSubjectEntity,
|
||||
exposureSourceList: List<ExposureSource>
|
||||
) {
|
||||
viewModel.navigateGameCollectionDetailPage(collection, exposureSourceList)
|
||||
viewModel.navigateGameCollectionDetailPage(position, collection, exposureSourceList)
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
@ -116,7 +116,8 @@ class SearchGameListFragment : LazyFragment() {
|
||||
context = requireContext(),
|
||||
itemId,
|
||||
topCommentId = "",
|
||||
exposureSourceList = exposureSourceList.toArrayList()
|
||||
exposureSourceList = exposureSourceList.toArrayList(),
|
||||
entrance = "游戏单搜索"
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
@ -9,6 +9,7 @@ import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.common.base.fragment.BaseFragment
|
||||
import com.gh.gamecenter.common.constant.EntranceConsts
|
||||
import com.gh.gamecenter.common.utils.goneIf
|
||||
import com.gh.gamecenter.common.utils.toColor
|
||||
import com.gh.gamecenter.databinding.FragmentSearchTabBinding
|
||||
import com.gh.gamecenter.feature.entity.SettingsEntity
|
||||
import com.gh.gamecenter.search.SearchGameResultFragment
|
||||
@ -43,7 +44,7 @@ class SearchTabFragment : BaseFragment<Any>() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
|
||||
location = arguments?.getString(EntranceConsts.KEY_LOCATION) ?: ""
|
||||
with(activityViewModel) {
|
||||
searchKeyAndType.observe(this@SearchTabFragment) { (key, type) ->
|
||||
@ -121,6 +122,17 @@ class SearchTabFragment : BaseFragment<Any>() {
|
||||
|
||||
}
|
||||
|
||||
override fun onDarkModeChanged() {
|
||||
super.onDarkModeChanged()
|
||||
if (::binding.isInitialized) {
|
||||
binding.tabLayout.setTabTextColors(
|
||||
com.gh.gamecenter.common.R.color.text_primary.toColor(requireContext()),
|
||||
com.gh.gamecenter.common.R.color.text_theme.toColor(requireContext())
|
||||
)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun newInstance(location: String) =
|
||||
|
||||
@ -2,7 +2,6 @@ package com.gh.gamecenter.search.viewholder
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.text.Html
|
||||
import android.util.SparseArray
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -14,10 +13,8 @@ import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.gh.common.util.CheckLoginUtils
|
||||
import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.SearchActivity
|
||||
import com.gh.gamecenter.SearchType
|
||||
import com.gh.gamecenter.common.exposure.ExposureSource
|
||||
import com.gh.gamecenter.common.utils.*
|
||||
import com.gh.gamecenter.core.utils.HtmlUtils
|
||||
import com.gh.gamecenter.databinding.GameCollectionSquareItemBinding
|
||||
import com.gh.gamecenter.feature.entity.GameEntity
|
||||
import com.gh.gamecenter.feature.exposure.ExposureEvent
|
||||
@ -113,16 +110,16 @@ class SearchGameListViewHolder(
|
||||
ivIcon.setOnClickListener {
|
||||
val game = item.games.getOrNull(index)
|
||||
game?.id?.let { gameId ->
|
||||
listener.navigateToGameDetailPage(gameId, item)
|
||||
listener.navigateToGameDetailPage(gameId, bindingAdapterPosition, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
userContainer.setOnClickListener {
|
||||
listener.navigateToHomePage(item.user.id, item)
|
||||
listener.navigateToHomePage(item.user.id, bindingAdapterPosition, item)
|
||||
}
|
||||
root.setOnClickListener {
|
||||
listener.navigateGameCollectionDetailPage(item, exposureEvent.source)
|
||||
listener.navigateGameCollectionDetailPage(bindingAdapterPosition, item, exposureEvent.source)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -131,12 +128,18 @@ class SearchGameListViewHolder(
|
||||
|
||||
fun navigateToGameDetailPage(
|
||||
gameId: String,
|
||||
position: Int,
|
||||
collection: CustomPageData.LinkColumnCollection.CustomSubjectEntity
|
||||
)
|
||||
|
||||
fun navigateToHomePage(userId: String, collection: CustomPageData.LinkColumnCollection.CustomSubjectEntity)
|
||||
fun navigateToHomePage(
|
||||
userId: String,
|
||||
position: Int,
|
||||
collection: CustomPageData.LinkColumnCollection.CustomSubjectEntity
|
||||
)
|
||||
|
||||
fun navigateGameCollectionDetailPage(
|
||||
position: Int,
|
||||
collection: CustomPageData.LinkColumnCollection.CustomSubjectEntity,
|
||||
exposureSourceList: List<ExposureSource>
|
||||
)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user