Compare commits

..

16 Commits

Author SHA1 Message Date
8c0773aab2 fix:模拟器下载流程修复20221027测试反馈 https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2125 2022-10-28 14:35:36 +08:00
e596de766a Merge remote-tracking branch 'origin/dev' into feature-issues2125 2022-10-27 14:36:36 +08:00
12c3605db8 fix:规范修改 2022-10-27 11:44:37 +08:00
4201d0abd3 fix:规范修改 2022-10-27 11:30:40 +08:00
3a0daea1fb fix:修改 2022-10-27 11:18:22 +08:00
17e4923c98 fix修改私有变量命名规范 2022-10-27 10:39:37 +08:00
1a2c90cfb0 fix:合并冲突 2022-10-27 10:37:46 +08:00
06c084a1ec feat:模拟器游戏埋点 2022-10-26 16:29:53 +08:00
930fc88183 merge 2022-10-26 11:30:14 +08:00
e8dec7d101 Merge remote-tracking branch 'origin/dev' into feature-issues2125 2022-10-26 11:20:46 +08:00
28fcd20186 fix:模拟器下载流程修改 2022-10-26 11:06:20 +08:00
d8483686d2 Merge remote-tracking branch 'origin/dev' into feature-issues2125
# Conflicts:
#	app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt
2022-10-25 17:40:55 +08:00
cb67b4f01e Merge branch 'dev' into 'feature-issues2125'
# Conflicts:
#   app/src/main/java/com/gh/common/util/NewFlatLogUtils.kt
2022-10-25 09:31:16 +00:00
236ecb9f4f fix:解决冲突 2022-10-25 17:26:46 +08:00
877335f47b fix:解决冲突 2022-10-25 17:21:07 +08:00
676b81b649 feat: 模拟器下载流程调整 https://git.shanqu.cc/pm/halo/halo-app-issues/-/issues/2125 2022-10-25 17:03:41 +08:00
381 changed files with 5558 additions and 2985 deletions

View File

@ -391,6 +391,7 @@ andResGuard {
"R.drawable.suggest_type_function_suggest",
"R.drawable.suggest_type_article_collect",
"R.drawable.suggest_type_copyright",
"R.drawable.help_result_empty",
"R.drawable.news_comment_detail_read",
"R.drawable.news_comment_detail_comment",
"R.drawable.news_comment_detail_share",

View File

@ -733,10 +733,6 @@
android:name=".BbsCertificationActivity"
android:screenOrientation="portrait" />
<activity
android:name=".discovery.DiscoveryActivity"
android:screenOrientation="portrait" />
<!-- <activity-->
<!-- android:name="${applicationId}.douyinapi.DouYinEntryActivity"-->
<!-- android:launchMode="singleTask"-->

View File

@ -8,26 +8,24 @@ import android.text.TextUtils;
import androidx.annotation.Nullable;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.common.util.PackageHelper;
import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.SuggestionActivity;
import com.gh.gamecenter.common.constant.Constants;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.common.utils.DarkModeUtils;
import com.gh.gamecenter.common.utils.EnvHelper;
import com.gh.gamecenter.core.utils.GsonUtils;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.entity.GameGuidePopupEntity;
import com.gh.gamecenter.entity.NewApiSettingsEntity;
import com.gh.gamecenter.entity.NewSettingsEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.SettingsEntity;
import com.gh.gamecenter.common.eventbus.EBReuse;
import com.gh.gamecenter.entity.SimulatorEntity;
import com.gh.gamecenter.entity.VSetting;
import com.gh.gamecenter.common.retrofit.BiResponse;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.vspace.VHelper;
import com.halo.assistant.HaloApp;
@ -66,9 +64,8 @@ public class Config {
private static SettingsEntity mSettingsEntity;
private static NewSettingsEntity mNewSettingsEntity;
private static NewApiSettingsEntity mNewApiSettingsEntity;
private static NewApiSettingsEntity.NightMode mNightModeSetting;
private static NewSettingsEntity.NightMode mNightModeSetting;
private static SimulatorEntity mNewSimulatorEntity;
private static VSetting mVSetting;
private static GameGuidePopupEntity mGameGuidePopupEntity;
@ -230,19 +227,19 @@ public class Config {
public static SimulatorEntity getNewSimulatorEntitySetting() {
if (mNewSimulatorEntity != null) {
return mNewSimulatorEntity;
} else if (mNewApiSettingsEntity != null && mNewApiSettingsEntity.getSimulator() != null) {
return mNewApiSettingsEntity.getSimulator();
} else if (mNewSettingsEntity != null && mNewSettingsEntity.getSimulator() != null) {
return mNewSettingsEntity.getSimulator();
} else {
return null;
}
}
@Nullable
public static NewApiSettingsEntity.NightMode getNightModeSetting() {
public static NewSettingsEntity.NightMode getNightModeSetting() {
if (mNightModeSetting != null) {
return mNightModeSetting;
} else if (mNewApiSettingsEntity != null && mNewApiSettingsEntity.getNightMode() != null) {
return mNewApiSettingsEntity.getNightMode();
} else if (mNewSettingsEntity != null && mNewSettingsEntity.getNightMode() != null) {
return mNewSettingsEntity.getNightMode();
} else {
return null;
}
@ -367,6 +364,9 @@ public class Config {
@Override
public void onSuccess(NewSettingsEntity data) {
mNewSettingsEntity = data;
if (mNightModeSetting != null) {
mNewSettingsEntity.setNightMode(mNightModeSetting);
}
SPUtils.setString(Constants.SP_NEW_SETTINGS, GsonUtils.toJson(data));
}
});
@ -384,22 +384,27 @@ public class Config {
});
}
if (mNewApiSettingsEntity == null) {
if (mNightModeSetting == null && mNewSimulatorEntity == null) {
RetrofitManager.getInstance()
.getNewApi().getNewSettings(PackageUtils.getGhVersionName(), channel)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new BiResponse<NewApiSettingsEntity>() {
.subscribe(new BiResponse<NewSettingsEntity>() {
@Override
public void onSuccess(NewApiSettingsEntity data) {
mNewApiSettingsEntity = data;
public void onSuccess(NewSettingsEntity data) {
mNightModeSetting = data.getNightMode();
mNewSimulatorEntity = data.getSimulator();
if (HaloApp.getInstance().isNewForThisVersion && mNightModeSetting != null && mNightModeSetting.getInstall()) {
DarkModeUtils.INSTANCE.updateFollowSystemDarkModeToSp(true);
DarkModeUtils.INSTANCE.updateAppDarkModeStatusToSp(true);
DarkModeUtils.INSTANCE.initDarkMode();
}
SPUtils.setString(Constants.SP_NEW_API_SETTINGS, GsonUtils.toJson(data));
if (mNewSettingsEntity != null) {
mNewSettingsEntity.setSimulator(mNewSimulatorEntity);
mNewSettingsEntity.setNightMode(mNightModeSetting);
SPUtils.setString(Constants.SP_NEW_SETTINGS, GsonUtils.toJson(data));
}
}
});
}

View File

@ -18,7 +18,7 @@ import com.halo.assistant.HaloApp
@Database(
entities = [AnswerEntity::class, ArticleEntity::class, NewsEntity::class, HistoryGameEntity::class, MyVideoEntity::class, GamesCollectionEntity::class],
version = 12,
version = 11,
exportSchema = false
)
@TypeConverters(
@ -28,7 +28,6 @@ import com.halo.assistant.HaloApp
AnswerUserConverter::class,
ThumbnailConverter::class,
TagStyleListConverter::class,
TagStyleConverter::class,
StringArrayListConverter::class,
ListStringConverter::class,
CommunityVideoConverter::class,
@ -128,13 +127,6 @@ abstract class HistoryDatabase : RoomDatabase() {
}
}
val MIGRATION_11_12: Migration = object : Migration(11, 12) {
override fun migrate(database: SupportSQLiteDatabase) {
database.execSQL("Alter TABLE HistoryGameEntity add subtitle TEXT NOT NULL DEFAULT ''")
database.execSQL("Alter TABLE HistoryGameEntity add subtitleStyle TEXT")
}
}
val instance by lazy {
Room.databaseBuilder(
HaloApp.getInstance().application,
@ -150,7 +142,6 @@ abstract class HistoryDatabase : RoomDatabase() {
.addMigrations(MIGRATION_8_9)
.addMigrations(MIGRATION_9_10)
.addMigrations(MIGRATION_10_11)
.addMigrations(MIGRATION_11_12)
.build()
}
}

View File

@ -71,8 +71,6 @@ object HistoryHelper {
historyGame.name = gameEntity.name
historyGame.tagStyle = gameEntity.tagStyle
historyGame.tag = gameEntity.getTag()
historyGame.subtitle = gameEntity.subtitle
historyGame.subtitleStyle = gameEntity.subtitleStyle
return historyGame
}

View File

@ -138,7 +138,6 @@ class SimulatorDownloadManager private constructor() {
cancelCallback: (() -> Unit)? = null
) {
if (context == null) return
this.simulatorLocation = location
this.simulator = simulator
this.gameId = gameId
@ -146,31 +145,21 @@ class SimulatorDownloadManager private constructor() {
PermissionHelper.checkGetInstalledAppsListBeforeAction(context, object : EmptyCallback {
override fun onCallback() {
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
//当没有安装新版本模拟器时候 判断是否隐藏
if (simulator?.active == false && !isInstalledNewSimulator) {
//判断是否隐藏
if (simulator?.active == false) {
showNoneEmulatorDialog(context)
return
}
var isInstalled = PackageUtils.isInstalledFromAllPackage(
context,
simulator?.apk?.packageName
)
//模拟器管理界面还是用之前的逻辑
if (isInstalledNewSimulator && location != SimulatorLocation.SIMULATOR_MANAGE) {
isInstalled = isInstalledNewSimulator
}
val isInstalled = PackageUtils.isInstalledFromAllPackage(context, simulator?.apk?.packageName)
// val versionFromInstalledApp = PackageUtils.getVersionNameByPackageName(simulator?.apk?.packageName)
val shouldShowUpdate =
PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val shouldShowUpdate = PackageUtils.isInstalledApkMatchedMd5(simulator?.apk?.packageName, simulator?.apk?.md5)
val showAlertTag = SPUtils.getString(SimulatorGameManager.SIMULATOR_UPDATE_SHOW_ALERT_TAG, "") //当天是否弹过
val todayIsShow = showAlertTag == TimeUtils.getToday()
downloadType = if (shouldShowUpdate && isInstalled) "update" else "download"
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE) {
if (downloadType == "update" && todayIsShow && location != SimulatorLocation.SIMULATOR_MANAGE){
return
}
if (downloadType == "download" && isInstalled) {
if (downloadType == "download" && isInstalled){
return
}
val title = if (shouldShowUpdate && isInstalled) "更新模拟器" else "安装模拟器"

View File

@ -6,11 +6,13 @@ import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.CountDownTimer;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.text.Html;
import android.text.Spannable;
@ -1905,21 +1907,13 @@ public class DialogUtils {
}
}
public static void showReportReasonDialog(Context context, ArrayList<String> items, ReportReasonCallBack callBack) {
showReportReasonDialog(context, items, "", callBack);
}
@SuppressLint("SetTextI18n")
public static void showReportReasonDialog(Context context, ArrayList<String> items, String title, ReportReasonCallBack callBack) {
public static void showReportReasonDialog(Context context, ArrayList<String> items, ReportReasonCallBack callBack) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);
DialogReportReasonBinding binding = DialogReportReasonBinding.inflate(LayoutInflater.from(context));
if (!title.isEmpty()) {
binding.reasonTitle.setText(title);
}
ReportReasonAdapter reportReasonAdapter = new ReportReasonAdapter(context, items, reason -> {
if (reason.equals("其他原因")) {
binding.reasonTitle.setText(R.string.report_reason_other_title);

View File

@ -35,7 +35,6 @@ import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.discovery.DiscoveryActivity
import com.gh.gamecenter.download.DownloadFragment.Companion.INDEX_UPDATE
import com.gh.gamecenter.entity.*
import com.gh.gamecenter.eventbus.EBSkip
@ -182,8 +181,7 @@ object DirectUtils {
"common_collection",
"game_list",
"game_list_detail",
"bbs_video",
"explore_column"
"bbs_video"
)
fun directToLinkPage(
@ -436,8 +434,6 @@ object DirectUtils {
"game_list_detail" -> directToGameCollectionDetail(context, linkEntity.link ?: "", entrance)
"explore_column" -> context.startActivity(DiscoveryActivity.getIntent(context, entrance))
"" -> {
// do nothing
}
@ -771,36 +767,6 @@ object DirectUtils {
jumpActivity(context, bundle)
}
@JvmStatic
fun directToFeedbackCompat(
context: Context,
content: String? = null,
hintType: String? = null,
isQaFeedback: Boolean = false,
qaContentId: String? = "",
entrance: String? = null
) {
val bundle = Bundle()
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
bundle.putString(KEY_TO, SuggestionActivity::class.java.simpleName)
if (isQaFeedback) {
bundle.putBoolean(KEY_IS_QA_FEEDBACK, true)
bundle.putString(KEY_QA_CONTENT_ID, qaContentId)
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
} else {
bundle.putString(KEY_CONTENT, content)
if (TextUtils.isEmpty(hintType)) {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.gameQuestion)
bundle.putString(KEY_SUGGEST_HINT_TYPE, KEY_PLUGIN)
} else {
bundle.putSerializable(KEY_SUGGESTTYPE, SuggestType.normal)
bundle.putString(KEY_SUGGEST_HINT_TYPE, hintType)
}
}
jumpActivityCompat(context, bundle)
}
@JvmStatic
fun directToDownloadManager(context: Context, entrance: String? = null) {
val bundle = Bundle()

View File

@ -787,7 +787,6 @@ object DownloadItemUtils {
DataLogUtils.uploadGameLog(context, gameEntity.id, gameEntity.name, entrance)
} else if (str == context.getString(R.string.attempt)) {
ChainBuilder().apply {
addHandler(UpdateNewSimulatorHandler())
addHandler(GamePermissionHandler())
addHandler(BrowserInstallHandler())
addHandler(PackageCheckHandler())
@ -845,11 +844,8 @@ object DownloadItemUtils {
val isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(context)
val isInstalledOldSimulator = SimulatorGameManager.isOldSimulatorInstalled(context)
var simulator = gameEntity.simulator
val newSimulator = Config.getNewSimulatorEntitySetting()
if (!isInstalledOldSimulator && newSimulator != null) {//在没有安装旧的模拟器且有配置新版模拟器 才使用新版模拟器 否则还是用以前旧的
if (newSimulator.active) {
simulator = newSimulator
}
if (!isInstalledOldSimulator) {
simulator = Config.getNewSimulatorEntitySetting()
}
if (downloadEntity != null && SimulatorGameManager.isSimulatorGame(gameEntity) && !isInstalled && !isInstalledNewSimulator) {
SimulatorDownloadManager.getInstance().showDownloadDialog(

View File

@ -241,20 +241,16 @@ object DownloadObserver {
val gameName = downloadEntity.getMetaExtra(Constants.GAME_NAME)
if (simulatorJson.isEmpty()) return
var simulator = GsonUtils.fromJson(simulatorJson, SimulatorEntity::class.java)
val isInstalled = PackageUtils.isInstalledFromAllPackage(
HaloApp.getInstance().application,
simulator.apk?.packageName
)
val isInstalledNewSimulator =
SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
val isInstalledOldSimulator =
SimulatorGameManager.isOldSimulatorInstalled(HaloApp.getInstance().application)
val isInstalled = PackageUtils.isInstalledFromAllPackage(HaloApp.getInstance().application, simulator.apk?.packageName)
val isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(HaloApp.getInstance().application)
val isInstalledOldSimulator = SimulatorGameManager.isOldSimulatorInstalled(HaloApp.getInstance().application)
// if (!isInstalled && !isInstalledNewSimulator) {
val currentActivity = AppManager.getInstance().currentActivity()
?: return
val newSimulator = Config.getNewSimulatorEntitySetting()
if ((!isInstalledOldSimulator && newSimulator != null && newSimulator.active) || isInstalledNewSimulator) { //如果没有安装任一旧的模拟器 或者下载了新模拟器 则使用新版本模拟器
simulator = newSimulator!!
if (!isInstalledOldSimulator || isInstalledNewSimulator) { //如果没有安装任一旧的模拟器 或者下载了新模拟器 则使用新版本模拟器
Config.getNewSimulatorEntitySetting().let {
simulator = it!!
}
}
SimulatorDownloadManager.getInstance().showDownloadDialog(
currentActivity, simulator,

View File

@ -37,32 +37,6 @@ import java.util.Set;
public class EntranceUtils {
public static void jumpActivityCompat(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);
if (HaloApp.getInstance().isRunningForeground || HaloApp.getInstance().isAlreadyUpAndRunning) {
// 应用正在运行,前台或后台
String to = bundle.getString(KEY_TO);
Class<?> clazz = ClassUtils.forName(to);
if (clazz == null) clazz = MainActivity.class;
if (ToolbarFragment.class.isAssignableFrom(clazz)) { // 兼容ToolbarFragment
ToolBarActivity.startFragmentNewTask(context, (Class<? extends ToolbarFragment>) clazz, bundle);
} else {
Intent intent1 = new Intent(context, clazz);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// 如果 activity 名称有 singleton 的就添加 reorder_to_front 标签 (有点粗暴有点蠢,但暂时就先这样吧 :C )
if (clazz.getSimpleName().toLowerCase().contains("singleton")) {
intent1.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
}
intent1.putExtras(bundle);
context.startActivity(intent1);
}
} else {
// 应用未在运行
context.startActivity(SplashScreenActivity.getSplashScreenIntent(context, bundle));
}
}
public static void jumpActivity(Context context, Bundle bundle) {
bundle.putBoolean(KEY_REQUIRE_REDIRECT, true);

View File

@ -558,7 +558,7 @@ object NewFlatLogUtils {
//手机号验证弹窗点击事件
fun logPhoneNumberVerifyDialogClick(entrance: String, text: String) {
val json = json {
"event" to "publish_phone_number_verify_dialog_click"
"event" to "phone_number_verify_dialog_click"
"entrance" to entrance
"text" to text
parseAndPutMeta().invoke(this)
@ -569,7 +569,7 @@ object NewFlatLogUtils {
//手机号验证界面展示事件
fun logPhoneNumberVerifyDialogShow(entrance: String) {
val json = json {
"event" to "publish_phone_number_verify_dialog_show"
"event" to "phone_number_verify_dialog_show"
"entrance" to entrance
parseAndPutMeta().invoke(this)
}
@ -580,7 +580,7 @@ object NewFlatLogUtils {
//完成手机号验证
fun logPhoneNumberVerifyDialogSuccess() {
val json = json {
"event" to "publish_phone_number_verify_dialog_success"
"event" to "phone_number_verify_dialog_success"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
@ -732,96 +732,4 @@ object NewFlatLogUtils {
}
log(json, "event", false)
}
//进入发现页面
fun logDiscoverPageEnter() {
val json = json {
"event" to "discover_page_enter"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//离开发现页面
fun logDiscoverPageQuit(sequence: Int) {
val json = json {
"event" to "discover_page_quit"
"sequence" to sequence
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//发现页面可见事件
fun logDiscoverPageVisible() {
val json = json {
"event" to "discover_page_visible"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//发现页面不可见事件
fun logDiscoverPageInvisible(sequence: Int) {
val json = json {
"event" to "discover_page_invisible"
"sequence" to sequence
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//页面顶部露出
fun logDiscoverPageTopVisible(countNum: Int) {
val json = json {
"event" to "discover_page_top_visible"
"count_num" to countNum
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//页面底部停留
fun logDiscoverPageBottomStay(countNum: Int) {
val json = json {
"event" to "discover_page_bottom_stay"
"count_num" to countNum
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//点击兴趣推荐卡片
fun logDiscoverPageRecommendedInterestCardClick(sequence: Int, linkText: String, linkType: String, linkId: String) {
val json = json {
"event" to "discover_page_recommended_interest_card_click"
"sequence" to sequence
"link_text" to linkText
"link_type" to linkType
"link_id" to linkId
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//点击跳转游戏库
fun logDiscoverPageJumpGamesLibraries() {
val json = json {
"event" to "discover_page_jump_games_libraries"
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
//触发不感兴趣
fun logDiscoverPageNotInterest(gameId: String, gameName: String) {
val json = json {
"event" to "discover_page_not_interest"
"game_id" to gameId
"game_name" to gameName
parseAndPutMeta().invoke(this)
}
log(json, "event", false)
}
}

View File

@ -36,7 +36,6 @@ import com.gh.common.util.PackageUtils;
import com.gh.gamecenter.core.utils.PageSwitchDataHelper;
import com.gh.gamecenter.core.utils.SPUtils;
import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.core.utils.SentryHelper;
import com.gh.gamecenter.download.DownloadedGameIdAndPackageNameDao;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
@ -390,16 +389,12 @@ public class DownloadManager implements DownloadStatusListener {
* 清理不存在本地 APK 文件的任务
*/
public void clearTasksThatFileBeenDeleted() {
try {
for (DownloadEntity entity : getAllDownloadEntity()) {
if (entity.getStatus() == DownloadStatus.done) {
if (FileUtils.isEmptyFile(entity.getPath())) {
cancel(entity.getUrl());
}
for (DownloadEntity entity : getAllDownloadEntity()) {
if (entity.getStatus() == DownloadStatus.done) {
if (FileUtils.isEmptyFile(entity.getPath())) {
cancel(entity.getUrl());
}
}
} catch (Exception e) {
SentryHelper.INSTANCE.onEvent("CLEAR_DELETED_TASK_ERROR", "exception_digest", e.getLocalizedMessage());
}
}

View File

@ -180,7 +180,6 @@ public class MainActivity extends BaseActivity {
showAd = getIntent().getBooleanExtra(SHOW_AD, false) && savedInstanceState == null;
HaloApp.getInstance().initFresco();
HaloApp.getInstance().isAlreadyUpAndRunning = true;
super.onCreate(savedInstanceState);
setStatusBarColor(Color.TRANSPARENT);

View File

@ -137,7 +137,7 @@ public class SkipActivity extends BaseActivity {
if (!TextUtils.isEmpty(qaId)) {
DirectUtils.directToQa(this, qaTitle, qaId);
} else if ("vgame".equals(suggestionType)) {
DirectUtils.directToFeedbackCompat(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
DirectUtils.directToFeedback(this, content, "game", isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
} else {
DirectUtils.directToFeedback(this, content, null, isQaFeedback, qaContentId, EntranceConsts.ENTRANCE_BROWSER);
}

View File

@ -1,6 +1,5 @@
package com.gh.gamecenter
import android.Manifest
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
@ -26,7 +25,6 @@ import com.gh.common.util.GameSubstituteRepositoryHelper.updateGameSubstituteRep
import com.gh.common.util.UsageStatsHelper.checkAndPostUsageStats
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.callback.SimpleCallback
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.RouteConsts
import com.gh.gamecenter.common.tracker.TrackerLogger
@ -62,8 +60,6 @@ class SplashScreenActivity : BaseActivity() {
private var mShouldPrefetchData = true
private val mPermissions = arrayOf(
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
PermissionHelper.PERMISSION_GET_INSTALLED_LIST
)
@ -154,41 +150,42 @@ class SplashScreenActivity : BaseActivity() {
private fun showPrivacyDialog(guideLayout: ViewPager) {
NewPrivacyPolicyDialogFragment.show(this, null) { isSuccess: Boolean ->
if (isSuccess) {
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
//
// // 恢复畅玩数据
// VHelper.recoverVDataIfPossible()
//
// requestPermission()
//
// // 检查是否有旧版本光环,有就删掉
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
// if (mStartMainActivityDirectly) {
// launchMainActivity()
// }
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
mShouldPrefetchData = false
prefetchData()
// 恢复畅玩数据
VHelper.recoverVDataIfPossible()
val callback = object : SimpleCallback<Boolean> {
override fun onCallback(arg: Boolean) {
// Dialog dismiss 后的回调
guideLayout.visibility = View.VISIBLE
SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
if (arg) {
requestPermission()
} else {
mStartMainActivityDirectly = false
}
}
requestPermission()
// 检查是否有旧版本光环,有就删掉
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
launchMainActivity()
} else {
mShouldPrefetchData = false
prefetchData()
}
mViewModel?.showPrivacyPolicy({
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
}, {
DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
})
// val callback = object : SimpleCallback<Boolean> {
// override fun onCallback(arg: Boolean) {
// // Dialog dismiss 后的回调
// guideLayout.visibility = View.VISIBLE
// SPUtils.setBoolean(Constants.SP_BRAND_NEW_USER, false)
// if (arg) {
// requestPermission()
// } else {
// mStartMainActivityDirectly = false
// }
// }
// }
//
// mViewModel?.showPrivacyPolicy({
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, it, callback)
// }, {
// DialogUtils.showPrivacyPolicyDialog(this@SplashScreenActivity, PrivacyPolicyEntity.createDefaultData(), callback)
// })
} else {
DialogUtils.showPrivacyPolicyDisallowDialog(
this,
@ -388,10 +385,10 @@ class SplashScreenActivity : BaseActivity() {
private fun checkAndRequestPermission() {
if (EasyPermissions.hasPermissions(this, *mPermissions)) {
// 恢复畅玩数据
VHelper.recoverVDataIfPossible()
// VHelper.recoverVDataIfPossible()
// 检查是否有旧版本光环,有就删掉
AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
// AppExecutor.ioExecutor.execute { deleteOutdatedUpdatePackage() }
if (mStartMainActivityDirectly) {
if (com.gh.gamecenter.common.BuildConfig.BUILD_TIME != 0L) {
showGitLogDialogIfNeeded()

View File

@ -4,7 +4,6 @@ import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.view.View;
@ -118,8 +117,7 @@ public class CleanApkAdapter extends BaseRecyclerAdapter<KcSelectGameViewHolder>
appInfo.sourceDir = apk_path;
appInfo.publicSourceDir = apk_path;
Drawable apk_icon = appInfo.loadIcon(pm);
Bitmap originalBitmap = BitmapUtils.drawableToBitmap(apk_icon, true);
apkEntity.setGameBm(BitmapUtils.compressBitmap(originalBitmap, 100));
apkEntity.setGameBm(BitmapUtils.drawableToBitmap(apk_icon, true));
/** apk的绝对路劲 */
apkEntity.setGamePath(apk_path);
/** apk的版本名称 String */

View File

@ -42,7 +42,6 @@ import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.suggest.SuggestType;
import com.lightgame.adapter.BaseRecyclerAdapter;
@ -197,8 +196,6 @@ public class LibaoDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
ExtensionsKt.setRootBackgroundColor(holder.binding.getRoot(), R.color.background_white);
if (mLibaoEntity.getGame() != null) {
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getGame().getIcon(), mLibaoEntity.getGame().getIconSubscript());
GameEntity gameEntity = mLibaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, holder.binding.gameSubtitleTv, null, null, false);
} else {
holder.binding.libaodetailGameIcon.displayGameIcon(mLibaoEntity.getIcon(), null);
}

View File

@ -315,10 +315,9 @@ public class DetailViewHolder {
boolean isInstalledNewSimulator = SimulatorGameManager.isNewSimulatorInstalled(mViewHolder.context);
boolean isInstalledOldSimulator = SimulatorGameManager.isOldSimulatorInstalled(mViewHolder.context);
SimulatorEntity simulator = mGameEntity.getSimulator();
SimulatorEntity newSimulator = Config.getNewSimulatorEntitySetting();
if (!isInstalledOldSimulator && newSimulator != null) {
if (newSimulator.getActive()) {
simulator = newSimulator;
if (!isInstalledOldSimulator){
if (Config.getNewSimulatorEntitySetting() != null){
simulator = Config.getNewSimulatorEntitySetting();
}
}

View File

@ -28,7 +28,6 @@ import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.databinding.AmwayCommentItemBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.game.GameAndPosition
import com.gh.gamecenter.game.GameItemViewHolder
import com.gh.gamecenter.game.vertical.GameVerticalAdapter
import com.gh.gamecenter.gamedetail.rating.RatingFragment
import com.gh.gamecenter.gamedetail.rating.RatingReplyActivity
@ -207,7 +206,6 @@ class AmwayAdapter(
) {
val context = binding.root.context
val amway = itemData.amwayCommentItem!!
val gameEntity = amway.game.toGameEntity()
binding.gameContainer.background = R.drawable.selector_f8f8f8.toDrawable(context)
binding.commentContainer.background = R.drawable.selector_f8f8f8.toDrawable(context)
@ -239,8 +237,7 @@ class AmwayAdapter(
)
}
itemData.exposureEvent = ExposureEvent.createEvent(gameEntity, basicExposureSource)
GameItemViewHolder.initGameSubtitle(gameEntity, binding.gameSubtitleTv)
itemData.exposureEvent = ExposureEvent.createEvent(amway.game.toGameEntity(), basicExposureSource)
binding.gameContainer.setOnClickListener {
GameDetailActivity.startGameDetailActivity(
@ -298,7 +295,7 @@ class AmwayAdapter(
binding.likeCountTv.setTextColor(R.color.theme_font.toColor(binding.likeCountTv.context))
binding.likeClickableView.setOnClickListener {
debounceActionWithInterval(binding.likeClickableView.id, 1000L) {
binding.likeIv.context.ifLogin("安利墙-取消点赞") {
binding.likeIv.context.ifLogin("安利墙") {
viewModel.undoLikeAmwayComment(amway.game.id, amway.comment.id)
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_取消点赞")
}
@ -309,7 +306,7 @@ class AmwayAdapter(
binding.likeCountTv.setTextColor(R.color.text_B3B3B3.toColor(binding.likeCountTv.context))
binding.likeClickableView.setOnClickListener {
debounceActionWithInterval(binding.likeClickableView.id, 1000L) {
binding.likeIv.context.ifLogin("安利墙-点赞") {
binding.likeIv.context.ifLogin("安利墙") {
playLikedAnimation(binding.likeCountTv, binding.likeIv, binding.likeAnimView)
viewModel.likeAmwayComment(amway.game.id, amway.comment.id)
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_点赞")

View File

@ -27,7 +27,6 @@ import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.CategoryGameItemBinding
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.game.GameItemViewHolder
import com.lightgame.download.DownloadEntity
class CategoryV2ListAdapter(
@ -246,8 +245,6 @@ class CategoryV2ListAdapter(
)
)
gameDes.text = gameEntity.decoratedDes
GameItemViewHolder.initGameSubtitle(gameEntity, gameSubtitleTv, gameDesSpace, root)
}
}

View File

@ -14,7 +14,6 @@ import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler;
import com.gh.common.util.CollectionUtils;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
@ -233,11 +232,6 @@ public class AnswerAdapter extends ListAdapter<AnswerEntity> implements ISyncAda
}
});
mPopupBinding.checkAllCb.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
);
mPopupBinding.checkAllCb.setOnClickListener(v -> {
if (mPopupBinding.checkAllCb.isChecked()) {
selectItems.clear();

View File

@ -16,7 +16,6 @@ import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.utils.DialogHelper;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.common.view.DrawableView;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.common.utils.ImageUtils;
import com.gh.common.util.NewsUtils;
@ -362,11 +361,6 @@ public class ArticleAdapter extends ListAdapter<NewsEntity> {
}
});
mPopupBinding.checkAllCb.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
);
mPopupBinding.checkAllCb.setOnClickListener(v -> {
if (mPopupBinding.checkAllCb.isChecked()) {
selectItems.clear();

View File

@ -18,7 +18,6 @@ import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.databinding.CommunityAnswerItemBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
import com.gh.gamecenter.common.entity.CommunityEntity
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.history.ManageOption
import com.gh.gamecenter.qa.answer.CommunityAnswerItemViewHolder
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity
@ -173,11 +172,6 @@ class CommunityArticleAdapter(
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -24,7 +24,6 @@ import com.gh.gamecenter.adapter.viewholder.GameCollectionItemViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.collection.GamesCollectionFragment.Companion.TYPE_USER
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.ItemGameCollectionFlexTagBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
@ -425,11 +424,6 @@ class GamesCollectionAdapter(
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -3,7 +3,6 @@ package com.gh.gamecenter.collection
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.graphics.drawable.StateListDrawable
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
@ -18,7 +17,6 @@ import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
import com.gh.gamecenter.databinding.VideoNewItemBinding
import com.gh.gamecenter.entity.MyVideoEntity
@ -168,11 +166,6 @@ class VideoAdapter(
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -1,36 +0,0 @@
package com.gh.gamecenter.discovery
import android.content.Context
import android.content.Intent
import android.os.Bundle
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.utils.updateStatusBarColor
/**
* 猜你喜欢-发现页
*/
class DiscoveryActivity : ToolBarActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
updateStatusBarColor(R.color.background_white, R.color.background_white)
setNavigationTitle("发现")
}
override fun isAutoResetViewBackgroundEnabled(): Boolean = true
override fun onDarkModeChanged() {
super.onDarkModeChanged()
updateStatusBarColor(R.color.background_white, R.color.background_white)
}
companion object {
fun getIntent(context: Context, entrance: String): Intent {
val bundle = Bundle()
bundle.putString(EntranceConsts.KEY_ENTRANCE, entrance)
return getTargetIntent(context, DiscoveryActivity::class.java, DiscoveryFragment::class.java, bundle)
}
}
}

View File

@ -1,429 +0,0 @@
package com.gh.gamecenter.discovery
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
import android.widget.Space
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.databind.BindingAdapters
import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.ExposureType
import com.gh.common.exposure.IExposable
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
import com.gh.gamecenter.BlockActivity
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.MainActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.StringUtils
import com.gh.gamecenter.databinding.DiscoveryGameItemBinding
import com.gh.gamecenter.databinding.ItemRecommendInterestBinding
import com.gh.gamecenter.databinding.ItemRecommendInterestFooterBinding
import com.gh.gamecenter.databinding.ItemRecommendInterestImageBinding
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBSkip
import com.gh.gamecenter.fragment.MainWrapperFragment
import com.gh.gamecenter.fragment.MainWrapperRepository
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.EventBus
class DiscoveryAdapter(
context: Context,
private val mViewModel: DiscoveryViewModel,
private val mBaseExposureSource: ArrayList<ExposureSource>,
private val mOuterSequence: Int,
private val mEntrance: String
) : ListAdapter<DiscoveryItemData>(context), IExposable {
private val mExposureEventSparseArray: SparseArray<ExposureEvent> = SparseArray()
override fun getItemViewType(position: Int): Int {
val value = mViewModel.loadStatusLiveData.value
if (position == itemCount - 1) {
if (value == LoadStatus.INIT_OVER || value == LoadStatus.LIST_OVER) {
return ITEM_DIRECT_GAME_BLOCK
}
return ItemViewType.ITEM_FOOTER
}
val itemData = mEntityList[position]
return when {
itemData.interestCardLabels != null -> {
ITEM_RECOMMEND_INTEREST
}
itemData.interestImageCardLabel != null -> {
ITEM_RECOMMEND_INTEREST_IMAGE
}
else -> {
ItemViewType.GAME_NORMAL
}
}
}
override fun areItemsTheSame(oldItem: DiscoveryItemData?, newItem: DiscoveryItemData?): Boolean {
if (oldItem?.gameEntity != null && newItem?.gameEntity != null) {
return oldItem.gameEntity.id == newItem.gameEntity.id
}
if (oldItem?.interestCardLabels != null && newItem?.interestCardLabels != null) {
return oldItem.interestCardLabels.firstOrNull()?.id == newItem.interestCardLabels.firstOrNull()?.id
}
if (oldItem?.interestImageCardLabel != null && newItem?.interestImageCardLabel != null) {
return oldItem.interestImageCardLabel.id == newItem.interestImageCardLabel.id
}
return false
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
ItemViewType.GAME_NORMAL -> {
DiscoveryGameViewHolder(parent.toBinding())
}
ItemViewType.ITEM_FOOTER -> {
FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
}
ITEM_DIRECT_GAME_BLOCK -> {
DirectGameBlockViewHolder(parent.toBinding())
}
ITEM_RECOMMEND_INTEREST -> {
RecommendInterestViewHolder(parent.toBinding())
}
ITEM_RECOMMEND_INTEREST_IMAGE -> {
RecommendInterestImageViewHolder(parent.toBinding())
}
else -> {
throw NullPointerException()
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is DiscoveryGameViewHolder -> {
val itemData = mEntityList[position]
val gameEntity = itemData.gameEntity!!
DownloadItemUtils.updateItem(mContext, gameEntity, holder, true, "star")
holder.bindGameItem(gameEntity)
val type = when (gameEntity.type) {
"recommend" -> "专题推荐"
"ad" -> "游戏广告"
"filter" -> "算法过滤"
else -> ""
}
val exposureSources = ArrayList<ExposureSource>().apply {
add(ExposureSource("发现", type))
}
val event = ExposureEvent.createEventWithSourceConcat(
gameEntity.apply {
sequence = position
if (mOuterSequence >= 0) {
outerSequence = mOuterSequence
}
},
mBaseExposureSource,
exposureSources,
null,
ExposureType.EXPOSURE
)
mExposureEventSparseArray.put(position, event)
holder.itemView.setOnClickListener {
GameDetailActivity.startGameDetailActivity(
mContext,
gameEntity,
StringUtils.buildString("(${mEntrance}", "-列表[", (position).toString(), "])"),
traceEvent = event
)
}
holder.itemView.setOnLongClickListener {
discoveryFeedback(position, gameEntity)
true
}
DownloadItemUtils.setOnClickListener(
mContext,
holder.binding.downloadBtn,
gameEntity,
position,
this,
StringUtils.buildString("(${mEntrance}", "-列表[", (position).toString(), "])"),
StringUtils.buildString(mEntrance, ":", gameEntity.name),
event
)
}
is RecommendInterestViewHolder -> {
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
holder.binding.backgroundView.background = R.drawable.bg_shape_space_radius_8.toDrawable(mContext)
holder.binding.interestTv.setTextColor(R.color.text_title.toColor(mContext))
val labels = mEntityList[position].interestCardLabels ?: return
val labelTvList = arrayListOf(holder.binding.labelTv1, holder.binding.labelTv2, holder.binding.labelTv3)
labelTvList.forEachIndexed { index, labelTv ->
labelTv.goneIf(labels.size < index + 1) {
labelTv.setTextColor(R.color.text_subtitle.toColor(mContext))
labelTv.background = R.drawable.bg_shape_white_radius_4.toDrawable(mContext)
labelTv.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
R.drawable.ic_interest_arrow.toDrawable(mContext),
null
)
labels[index].text = labels[index].linkText
labelTv.text = labels[index].title
labelTv.setOnClickListener {
DirectUtils.directToLinkPage(holder.binding.root.context, labels[index], mEntrance, "")
logDiscoverPageRecommendedInterestCardClick(
mEntityList[position].cardPosition,
labels[index]
)
}
}
}
}
is RecommendInterestImageViewHolder -> {
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
val label = mEntityList[position].interestImageCardLabel ?: return
label.text = label.linkText
holder.binding.root.setOnClickListener {
DirectUtils.directToLinkPage(holder.binding.root.context, label, mEntrance, "")
logDiscoverPageRecommendedInterestCardClick(mEntityList[position].cardPosition, label)
}
}
is DirectGameBlockViewHolder -> {
holder.binding.root.setBackgroundColor(R.color.background_white.toColor(mContext))
holder.binding.root.setOnClickListener {
val navBar = MainWrapperRepository.getInstance().getNavBarLiveData().value
if (navBar == null || mContext is DiscoveryActivity) {
val blockData = HomeBottomBarHelper.getDefaultGameBarData()
mContext.startActivity(BlockActivity.getIntent(mContext, blockData, mEntrance))
} else {
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_MAIN, MainWrapperFragment.INDEX_GAME))
}
NewFlatLogUtils.logDiscoverPageJumpGamesLibraries()
}
}
is FooterViewHolder -> {
holder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver)
}
}
}
private fun logDiscoverPageRecommendedInterestCardClick(
position: Int?,
label: DiscoveryGameCardLabel
) {
if (position == null) return
NewFlatLogUtils.logDiscoverPageRecommendedInterestCardClick(
position,
label.text ?: "",
label.type ?: "",
label.link ?: ""
)
}
override fun getItemCount(): Int {
return if (mEntityList == null || mEntityList.isEmpty()) return 0 else mEntityList.size + 1
}
private fun discoveryFeedback(position: Int, gameEntity: GameEntity) {
DialogUtils.showReportReasonDialog(
mContext,
Constants.FEEDBACK_REASON_LIST.toList() as ArrayList<String>,
"不喜欢的原因"
) { reason, _ ->
mViewModel.discoveryFeedback(gameEntity.id, reason, gameEntity.type ?: "") {
NewFlatLogUtils.logDiscoverPageNotInterest(gameEntity.id, gameEntity.name ?: "")
mViewModel.forceRefresh = true
mEntityList.removeAt(position)
notifyItemRemoved(position)
}
}
}
fun notifyItemByDownload(download: DownloadEntity) {
val positionAndPackageMap = mViewModel.positionAndPackageMap
for (key in positionAndPackageMap.keys) {
if (key.contains(download.packageName)) {
val position = positionAndPackageMap[key]
if (position != null && mEntityList != null && position < mEntityList.size) {
mEntityList[position].gameEntity?.let {
it.getEntryMap()[download.platform] = download
}
notifyItemChanged(position)
}
}
}
}
fun notifyItemAndRemoveDownload(status: EBDownloadStatus) {
val positionAndPackageMap = mViewModel.positionAndPackageMap
for (key in positionAndPackageMap.keys) {
if (key.contains(status.packageName)) {
val position = positionAndPackageMap[key]
if (position != null && mEntityList != null && position < mEntityList.size) {
mEntityList[position].gameEntity?.let {
it.getEntryMap().remove(status.platform)
}
notifyItemChanged(position)
}
}
}
}
fun clearPositionAndPackageMap() {
mViewModel.positionAndPackageMap.clear()
}
override fun getEventByPosition(pos: Int): ExposureEvent? {
return mExposureEventSparseArray.get(pos)
}
override fun getEventListByPosition(pos: Int): List<ExposureEvent>? {
return null
}
class DiscoveryGameViewHolder(val binding: DiscoveryGameItemBinding) : GameViewHolder(binding.root) {
init {
gameDownloadBtn = binding.downloadBtn
gameProgressbar = binding.gameProgressbar
gameInfo = binding.gameInfo
gameDownloadPercentage = binding.downloadPercentage
gameDes = binding.gameDes
gameDownloadSpeed = binding.downloadSpeed
gameRating = binding.gameRating
recommendContainer = binding.recommendContainer
recommendIv = binding.recommendIv
}
fun bindGameItem(gameEntity: GameEntity) {
binding.run {
root.background = R.drawable.reuse_listview_item_style.toDrawable(root.context)
gameKaifuType.setBackgroundColor(R.color.theme.toColor(root.context))
gameName.setTextColor(R.color.text_title.toColor(root.context))
gameDes.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
downloadSpeed.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
downloadPercentage.setTextColor(R.color.theme_font.toColor(root.context))
gameIconView.displayGameIcon(gameEntity)
BindingAdapters.setGameName(gameName, gameEntity, false, null)
BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10)
gameRating.setCompoundDrawablesWithIntrinsicBounds(
if (gameEntity.commentCount > 3) R.drawable.game_horizontal_rating.toDrawable() else null,
null,
null,
null
)
gameRating.text = if (gameEntity.commentCount > 3) {
if (gameEntity.star == 10.0F) "10" else gameEntity.star.toString()
} else {
""
}
gameRating.setPadding(0, 0, if (gameEntity.commentCount > 3) 8F.dip2px() else 0, 0)
gameRating.setTextColor(
if (gameEntity.commentCount > 3) {
R.color.theme_font.toColor(binding.root.context)
} else {
R.color.theme.toColor(binding.root.context)
}
)
gameDes.visibleIf(gameEntity.recommendTag.isNotEmpty()) {
gameDes.text = "根据 “${gameEntity.recommendTag}” 兴趣推荐"
}
//type: recommend 专题游戏 | ad 广告游戏 | filter 算法游戏
adLabelTv.goneIf(!(gameEntity.type == "ad" && gameEntity.adIconActive))
if (gameEntity.type == "ad" && gameEntity.adIconActive) {
recommendReasonTv.visibility = View.GONE
} else {
recommendReasonTv.visibility = View.GONE
if (gameEntity.columnRank != null) {
recommendReasonTv.text =
"${gameEntity.columnRank!!.name}·第${gameEntity.columnRank!!.position}"
recommendReasonTv.setTextColor(R.color.theme_yellow.toColor(binding.root.context))
recommendReasonTv.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.ic_discovery_rank.toDrawable(binding.root.context),
null,
null,
null
)
recommendReasonTv.background =
R.drawable.bg_discovery_recommend.toDrawable(binding.root.context)
recommendReasonTv.visibility = View.VISIBLE
} else if (gameEntity.type == "recommend") {
recommendReasonTv.text = "其他玩家推荐"
recommendReasonTv.setTextColor(R.color.theme_font.toColor(binding.root.context))
recommendReasonTv.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null)
recommendReasonTv.background = R.drawable.bg_discovery_rank.toDrawable(binding.root.context)
recommendReasonTv.visibility = View.VISIBLE
}
}
initGameSubtitle(gameEntity, gameSubtitleTv, gameDesSpace)
}
}
private fun initGameSubtitle(
entity: GameEntity,
gameSubtitleTv: TextView,
gameDesSpace: Space,
) {
gameSubtitleTv.visibility = View.GONE
if ((entity.serverLabel == null && entity.subtitle.isNotEmpty() && !entity.advanceDownload) || (entity.subtitle.isNotEmpty())) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = entity.subtitle
if (entity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${entity.subtitleStyle?.color}"))
background = GradientDrawable().apply {
cornerRadius = 2F.dip2px().toFloat()
if (entity.subtitleStyle?.style == "border") {
setColor(Color.TRANSPARENT)
setStroke(0.5F.dip2px(), Color.parseColor("#${entity.subtitleStyle?.background}"))
} else {
shape = GradientDrawable.RECTANGLE
setColor(Color.parseColor("#${entity.subtitleStyle?.background}"))
}
}
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (entity.advanceDownload) {
gameSubtitleTv.apply {
visibility = View.VISIBLE
text = "预下载"
setTextColor(R.color.text_subtitle.toColor(context))
background = R.drawable.bg_advance_download_game_subtitle.toDrawable(context)
}
}
}
}
class RecommendInterestViewHolder(val binding: ItemRecommendInterestBinding) :
BaseRecyclerViewHolder<Any>(binding.root)
class RecommendInterestImageViewHolder(val binding: ItemRecommendInterestImageBinding) :
BaseRecyclerViewHolder<Any>(binding.root)
class DirectGameBlockViewHolder(val binding: ItemRecommendInterestFooterBinding) :
BaseRecyclerViewHolder<Any>(binding.root)
companion object {
const val ITEM_RECOMMEND_INTEREST = 200
const val ITEM_RECOMMEND_INTEREST_IMAGE = 201
const val ITEM_DIRECT_GAME_BLOCK = 202
}
}

View File

@ -1,263 +0,0 @@
package com.gh.gamecenter.discovery
import android.view.LayoutInflater
import android.widget.FrameLayout
import android.widget.RelativeLayout
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
import com.ethanhua.skeleton.Skeleton
import com.gh.common.exposure.ExposureListener
import com.gh.common.exposure.ExposureSource
import com.gh.common.util.DialogUtils
import com.gh.common.util.NewFlatLogUtils
import com.gh.common.xapk.XapkInstaller
import com.gh.common.xapk.XapkUnzipStatus
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
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.utils.dip2px
import com.gh.gamecenter.common.utils.getBitmapFromView
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.databinding.LayoutDiscoveryGuideBinding
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.gh.gamecenter.eventbus.EBPackage
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.*
import kotlin.concurrent.fixedRateTimer
class DiscoveryFragment : LazyListFragment<DiscoveryItemData, DiscoveryViewModel>() {
private var mAdapter: DiscoveryAdapter? = null
private var mDiscoveryVisibleTimer: Timer? = null
private var mDiscoveryQuitTimer: Timer? = null
//页面顶部露出次数
private var mPageTopVisibleCount = 0
//页面底部露出次数
private var mPageBottomVisibleCount = 0
private lateinit var mExposureListener: ExposureListener
private val dataWatcher = object : DataWatcher() {
override fun onDataChanged(downloadEntity: DownloadEntity) {
mAdapter?.notifyItemByDownload(downloadEntity)
if (downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS] == XapkUnzipStatus.FAILURE.name) {
showUnzipFailureDialog(downloadEntity)
}
}
override fun onDataInit(downloadEntity: DownloadEntity) {
mAdapter?.notifyItemByDownload(downloadEntity)
}
}
override fun initRealView() {
super.initRealView()
mCachedView.setBackgroundColor(R.color.background_white.toColor(requireContext()))
}
override fun initSkeletonScreen() {
if (mSkeletonScreenView == null) return
mSkeletonScreen = Skeleton.bind(mSkeletonScreenView)
.shimmer(true)
.angle(Constants.SHIMMER_ANGLE)
.color(R.color.skeleton_shimmer_color)
.duration(Constants.SHIMMER_DURATION)
.maskWidth(Constants.MASK_WIDTH)
.gradientCenterColorWidth(Constants.GRADIENT_CENTER_COLOR_WIDTH)
.apply {
load(R.layout.fragment_discovery_skeleton)
}
.show()
}
override fun onFragmentFirstVisible() {
super.onFragmentFirstVisible()
if (mAdapter != null) {
mExposureListener = ExposureListener(this, mAdapter!!)
mListRv?.addOnScrollListener(mExposureListener)
mListRv?.addOnScrollListener(object : OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
val layoutManager = mListRv?.layoutManager as? LinearLayoutManager ?: return
val firstVisibleItemPosition = layoutManager.findFirstCompletelyVisibleItemPosition()
val lastVisibleItemPosition = layoutManager.findLastCompletelyVisibleItemPosition()
if (firstVisibleItemPosition == 0) {
mPageTopVisibleCount++
NewFlatLogUtils.logDiscoverPageTopVisible(mPageTopVisibleCount)
}
if (lastVisibleItemPosition == (mAdapter?.itemCount ?: 0) - 1) {
mPageBottomVisibleCount++
NewFlatLogUtils.logDiscoverPageBottomStay(mPageBottomVisibleCount)
}
}
}
})
}
mDiscoveryVisibleTimer =
fixedRateTimer(
"Discovery-Visible-Rate-Timer",
initialDelay = mDiscoveryVisibleDuration,
period = mDiscoveryVisibleDuration
) {
NewFlatLogUtils.logDiscoverPageVisible()
}
mDiscoveryQuitTimer =
fixedRateTimer(
"Discovery-Quit-Rate-Timer",
initialDelay = mDiscoveryQuitDuration,
period = mDiscoveryQuitDuration
) {
val lastVisiblePosition =
(mListRv?.layoutManager as? LinearLayoutManager)?.findLastCompletelyVisibleItemPosition() ?: 0
NewFlatLogUtils.logDiscoverPageQuit(lastVisiblePosition)
mDiscoveryQuitTimer?.cancel()
mDiscoveryQuitTimer = null
}
NewFlatLogUtils.logDiscoverPageEnter()
}
override fun provideListAdapter(): ListAdapter<*> {
val basicExposureSource = arrayListOf<ExposureSource>().apply {
arguments?.getParcelable<ExposureSource>(EntranceConsts.KEY_EXPOSURE_SOURCE)?.let { add(it) }
}
val outerSequence = requireArguments().getInt(EntranceConsts.KEY_POSITION, -1)
return mAdapter ?: DiscoveryAdapter(
requireContext(),
mListViewModel,
basicExposureSource,
outerSequence,
"发现页"
).also { mAdapter = it }
}
override fun onFragmentResume() {
super.onFragmentResume()
DownloadManager.getInstance().addObserver(dataWatcher)
}
override fun onFragmentPause() {
super.onFragmentPause()
DownloadManager.getInstance().removeObserver(dataWatcher)
val lastVisiblePosition =
(mListRv?.layoutManager as? LinearLayoutManager)?.findLastCompletelyVisibleItemPosition() ?: 0
NewFlatLogUtils.logDiscoverPageInvisible(lastVisiblePosition)
}
override fun onStop() {
super.onStop()
val lastVisiblePosition =
(mListRv?.layoutManager as? LinearLayoutManager)?.findLastCompletelyVisibleItemPosition() ?: 0
NewFlatLogUtils.logDiscoverPageQuit(lastVisiblePosition)
if (mDiscoveryVisibleTimer != null) {
mDiscoveryVisibleTimer?.cancel()
mDiscoveryVisibleTimer = null
}
if (mDiscoveryQuitTimer != null) {
mDiscoveryQuitTimer?.cancel()
mDiscoveryQuitTimer = null
}
}
override fun getItemDecoration(): RecyclerView.ItemDecoration? = null
private fun showUnzipFailureDialog(downloadEntity: DownloadEntity) {
val data = mListViewModel.positionAndPackageMap
for (gameAndPosition in data) {
if (gameAndPosition.key.contains(downloadEntity.packageName)) {
val targetView = mLayoutManager.findViewByPosition(gameAndPosition.value)
if (targetView != null) {
DialogUtils.showUnzipFailureDialog(requireContext(), downloadEntity)
return
}
}
}
}
override fun onChanged(ts: MutableList<DiscoveryItemData>?) {
super.onChanged(ts)
val isFirstGuide = SPUtils.getBoolean(Constants.SP_DISCOVERY_GUIDE, true)
if (!isFirstGuide) return
AppExecutor.uiExecutor.executeWithDelay({
showGuideView()
SPUtils.setBoolean(Constants.SP_DISCOVERY_GUIDE, false)
}, 800)
}
private fun showGuideView() {
if (!isSupportVisible) return
val firstView = mListRv?.layoutManager?.findViewByPosition(0)
if (firstView != null && requireActivity() is AppCompatActivity) {
val location = IntArray(2)
firstView.getLocationInWindow(location)
val decorView = requireActivity().window.decorView as? FrameLayout
val guideViewBinding =
LayoutDiscoveryGuideBinding.inflate(LayoutInflater.from(requireContext()), decorView, true)
val originalBackground = firstView.background
val newColor =
if (mIsDarkModeOn) R.color.black.toColor(requireContext()) else R.color.white.toColor(requireContext())
firstView.setBackgroundColor(newColor)
guideViewBinding.guideImageContainer.setCardBackgroundColor(newColor)
val snapshotBitmap = firstView.getBitmapFromView(
firstView.width - 16F.dip2px(),
firstView.height,
-8F.dip2px().toFloat(),
0F
)
firstView.background = originalBackground
guideViewBinding.guideImage.setImageBitmap(snapshotBitmap)
(guideViewBinding.guideImageContainer.layoutParams as RelativeLayout.LayoutParams).run {
topMargin = location[1]
guideViewBinding.guideImageContainer.layoutParams = this
}
guideViewBinding.root.setOnClickListener {
decorView?.removeView(it)
}
}
}
override fun onDarkModeChanged() {
super.onDarkModeChanged()
mListRv?.recycledViewPool?.clear()
mAdapter?.notifyItemRangeChanged(0, mAdapter?.itemCount ?: 0)
mCachedView?.setBackgroundColor(R.color.background_white.toColor(requireContext()))
}
override fun isAutomaticLoad(): Boolean = false
// 下载被删除事件
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(status: EBDownloadStatus) {
if ("delete" == status.status) {
mAdapter?.notifyItemAndRemoveDownload(status)
}
}
// 安装/卸载 事件
@Subscribe(threadMode = ThreadMode.MAIN)
fun onEventMainThread(busFour: EBPackage) {
if ("安装" == busFour.type || "卸载" == busFour.type) {
mAdapter?.notifyDataSetChanged()
}
}
companion object {
private const val mDiscoveryVisibleDuration = 5 * 1000L
private const val mDiscoveryQuitDuration = 60 * 60 * 1000L
}
}

View File

@ -1,14 +0,0 @@
package com.gh.gamecenter.discovery
import androidx.annotation.Keep
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.entity.GameEntity
@Keep
data class DiscoveryItemData(
val gameEntity: GameEntity? = null,
val interestCardLabels: ArrayList<DiscoveryGameCardLabel>? = null,
val interestImageCardLabel: DiscoveryGameCardLabel? = null,
//兴趣推荐卡片序号,埋点用
var cardPosition: Int? = null
)

View File

@ -1,211 +0,0 @@
package com.gh.gamecenter.discovery
import android.annotation.SuppressLint
import android.app.Application
import com.gh.common.util.PackageUtils
import com.gh.download.DownloadManager
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.retrofit.BiResponse
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.common.utils.observableToMain
import com.gh.gamecenter.common.utils.singleToMain
import com.gh.gamecenter.common.utils.toRequestBody
import com.gh.gamecenter.core.utils.ToastUtils
import com.gh.gamecenter.entity.DiscoveryGameCardLabel
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
import io.reactivex.Observable
import okhttp3.ResponseBody
import retrofit2.HttpException
class DiscoveryViewModel(application: Application) : ListViewModel<GameEntity, DiscoveryItemData>(application) {
val positionAndPackageMap = HashMap<String, Int>()
var forceRefresh = true
private val mApi = RetrofitManager.getInstance().api
private var mGameTags: ArrayList<LinkEntity>? = null
private var mDiscoveryGameCardLabels: ArrayList<DiscoveryGameCardLabel>? = null
private var mDiscoveryGameCardLabelMap: LinkedHashMap<String, ArrayList<DiscoveryGameCardLabel>> = linkedMapOf()
init {
getCardLabels()
}
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData) {
mergeResultItemData(it)
}
}
private fun mergeResultItemData(games: MutableList<GameEntity>) {
val itemDataList = arrayListOf<DiscoveryItemData>()
var insertCount = 0
var i = 0
while (i < games.size) {
val gameEntity = games[i]
//删除已安装的游戏
if (gameEntity.getApk().isNotEmpty() && PackageUtils.isInstalled(
HaloApp.getInstance().application,
gameEntity.getApk()[0].packageName
)
) {
games.removeAt(i)
i--
}
i++
}
games.forEachIndexed { index, gameEntity ->
itemDataList.add(DiscoveryItemData(gameEntity))
//第6、12、18、24个游戏后面固定插入兴趣推荐卡片
when (index) {
5 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 1,
interestCardLabels = mDiscoveryGameCardLabelMap["卡片一"]
)
)
insertCount++
}
11 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 2,
interestImageCardLabel = mDiscoveryGameCardLabelMap["卡片二"]?.get(0)
)
)
insertCount++
}
17 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 3,
interestCardLabels = mDiscoveryGameCardLabelMap["卡片三"]
)
)
insertCount++
}
23 -> {
itemDataList.add(
DiscoveryItemData(
cardPosition = 4,
interestCardLabels = mDiscoveryGameCardLabelMap["卡片四"]
)
)
insertCount++
}
else -> {
//do nothing
}
}
addGamePositionAndPackage(index + insertCount, gameEntity)
}
mResultLiveData.postValue(itemDataList)
}
override fun provideDataObservable(page: Int): Observable<MutableList<GameEntity>>? {
val paramsMap = if (forceRefresh) {
mapOf("refresh" to "true")
} else {
mapOf()
}
return mApi.getDiscoveryGames(page, paramsMap).map {
forceRefresh = false
if (page == 1) {
mGameTags = it.gameTags
groupingDiscoveryLabel()
}
it.games
}
}
//按照card字段分组
private fun groupingDiscoveryLabel() {
mDiscoveryGameCardLabelMap.clear()
var tagIndex = 0
mDiscoveryGameCardLabels?.forEach {
if (mDiscoveryGameCardLabelMap.contains(it.card)) {
mDiscoveryGameCardLabelMap[it.card]?.add(it)
} else {
mDiscoveryGameCardLabelMap[it.card] = arrayListOf(it)
}
}
//如果link_type为空需要在mGameTags中依次获取
mDiscoveryGameCardLabelMap.keys.forEach {
val labels = mDiscoveryGameCardLabelMap[it]
labels?.forEach { label ->
if (!mGameTags.isNullOrEmpty() && mGameTags!!.size > tagIndex && label.type.isNullOrEmpty()) {
val gameTag = mGameTags!![tagIndex]
label.link = gameTag.link
label.type = gameTag.type
label.linkText = gameTag.linkText
label.title = gameTag.linkText
tagIndex++
}
}
}
}
private fun getCardLabels() {
mApi.cardLabels
.compose(observableToMain())
.subscribe(object : Response<ArrayList<DiscoveryGameCardLabel>>() {
override fun onResponse(response: ArrayList<DiscoveryGameCardLabel>?) {
super.onResponse(response)
mDiscoveryGameCardLabels = response
initLoadParams()
loadData()
}
override fun onFailure(e: HttpException?) {
super.onFailure(e)
mLoadStatusLiveData.value = LoadStatus.INIT_FAILED
}
})
}
@SuppressLint("CheckResult")
fun discoveryFeedback(gameId: String, reason: String, type: String, callback: () -> Unit) {
val paramsMap = mapOf(
"reason" to reason,
"type" to type
)
mApi.discorveryFeedback(gameId, paramsMap.toRequestBody())
.compose(singleToMain())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
callback.invoke()
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
ToastUtils.showToast("反馈失败")
}
})
}
private fun addGamePositionAndPackage(position: Int, game: GameEntity) {
var packages = ""
for (apkEntity in game.getApk()) {
packages += apkEntity.packageName
}
positionAndPackageMap[packages + (position)] = position
game.gameLocation = GameEntity.GameLocation.INDEX
game.setEntryMap(DownloadManager.getInstance().getEntryMap(game.name))
}
override fun load(loadType: LoadType?) {
if (loadType == LoadType.REFRESH) {
getCardLabels()
} else {
super.load(loadType)
}
}
}

View File

@ -32,10 +32,6 @@ data class AmwayCommentEntity(
@SerializedName("new_star")
var star: Float,
var subtitle: String? = "",
@SerializedName("subtitle_style")
var subtitleStyle: TagStyleEntity? = null,
// 曝光用的位置
var sequence: Int = 0,
var outerSequence: Int = 0
@ -54,9 +50,6 @@ data class AmwayCommentEntity(
gameEntity.iconSubscript = iconSubscript
gameEntity.platform = ""
gameEntity.subtitle = subtitle ?: ""
gameEntity.subtitleStyle = subtitleStyle
gameEntity.sequence = sequence
gameEntity.outerSequence = outerSequence
return gameEntity

View File

@ -1,14 +0,0 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.LinkEntity
import com.google.gson.annotations.SerializedName
data class DiscoveryGameCardEntity(
val more: Int,
@SerializedName("game_tags")
val gameTags: ArrayList<LinkEntity> = arrayListOf(),
@SerializedName("data")
val games: ArrayList<GameEntity> = arrayListOf()
)

View File

@ -1,11 +0,0 @@
package com.gh.gamecenter.entity
import com.gh.gamecenter.common.entity.LinkEntity
import com.google.gson.annotations.SerializedName
data class DiscoveryGameCardLabel(
@SerializedName("_id")
val id: String = "",
val card: String = "",
val order: Int = 0,
) : LinkEntity()

View File

@ -20,6 +20,7 @@ import com.lightgame.download.DownloadEntity
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import java.util.*
import kotlin.collections.ArrayList
@Parcelize
data class GameEntity(
@ -290,13 +291,6 @@ data class GameEntity(
var welcomeDialogId: String? = null,
var welcomeDialogTitle: String? = null,
@SerializedName("column_rank")
var columnRank: ColumnRank? = null,//榜单详情
@SerializedName("ad_icon_active")
var adIconActive: Boolean = false,// 游戏广告 true显示false隐藏。只有当type=ad时才会返回该字段
@SerializedName("recommend_tag")
var recommendTag: String = "",
// 专题id用于曝光使用
var subjectId: String? = null,
// 专题名字,用于曝光使用
@ -842,12 +836,6 @@ data class GameEntity(
var url: String = ""
) : Parcelable
}
@Parcelize
data class ColumnRank(
val name: String = "",
val position: Int = 0
) : Parcelable
}
@Parcelize
@ -876,11 +864,7 @@ data class SimpleGame(
@SerializedName("recommend_text")
var recommendText: String = "",
@SerializedName("download_status")
var downloadStatus: String = "",
var subtitle: String? = "",
@SerializedName("subtitle_style")
var subtitleStyle: TagStyleEntity? = null,
var downloadStatus: String = ""
) : Parcelable {
@IgnoredOnParcel
@ -906,8 +890,6 @@ data class SimpleGame(
gameEntity.recommendStar = recommendStar
gameEntity.recommendText = recommendText
gameEntity.downloadStatus = downloadStatus
gameEntity.subtitle = subtitle ?: ""
gameEntity.subtitleStyle = subtitleStyle
return gameEntity
}

View File

@ -16,9 +16,6 @@ data class HistoryGameEntity(
var tag: ArrayList<String>? = null,
var isLibaoExist: Boolean = false,
var subtitle: String = "",
var subtitleStyle: TagStyleEntity? = null,
@SerializedName("tag_style")
var tagStyle: ArrayList<TagStyleEntity> = ArrayList(),
@ -34,8 +31,6 @@ data class HistoryGameEntity(
gameEntity.des = des
gameEntity.rawIcon = icon
gameEntity.iconSubscript = iconSubscript
gameEntity.subtitle = subtitle
gameEntity.subtitleStyle = subtitleStyle
gameEntity.name = name
gameEntity.tagStyle = tagStyle
gameEntity.isLibaoExists = isLibaoExist

View File

@ -1,21 +0,0 @@
package com.gh.gamecenter.entity
import com.google.gson.annotations.SerializedName
data class NewApiSettingsEntity(
@SerializedName("night_mode")
var nightMode: NightMode? = null,
var simulator: SimulatorEntity? = null,
) {
/**
*
* "icon": false, // 是否显示切换true显示
* "setting": false, // 设置页面是否显示true显示
* "install": false, // 安装时的默认值true开启
*/
data class NightMode(
val icon: Boolean,
val setting: Boolean,
val install: Boolean
)
}

View File

@ -5,6 +5,9 @@ import com.google.gson.annotations.SerializedName
data class NewSettingsEntity(
@SerializedName("install_model")
var installModel: InstallModel? = null,
@SerializedName("night_mode")
var nightMode: NightMode? = null,
var simulator: SimulatorEntity? = null
) {
data class InstallModel(
var status: String = "",
@ -12,4 +15,16 @@ data class NewSettingsEntity(
@SerializedName("white_list")
var whiteList: ArrayList<String>? = arrayListOf()
)
/**
*
* "icon": false, // 是否显示切换true显示
* "setting": false, // 设置页面是否显示true显示
* "install": false, // 安装时的默认值true开启
*/
data class NightMode(
val icon: Boolean,
val setting: Boolean,
val install: Boolean
)
}

View File

@ -28,13 +28,13 @@ data class PrivacyPolicyEntity(
intro = "用于下载游戏,以及实现内容缓存提升浏览体验"
)
)
// permissions.add(
// PermissionsEntity(
// icon = "res:///" + R.drawable.permission_phone_state,
// name = "设备信息",
// intro = "为保障您的账号安全及使用软件与服务可安全运行"
// )
// )
permissions.add(
PermissionsEntity(
icon = "res:///" + R.drawable.permission_phone_state,
name = "设备信息",
intro = "为保障您的账号安全及使用软件与服务可安全运行"
)
)
// permissions.add(PermissionsEntity(
// icon = "res:///" + R.drawable.permission_sdk,
// name = "第三方SDK使用信息提醒",

View File

@ -722,7 +722,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
val entrance = if (mForumDetail?.type == "game_bbs") "游戏论坛详情页" else "综合论坛详情页"
NewLogUtils.logBbsPostPanelClick(entrance, mBbsId, mBbsType)
contentView.findViewById<View>(R.id.community_edit_article_container).setOnClickListener {
context?.ifLogin("论坛详情-发布-发帖子", action = {
context?.ifLogin("论坛详情", action = {
checkStoragePermissionBeforeAction {
MtaHelper.onEvent("论坛详情", "发布", "发帖子")
NewLogUtils.logArticleEditEnter(entrance, mBbsId, mBbsType)
@ -745,7 +745,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
})
}
contentView.findViewById<View>(R.id.community_edit_question_container).setOnClickListener {
context?.ifLogin("论坛详情-发布-提问", action = {
context?.ifLogin("论坛详情", action = {
checkStoragePermissionBeforeAction {
MtaHelper.onEvent("论坛详情", "发布", "提问")
NewLogUtils.logQuestionEditEnter(entrance, mBbsId, mBbsType)
@ -768,7 +768,7 @@ class ForumDetailFragment : BaseLazyTabFragment(), IScrollable {
})
}
contentView.findViewById<View>(R.id.community_edit_video_container).setOnClickListener {
context?.ifLogin("论坛详情-发布-视频", action = {
context?.ifLogin("论坛详情", action = {
checkStoragePermissionBeforeAction {
MtaHelper.onEvent("论坛详情", "发布", "发视频")
NewLogUtils.logPublishVideoEnter(entrance, mBbsId, mBbsType)

View File

@ -404,7 +404,7 @@ class CommunityHomeFragment : LazyFragment() {
dialog.show()
NewLogUtils.logBbsPostPanelClick("推荐信息流", "", "")
contentView.findViewById<View>(R.id.community_edit_article_container).setOnClickListener {
context?.ifLogin("论坛首页-发布-发帖子", action = {
context?.ifLogin("论坛首页", action = {
checkStoragePermissionBeforeAction {
showRegulationTestDialogIfNeeded {
MtaHelper.onEvent("论坛首页", "发布", "发帖子")
@ -419,7 +419,7 @@ class CommunityHomeFragment : LazyFragment() {
})
}
contentView.findViewById<View>(R.id.community_edit_question_container).setOnClickListener {
context?.ifLogin("论坛首页-发布-提问", action = {
context?.ifLogin("论坛首页", action = {
checkStoragePermissionBeforeAction {
showRegulationTestDialogIfNeeded {
MtaHelper.onEvent("论坛首页", "发布", "提问")
@ -431,7 +431,7 @@ class CommunityHomeFragment : LazyFragment() {
})
}
contentView.findViewById<View>(R.id.community_edit_video_container).setOnClickListener {
context?.ifLogin("论坛首页-发布-视频", action = {
context?.ifLogin("论坛首页", action = {
checkStoragePermissionBeforeAction {
showRegulationTestDialogIfNeeded {
MtaHelper.onEvent("论坛首页", "发布", "发视频")

View File

@ -345,7 +345,7 @@ class ForumArticleAskItemViewHolder(val binding: CommunityAnswerItemBinding) :
}
inviteAnswer.setOnClickListener {
CheckLoginUtils.checkLogin(itemView.context, "${entrance}-点赞") {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
val questionsDetailEntity = QuestionsDetailEntity(
id = entity.id,
title = entity.questions.title,

View File

@ -25,7 +25,6 @@ import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.databinding.FragmentMainHomeWrapperBinding
import com.gh.gamecenter.databinding.TabItemMainBinding
import com.gh.gamecenter.discovery.DiscoveryFragment
import com.gh.gamecenter.entity.SubjectData
import com.gh.gamecenter.entity.SubjectRecommendEntity
import com.gh.gamecenter.game.GameFragment
@ -487,10 +486,6 @@ class HomeSearchToolWrapperFragment : SearchToolWrapperFragment() {
putString(EntranceConsts.KEY_COLLECTION_ID, tab.link)
putString(EntranceConsts.KEY_COLUMNNAME, tab.text)
})
"explore_column" -> DiscoveryFragment().with(Bundle().apply {
putString(EntranceConsts.KEY_ENTRANCE, "首页")
putInt(EntranceConsts.KEY_POSITION, index)
})
"bbs" -> Fragment()
else -> Fragment()
}

View File

@ -36,7 +36,6 @@ import com.gh.gamecenter.common.entity.LinkEntity
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.FixGridLayoutManager
import com.gh.gamecenter.common.view.GridSpacingItemDecoration
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.core.utils.MtaHelper
@ -66,13 +65,13 @@ import com.gh.gamecenter.game.vertical.GameVerticalAdapter
import com.gh.gamecenter.game.vertical.GameVerticalSlideViewHolder
import com.gh.gamecenter.game.vertical.OnPagerSnapScrollListener
import com.gh.gamecenter.home.BlankDividerViewHolder
import com.gh.gamecenter.home.HomeDividerViewHolder
import com.gh.gamecenter.home.HomeGameItemViewHolder
import com.gh.gamecenter.home.gamecollection.HomeGameCollectionViewHolder
import com.gh.gamecenter.servers.GameServersActivity
import com.gh.gamecenter.subject.SubjectActivity
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.download.DownloadEntity
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.home.HomeGameItemViewHolder
class GameFragmentAdapter(
context: Context,
@ -129,7 +128,6 @@ class GameFragmentAdapter(
if (itemData.doubleCardColumn != null) return ItemViewType.DOUBLE_CARD_COLUMN
if (itemData.bigImageRecommend != null) return ItemViewType.BIG_IMAGE_RECOMMEND
if (itemData.attachGame != null) return ItemViewType.GAME_ITEM
if (itemData.lineDivider != null) return ItemViewType.DIVIDER_ITEM
return ItemViewType.LOADING
}
@ -166,7 +164,6 @@ class GameFragmentAdapter(
ItemViewType.DOUBLE_CARD_COLUMN -> DoubleCardViewHolder(parent.toBinding())
ItemViewType.BIG_IMAGE_RECOMMEND -> BigImageRecommendViewHolder(parent.toBinding())
ItemViewType.GAME_ITEM -> HomeGameItemViewHolder(parent.toBinding())
ItemViewType.DIVIDER_ITEM -> HomeDividerViewHolder(parent.toBinding())
else -> GameItemViewHolder(GameItemBinding.bind(mLayoutInflater.inflate(R.layout.game_item, parent, false)))
}
@ -194,7 +191,6 @@ class GameFragmentAdapter(
is DoubleCardViewHolder -> bindGameDoubleCard(holder, position)
is BigImageRecommendViewHolder -> bindBigImageRecommend(holder, position)
is HomeGameItemViewHolder -> bindAttachGame(holder, position)
is HomeDividerViewHolder -> holder.bindView(mItemDataList[position].lineDivider ?: 1F)
}
}

View File

@ -2,7 +2,6 @@ package com.gh.gamecenter.game
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.text.TextUtils
import android.view.View
import android.widget.Space
import android.widget.TextView
@ -12,7 +11,6 @@ import com.gh.common.databind.BindingAdapters
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.maxWidthExcludeZero
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.DrawableView
@ -34,7 +32,6 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
) {
binding.run {
root.background = R.drawable.reuse_listview_item_style.toDrawable(root.context)
selectIv.setImageDrawable(DrawableView.getCheckSelectorDrawable(root.context))
gameKaifuType.setBackgroundColor(R.color.theme.toColor(root.context))
gameName.setTextColor(R.color.text_title.toColor(root.context))
gameDes.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
@ -89,17 +86,19 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
}
@JvmStatic
fun initGameSubtitle(entity: GameEntity,
gameSubtitleTv: TextView,
gameDesSpace: Space? = null,
rootContainer: ConstraintLayout? = null,
forceShowSubtitle: Boolean = false) {
fun initGameSubtitle(
entity: GameEntity,
gameSubtitleTv: TextView,
gameDesSpace: Space,
rootContainer: ConstraintLayout,
forceShowSubtitle: Boolean = false
) {
gameSubtitleTv.visibility = View.GONE
if ((entity.serverLabel == null && entity.subtitle.isNotEmpty() && !entity.advanceDownload) || (forceShowSubtitle && entity.subtitle.isNotEmpty())) {
gameSubtitleTv.run {
visibility = View.VISIBLE
text = entity.subtitle
if (entity.subtitleStyle != null && !TextUtils.isEmpty(entity.subtitleStyle?.color)) {
if (entity.subtitleStyle != null) {
setTextColor(Color.parseColor("#${entity.subtitleStyle?.color}"))
background = GradientDrawable().apply {
cornerRadius = 2F.dip2px().toFloat()
@ -113,9 +112,8 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
}
}
}
gameDesSpace?.post {
// 模拟器上可能出现未提前 bindView 导致 gameDesSpace.width 为 0 的情况
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
gameDesSpace.post {
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (entity.advanceDownload) {
@ -126,12 +124,15 @@ class GameItemViewHolder(var binding: GameItemBinding) : BaseRecyclerViewHolder<
background = R.drawable.bg_advance_download_game_subtitle.toDrawable(context)
}
}
rootContainer?.let {
ConstraintSet().apply {
clone(rootContainer)
connect(R.id.game_name, ConstraintSet.END, if (entity.serverLabel != null && !entity.advanceDownload && !forceShowSubtitle) R.id.recent_played_tag else R.id.gameSubtitleTv, ConstraintSet.START)
}.applyTo(rootContainer)
}
ConstraintSet().apply {
clone(rootContainer)
connect(
R.id.game_name,
ConstraintSet.END,
if (entity.serverLabel != null && !entity.advanceDownload && !forceShowSubtitle) R.id.recent_played_tag else R.id.gameSubtitleTv,
ConstraintSet.START
)
}.applyTo(rootContainer)
}
}

View File

@ -527,15 +527,17 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
GameSubstituteRepositoryHelper.replaceGames(data, mSubjectGameIdList, it, false)
}
}
val shouldShowDivider = subjectEntity.type == "game" || subjectEntity.type == "video"
val nextItem = if (index + 1 < mSubjectList.size) {
mSubjectList[index + 1]
} else {
mSubjectList[index]
}
val shouldShowDivider = nextItem.type == "game" || nextItem.type == "video"
// 若在顶端则不添加空白间距
if (!(!isTopItemShown && index == 0) && !shouldShowDivider) {
mItemDataListCache.add(getBlankSpacingItem())
}
if (shouldShowDivider) {
mItemDataListCache.add(GameItemData().apply { lineDivider = DEFAULT_DIVIDER })
}
if (!data.isNullOrEmpty() && !data[0].image.isNullOrEmpty() && subjectEntity.type != "column_collection") {
val itemDataImage = GameItemData()
@ -909,8 +911,4 @@ class GameViewModel(application: Application, var blockData: SubjectRecommendEnt
return GameViewModel(mApplication, blockData) as T
}
}
companion object {
const val DEFAULT_DIVIDER = 1F
}
}

View File

@ -37,8 +37,6 @@ class CommonCollectionViewHolder(val binding: CommonCollectionListBinding) : Bas
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
var position = mLayoutManager.findLastCompletelyVisibleItemPosition()
if (position == -1) position = mLayoutManager.findLastVisibleItemPosition() - 1
if (position < 0) return
val linkEntity = mCollection?.commonCollectionList?.get(position)
NewLogUtils.logSlideCommonCollection(
mCollection?.id ?: "",

View File

@ -37,8 +37,6 @@ class GameItemData {
var blankDivider: Float? = null // 空白的空间补全item
var lineDivider: Float? = null
var offset: Int = 0
var exposureEvent: ExposureEvent? = null
var exposureEventList: ArrayList<ExposureEvent>? = null

View File

@ -13,7 +13,6 @@ import com.gh.common.util.DownloadItemUtils
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.maxWidthExcludeZero
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.AsyncUi
@ -112,7 +111,7 @@ class GameVerticalAdapter(
}
}
mGameDesSpace.post {
gameSubtitleTv.maxWidthExcludeZero(mGameDesSpace.width)
gameSubtitleTv.maxWidth = mGameDesSpace.width
}
}
if (gameEntity.advanceDownload) {

View File

@ -149,7 +149,7 @@ open class GameCollectionDetailAdapter(
}
is CommentItemViewHolder -> {
bindComment(holder.binding, mEntityList[position].commentNormal!!, position) { deleteCommentEntity ->
bindComment(holder.binding, mEntityList[position].commentNormal!!) { deleteCommentEntity ->
val findEntity =
mEntityList.find { it.commentNormal != null && it.commentNormal?.id == deleteCommentEntity.id }
val index = mEntityList.indexOf(findEntity)
@ -193,7 +193,6 @@ open class GameCollectionDetailAdapter(
fun bindComment(
binding: ItemArticleDetailCommentBinding,
comment: CommentEntity,
position: Int,
deleteCallBack: ((comment: CommentEntity) -> Unit)? = null
) {
bindNormalComment(binding, comment, deleteCallBack)
@ -203,7 +202,7 @@ open class GameCollectionDetailAdapter(
updateSubComment(this, comment)
floorHintTv.visibility = View.GONE
bottomDivider.goneIf(position == itemCount - 2)
bottomDivider.visibility = View.GONE
root.setOnClickListener {
mContext.startActivity(
@ -639,7 +638,7 @@ open class GameCollectionDetailAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (gameEntity.advanceDownload) {

View File

@ -592,36 +592,32 @@ class GameDetailFragment : ToolbarFragment(), IScrollable {
}
private fun subtractGameNameIfNeeded(textView: TextView, name: CharSequence, tagLayout: FrameLayout) {
try {
if (!isAdded) return
textView.run {
if (lineCount > 2 || (layout != null && layout.getEllipsisCount(1) > 0)) {
val displayName = name.substring(0, name.length - 2) + ""
text = displayName
if (tagLayout.getChildAt(0) != null) {
val tagView = tagLayout.getChildAt(0)
tagView.layoutParams = (tagView.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(if (lineCount == 1) 0 else 4F.dip2px(), 0, 0, 0)
}
}
val tagBitmap = tagLayout.convertViewToBitmap()
text = SpannableStringBuilder("$displayName ").apply {
tagBitmap?.let {
setSpan(
CenterImageSpan(
context,
it
), displayName.length, displayName.length + 1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE
)
}
}
post {
subtractGameNameIfNeeded(this, displayName, tagLayout)
if (!isAdded) return
textView.run {
if (lineCount > 2 || (layout != null && layout.getEllipsisCount(1) > 0)) {
val displayName = name.substring(0, name.length - 2) + ""
text = displayName
if (tagLayout.getChildAt(0) != null) {
val tagView = tagLayout.getChildAt(0)
tagView.layoutParams = (tagView.layoutParams as FrameLayout.LayoutParams).apply {
setMargins(if (lineCount == 1) 0 else 4F.dip2px(), 0, 0, 0)
}
}
val tagBitmap = tagLayout.convertViewToBitmap()
text = SpannableStringBuilder("$displayName ").apply {
tagBitmap?.let {
setSpan(
CenterImageSpan(
context,
it
), displayName.length, displayName.length + 1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE
)
}
}
post {
subtractGameNameIfNeeded(this, displayName, tagLayout)
}
}
} catch (e: Exception) {
SentryHelper.onEvent("GAME_DETAIL_SUBTRACT_GAME_NAME_ERROR", "exception_digest", e.localizedMessage)
}
}

View File

@ -215,8 +215,7 @@ class RatingReplyActivity : ListActivity<RatingReplyEntity, RatingReplyViewModel
fun onViewClick(view: View) {
if (view.id == R.id.answer_comment_send_btn) {
val entrance = if (mReadyReplyData == null) "${mEntrance}-评论详情-评论" else "${mEntrance}-评论详情-回复"
ifLogin(entrance) {
ifLogin(mEntrance) {
showRegulationTestDialogIfNeeded {
val replyContent = mInputBinding.answerCommentEt.text.toString()
if (replyContent.isNotEmpty()) {

View File

@ -1,9 +1,15 @@
package com.gh.gamecenter.gamedetail.rating
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.ColorDrawable
import android.net.Uri
import android.text.SpannableStringBuilder
import android.text.Spanned
import android.text.TextPaint
import android.text.style.ClickableSpan
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -12,37 +18,39 @@ import android.widget.PopupWindow
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.IExposable
import com.gh.common.util.*
import com.gh.common.util.DialogUtils
import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.common.view.CustomLinkMovementMethod
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.base.activity.BaseActivity
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.callback.ConfirmListener
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.common.view.SegmentedFilterView
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.core.utils.MtaHelper
import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.core.utils.SpanBuilder
import com.gh.gamecenter.databinding.ItemArticleDetailCommentBinding
import com.gh.gamecenter.databinding.PieceArticleDetailCommentFilterBinding
import com.gh.gamecenter.databinding.RatingReplyHeadItemBinding
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.entity.PluginLocation
import com.gh.gamecenter.entity.RatingComment
import com.gh.gamecenter.entity.RatingReplyEntity
import com.gh.gamecenter.entity.UserEntity
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
import com.gh.gamecenter.login.user.UserManager
import com.lightgame.utils.Utils
import com.squareup.picasso.Picasso
import io.reactivex.Single
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
class RatingReplyAdapter(
context: Context,
@ -188,7 +196,7 @@ class RatingReplyAdapter(
return@OnLongClickListener true
})
likeCountTv.setDebouncedClickListener {
likeCountTv.context.ifLogin("${entrance}-评论详情-点赞") {
likeCountTv.context.ifLogin(entrance) {
if (!commentData.me.isVoted) {
viewModel.voteComment {
likeCountTv.setCompoundDrawablesWithIntrinsicBounds(
@ -557,6 +565,47 @@ class RatingReplyAdapter(
}
}
@SuppressLint("CheckResult")
private fun RatingReplyItemBinding.setBadgeSpan(
user: UserEntity,
replyNameSpannable: SpannableStringBuilder,
startIndex: Int,
endIndex: Int
) {
Single.just(user.badge?.icon)
.map {
ImageUtils.picasso.load(Uri.parse(it)).priority(Picasso.Priority.HIGH).get()
}.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
val bitmapDrawable = BitmapDrawable(mContext.resources, it)
bitmapDrawable.setBounds(0, 0, 16F.dip2px(), 16F.dip2px())
replyNameSpannable.setSpan(
CenterImageSpan(bitmapDrawable),
startIndex,
endIndex,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
)
replyNameSpannable.setSpan(object : ClickableSpan() {
override fun updateDrawState(ds: TextPaint) {
super.updateDrawState(ds)
ds.isUnderlineText = false
}
override fun onClick(widget: View) {
MtaHelper.onEvent("进入徽章墙_用户记录", "游戏评论详情", "${user.name}${user.id}")
MtaHelper.onEvent("徽章中心", "进入徽章中心", "游戏评论详情")
DirectUtils.directToBadgeWall(mContext, user.id, user.name, user.icon)
}
}, startIndex, endIndex, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE)
userName.movementMethod = CustomLinkMovementMethod.getInstance()
userName.text = replyNameSpannable
}, {
it.printStackTrace()
})
}
fun handleSyncData(requestCode: Int, intent: Intent?) {
SyncDataBetweenPageHelper.resultHandle(intent, object : OnSyncCallBack<RatingComment> {
override fun onData(dataPosition: Int): RatingComment? {

View File

@ -16,7 +16,6 @@ import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.GameViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.GameItemBinding
import com.gh.gamecenter.databinding.PopupHistoryOptionBinding
@ -150,11 +149,6 @@ class HistoryGameListAdapter(context: Context, private val mViewModel: HistoryGa
}, extraConfig = DialogHelper.Config(centerTitle = true, centerContent = true))
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()

View File

@ -1,17 +0,0 @@
package com.gh.gamecenter.home
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.R
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.databinding.HomeDividerItemBinding
class HomeDividerViewHolder(var binding: HomeDividerItemBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bindView(height: Float) {
val lp = binding.container.layoutParams
lp.height = height.dip2px()
binding.container.layoutParams = lp
binding.divider.setBackgroundColor(R.color.divider.toColor(binding.root.context))
}
}

View File

@ -14,15 +14,14 @@ import com.gh.common.util.NewLogUtils
import com.gh.gamecenter.AboutActivity
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder
import com.gh.gamecenter.common.baselist.DiffUtilAdapter
import com.gh.gamecenter.common.baselist.LoadStatus
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.safelyGetInRelease
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.databinding.HomeDividerItemBinding
import com.gh.gamecenter.entity.AmwayCommentEntity
import com.gh.gamecenter.entity.SubjectEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
@ -475,6 +474,16 @@ class HomeFragmentAdapter(
return mDataList[pos].exposureEventList
}
class HomeDividerViewHolder(var binding: HomeDividerItemBinding) :
RecyclerView.ViewHolder(binding.root) {
fun bindView(height: Float) {
val lp = binding.container.layoutParams
lp.height = height.dip2px()
binding.container.layoutParams = lp
binding.divider.setBackgroundColor(R.color.divider.toColor(binding.root.context))
}
}
companion object {
const val SLIDE_ITEM: Int = 100
const val RECOMMENDS_ITEM: Int = 101

View File

@ -15,6 +15,7 @@ import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.RandomUtils
import com.gh.gamecenter.databinding.HomeGameItemBinding
import com.gh.gamecenter.entity.SubjectEntity
@ -39,15 +40,18 @@ class HomeGameItemViewHolder(val binding: HomeGameItemBinding) : BaseRecyclerVie
val displayContent = subjectEntity.displayContent
game.displayContent = displayContent
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = game.apply {
outerSequence = position
},
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("游戏", ""))
)
createExposureEventCallback.invoke(exposureEvent)
var exposureEvent: ExposureEvent? = null
holder.bindGameInfo(subjectEntity, adapter, position, exposureEvent, entrance)
runOnIoThread(true) {
exposureEvent = ExposureEvent.createEventWithSourceConcat(
gameEntity = game,
basicSource = mBasicExposureSource,
source = listOf(ExposureSource("游戏", ""))
)
createExposureEventCallback.invoke(exposureEvent!!)
}
holder.binding.gameBrief.text = subjectEntity.recommendText
holder.binding.gameImage.visibleIf(!(displayContent == "video" && game.topVideo != null))
holder.binding.autoVideoView.goneIf(displayContent != "video" || game.topVideo == null) {

View File

@ -12,16 +12,13 @@ import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.common.view.AsyncCell
import com.gh.gamecenter.databinding.HomeAmwayItemBinding
import com.gh.gamecenter.entity.AmwayCommentEntity
import com.gh.gamecenter.game.GameItemViewHolder
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
import java.util.regex.Pattern
class HomeAmwayItemViewHolder(val binding: HomeAmwayItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
fun bindAmway(amway: AmwayCommentEntity) {
val gameEntity = amway.game.toGameEntity()
binding.gameIcon.displayGameIcon(gameEntity)
binding.gameIcon.displayGameIcon(amway.game.toGameEntity())
binding.gameName.text = amway.game.name
binding.amwayScoreNumber.text = amway.game.star.toString()
BindingAdapters.setGameTags(binding.gameTags, amway.game.tag, 2)
@ -54,7 +51,6 @@ class HomeAmwayItemViewHolder(val binding: HomeAmwayItemBinding) : BaseRecyclerV
ratingName.setTextColor(R.color.text_subtitleDesc.toColor(root.context))
all.setTextColor(R.color.text_title.toColor(root.context))
}
GameItemViewHolder.initGameSubtitle(gameEntity, binding.gameSubtitleTv)
}
}

View File

@ -27,12 +27,10 @@ import com.gh.gamecenter.adapter.viewholder.NewsDigestViewHolder;
import com.gh.gamecenter.databinding.NewsDigestItemBinding;
import com.gh.gamecenter.entity.CommentnumEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.entity.ViewsEntity;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.manager.CommentManager;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.manager.VisitManager;
@ -367,9 +365,6 @@ class ConcernAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.binding.newsDigestThumb.displayGameIcon(concernEntity.getGameIcon(), null);
}
viewHolder.binding.newsDigestTitle.setText(concernEntity.getGameName());
GameEntity gameEntity = concernEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, viewHolder.binding.gameSubtitleTv, null, null, false);
NewsUtils.setNewsPublishOn(viewHolder.binding.newsDigestTime, concernEntity.getTime());
if ("libao".equals(concernEntity.getType())) {

View File

@ -22,10 +22,8 @@ import com.gh.gamecenter.common.callback.OnRequestCallBackListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.databinding.LibaoItemBinding;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -240,9 +238,6 @@ class Libao2FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
// LibaoUtils.setLiBaoBtnStatusRound(holder.libaoBtnStatus, libaoEntity, true, mContext);
}
GameEntity gameEntity = libaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, holder.binding.gameSubtitleTv, null, null, false);
}
private void initFooterViewHolder(FooterViewHolder holder) {

View File

@ -25,12 +25,10 @@ import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.LibaoNormalViewHolder;
import com.gh.gamecenter.databinding.LibaoItemBinding;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -263,9 +261,6 @@ class Libao3FragmentAdapter extends BaseRecyclerAdapter<RecyclerView.ViewHolder>
holder.binding.libaoBtnStatus.setText("复制");
holder.binding.libaoBtnStatus.setBackgroundResource(R.drawable.button_normal_round_style);
GameEntity gameEntity = libaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, holder.binding.gameSubtitleTv, null, null, false);
} else if (viewHolder instanceof FooterViewHolder) {
initFooterViewHolder((FooterViewHolder) viewHolder);
}

View File

@ -20,12 +20,10 @@ import com.gh.gamecenter.common.utils.ExtensionsKt;
import com.gh.gamecenter.core.utils.DisplayUtils;
import com.gh.gamecenter.core.utils.UrlFilterUtils;
import com.gh.gamecenter.databinding.LibaoItemBinding;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.MeEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.common.retrofit.Response;
import com.gh.gamecenter.game.GameItemViewHolder;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.lightgame.adapter.BaseRecyclerAdapter;
@ -170,8 +168,6 @@ public class LibaoHistoryAdapter extends BaseRecyclerAdapter<ViewHolder> {
LibaoUtils.setLiBaoBtnStatusRound(viewHolder.binding.libaoBtnStatus,
libaoEntity, true, mContext);
GameEntity gameEntity = libaoEntity.getGame().toGameEntity();
GameItemViewHolder.initGameSubtitle(gameEntity, viewHolder.binding.gameSubtitleTv, null, null, false);
} else {
FooterViewHolder viewHolder = (FooterViewHolder) holder;
viewHolder.initFooterViewHolder(isLoading, isNetworkError, isOver, v -> {

View File

@ -18,7 +18,6 @@ import com.gh.gamecenter.databinding.LibaoItemBinding
import com.gh.gamecenter.entity.LibaoEntity
import com.gh.gamecenter.entity.LibaoStatusEntity
import com.gh.gamecenter.common.retrofit.Response
import com.gh.gamecenter.game.GameItemViewHolder
import com.gh.gamecenter.retrofit.RetrofitManager
import com.lightgame.adapter.BaseRecyclerAdapter
import io.reactivex.android.schedulers.AndroidSchedulers
@ -225,10 +224,6 @@ class LibaoNewAdapter(
}
}
}
libaoEntity.game?.toGameEntity()?.let {
GameItemViewHolder.initGameSubtitle(it, holder.binding.gameSubtitleTv)
}
}
fun getLibaoListSize(): Int {

View File

@ -44,7 +44,7 @@ import com.gh.gamecenter.qa.answer.detail.SimpleAnswerDetailActivity;
import com.gh.gamecenter.qa.article.detail.ArticleDetailActivity;
import com.gh.gamecenter.qa.comment.NewCommentDetailActivity;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.qa.dialog.AskFollowMoreDialog;
import com.gh.gamecenter.qa.follow.AskFollowMoreDialog;
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity;
import com.gh.gamecenter.qa.video.detail.ForumVideoDetailActivity;
import com.gh.gamecenter.retrofit.RetrofitManager;

View File

@ -126,7 +126,7 @@ class MyFollowedGameAdapter(context: Context, var mViewModel: MyFollowedGameView
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (gameEntity.advanceDownload) {

View File

@ -127,7 +127,7 @@ class MyReservationAdapter(context: Context, var mViewModel: MyReservationViewMo
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (gameEntity.advanceDownload) {

View File

@ -165,7 +165,7 @@ open class PlayedGameAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (gameEntity.advanceDownload) {

View File

@ -115,7 +115,7 @@ class HaloPersonalFragment : BaseLazyFragment() {
mStubBinding.motionLayout -> {
if (mUserInfoEntity == null) {
NewFlatLogUtils.logHaloSelfLogin()
CheckLoginUtils.checkLogin(context, "我的光环-立即登录", null)
CheckLoginUtils.checkLogin(context, "我的光环-手机登录", null)
} else {
mStubBinding.ivArrow.performClick()
}
@ -123,7 +123,7 @@ class HaloPersonalFragment : BaseLazyFragment() {
mStubBinding.toolbarContainer -> {
if (mUserInfoEntity == null) {
NewFlatLogUtils.logHaloSelfLogin()
CheckLoginUtils.checkLogin(context, "我的光环-立即登录", null)
CheckLoginUtils.checkLogin(context, "我的光环-手机登录", null)
}
}
mStubBinding.darkModeIv -> {
@ -181,7 +181,7 @@ class HaloPersonalFragment : BaseLazyFragment() {
)
} else {
NewFlatLogUtils.logHaloSelfLogin()
CheckLoginUtils.checkLogin(context, "我的光环-立即登录", null)
CheckLoginUtils.checkLogin(context, "我的光环-手机登录", null)
}
}
mStubBinding.ivArrow -> {

View File

@ -52,30 +52,53 @@ class HaloPersonalRecommendAdapter(val context: Context) : BaseRecyclerAdapter<R
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is PersonalRecommendItemViewHolder && mEntityList.isNotEmpty()) {
val addonLinkEntity = mEntityList[position]
holder.binding.rightDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.topDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.leftDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.bottomDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.bottomDivider.setBackgroundColor(R.color.divider.toColor(mContext))
holder.binding.nameTv.setTextColor(R.color.text_title.toColor(mContext))
holder.binding.descTv.setTextColor(R.color.text_subtitleDesc.toColor(mContext))
when (position) {
0 -> {
holder.binding.rightDivider.visibility = View.VISIBLE
holder.binding.leftDivider.visibility = View.GONE
holder.binding.topDivider.visibility = View.GONE
if (itemCount > 2) {
holder.binding.bottomDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.layoutParams =
(holder.binding.bottomDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(12F.dip2px(), 0, 0, 0)
}
}
}
1 -> {
holder.binding.rightDivider.visibility = View.GONE
holder.binding.leftDivider.visibility = View.VISIBLE
holder.binding.topDivider.visibility = View.GONE
if (itemCount > 2) {
holder.binding.bottomDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.layoutParams =
(holder.binding.bottomDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(0, 0, 12F.dip2px(), 0)
}
}
}
2 -> {
holder.binding.rightDivider.visibility = View.VISIBLE
holder.binding.leftDivider.visibility = View.GONE
holder.binding.topDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.visibility = View.GONE
holder.binding.topDivider.layoutParams =
(holder.binding.topDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(12F.dip2px(), 0, 0, 0)
}
}
3 -> {
holder.binding.rightDivider.visibility = View.GONE
holder.binding.leftDivider.visibility = View.VISIBLE
holder.binding.topDivider.visibility = View.VISIBLE
holder.binding.bottomDivider.visibility = View.GONE
holder.binding.topDivider.layoutParams =
(holder.binding.topDivider.layoutParams as ConstraintLayout.LayoutParams).apply {
setMargins(0, 0, 12F.dip2px(), 0)

View File

@ -37,10 +37,6 @@ class UserHistoryViewModel(
var videoList = arrayListOf<ForumVideoEntity>()
var count = MutableLiveData<Int>()
init {
setOverLimitSize(1)
}
override fun provideDataObservable(page: Int): Observable<MutableList<PersonalHistoryEntity>> {
getCount()
return mApi.getPersonalHistory(

View File

@ -102,7 +102,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
if (filterIllegalVoteStatus(entity.active)) return@setOnClickListener
debounceActionWithInterval(R.id.container_like, 1000) {
CheckLoginUtils.checkLogin(itemView.context, "${entrance}-点赞") {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
if (!voteIcon.isChecked) voteAnswer(entity)
else cancelAnswerVote(entity)
}
@ -254,7 +254,7 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
if (filterIllegalVoteStatus(entity.active)) return@setOnClickListener
debounceActionWithInterval(R.id.container_like, 1000) {
CheckLoginUtils.checkLogin(itemView.context, "${entrance}-点赞") {
CheckLoginUtils.checkLogin(itemView.context, entrance) {
if (entrance == "社区+(推荐)" && position != null) {
entity.run {
NewLogUtils.logRecommendFeedContentClick(
@ -340,24 +340,17 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
RetrofitManager.getInstance()
.api.voteVideo(entity.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
entity.count.vote = entity.count.vote + 1
entity.me.isVoted = true
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
//Utils.toast(getApplication(), "已点赞")
EnergyBridge.postEnergyTask("vote_video", entity.id)
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
if (exception is HttpException) {
ErrorHelper.handleError(
itemView.context,
exception.response()?.errorBody()?.string()
)
}
entity.count.vote = entity.count.vote - 1
entity.me.isVoted = false
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
}
})
@ -382,9 +375,6 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
EnergyBridge.postEnergyTask("vote_answer", entity.id)
}
ToastUtils.showToast("已赞同")
entity.count.vote = entity.count.vote + 1
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
}
override fun onFailure(e: HttpException?) {
@ -393,64 +383,69 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
e?.response()?.errorBody()?.string(),
false
) {
when (it) {
403008 -> {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
}
403036 -> {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
}
404001 -> {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
}
else -> {
setVoteAndCommentStyle(entity)
false
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
} else if (403036 == it) {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
} else if (404001 == it) {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
} else {
entity.count.vote = entity.count.vote - 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = true
} else {
entity.me.isAnswerVoted = true
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
false
}
}
}
})
}
entity.count.vote = entity.count.vote + 1
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
playVoteAnimation()
}
@SuppressLint("CheckResult")
fun cancelAnswerVote(entity: AnswerEntity) {
entity.count.vote = entity.count.vote - 1
voteIcon.isChecked = false
voteCount.setTextColor(R.color.text_subtitleDesc.toColor(voteCount.context))
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
if (entity.type == "video") {
RetrofitManager.getInstance()
.api.undoVoteVideo(entity.id)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : BiResponse<ResponseBody>() {
override fun onSuccess(data: ResponseBody) {
entity.count.vote = entity.count.vote - 1
entity.me.isVoted = false
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
Utils.toast(itemView.context, "取消点赞")
}
override fun onFailure(exception: Exception) {
super.onFailure(exception)
if (exception is HttpException) {
ErrorHelper.handleError(
itemView.context,
exception.response()?.errorBody()?.string()
)
}
entity.count.vote = entity.count.vote + 1
entity.me.isVoted = true
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
}
})
} else {
val unVoteObservable = if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = false
RetrofitManager.getInstance().api.postCommunityArticleUnVote(entity.id)
} else {
entity.me.isAnswerVoted = false
RetrofitManager.getInstance().api
.postAnswerUnvote(entity.id)
}
@ -459,14 +454,6 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
.observeOn(AndroidSchedulers.mainThread())
.subscribe(object : Response<VoteEntity>() {
override fun onResponse(response: VoteEntity?) {
entity.count.vote = entity.count.vote - 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = false
} else {
entity.me.isAnswerVoted = false
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
Utils.toast(itemView.context, "取消赞同")
}
@ -476,25 +463,27 @@ open class BaseAnswerOrArticleItemViewHolder(itemView: View) : BaseRecyclerViewH
e?.response()?.errorBody()?.string(),
false
) {
when (it) {
403008 -> {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
}
403036 -> {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
}
404001 -> {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
}
else -> {
setVoteAndCommentStyle(entity)
false
if (403008 == it) {
Utils.toast(itemView.context, R.string.ask_vote_hint)
true
} else if (403036 == it) {
Utils.toast(itemView.context, R.string.ask_vote_limit_hint)
true
} else if (404001 == it) {
Utils.toast(itemView.context, "内容可能已被删除")
entity.active = false
setVoteAndCommentStyle(entity)
true
} else {
entity.count.vote = entity.count.vote + 1
if (entity.type == "community_article") {
entity.me.isCommunityArticleVote = true
} else {
entity.me.isAnswerVoted = true
}
voteCount.text = if (entity.count.vote > 0) entity.count.vote.toString() else "赞同"
setVoteAndCommentStyle(entity)
false
}
}
}

View File

@ -326,13 +326,6 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
super.onResume()
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
EventBus.getDefault().post(EBReuse(COMMENT_RESUME))
if (::commentEt.isInitialized && commentEt.text.isNotEmpty()) {
// 若不延迟,可能回来的时候不能获取焦点导致弹不起来
mBaseHandler.postDelayed({
Util_System_Keyboard.showSoftKeyboard(context, commentEt)
}, 200)
}
}
override fun onPause() {
@ -543,9 +536,9 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
CommentType.VIDEO,
CommentType.VIDEO_CONVERSATION -> {
if (mCommentEntity == null) {
if (this is StairsCommentFragment) "视频流详情-评论-写评论" else "视频详情-评论-写评论"
"视频详情-评论-写评论"
} else {
if (this is StairsCommentFragment) "视频流详情-评论-回复" else "视频详情-评论-回复"
"视频详情-评论-回复"
}
}

View File

@ -12,6 +12,7 @@ import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.collection.AnswerFragment
import com.gh.gamecenter.databinding.AskAnswerItemBinding
import com.gh.gamecenter.qa.entity.AnswerEntity
import com.gh.gamecenter.qa.questions.detail.AnswerViewHolder
class AnswerAdapter(context: Context, private val mEntrance: String?) : ListAdapter<AnswerEntity>(context) {

View File

@ -0,0 +1,117 @@
//package com.gh.gamecenter.qa.editor
//
//import android.app.Activity
//import androidx.lifecycle.Observer
//import androidx.lifecycle.ViewModelProviders
//import android.content.Intent
//import android.os.Bundle
//import android.view.View
//import android.widget.EditText
//import android.widget.TextView
//import com.gh.gamecenter.common.base.fragment.BaseFragment
//import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
//import com.gh.gamecenter.R
//import com.gh.gamecenter.qa.entity.AnswerEntity
//import com.gh.gamecenter.qa.entity.ArticleEntity
//import com.gh.gamecenter.qa.questions.edit.manager.HistoryDetailActivity
//import com.lightgame.utils.Util_System_Keyboard
//import kotterknife.bindView
//
//class LinkFragment : BaseFragment<Any>() {
//
// val searchEt by bindView<EditText>(R.id.et_search)
// val searchTv by bindView<TextView>(R.id.tv_search)
// val backTv by bindView<TextView>(R.id.tv_back)
// val hint by bindView<TextView>(R.id.link_hint)
//
// private lateinit var mViewModel: LinkViewModel
// private var mProcessingDialog: WaitingDialogFragment? = null
//
// override fun getLayoutId(): Int {
// return R.layout.fragment_link
// }
//
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// mViewModel = ViewModelProviders.of(this).get(LinkViewModel::class.java)
// mViewModel.processDialog.observe(this, Observer { it ->
// if (it?.isShow!!) {
// mProcessingDialog = WaitingDialogFragment.newInstance(it.msg, false)
// mProcessingDialog?.show(childFragmentManager, HistoryDetailActivity::class.java.simpleName)
// } else {
// mProcessingDialog?.dismiss()
// }
// })
// mViewModel.articleLiveData.observe(this, Observer {
// val intent = Intent()
// intent.putExtra(ArticleEntity::class.java.simpleName, it)
// activity?.setResult(Activity.RESULT_OK, intent)
// activity?.finish()
// })
// mViewModel.answerLiveData.observe(this, Observer {
// val intent = Intent()
// intent.putExtra(AnswerEntity::class.java.simpleName, it)
// activity?.setResult(Activity.RESULT_OK, intent)
// activity?.finish()
// })
// }
//
// override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
// super.onViewCreated(view, savedInstanceState)
// searchTv.text = "确定"
// if (activity is InsertAnswerWrapperActivity) {
// searchEt.hint = "请输入回答链接"
// hint.text = "获取回答链接的方式:(暂不支持外部链接)\n1.在回答详情页面,点击下方的\"分享\"按钮 \n2.在分享窗口内,再点击【复制链接】即可"
// } else {
// searchEt.hint = "请输入帖子链接"
// hint.text = "获取帖子链接的方式:(暂不支持外部链接)\n1.在帖子详情页面,点击下方的【分享】按钮 \n2.在分享窗口内,再点击【复制链接】即可"
// }
//
// searchTv.setOnClickListener {
// val link = searchEt.text.toString()
// if ((link.contains("articles") || link.contains("article")) && activity is InsertArticleWrapperActivity) {
// var communityId: String? = null
// var articleId: String? = null
// val splits = link.split("/")
// for (i in 0 until splits.size) {
// val split = splits[i]
// if (split.contains("articles") || split.contains("article")) {
// if (i > 0) {
// communityId = splits[i - 1]
// }
//
// if (splits.size - 1 > i) {
// articleId = splits[i + 1].split(".")[0]
// }
// }
// }
// if (communityId != null && articleId != null) {
// mViewModel.getArticleData(communityId, articleId)
// return@setOnClickListener
// }
// } else if (link.contains("answer") && activity is InsertAnswerWrapperActivity) {
// var answerId: String? = null
// var splits = link.split("=")
// if (splits.size > 1) answerId = splits[1]
// if (answerId.isNullOrEmpty()) {
// splits = link.split("/")
// answerId = splits[splits.size - 1]
// }
// if (!answerId.isNullOrEmpty()) {
// mViewModel.getAnswerData(answerId)
// return@setOnClickListener
// }
// }
// toast("链接格式不对,请检查并重新输入")
// }
// }
//
// fun onPageChanged(position: Int) {
// if (position == 0) {
// searchEt.requestFocus()
// Util_System_Keyboard.showSoftKeyboard(context, searchEt)
// } else {
// Util_System_Keyboard.hideSoftKeyboard(context, searchEt)
// }
// }
//}

View File

@ -0,0 +1,64 @@
//package com.gh.gamecenter.qa.editor
//
//import android.app.Application
//import androidx.lifecycle.AndroidViewModel
//import androidx.lifecycle.MediatorLiveData
//import androidx.lifecycle.MutableLiveData
//import com.gh.gamecenter.common.base.fragment.WaitingDialogFragment
//import com.gh.gamecenter.qa.entity.AnswerEntity
//import com.gh.gamecenter.qa.entity.ArticleEntity
//import com.gh.gamecenter.retrofit.Response
//import com.gh.gamecenter.retrofit.RetrofitManager
//import com.lightgame.utils.Utils
//import io.reactivex.android.schedulers.AndroidSchedulers
//import io.reactivex.schedulers.Schedulers
//import retrofit2.HttpException
//
//class LinkViewModel(application: Application) : AndroidViewModel(application) {
//
// private val mApi = RetrofitManager.getInstance().api
//
// val answerLiveData = MutableLiveData<AnswerEntity>()
// val articleLiveData = MutableLiveData<ArticleEntity>()
// val processDialog = MediatorLiveData<WaitingDialogFragment.WaitingDialogData>()
//
// fun getAnswerData(answerId: String) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", true))
// mApi
// .getCommunityArticle(answerId)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(object : Response<AnswerEntity>() {
// override fun onResponse(response: AnswerEntity?) {
// answerLiveData.postValue(response)
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// }
//
// override fun onFailure(e: HttpException?) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// Utils.toast(getApplication(), "插入链接失败,内容可能已被删除")
// }
// })
// }
//
// fun getArticleData(communityId: String, article: String) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", true))
// mApi
// .getCommunityArticle(communityId, article)
// .subscribeOn(Schedulers.io())
// .observeOn(AndroidSchedulers.mainThread())
// .subscribe(object : Response<ArticleEntity>() {
// override fun onResponse(response: ArticleEntity?) {
// articleLiveData.postValue(response)
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// }
//
// override fun onFailure(e: HttpException?) {
// processDialog.postValue(WaitingDialogFragment.WaitingDialogData("校验中...", false))
// Utils.toast(getApplication(), "插入链接失败,内容可能已被删除")
// }
// })
//
// }
//
//}

View File

@ -0,0 +1,76 @@
package com.gh.gamecenter.qa.editor
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.view.GridSpacingItemDecoration
import com.gh.gamecenter.common.baselist.ListFragment
import com.gh.gamecenter.common.utils.dip2px
import com.gh.gamecenter.common.utils.viewModelProvider
import com.gh.gamecenter.databinding.FragmentLocalMediaBinding
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.video.upload.view.UploadVideoActivity
import com.gh.gamecenter.video.videomanager.VideoManagerActivity
import com.zhihu.matisse.Matisse
import com.zhihu.matisse.internal.utils.PathUtils
@Deprecated("v5.0.0废弃")
class OnlineVideoFragment : ListFragment<MyVideoEntity, OnlineVideoViewModel>() {
private lateinit var binding: FragmentLocalMediaBinding
private var mAdapter: VideoAdapter? = null
override fun getInflatedLayout(): View {
binding = FragmentLocalMediaBinding.inflate(LayoutInflater.from(requireContext()), null, false)
return binding.root
}
override fun provideListAdapter(): VideoAdapter {
if (mAdapter == null) {
mAdapter = VideoAdapter(requireContext(), mListViewModel)
}
return mAdapter!!
}
override fun getItemDecoration(): RecyclerView.ItemDecoration? {
return GridSpacingItemDecoration(3, 1f.dip2px(), false)
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (VideoManagerActivity.REQUEST_CODE_SELECT_VIDEO == requestCode && data != null) {
val uris = Matisse.obtainResult(data)
if (uris.size > 0) {
val videoPath = PathUtils.getPath(requireContext(), uris[0])
val intent = UploadVideoActivity.getIntent(requireContext(), videoPath, mEntrance, "插入视频")
startActivityForResult(intent, VideoManagerActivity.REQUEST_CODE_VIDEO)
}
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val gridLayoutManager = GridLayoutManager(requireContext(), 3)
gridLayoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
return if (position == mAdapter!!.itemCount - 1) {
3
} else {
1
}
}
}
mListRv.layoutManager = gridLayoutManager
}
override fun provideListViewModel(): OnlineVideoViewModel {
return viewModelProvider()
}
}

View File

@ -0,0 +1,25 @@
package com.gh.gamecenter.qa.editor
import android.app.Application
import com.gh.common.constant.Config
import com.gh.gamecenter.common.baselist.ListViewModel
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.login.user.UserManager
import com.gh.gamecenter.retrofit.RetrofitManager
import io.reactivex.Observable
@Deprecated("v5.0.0废弃")
class OnlineVideoViewModel(application: Application) : ListViewModel<MyVideoEntity, MyVideoEntity>(application) {
override fun provideDataObservable(page: Int): Observable<MutableList<MyVideoEntity>> {
return RetrofitManager.getInstance().api.getCommunityInsertVideo(
UserManager.getInstance().userId,
page,
Config.VIDEO_PAGE_SIZE
)
}
override fun mergeResultLiveData() {
mResultLiveData.addSource(mListLiveData, mResultLiveData::postValue)
}
}

View File

@ -0,0 +1,87 @@
package com.gh.gamecenter.qa.editor
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.R
import com.gh.gamecenter.common.viewholder.FooterViewHolder
import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.utils.DialogHelper
import com.gh.gamecenter.core.utils.SPUtils
import com.gh.gamecenter.common.utils.toSimpleCount
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.gamecenter.databinding.VideoStatusItemBinding
import com.gh.gamecenter.entity.MyVideoEntity
import com.gh.gamecenter.video.VideoStatusItemViewHolder
import com.gh.gamecenter.video.VideoVerifyItemViewHolder
import java.text.SimpleDateFormat
import java.util.*
@Deprecated("v5.0.0废弃")
class VideoAdapter(
context: Context,
val mViewModel: OnlineVideoViewModel
) : ListAdapter<MyVideoEntity>(context) {
override fun getItemViewType(position: Int): Int {
if (position == itemCount - 1) return ItemViewType.ITEM_FOOTER
return ItemViewType.ITEM_BODY
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val view: View
return when (viewType) {
ItemViewType.ITEM_FOOTER -> {
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false)
FooterViewHolder(view)
}
else -> {
view = mLayoutInflater.inflate(R.layout.video_status_item, parent, false)
return VideoStatusItemViewHolder(VideoStatusItemBinding.bind(view))
}
}
}
override fun getItemCount(): Int {
return if (mEntityList == null || mEntityList.isEmpty()) 0 else mEntityList.size + FOOTER_ITEM_COUNT
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is VideoStatusItemViewHolder) {
val entity = mEntityList[position]
VideoVerifyItemViewHolder.setVideoStatus(holder.binding.status, entity.status)
ImageUtils.display(holder.binding.includeVideo.videoCover, entity.poster)
holder.binding.includeVideo.videoLikeCount.text = entity.vote.toSimpleCount()
holder.itemView.setOnClickListener {
val lastHintTime = SPUtils.getString("pending_hint_time", "")
val format = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault())
val today = format.format(Date())
if (entity.status == "pending" && today != lastHintTime) {
DialogHelper.showDialog(mContext, "提示",
"当前视频正在审核中,审核通过才会显示",
"知道了", "", { setResultAndFinish(entity) })
SPUtils.setString("pending_hint_time", today)
} else {
setResultAndFinish(entity)
}
}
} else if (holder is FooterViewHolder) {
holder.initFooterViewHolder(mViewModel, mIsLoading, mIsNetworkError, mIsOver)
}
}
private fun setResultAndFinish(entity: MyVideoEntity) {
if (mContext is Activity) {
val intent = Intent()
intent.putExtra(MyVideoEntity::class.java.simpleName, entity)
(mContext as Activity).setResult(Activity.RESULT_OK, intent)
(mContext as Activity).finish()
}
}
}

View File

@ -0,0 +1,54 @@
package com.gh.gamecenter.qa.entity
import android.os.Parcel
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
/**
* Created by khy on 11/12/17.
*/
class AskTagGroupsEntity() : Parcelable {
@SerializedName("_id")
var id: String? = null
var name: String? = null
var icon: String? = null
@SerializedName("description")
var des: String? = null
var order: Int = 1000 // 优先级 默认最高(最后)
constructor(parcel: Parcel) : this() {
id = parcel.readString()
name = parcel.readString()
icon = parcel.readString()
des = parcel.readString()
order = parcel.readInt()
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeString(id)
parcel.writeString(name)
parcel.writeString(icon)
parcel.writeString(des)
parcel.writeInt(order)
}
override fun describeContents(): Int {
return 0
}
companion object CREATOR : Parcelable.Creator<AskTagGroupsEntity> {
override fun createFromParcel(parcel: Parcel): AskTagGroupsEntity {
return AskTagGroupsEntity(parcel)
}
override fun newArray(size: Int): Array<AskTagGroupsEntity?> {
return arrayOfNulls(size)
}
}
}

View File

@ -0,0 +1,45 @@
package com.gh.gamecenter.qa.entity
import android.os.Parcel
import android.os.Parcelable
/**
* Created by khy on 11/12/17.
*/
class AskTimeEntity() : Parcelable {
var create: Long? = null
var update: Long? = null
var open: Long? = null
constructor(parcel: Parcel) : this() {
create = parcel.readValue(Long::class.java.classLoader) as? Long
update = parcel.readValue(Long::class.java.classLoader) as? Long
open = parcel.readValue(Long::class.java.classLoader) as? Long
}
override fun writeToParcel(parcel: Parcel, flags: Int) {
parcel.writeValue(create)
parcel.writeValue(update)
parcel.writeValue(open)
}
override fun describeContents(): Int {
return 0
}
companion object {
@JvmField
val CREATOR: Parcelable.Creator<AskTimeEntity> = object : Parcelable.Creator<AskTimeEntity> {
override fun createFromParcel(parcel: Parcel): AskTimeEntity {
return AskTimeEntity(parcel)
}
override fun newArray(size: Int): Array<AskTimeEntity?> {
return arrayOfNulls(size)
}
}
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.qa.dialog
package com.gh.gamecenter.qa.follow
import android.app.Activity
import android.content.Context
@ -9,10 +9,10 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.DirectUtils
import com.gh.common.util.NewsUtils
import com.gh.gamecenter.common.base.fragment.BaseDialogFragment
import com.gh.common.util.DirectUtils
import com.gh.gamecenter.common.utils.ImageUtils
import com.gh.common.util.NewsUtils
import com.gh.gamecenter.common.utils.toBinding
import com.gh.gamecenter.databinding.DialogAskFollowMoreBinding
import com.gh.gamecenter.databinding.ItemAskFollowMoreBinding

View File

@ -0,0 +1,85 @@
package com.gh.gamecenter.qa.myqa;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.databinding.CommunityQuestionItemBinding;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.qa.questions.CommunityQuestionViewHolder;
import kotlin.Pair;
/**
* Created by khy on 20/12/17.
*/
class ConcernQuestionsAdapter extends ListAdapter<Questions> implements ISyncAdapterHandler {
private OnListClickListener mListClickListener;
private String mEntrance = "";
public ConcernQuestionsAdapter(Context context, String entrance, OnListClickListener listClickListener) {
super(context);
mEntrance = entrance;
mListClickListener = listClickListener;
}
@Override
public int getItemViewType(int position) {
if (position == getItemCount() - 1) return ItemViewType.ITEM_FOOTER;
return ItemViewType.ITEM_BODY;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch (viewType) {
case ItemViewType.ITEM_FOOTER:
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
return new FooterViewHolder(view, mListClickListener);
case ItemViewType.ITEM_BODY:
view = mLayoutInflater.inflate(R.layout.community_question_item, parent, false);
return new CommunityQuestionViewHolder(CommunityQuestionItemBinding.bind(view));
default:
return null;
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (getItemViewType(position)) {
case ItemViewType.ITEM_BODY:
Questions questions = mEntityList.get(position);
((CommunityQuestionViewHolder) holder).bindMyQuestionViewHolder(questions, mEntrance, "我的问答-关注问题");
break;
case ItemViewType.ITEM_FOOTER:
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
footerViewHolder.initItemPadding();
footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver);
break;
}
}
@Override
public int getItemCount() {
return mEntityList == null || mEntityList.isEmpty() ? 0 : mEntityList.size() + FOOTER_ITEM_COUNT;
}
@Nullable
@Override
public Pair<String, Object> getSyncData(int position) {
if (position >= mEntityList.size()) return null;
Questions entity = mEntityList.get(position);
return new Pair(entity.getId(), entity);
}
}

View File

@ -0,0 +1,79 @@
package com.gh.gamecenter.qa.myqa;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.common.baselist.ListFragment;
import com.gh.gamecenter.common.baselist.LoadType;
import com.gh.gamecenter.common.baselist.NormalListViewModel;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.retrofit.RetrofitManager;
import java.util.List;
import io.reactivex.Observable;
/**
* Created by khy on 20/12/17.
*/
public class ConcernQuestionsFragment extends ListFragment<Questions, NormalListViewModel> {
public static final int KEY_CHECK_QUESTION_CONCERN = 105;
private ConcernQuestionsAdapter mAdapter;
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == KEY_CHECK_QUESTION_CONCERN && resultCode == Activity.RESULT_OK) {
onLoadRefresh();
}
}
public static ConcernQuestionsFragment getInstance(String entrance) {
ConcernQuestionsFragment fragment = new ConcernQuestionsFragment();
Bundle args = new Bundle();
args.putString(EntranceConsts.KEY_ENTRANCE, entrance);
fragment.setArguments(args);
return fragment;
}
@Override
protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new ConcernQuestionsAdapter(getContext(), mEntrance, this) : mAdapter;
}
@Override
public Observable<List<Questions>> provideDataObservable(int page) {
return RetrofitManager.getInstance().getApi().getConcernQuestions(UserManager.getInstance().getUserId(), page);
}
@Override
public void onListClick(View view, int position, Object data) {
if (view.getId() == R.id.footerview_item) {
if (mAdapter.isNetworkError()) {
mListViewModel.load(LoadType.RETRY);
}
}
}
@Override
protected boolean addSyncPageObserver() {
return true;
}
@Nullable
@Override
protected RecyclerView.Adapter provideSyncAdapter() {
return mAdapter;
}
}

View File

@ -4,19 +4,19 @@ import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.base.fragment.BaseFragment_TabLayout;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.core.utils.MtaHelper;
import com.gh.gamecenter.R;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.qa.article.MyArticleFragment;
import com.gh.gamecenter.qa.draft.CommunityDraftWrapperActivity;
import java.util.List;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
/**
* Created by khy on 20/12/17.
*/
@ -28,12 +28,16 @@ public class MyAskWrapperFragment extends BaseFragment_TabLayout {
String entrance = null;
if (getArguments() != null) entrance = getArguments().getString(EntranceConsts.KEY_ENTRANCE);
// fragments.add(ConcernQuestionsFragment.getInstance(entrance));
// fragments.add(MyQuestionsFragment.getInstance(entrance));
fragments.add(MyAnswerFragment.getInstance(entrance));
fragments.add(MyArticleFragment.getInstance(entrance, UserManager.getInstance().getUserId()));
}
@Override
protected void initTabTitleList(List<String> tabTitleList) {
// tabTitleList.add("关注问题");
// tabTitleList.add("我的问题");
tabTitleList.add("我的回答");
tabTitleList.add("我的帖子");
}

View File

@ -0,0 +1,87 @@
package com.gh.gamecenter.qa.myqa;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.callback.OnListClickListener;
import com.gh.gamecenter.common.constant.ItemViewType;
import com.gh.gamecenter.common.syncpage.ISyncAdapterHandler;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.viewholder.FooterViewHolder;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.databinding.CommunityQuestionItemBinding;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.qa.questions.CommunityQuestionViewHolder;
import com.gh.gamecenter.qa.questions.newdetail.NewQuestionDetailActivity;
import kotlin.Pair;
/**
* Created by khy on 20/12/17.
*/
public class MyQuestionsAdapter extends ListAdapter<Questions> implements ISyncAdapterHandler {
private OnListClickListener mListClickListener;
private String mEntrance = "";
public MyQuestionsAdapter(Context context, String entrance, OnListClickListener listClickListener) {
super(context);
mEntrance = entrance;
mListClickListener = listClickListener;
}
@Override
public int getItemViewType(int position) {
if (position == getItemCount() - 1) return ItemViewType.ITEM_FOOTER;
return ItemViewType.ITEM_BODY;
}
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view;
switch (viewType) {
case ItemViewType.ITEM_FOOTER:
view = mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false);
return new FooterViewHolder(view, mListClickListener);
case ItemViewType.ITEM_BODY:
view = mLayoutInflater.inflate(R.layout.community_question_item, parent, false);
return new CommunityQuestionViewHolder(CommunityQuestionItemBinding.bind(view));
default:
return null;
}
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
switch (getItemViewType(position)) {
case ItemViewType.ITEM_BODY:
Questions questions = mEntityList.get(position);
((CommunityQuestionViewHolder) holder).bindMyQuestionViewHolder(questions, mEntrance, "我的光环-我的问答-我的问题");
holder.itemView.setOnClickListener(v -> mContext.startActivity(NewQuestionDetailActivity.getIntent(mContext, questions.getId(), mEntrance, "我的光环-我的问答-我的问题")));
break;
case ItemViewType.ITEM_FOOTER:
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
footerViewHolder.initItemPadding();
footerViewHolder.initFooterViewHolder(mIsLoading, mIsNetworkError, mIsOver);
break;
}
}
@Override
public int getItemCount() {
return mEntityList == null || mEntityList.isEmpty() ? 0 : mEntityList.size() + FOOTER_ITEM_COUNT;
}
@Nullable
@Override
public Pair<String, Object> getSyncData(int position) {
if (position >= mEntityList.size()) return null;
Questions entity = mEntityList.get(position);
return new Pair(entity.getId(), entity);
}
}

View File

@ -0,0 +1,71 @@
package com.gh.gamecenter.qa.myqa;
import android.os.Bundle;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;
import com.gh.gamecenter.common.constant.EntranceConsts;
import com.gh.gamecenter.R;
import com.gh.gamecenter.common.baselist.ListAdapter;
import com.gh.gamecenter.common.baselist.ListFragment;
import com.gh.gamecenter.common.baselist.LoadType;
import com.gh.gamecenter.common.baselist.NormalListViewModel;
import com.gh.gamecenter.login.user.UserManager;
import com.gh.gamecenter.qa.entity.Questions;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.halo.assistant.HaloApp;
import com.lightgame.utils.Utils;
import java.util.List;
import io.reactivex.Observable;
/**
* Created by khy on 20/12/17.
*/
public class MyQuestionsFragment extends ListFragment<Questions, NormalListViewModel> {
private MyQuestionsAdapter mAdapter;
public static MyQuestionsFragment getInstance(String entrance) {
MyQuestionsFragment fragment = new MyQuestionsFragment();
Bundle args = new Bundle();
args.putString(EntranceConsts.KEY_ENTRANCE, entrance);
fragment.setArguments(args);
return fragment;
}
@Override
protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new MyQuestionsAdapter(getContext(), mEntrance, this) : mAdapter;
}
@Override
public Observable<List<Questions>> provideDataObservable(int page) {
return RetrofitManager.getInstance().getApi().getMyQuestions(UserManager.getInstance().getUserId(), page,
HaloApp.getInstance().getChannel(), Utils.getTime(getContext()));
}
@Override
public void onListClick(View view, int position, Object data) {
if (view.getId() == R.id.footerview_item) {
if (mAdapter.isNetworkError()) {
mListViewModel.load(LoadType.RETRY);
}
}
}
@Override
protected boolean addSyncPageObserver() {
return true;
}
@Nullable
@Override
protected RecyclerView.Adapter provideSyncAdapter() {
return mAdapter;
}
}

View File

@ -0,0 +1,81 @@
package com.gh.gamecenter.qa.questions
import android.annotation.SuppressLint
import android.view.MotionEvent
import android.view.View
import android.widget.TextView
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.common.util.CheckLoginUtils
import com.gh.common.util.NewsUtils
import com.gh.gamecenter.core.utils.NumberUtils
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.CommunityQuestionItemBinding
import com.gh.gamecenter.qa.answer.edit.AnswerEditActivity
import com.gh.gamecenter.qa.entity.Questions
class CommunityQuestionViewHolder(val binding: CommunityQuestionItemBinding) :
BaseRecyclerViewHolder<Any>(binding.root) {
fun bindQuestionViewHolder(questions: Questions, entrance: String, path: String) {
bindViewHolder(questions, entrance, path)
binding.endDesc.text = NewsUtils.getFormattedTime(questions.time)
}
fun bindMyQuestionViewHolder(questions: Questions, entrance: String, path: String) {
bindViewHolder(questions, entrance, path)
binding.endDesc.text = questions.communityName
}
@SuppressLint("ClickableViewAccessibility")
private fun bindViewHolder(questions: Questions, entrance: String, path: String) {
binding.title.text = questions.title
bindAnswerCount(questions, binding.answerCountContainer, binding.answerCount, entrance)
}
companion object {
fun bindAnswerCount(
questions: Questions,
answerCountContainer: View,
answerCountTv: TextView,
entrance: String
) {
if (questions.answerCount > 0) {
DrawableView.setTextDrawable(
answerCountTv,
R.drawable.community_question_answer_count,
NumberUtils.transSimpleCount(questions.answerCount)
)
} else {
DrawableView.setTextDrawable(
answerCountTv,
R.drawable.community_answer_count,
"回答"
)
}
// 虽然很丑陋但是没有想到其它好的办法实现https://gitlab.ghzs.com/pm/halo-app-issues/issues/812 (7)
if (questions.answerCount <= 0 && questions.me.myAnswerId.isNullOrEmpty()) {
answerCountContainer.setOnTouchListener { _, event ->
if (event.action == MotionEvent.ACTION_DOWN || event.action == MotionEvent.ACTION_MOVE) {
answerCountContainer.setBackgroundResource(R.drawable.reuse_listview_item_style)
} else {
answerCountContainer.background = null
}
false
}
answerCountContainer.setOnClickListener {
CheckLoginUtils.checkLogin(it.context, entrance) {
val communityName = questions.communityName
it.context.startActivity(AnswerEditActivity.getIntent(it.context, questions, communityName))
}
}
answerCountContainer.isClickable = true
} else {
answerCountContainer.isClickable = false
answerCountContainer.setOnTouchListener(null)
}
}
}
}

View File

@ -1,4 +1,4 @@
package com.gh.gamecenter.qa.editor;
package com.gh.gamecenter.qa.questions.detail;
import android.content.Context;
import android.graphics.Paint;

View File

@ -63,7 +63,7 @@ class VideoDescViewModel(application: Application) :
fun postVote() {
if (topVideoDetail == null) return
if (!UserManager.getInstance().isLoggedIn) {
CheckLoginUtils.checkLogin(getApplication(), "视频详情-点赞") {}
CheckLoginUtils.checkLogin(getApplication(), "视频详情") {}
return
}
if (topVideoDetail!!.me.isVoted) {

View File

@ -756,7 +756,7 @@ public interface ApiService {
* 新的设置接口
*/
@GET("settings")
Single<NewApiSettingsEntity> getNewSettings(@Query("version") String version, @Query("channel") String channel);
Single<NewSettingsEntity> getNewSettings(@Query("version") String version, @Query("channel") String channel);
/**
* 获取新的配置信息,因为旧的已经太大了避免冲突
@ -1657,6 +1657,12 @@ public interface ApiService {
@GET("users/{user_id}/videos")
Observable<List<MyVideoEntity>> getUserVideo(@Path("user_id") String userId, @Query("page") int page, @Query("page_size") int pageSize);
/**
* 获取用户的视频草稿列表(包括审核中)
*/
@GET("users/{user_id}/videos?view=insert_video_page")
Observable<List<MyVideoEntity>> getCommunityInsertVideo(@Path("user_id") String userId, @Query("page") int page, @Query("page_size") int pageSize);
/**
* 获取用户的视频收藏列表
*/
@ -2936,22 +2942,4 @@ public interface ApiService {
*/
@POST("mobile_auth/{user_id}:unbind")
Single<ResponseBody> unBindPhone();
/**
* 获取发现页游戏列表
*/
@GET("home/explore/games")
Observable<DiscoveryGameCardEntity> getDiscoveryGames(@Query("page") int page, @QueryMap Map<String, Object> params);
/**
* 获取发现页卡片列表
*/
@GET("home/explore/cards")
Observable<ArrayList<DiscoveryGameCardLabel>> getCardLabels();
/**
* 反馈游戏
*/
@POST("home/explore/games/{game_id}/feedback")
Single<ResponseBody> discorveryFeedback(@Path("game_id") String gameId, @Body RequestBody body);
}

View File

@ -1,20 +0,0 @@
package com.gh.gamecenter.room.converter
import androidx.room.TypeConverter
import com.gh.gamecenter.common.utils.toJson
import com.gh.gamecenter.common.utils.toObject
import com.gh.gamecenter.entity.TagStyleEntity
class TagStyleConverter {
@TypeConverter
fun toString(entity: TagStyleEntity?): String {
return entity?.toJson() ?: ""
}
@TypeConverter
fun toObject(value: String?): TagStyleEntity {
return value?.toObject() ?: TagStyleEntity()
}
}

View File

@ -166,7 +166,7 @@ class SearchGameIndexAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (gameEntity.advanceDownload) {

View File

@ -228,7 +228,7 @@ class SearchGameResultAdapter(
}
}
gameDesSpace.post {
gameSubtitleTv.maxWidthExcludeZero(gameDesSpace.width)
gameSubtitleTv.maxWidth = gameDesSpace.width
}
}
if (gameEntity.advanceDownload) {

View File

@ -25,7 +25,6 @@ import com.gh.gamecenter.common.utils.toColor
import com.gh.gamecenter.common.utils.toDrawable
import com.gh.gamecenter.core.utils.DisplayUtils
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.game.GameItemViewHolder
import com.lightgame.adapter.BaseRecyclerAdapter
import java.text.SimpleDateFormat
import java.util.*
@ -300,8 +299,6 @@ class GameServersContentAdapter(
viewHolder.binding.home2TestType.background = getServerDrawableBySource(R.color.tag_orange)
}
GameItemViewHolder.initGameSubtitle(gameEntity, viewHolder.binding.gameSubtitleTv, forceShowSubtitle = true)
if (gameEntity.fixedTop!!) {
val tag = "今日开服"
viewHolder.binding.home2TestType.visibility = View.VISIBLE

View File

@ -36,7 +36,6 @@ import com.gh.gamecenter.common.baselist.ListAdapter
import com.gh.gamecenter.common.callback.BiCallback
import com.gh.gamecenter.common.constant.EntranceConsts
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.utils.*
import com.gh.gamecenter.databinding.SimulatorGameItemBinding
import com.gh.gamecenter.databinding.SimulatorHeaderViewBinding
@ -200,7 +199,6 @@ class SimulatorGameListAdapter(
recommendStar.rating = gameEntity.recommendStar.toFloat()
}
gameItemIncluded.recentPlayedTag.goneIf(!gameEntity.isRecentlyPlayed)
gameItemIncluded.selectIv.setImageDrawable(DrawableView.getCheckSelectorDrawable(mContext))
gameItemIncluded.selectIv.goneIf(!mShowSelectFlag)
gameItemIncluded.selectIv.isChecked = mSelectList[position - 1]
gameItemIncluded.selectIv.setOnClickListener {

View File

@ -60,11 +60,6 @@ class SimulatorGameViewModel(application: Application) : AndroidViewModel(applic
}
}
}
} else {
// 若网络数据为空,本地数据不为空时同步本地数据到服务端 (避免本地数据与网络数据不一致的问题)
if (localSimulatorList.isNotEmpty()) {
SimulatorGameManager.recordDownloadSimulatorGames()
}
}
}, {
simulators.postValue(mResultSimulatorsList)

View File

@ -0,0 +1,6 @@
package com.gh.gamecenter.video
import com.gh.gamecenter.common.base.BaseRecyclerViewHolder
import com.gh.gamecenter.databinding.VideoStatusItemBinding
class VideoStatusItemViewHolder(var binding: VideoStatusItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)

View File

@ -437,7 +437,7 @@ class DetailPlayerView @JvmOverloads constructor(context: Context, attrs: Attrib
}
} else {
uploadVideoStreamingPlaying("点赞-跳转登录")
CheckLoginUtils.checkLogin(context, "视频流详情-点赞") {}
CheckLoginUtils.checkLogin(context, "(游戏详情)") {}
}
}
}

View File

@ -25,7 +25,6 @@ import com.gh.gamecenter.common.baselist.LoadType
import com.gh.gamecenter.common.constant.Constants
import com.gh.gamecenter.common.constant.ItemViewType
import com.gh.gamecenter.common.utils.*
import com.gh.gamecenter.common.view.DrawableView
import com.gh.gamecenter.core.AppExecutor
import com.gh.gamecenter.core.runOnIoThread
import com.gh.gamecenter.core.utils.CurrentActivityHolder
@ -137,7 +136,7 @@ class VDownloadManagerAdapter(
holder.binding.descTv.goneIf(!mViewModel.isTypeDownloaded() || gameEntity.des?.isEmpty() == true)
holder.binding.descTv.text = gameEntity.des
holder.binding.selectIv.setImageDrawable(DrawableView.getCheckSelectorDrawable(mContext))
holder.binding.selectIv.setImageDrawable(R.drawable.selector_ic_simulator.toDrawable(mContext))
holder.binding.selectIv.goneIf(mCurrentOption == ManageOption.OPTION_MANAGER)
holder.binding.selectIv.isChecked = selectItems.contains(gameEntity.id)
@ -243,11 +242,6 @@ class VDownloadManagerAdapter(
extraConfig = DialogHelper.Config(centerTitle = true)
)
}
mPopupBinding?.checkAllCb?.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(
mContext
), null, null, null
)
mPopupBinding?.checkAllCb?.setOnClickListener {
if (mPopupBinding?.checkAllCb?.isChecked == true) {
selectItems.clear()
@ -267,7 +261,7 @@ class VDownloadManagerAdapter(
checkAllCb.setTextColor(R.color.text_title.toColor(mContext))
selectNumTv.setTextColor(R.color.theme_font.toColor(mContext))
checkAllCb.setCompoundDrawablesWithIntrinsicBounds(
DrawableView.getCheckSelectorDrawable(mContext),
R.drawable.selector_ic_simulator.toDrawable(mContext),
null,
null,
null

View File

@ -5,7 +5,6 @@ import android.annotation.SuppressLint
import android.content.ContentValues
import android.content.Context
import android.content.Intent
import android.database.sqlite.SQLiteFullException
import android.net.Uri
import android.os.Build
import android.text.TextUtils
@ -611,13 +610,9 @@ object VHelper {
*/
private fun updateVGamePlayedTime(packageName: String, lastPlayedTime: Long, totalPlayedTime: Long) {
getVGameSnapshot(null, packageName)?.let {
it.downloadEntity.addMetaExtra(KEY_LAST_PLAYED_TIME, lastPlayedTime.toString())
it.downloadEntity.addMetaExtra(KEY_LAST_PLAYED_TIME, totalPlayedTime.toString())
it.downloadEntity.addMetaExtra(KEY_TOTAL_PLAYED_TIME, totalPlayedTime.toString())
try {
mVGameDao.insert(it)
} catch (e: SQLiteFullException) {
ToastUtils.toast("设备存储空间不足,请清理后重试")
}
mVGameDao.insert(it)
}
// 更新首页排序

Some files were not shown because too many files have changed in this diff Show More