Merge branch 'dev-5.8.0' into feature-night_mode_test

# Conflicts:
#	app/src/main/res/layout/activity_ask_column_detail.xml
#	app/src/main/res/layout/activity_background_clip.xml
#	app/src/main/res/layout/activity_kaifu_patch.xml
#	app/src/main/res/layout/activity_rating_edit.xml
#	app/src/main/res/layout/activity_video_game.xml
#	app/src/main/res/layout/activity_video_uplaod.xml
#	app/src/main/res/layout/ask_search_question_item.xml
#	app/src/main/res/layout/catalog_header_item.xml
#	app/src/main/res/layout/catalog_image_item.xml
#	app/src/main/res/layout/commodity_item.xml
#	app/src/main/res/layout/common_collection_detail_one_item.xml
#	app/src/main/res/layout/common_collection_detail_two_item.xml
#	app/src/main/res/layout/common_collection_image_text_item.xml
#	app/src/main/res/layout/common_collection_item.xml
#	app/src/main/res/layout/community_follow_item.xml
#	app/src/main/res/layout/community_select_opened_item.xml
#	app/src/main/res/layout/daily_task_item.xml
#	app/src/main/res/layout/dialog_download_link.xml
#	app/src/main/res/layout/dialog_upload_schedule.xml
#	app/src/main/res/layout/download_dialog_installed_item.xml
#	app/src/main/res/layout/download_dialog_item.xml
#	app/src/main/res/layout/followers_or_fans_item.xml
#	app/src/main/res/layout/forum_search_content_list.xml
#	app/src/main/res/layout/fragment_answer_detail.xml
#	app/src/main/res/layout/fragment_answer_edit.xml
#	app/src/main/res/layout/fragment_background_preview.xml
#	app/src/main/res/layout/fragment_forum_detail.xml
#	app/src/main/res/layout/fragment_forum_video_detail.xml
#	app/src/main/res/layout/fragment_game_collection_poster.xml
#	app/src/main/res/layout/fragment_main_home.xml
#	app/src/main/res/layout/fragment_search_default.xml
#	app/src/main/res/layout/game_collection_detail_image_item.xml
#	app/src/main/res/layout/game_collection_item.xml
#	app/src/main/res/layout/game_head_item.xml
#	app/src/main/res/layout/game_image_item.xml
#	app/src/main/res/layout/game_image_slide_item.xml
#	app/src/main/res/layout/game_viewpager_item.xml
#	app/src/main/res/layout/home_amway_item.xml
#	app/src/main/res/layout/home_game_item.xml
#	app/src/main/res/layout/home_recommend_item.xml
#	app/src/main/res/layout/home_slide_list_item.xml
#	app/src/main/res/layout/item_article_detail_comment.xml
#	app/src/main/res/layout/item_forum_video.xml
#	app/src/main/res/layout/item_game_libao.xml
#	app/src/main/res/layout/item_my_game_collection.xml
#	app/src/main/res/layout/local_video_item.xml
#	app/src/main/res/layout/novice_task_item.xml
#	app/src/main/res/layout/rating_comment_item.xml
#	app/src/main/res/layout/rating_reply_item.xml
#	app/src/main/res/layout/set_wait_dialog.xml
#	app/src/main/res/layout/stairs_comment_item.xml
This commit is contained in:
leafwai
2022-03-11 11:41:46 +08:00
813 changed files with 19816 additions and 69847 deletions

4
.gitmodules vendored
View File

@ -1,7 +1,7 @@
[submodule "libraries/LGLibrary"]
path = libraries/LGLibrary
url = git@git.ghzs.com:android/common-library.git
url = git@git.shanqu.cc:android/common-library.git
branch = master
[submodule "assistant_flutter"]
path = assistant_flutter
url = git@git.ghzs.com:halo/android/flutter-module.git
url = git@git.shanqu.cc:halo/android/flutter-module.git

View File

@ -1,7 +1,7 @@
// This comment exists for a reason, do not delete
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android' // kotlin
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'
apply plugin: 'AndResGuard'
@ -9,13 +9,9 @@ import groovy.xml.XmlUtil
android {
androidExtensions {
experimental = true
}
buildFeatures {
viewBinding = true
dataBinding = true
viewBinding true
dataBinding true
}
compileOptions {

View File

@ -242,11 +242,6 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
<activity
android:name="com.gh.gamecenter.ToolBoxActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.gh.gamecenter.WeiBoShareActivity"
android:screenOrientation="portrait"
@ -286,18 +281,10 @@
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden" />
<activity
android:name="com.gh.gamecenter.qa.search.AskSearchActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.answer.detail.AnswerDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.questions.detail.QuestionsDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name=".qa.answer.fold.AnswerFoldActivity"
android:screenOrientation="portrait" />
@ -318,14 +305,6 @@
android:name="com.gh.gamecenter.MessageKeFuActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.select.CommunitiesSelectActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.subject.CommunitySubjectActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.MessageInviteActivity"
android:screenOrientation="portrait" />
@ -342,10 +321,6 @@
android:name="com.gh.gamecenter.qa.myqa.MyAskActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.column.order.AskTabOrderActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.questions.edit.QuestionEditActivity"
android:screenOrientation="portrait" />
@ -367,10 +342,6 @@
android:name="com.gh.gamecenter.amway.AmwayActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.column.detail.AskColumnDetailActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.NetworkDiagnosisActivity"
android:screenOrientation="portrait" />
@ -457,10 +428,6 @@
android:name="com.gh.gamecenter.tag.TagsActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.qa.article.SimpleArticleListActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.gh.gamecenter.video.videomanager.VideoManagerActivity"
android:screenOrientation="portrait" />
@ -833,48 +800,6 @@
</intent-filter>
</receiver>
<!-- <receiver android:name="com.gh.gamecenter.receiver.UmengMessageReceiver">-->
<!-- <intent-filter>-->
<!-- <action android:name="com.gh.gamecenter.UMENG" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- &lt;!&ndash;魅族push应用定义消息receiver声明 &ndash;&gt;-->
<!-- <receiver android:name="com.gh.gamecenter.receiver.UmengMeizuPushReceiver">-->
<!-- <intent-filter>-->
<!-- &lt;!&ndash; 接收push消息 &ndash;&gt;-->
<!-- <action android:name="com.meizu.flyme.push.intent.MESSAGE" />-->
<!-- &lt;!&ndash; 接收register消息 &ndash;&gt;-->
<!-- <action android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" />-->
<!-- &lt;!&ndash; 接收unregister消息&ndash;&gt;-->
<!-- <action android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" />-->
<!-- &lt;!&ndash; 兼容低版本Flyme3推送服务配置 &ndash;&gt;-->
<!-- <action android:name="com.meizu.c2dm.intent.REGISTRATION" />-->
<!-- <action android:name="com.meizu.c2dm.intent.RECEIVE" />-->
<!-- <category android:name="${applicationId}" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <receiver-->
<!-- android:name="com.gh.common.im.ImReceiver"-->
<!-- android:enabled="true">-->
<!-- <intent-filter android:priority="2147483647">-->
<!-- <action android:name="com.gh.im" />-->
<!-- <action android:name="action_finish" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<!-- <meta-data-->
<!-- android:name="com.huawei.hms.client.appid"-->
<!-- android:value="@string/huawei_push_appid" />-->
<!-- <service-->
<!-- android:name="com.gh.base.GHUmengNotificationService"-->
<!-- android:permission="android.permission.BIND_JOB_SERVICE" />-->
<!--<service android:name = "com.gh.gamecenter.statistics.AppStaticService" />-->
<!-- 梦工厂配置 开始 -->
<!--<meta-data
android:name="MGC_APPID"

File diff suppressed because it is too large Load Diff

View File

@ -4,12 +4,14 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.FragmentManager;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.ExtensionsKt;
import com.gh.gamecenter.R;
@ -53,6 +55,14 @@ public class WaitingDialogFragment extends BaseDialogFragment {
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
WindowManager.LayoutParams layoutParams = getDialog().getWindow().getAttributes();
layoutParams.width = DisplayUtils.dip2px(160);
getDialog().getWindow().setAttributes(layoutParams);
}
@Override
public void show(FragmentManager manager, String tag) {
try {

View File

@ -24,23 +24,21 @@ object AppExecutor {
private val mMinimumPoolSize = 16.coerceAtLeast(mCoreSize * 4)
private val mMaximumPoolSize = 64.coerceAtLeast(mCoreSize * 16)
// TODO 因为 LinkedBlockingQueue 过大导致 MaximumPoolSize 的值几乎无效,下版本改造 [PackageRepository] 启动请求一堆游戏摘要信息的接口?
@JvmStatic
val uiExecutor by lazy { MainThreadExecutor() }
@JvmStatic
val lightWeightIoExecutor by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LIGHT_WEIGHT_IO_THREAD")) }
val lightWeightIoExecutor: ExecutorService by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LIGHT_WEIGHT_IO_THREAD")) }
@JvmStatic
val logExecutor by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LOG_THREAD")) }
val logExecutor: ExecutorService by lazy { Executors.newSingleThreadExecutor(GHThreadFactory("GH_LOG_THREAD")) }
@JvmStatic
val ioExecutor = ThreadPoolExecutor(
mMinimumPoolSize,
mMaximumPoolSize,
20L, TimeUnit.SECONDS,
LinkedBlockingQueue<Runnable>(1000),
LinkedBlockingQueue(256),
GHThreadFactory("GH_IO_THREAD"))
val cachedScheduler by lazy { Schedulers.from(ioExecutor) }
@ -60,12 +58,12 @@ object AppExecutor {
fun runOnIoThread(isLightWeightTask: Boolean = false, f: () -> Unit) {
if (isLightWeightTask) {
AppExecutor.lightWeightIoExecutor.execute(f)
lightWeightIoExecutor.execute(f)
} else {
AppExecutor.ioExecutor.execute(f)
ioExecutor.execute(f)
}
}
fun runOnUiThread(f: () -> Unit) {
AppExecutor.uiExecutor.execute(f)
uiExecutor.execute(f)
}

View File

@ -16,7 +16,6 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import androidx.databinding.BindingAdapter;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.facebook.drawee.view.SimpleDraweeView;
@ -34,6 +33,7 @@ import com.gh.common.util.DataUtils;
import com.gh.common.util.DialogUtils;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.DownloadDialogHelper;
import com.gh.common.util.ExtensionsKt;
import com.gh.common.util.GameUtils;
import com.gh.common.util.GameViewUtils;
import com.gh.common.util.ImageUtils;
@ -84,22 +84,18 @@ import java.util.List;
public class BindingAdapters {
@BindingAdapter("imageIcon")
public static void loadIcon(SimpleDraweeView view, String imageUrl) {
ImageUtils.displayIcon(view, imageUrl);
}
@BindingAdapter("imageUrl")
public static void loadImage(SimpleDraweeView view, String imageUrl) {
ImageUtils.display(view, imageUrl);
}
@BindingAdapter("setTextSize")
public static void setTextSize(TextView view, int number) {
view.setTextSize(number);
}
@BindingAdapter("setTypeface")
public static void setTypeface(TextView view, String type) {
if (type == null) return;
@ -119,7 +115,6 @@ public class BindingAdapters {
}
}
@BindingAdapter({"addDetailKaiFuView", "addDetailKaiFuViewListener", "isReadyPatch"})
public static void addDetailKaiFuView(LinearLayout view, List<ServerCalendarEntity> list
, OnViewClickListener listener, Boolean isReadyPatch) {
if (list == null) return;
@ -127,13 +122,13 @@ public class BindingAdapters {
for (int i = 0; i < list.size() + 1; i++) { // 1 is Title
View inflate = LayoutInflater.from(view.getContext()).inflate(R.layout.kaifu_detail_item_row, null);
KaifuDetailItemRowBinding binding = KaifuDetailItemRowBinding.bind(inflate);
binding.setIsCloseBottom(i == list.size());
binding.setIsReadyPatch(isReadyPatch);
if (i == 0) {
binding.setIsTitle(true);
} else {
ServerCalendarEntity serverEntity = list.get(i - 1);
binding.setEntity(serverEntity);
binding.getRoot().setBackgroundColor(isReadyPatch ? ExtensionsKt.toColor(R.color.theme) : ExtensionsKt.toColor(R.color.white));
binding.getRoot().setPadding(DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), DisplayUtils.dip2px(1), i == list.size() ? DisplayUtils.dip2px(1) : 0);
ServerCalendarEntity serverEntity = list.get(i - 1);
binding.timeTv.setText(i == 0 ? "时间" : serverEntity.getFormatTime("HH:mm"));
binding.remarkTv.setText(i == 0 ? "备注" : serverEntity.getRemark());
binding.nameTv.setText(i == 0 ? "名字" : (TextUtils.isEmpty(serverEntity.getNote()) ? "-" : serverEntity.getNote()));
if (i != 0) {
binding.getRoot().setOnClickListener(v -> {
listener.onClick(v, isReadyPatch != null && isReadyPatch ? serverEntity : null);
});
@ -155,12 +150,10 @@ public class BindingAdapters {
}
// 如果超过10000则转换为1.0W
@BindingAdapter("transSimpleCount")
public static void transSimpleCount(TextView view, int count) {
view.setText(NumberUtils.transSimpleCount(count));
}
@BindingAdapter("textColorFromString")
public static void textColorFromString(TextView tv, String hexString) {
if (TextUtils.isEmpty(hexString)) return;
@ -171,7 +164,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("visibleGone")
public static void showHide(View view, Boolean show) {
if (show != null && show) {
view.setVisibility(View.VISIBLE);
@ -180,7 +172,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("goneIf")
public static void goneIf(View view, Boolean gone) {
if (gone != null && gone) {
view.setVisibility(View.GONE);
@ -192,7 +183,6 @@ public class BindingAdapters {
/**
* lazy 的 paddingTop
*/
@BindingAdapter("lazyPaddingLeft")
public static void lazyPaddingLeft(View view, int paddingLeftInDp) {
view.setPadding(DisplayUtils.dip2px(paddingLeftInDp), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom());
}
@ -200,7 +190,6 @@ public class BindingAdapters {
/**
* lazy 的 paddingTop
*/
@BindingAdapter("lazyPaddingTop")
public static void lazyPaddingTop(View view, int paddingTopInDp) {
view.setPadding(view.getPaddingLeft(), DisplayUtils.dip2px(paddingTopInDp), view.getPaddingRight(), view.getPaddingBottom());
}
@ -208,12 +197,10 @@ public class BindingAdapters {
/**
* lazy 的 paddingBottom
*/
@BindingAdapter("lazyPaddingBottom")
public static void lazyPaddingBottom(View view, int paddingBottomInDp) {
view.setPadding(view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), DisplayUtils.dip2px(paddingBottomInDp));
}
@BindingAdapter("visibleInvisible")
public static void visibleInvisible(View view, Boolean show) {
if (show != null && show) {
view.setVisibility(View.VISIBLE);
@ -222,7 +209,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("messageUnread")
public static void setMessageUnread(TextView view, int unreadCount) {
if (unreadCount < 100) {
view.setText(String.valueOf(unreadCount));
@ -231,7 +217,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("serverTypePadding")
public static void setServerTypePadding(TextView view, String serverType) {
int paddRight = 0;
if (TextUtils.isEmpty(serverType)) {
@ -249,7 +234,6 @@ public class BindingAdapters {
view.setPadding(0, 0, paddRight, 0);
}
@BindingAdapter("serverType")
public static void setServerType(TextView view, String serverType) {
view.setText(serverType);
if ("删档内测".equals(serverType) || "不删档内测".equals(serverType)) {
@ -259,26 +243,22 @@ public class BindingAdapters {
}
}
@BindingAdapter("game")
public static void setGame(View view, GameEntity gameEntity) {
if (gameEntity != null && view instanceof GameIconView) {
((GameIconView) view).displayGameIcon(gameEntity);
}
}
@BindingAdapter("gameIcon")
public static void setGameIcon(View view, GameEntity gameEntity) {
if (gameEntity != null && view instanceof GameIconView) {
((GameIconView) view).displayGameIcon(gameEntity.getIcon(), gameEntity.getIconSubscript());
}
}
@BindingAdapter("articleType")
public static void setArticleType(TextView view, String articleType) {
NewsUtils.setNewsType(view, articleType, 0, 0);
}
@BindingAdapter("detailDownloadText")
public static void setDetailDownloadText(TextView view, GameEntity gameEntity) {
if (gameEntity == null || gameEntity.getApk().isEmpty()) {
view.setBackgroundResource(R.drawable.game_item_btn_pause_style);
@ -287,7 +267,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("liBaoBtn")
public static void setLiBaoBtn(TextView view, String status) {
if (TextUtils.isEmpty(status)) return;
switch (status) {
@ -352,7 +331,6 @@ public class BindingAdapters {
}
// 大图下的进度条
@BindingAdapter({"downloadButton", "traceEvent", "clickCallBack", "entrance", "location"})
public static void setDownloadButton(DownloadProgressBar progressBar,
GameEntity gameEntity,
ExposureEvent traceEvent,
@ -692,13 +670,11 @@ public class BindingAdapters {
}
}
@BindingAdapter("gameLabelList")
public static void setGameLabelList(LinearLayout layout, List<TagStyleEntity> tagStyle) {
GameViewUtils.setLabelList(layout.getContext(), layout, tagStyle);
}
// 包含测试开服标签
@BindingAdapter("setGameTags")
public static void setGameTags(LinearLayout layout, GameEntity gameEntity) {
try {
if (layout.getVisibility() == View.GONE) return;
@ -739,7 +715,6 @@ public class BindingAdapters {
}
}
@BindingAdapter("setVideoDetailGameTags")
public static void setVideoDetailGameTags(LinearLayout layout, GameEntity gameEntity) {
try {
ArrayList<TagStyleEntity> tagStyle = new ArrayList<>();
@ -767,14 +742,12 @@ public class BindingAdapters {
}
}
@BindingAdapter("isRefreshing")
public static void isRefreshing(SwipeRefreshLayout layout, LoadStatus status) {
if (status != LoadStatus.INIT_LOADING && status != LoadStatus.LIST_LOADING) {
layout.setRefreshing(false);
}
}
@BindingAdapter({"setGameName", "isShowPlatform", "isShowSuffix"})
public static void setGameName(TextView view, GameEntity game, boolean isShowPlatform, @Nullable Boolean isShowSuffix) {
if (isShowSuffix == null) isShowSuffix = true; // 默认显示
if (isShowPlatform && game.getApk().size() > 0) {
@ -787,7 +760,6 @@ public class BindingAdapters {
}
@BindingAdapter({"setCommunityImage", "setCommunityVideoImage"})
public static void setCommunityImage(SimpleDraweeView imageView, List<String> images, List<CommunityVideoEntity> videos) {
if (videos.size() > 0) {
CommunityVideoEntity videoEntity = videos.get(0);
@ -801,7 +773,6 @@ public class BindingAdapters {
}
}
@BindingAdapter({"setCommunityVideoDuration"})
public static void setCommunityVideoDuration(TextView mVideoDuration, List<CommunityVideoEntity> videos) {
if (videos != null && videos.size() > 0) {
CommunityVideoEntity videoEntity = videos.get(0);
@ -813,7 +784,6 @@ public class BindingAdapters {
}
}
@BindingAdapter({"setGameTags", "setMaxGameTags"})
public static void setGameTags(TextView view, List<TagStyleEntity> tags, int maxTags) {
if (tags == null) {
view.setText("");
@ -842,7 +812,6 @@ public class BindingAdapters {
view.setText(span);
}
@BindingAdapter({"setVideoData"})
public static void setVideoData(TextView view, int count) {
if (count > 0) {
view.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(view.getContext(), R.drawable.ic_video_data_up), null, null, null);

View File

@ -1,5 +1,8 @@
package com.gh.common.databind;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
@ -7,18 +10,14 @@ import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.StateListDrawable;
import android.view.View;
import androidx.annotation.ColorInt;
import androidx.annotation.IntDef;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.lang.reflect.Field;
import androidx.annotation.ColorInt;
import androidx.annotation.IntDef;
import androidx.databinding.BindingAdapter;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.PARAMETER;
public class DrawablesBindingAdapter {
private static final String TAG = "Drawables";
@ -27,7 +26,7 @@ public class DrawablesBindingAdapter {
// normal, checked, checkable, enabled, focused, pressed, selected
@BindingAdapter(value = {
/*@BindingAdapter(value = {
"drawable_shapeMode",
"drawable_solidColor",
"drawable_strokeColor",
@ -248,7 +247,7 @@ public class DrawablesBindingAdapter {
"drawable_pressed",
"drawable_selected",
}, requireAll = false)
}, requireAll = false)*/
public static void setViewBackground(
View view,

View File

@ -23,6 +23,7 @@ import com.gh.common.constant.Constants
import com.gh.common.util.*
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DialogDeviceRemindBinding
import com.gh.gamecenter.entity.DeviceDialogEntity
import com.gh.gamecenter.entity.GameEntity
import com.google.gson.reflect.TypeToken
@ -31,14 +32,13 @@ import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.dialog_device_remind.view.*
import java.lang.ref.WeakReference
/**
* 设备提醒弹窗
*/
class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val gameEntity: GameEntity) : Dialog(context, R.style.GhAlertDialog) {
private lateinit var view: View
private val mBinding: DialogDeviceRemindBinding by lazy { DialogDeviceRemindBinding.inflate(layoutInflater) }
private var currentPage = 0
private var mSlideLooperInterval = 3000L
private lateinit var mLooperHandle: LooperHandle
@ -96,13 +96,12 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
window?.setBackgroundDrawable(ColorDrawable(Color.TRANSPARENT))
view = LayoutInflater.from(context).inflate(R.layout.dialog_device_remind, null)
setContentView(view)
setContentView(mBinding.root)
mDatas.addAll(entity.gallery)
view.titleTv.text = entity.title
view.contentTv.text = entity.content
mBinding.titleTv.text = entity.title
mBinding.contentTv.text = entity.content
view.bannerView.apply {
mBinding.bannerView.apply {
orientation = ViewPager2.ORIENTATION_HORIZONTAL
mAdapter = BannerAdapter()
val recyclerView = getChildAt(0) as RecyclerView
@ -133,36 +132,36 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
}
val isFirst = SPUtils.getBoolean(Constants.SP_FIRST_DEVICE_REMIND, false)
if (!isFirst) {
view.cancelTv.isEnabled = false
view.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_round_f5f5f5)
mBinding.cancelTv.isEnabled = false
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_round_f5f5f5)
disposable = countDownTimer(3) { finish, time ->
if (finish) {
view.cancelTv.isEnabled = true
view.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
view.cancelTv.text = "我知道了"
view.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
mBinding.cancelTv.isEnabled = true
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
mBinding.cancelTv.text = "我知道了"
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
} else {
view.cancelTv.text = "我知道了(${time}S)"
mBinding.cancelTv.text = "我知道了(${time}S)"
}
}
SPUtils.setBoolean(Constants.SP_FIRST_DEVICE_REMIND, true)
} else {
view.noRemindAgainCb.visibility = View.VISIBLE
view.cancelTv.text = "我知道了"
view.cancelTv.isEnabled = true
view.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
view.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
mBinding.noRemindAgainCb.visibility = View.VISIBLE
mBinding.cancelTv.text = "我知道了"
mBinding.cancelTv.isEnabled = true
mBinding.cancelTv.setTextColor(ContextCompat.getColor(context, R.color.white))
mBinding.cancelTv.background = ContextCompat.getDrawable(context, R.drawable.button_blue_oval)
}
view.cancelTv.setOnClickListener {
SPUtils.setBoolean(Constants.SP_NO_REMIND_AGAIN, view.noRemindAgainCb.isChecked)
mBinding.cancelTv.setOnClickListener {
SPUtils.setBoolean(Constants.SP_NO_REMIND_AGAIN, mBinding.noRemindAgainCb.isChecked)
dismiss()
}
DownloadManager.getInstance().addObserver(dataWatcher)
}
private fun addIndicator() {
view.indicatorLl.removeAllViews()
mBinding.indicatorLl.removeAllViews()
mDatas.forEach { _ ->
val indicatorView = ImageView(context).apply {
setImageResource(R.drawable.selector_device_remind_indicator)
@ -171,13 +170,13 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
params.rightMargin = DisplayUtils.dip2px(1F)
layoutParams = params
}
view.indicatorLl.addView(indicatorView)
mBinding.indicatorLl.addView(indicatorView)
}
}
private fun slideIndicator(position: Int) {
for (i in 0 until view.indicatorLl.childCount) {
val childAt = view.indicatorLl.getChildAt(i)
for (i in 0 until mBinding.indicatorLl.childCount) {
val childAt = mBinding.indicatorLl.getChildAt(i)
childAt.isSelected = i == position
}
}
@ -210,7 +209,7 @@ class DeviceRemindDialog(context: Context, val entity: DeviceDialogEntity, val g
fun scrollToNextPage() {
currentPage++
view.bannerView.setCurrentItem(currentPage, true)
mBinding.bannerView.setCurrentItem(currentPage, true)
}
fun startScroll() {

View File

@ -16,10 +16,10 @@ import com.gh.common.util.PermissionHelper
import com.gh.common.util.fromHtml
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DialogNotificationHintBinding
import com.gh.gamecenter.entity.NotificationStyleEntity
import com.gh.gamecenter.entity.NotificationUgc
import com.lightgame.utils.Utils
import kotlinx.android.synthetic.main.dialog_notification_hint.*
import org.json.JSONArray
import java.io.BufferedReader
import java.io.IOException
@ -30,9 +30,10 @@ import kotlin.random.Random
class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
private var mNotificationUgc: NotificationUgc? = null
private val mBinding: DialogNotificationHintBinding by lazy { DialogNotificationHintBinding.inflate(layoutInflater) }
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.dialog_notification_hint, null)
return mBinding.root
}
@Suppress("DEPRECATION")
@ -55,39 +56,41 @@ class NotificationHintDialogFragment : BaseTrackableDialogFragment() {
val styleEntityJson = jsonObj.getJSONObject(mNotificationUgc!!.value)
val styleEntity = GsonUtils.fromJson(styleEntityJson.toString(), NotificationStyleEntity::class.java)
val drawableId = resources.getIdentifier(styleEntity.image, "drawable", requireContext().packageName)
notificationIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), drawableId))
notificationTitle.text = styleEntity.title
notificationContent.text = styleEntity.content.fromHtml()
if (index == 0) {
closeIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_notification_close_1))
} else {
activateTv.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_notification_open_btn_style_1)
activateTv.text = "优雅的开启"
}
mBinding.run {
notificationIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), drawableId))
notificationTitle.text = styleEntity.title
notificationContent.text = styleEntity.content.fromHtml()
if (index == 0) {
closeIv.setImageDrawable(ContextCompat.getDrawable(requireContext(), R.drawable.ic_notification_close_1))
} else {
activateTv.background = ContextCompat.getDrawable(requireContext(), R.drawable.bg_notification_open_btn_style_1)
activateTv.text = "优雅的开启"
}
activateTv.setOnClickListener {
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击立即开启")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击立即开启")
dismissAllowingStateLoss()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//这种方案适用于 API 26, 即8.0含8.0)以上可以用
val intent = Intent()
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID)
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
activateTv.setOnClickListener {
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击立即开启")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击立即开启")
dismissAllowingStateLoss()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//这种方案适用于 API 26, 即8.0含8.0)以上可以用
val intent = Intent()
intent.action = Settings.ACTION_APP_NOTIFICATION_SETTINGS
intent.putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID)
try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
PermissionHelper.toPermissionSetting(requireActivity())
}
} else {
PermissionHelper.toPermissionSetting(requireActivity())
}
} else {
PermissionHelper.toPermissionSetting(requireActivity())
}
}
closeIv.setOnClickListener {
dismissAllowingStateLoss()
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击关闭")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击关闭")
closeIv.setOnClickListener {
dismissAllowingStateLoss()
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "点击关闭")
MtaHelper.onEventWithBasicDeviceInfo(getEvent(), getKey(), "${styleEntity.scenes}_${styleEntity.styleNo}_点击关闭")
}
}
dialog?.setCanceledOnTouchOutside(true)

View File

@ -62,9 +62,11 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
detectionObjects?.forEach { detectionObject ->
if (detectionObject.packages.contains(packageName)) {
val packageLink = gameEntity?.packageDialog?.links?.find { it.buttonLink }
LogUtils.uploadPackageCheck("pkg_check_pop_download", if (DownloadStatus.add == downloadEntity.status) "下载开始" else "下载完成",
gameEntity, packageLink?.text ?: "", packageLink?.title
?: "", downloadEntity.gameId, downloadEntity.getMetaExtra(Constants.GAME_NAME))
LogUtils.uploadPackageCheck(
"pkg_check_pop_download", if (DownloadStatus.add == downloadEntity.status) "下载开始" else "下载完成",
gameEntity, packageLink?.text ?: "", packageLink?.title
?: "", downloadEntity.gameId, downloadEntity.getMetaExtra(Constants.GAME_NAME)
)
}
}
}
@ -98,8 +100,10 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
val spanBuilder = SpanBuilder(it.linkHintText).build()
it.links.forEachIndexed { index, link ->
val linkSpan = SpanBuilder(link.title ?: "").click(0, (link.title
?: "").length, R.color.theme_font, true) {
val linkSpan = SpanBuilder(link.title ?: "").click(
0, (link.title
?: "").length, R.color.theme_font, true
) {
LogUtils.uploadPackageCheck("pkg_check_pop_click", "点击链接", gameEntity, link.text, link.title, "", "")
DirectUtils.directToLinkPage(requireContext(), link, "包名检测弹窗", "")
}.build()
@ -205,6 +209,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
if (it >= mDuration) {
mDisposable?.dispose()
binding.downloadBtn.isEnabled = true
binding.downloadBtn.background = R.drawable.bg_notification_open_btn_style_2.toDrawable()
}
}
val animator = ValueAnimator.ofInt(0, 100)
@ -273,7 +278,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
}
}
inner class PackageCheckAdapter(val context: Context, val entities: ArrayList<DetectionObjectEntity>) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
inner class PackageCheckAdapter(val context: Context, val entities: ArrayList<DetectionObjectEntity>) :
BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
private var index = -1
fun notifyPackages() {
@ -282,7 +288,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return PackageCheckViewHolder(PackageCheckItemBinding.bind(LayoutInflater.from(context).inflate(R.layout.package_check_item, parent, false)))
return PackageCheckViewHolder(parent.toBinding())
}
override fun getItemCount(): Int = entities.size
@ -290,7 +296,7 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is PackageCheckViewHolder) {
val entity = entities[position]
holder.binding.entity = entity
holder.binding.gameNameTv.text = entity.text
if (position <= index) {
val isAllInstalled = checkDetectionsInstalled(mAllInstalledPackages, entity.packages)
if (isAllInstalled) {
@ -339,7 +345,8 @@ class PackageCheckDialogFragment : BaseDialogFragment() {
if (!activity.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) return
var dialogFragment = activity.supportFragmentManager.findFragmentByTag(PackageCheckDialogFragment::class.java.simpleName) as? PackageCheckDialogFragment
var dialogFragment =
activity.supportFragmentManager.findFragmentByTag(PackageCheckDialogFragment::class.java.simpleName) as? PackageCheckDialogFragment
if (dialogFragment == null) {
dialogFragment = PackageCheckDialogFragment()
dialogFragment.gameEntity = gameEntity

View File

@ -3,7 +3,7 @@ package com.gh.common.exposure
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Keep
@Parcelize

View File

@ -12,7 +12,7 @@ import com.gh.common.util.getFirstElementDividedByDivider
import com.gh.download.server.BrowserInstallHelper
import com.gh.gamecenter.entity.GameEntity
import com.lightgame.download.DownloadEntity
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import java.util.*
import kotlin.collections.ArrayList

View File

@ -2,7 +2,7 @@ package com.gh.common.exposure
import android.os.Parcelable
import androidx.annotation.Keep
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Keep
@Parcelize

View File

@ -2,7 +2,7 @@ package com.gh.common.exposure.meta
import android.os.Parcelable
import androidx.annotation.Keep
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Keep
@Parcelize

View File

@ -52,7 +52,6 @@ object HistoryHelper {
historyGame.iconSubscript = updateEntity.iconSubscript
historyGame.name = updateEntity.name
historyGame.tagStyle = updateEntity.tagStyle
historyGame.tag = updateEntity.tag
return historyGame
}

View File

@ -4,7 +4,7 @@ import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import java.util.*
@Keep

View File

@ -12,13 +12,15 @@ import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.cardview.widget.CardView
import androidx.core.view.ViewCompat
import com.facebook.drawee.view.SimpleDraweeView
import com.gh.common.util.DisplayUtils
import com.gh.common.util.ImageUtils
import com.gh.common.util.doOnEnd
import com.gh.common.util.doOnStart
import com.gh.gamecenter.R
import kotlinx.android.synthetic.main.view_notifier.view.*
class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0)
: FrameLayout(context, attrs, defStyle) {
@ -65,13 +67,21 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
var showVerticalTranslateAnimation: Boolean = true
private var mCardView: CardView
private var mContentTv: TextView
private var mIconIv: SimpleDraweeView
init {
inflate(context, R.layout.view_notifier, this)
ViewCompat.setTranslationZ(this, Integer.MAX_VALUE.toFloat())
cardView.scaleX = SCALE_MINI
cardView.scaleY = SCALE_MINI
mCardView = findViewById(R.id.cardView)
mContentTv = findViewById(R.id.tvText)
mIconIv = findViewById(R.id.ivIcon)
mCardView.scaleX = SCALE_MINI
mCardView.scaleY = SCALE_MINI
verticalAnimationOffset = dp2px(100F)
@ -113,7 +123,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
expandAnimator.duration = DEFAULT_DURATION
expandAnimator.addUpdateListener { a ->
val progress = a?.animatedValue as Float
tvText.width = (textWidth * progress).toInt()
mContentTv.width = (textWidth * progress).toInt()
}
expandAnimator.doOnEnd {
enableSwipeToDismiss()
@ -124,46 +134,46 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
shrinkAnimator.duration = DEFAULT_DURATION
shrinkAnimator.addUpdateListener { a ->
val progress = a?.animatedValue as Float
tvText.width = (textWidth * progress).toInt()
mContentTv.width = (textWidth * progress).toInt()
}
shrinkAnimator.doOnEnd {
val lp = FrameLayout.LayoutParams(cardView.layoutParams)
val lp = FrameLayout.LayoutParams(mCardView.layoutParams)
lp.gravity = Gravity.NO_GRAVITY
cardView.layoutParams = lp
mCardView.layoutParams = lp
disableSwipeToDismiss()
}
translateToLeftAnimator = ObjectAnimator.ofFloat(cardView, "translationX", veryRight, centerX)
translateToLeftAnimator = ObjectAnimator.ofFloat(mCardView, "translationX", veryRight, centerX)
translateToLeftAnimator.duration = DEFAULT_DURATION
translateToLeftAnimator.doOnEnd {
onShowListener?.onShow()
val lp = FrameLayout.LayoutParams(cardView.layoutParams)
val lp = FrameLayout.LayoutParams(mCardView.layoutParams)
lp.gravity = Gravity.CENTER_HORIZONTAL
cardView.layoutParams = lp
cardView.translationX = 0f
mCardView.layoutParams = lp
mCardView.translationX = 0f
expandAnimator.start()
}
translateToRightAnimator = ObjectAnimator.ofFloat(cardView, "translationX", centerX, veryRight)
translateToRightAnimator = ObjectAnimator.ofFloat(mCardView, "translationX", centerX, veryRight)
translateToRightAnimator.duration = DEFAULT_DURATION
translateUpAnimator = ObjectAnimator.ofFloat(cardView, "translationY", veryBottom + verticalAnimationOffset, veryBottom)
translateUpAnimator = ObjectAnimator.ofFloat(mCardView, "translationY", veryBottom + verticalAnimationOffset, veryBottom)
translateUpAnimator.duration = DEFAULT_DURATION
translateUpAnimator.doOnStart { cardView.translationX = veryRight }
translateUpAnimator.doOnStart { mCardView.translationX = veryRight }
translateDownAnimator = ObjectAnimator.ofFloat(cardView, "translationY", veryBottom, veryBottom + verticalAnimationOffset)
translateDownAnimator = ObjectAnimator.ofFloat(mCardView, "translationY", veryBottom, veryBottom + verticalAnimationOffset)
translateDownAnimator.duration = DEFAULT_DURATION
zoomInAnimator = ObjectAnimator.ofPropertyValuesHolder(cardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_DEFAULT),
zoomInAnimator = ObjectAnimator.ofPropertyValuesHolder(mCardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_DEFAULT),
PropertyValuesHolder.ofFloat("scaleY", SCALE_DEFAULT))
zoomInAnimator.duration = DEFAULT_DURATION
zoomInAnimator.doOnStart { cardView.translationX = veryRight }
zoomInAnimator.doOnStart { cardView.translationY = veryBottom }
zoomInAnimator.doOnStart { mCardView.translationX = veryRight }
zoomInAnimator.doOnStart { mCardView.translationY = veryBottom }
zoomOutAnimator = ObjectAnimator.ofPropertyValuesHolder(cardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_MINI),
zoomOutAnimator = ObjectAnimator.ofPropertyValuesHolder(mCardView, PropertyValuesHolder.ofFloat("scaleX", SCALE_MINI),
PropertyValuesHolder.ofFloat("scaleY", SCALE_MINI))
zoomOutAnimator.duration = DEFAULT_DURATION
zoomOutAnimator.doOnEnd { removeFromParent() }
@ -177,7 +187,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
}
private fun enableSwipeToDismiss() {
cardView?.setOnTouchListener(SwipeDismissTouchListener(cardView, object : SwipeDismissTouchListener.DismissCallbacks {
mCardView?.setOnTouchListener(SwipeDismissTouchListener(mCardView, object : SwipeDismissTouchListener.DismissCallbacks {
override fun canDismiss(): Boolean {
return true
}
@ -193,7 +203,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
}
private fun disableSwipeToDismiss() {
cardView?.setOnTouchListener(null)
mCardView?.setOnTouchListener(null)
}
override fun onDetachedFromWindow() {
@ -264,13 +274,13 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
fun setText(text: String?) {
if (!TextUtils.isEmpty(text)) {
tvText.text = text
tvText.measure(0, 0)
textWidth = tvText.measuredWidth
tvText.width = 0
mContentTv.text = text
mContentTv.measure(0, 0)
textWidth = mContentTv.measuredWidth
mContentTv.width = 0
cardView.measure(0, 0)
cardViewWidth = cardView.measuredWidth
mCardView.measure(0, 0)
cardViewWidth = mCardView.measuredWidth
}
}
@ -284,7 +294,7 @@ class NotifierView @JvmOverloads constructor(context: Context, attrs: AttributeS
}
fun setIcon(url: String) {
ImageUtils.display(ivIcon, url)
ImageUtils.display(mIconIv, url)
}
private fun dp2px(dp: Float): Int {

View File

@ -173,10 +173,11 @@ object DialogHelper {
val dialog = Dialog(context)
val binding = DialogProgressBinding.inflate(context.layoutInflater)
binding.contentTv.text = content
binding.loadingLottie.setAnimation("lottie/loading.json")
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
dialog.setContentView(binding.root)
dialog.setCanceledOnTouchOutside(false)
dialog.window?.setBackgroundDrawableResource(R.drawable.background_shape_white_radius_8)
dialog.window?.attributes = dialog.window?.attributes?.apply { width = 160F.dip2px() }
uiModificationCallback?.invoke(binding)
dialog.show()
return dialog

View File

@ -44,13 +44,9 @@ import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.content.ContextCompat;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.common.AppExecutor;
@ -81,6 +77,7 @@ import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.Badge;
import com.gh.gamecenter.entity.BadgeEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.PermissionsEntity;
import com.gh.gamecenter.entity.PrivacyPolicyEntity;
import com.gh.gamecenter.entity.SettingsEntity;
import com.gh.gamecenter.entity.SimpleGameEntity;
@ -101,6 +98,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
public class DialogUtils {
public static Dialog showWaitDialog(Context context, String msg) {
@ -113,6 +113,10 @@ public class DialogUtils {
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(view);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setBackgroundDrawableResource(R.drawable.background_shape_white_radius_8);
WindowManager.LayoutParams layoutParams = dialog.getWindow().getAttributes();
layoutParams.width = DisplayUtils.dip2px(160);
dialog.getWindow().setAttributes(layoutParams);
dialog.show();
return dialog;
}
@ -994,7 +998,10 @@ public class DialogUtils {
if (holder instanceof PrivacyPolicyItemViewHolder) {
PrivacyPolicyItemViewHolder viewHolder = (PrivacyPolicyItemViewHolder) holder;
PrivacyItemBinding binding = viewHolder.getBinding();
binding.setData(entity.getPermissions().get(position));
final PermissionsEntity permissionsEntity = entity.getPermissions().get(position);
ImageUtils.display(binding.icon, permissionsEntity.getIcon());
binding.name.setText(permissionsEntity.getName());
binding.intro.setText(permissionsEntity.getIntro());
GenericDraweeHierarchy hierarchy = binding.icon.getHierarchy();
if (hierarchy != null) {
if (position == 0) {
@ -1393,11 +1400,12 @@ public class DialogUtils {
} else {
final Dialog dialog = new Dialog(context, R.style.GhAlertDialog);
DialogOverseaConfirmationBinding binding = DataBindingUtil.inflate(LayoutInflater.from(context), R.layout.dialog_oversea_confirmation, null, false);
DialogOverseaConfirmationBinding binding = DialogOverseaConfirmationBinding.inflate(LayoutInflater.from(context), null, false);
View contentView = binding.getRoot();
binding.setGame(gameEntity);
binding.gameIcon.displayGameIcon(gameEntity);
binding.gameNameTv.setText(context.getString(R.string.dialog_oversea_hint, gameEntity.getName()));
binding.urlTv.setText(gameEntity.getOverseasAddressDialog().getLink());
binding.closeIv.setOnClickListener(v -> dialog.dismiss());
binding.downloadBtn.setText("下载(" + gameEntity.getApk().get(0).getSize() + "");
@ -1434,7 +1442,7 @@ public class DialogUtils {
params = window.getAttributes();
params.width = (int) (context.getResources().getDisplayMetrics().widthPixels * 0.9);
window.setAttributes(params);
window.setBackgroundDrawableResource(R.drawable.full_dialog_background);
window.setBackgroundDrawableResource(R.drawable.textview_white_up);
}
inflate.findViewById(R.id.imprint_close).setOnClickListener(v -> dialog.dismiss());
@ -1453,10 +1461,11 @@ public class DialogUtils {
continue;
}
View item = LayoutInflater.from(context).inflate(R.layout.imprint_content_item, null);
ImprintContentItemBinding bind = DataBindingUtil.bind(item);
bind.setApk(apk);
ImprintContentItemBinding bind = ImprintContentItemBinding.bind(item);
String platform = TextUtils.isEmpty(apk.getRemark()) ? apk.getPlatformName() : apk.getPlatformName() + "\n" + apk.getRemark();
bind.setPlatformName(platform);
bind.imprintPlatform.setText(platform);
bind.imprintVersion.setText(apk.getVersion());
bind.imprintTime.setText(NewsUtils.getFormattedTime(apk.getTime() != null ? apk.getTime() : 0));
content.addView(item, LinearLayout.LayoutParams.MATCH_PARENT, DisplayUtils.dip2px(40));
}
@ -2209,7 +2218,7 @@ public class DialogUtils {
dialog.show();
}
public static void showReserveSuccess2WechatBindDialog(Context context, ConfirmListener confirmListener,CancelListener cancelListener) {
public static void showReserveSuccess2WechatBindDialog(Context context, ConfirmListener confirmListener, CancelListener cancelListener) {
context = checkDialogContext(context);
final Dialog dialog = new Dialog(context, R.style.DialogWindowTransparent);

View File

@ -208,7 +208,7 @@ object DownloadItemUtils {
} else {
text = context.getString(R.string.none)
setTextColor(R.color.button_gray.toColor())
setBackgroundResource(R.drawable.news_detail_comment)
setBackgroundResource(R.drawable.button_border_gray_oval)
if (hideDownloadBtnIfNoAvailableContent) {
visibility = View.GONE
}
@ -227,16 +227,18 @@ object DownloadItemUtils {
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
} else if (status == DownloadStatus.waiting) {
setText(R.string.waiting)
setBackgroundResource(R.drawable.game_item_btn_downloading_style)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
setBackgroundResource(R.drawable.button_round_border_eeeeee)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_subtitleDesc))
} else if (status == DownloadStatus.pause || status == DownloadStatus.timeout || status == DownloadStatus.neterror || status == DownloadStatus.subscribe || status == DownloadStatus.overflow) {
if (status == DownloadStatus.waiting) {
setText(R.string.waiting)
setBackgroundResource(R.drawable.button_round_border_eeeeee)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_subtitleDesc))
} else {
setText(R.string.downloading)
setBackgroundResource(R.drawable.game_item_btn_downloading_style)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
}
setBackgroundResource(R.drawable.game_item_btn_downloading_style)
setTextColor(ContextCompat.getColorStateList(context, R.color.text_downloading_style))
} else if (status == DownloadStatus.done) {
val xapkStatus = downloadEntity.meta[XapkInstaller.XAPK_UNZIP_STATUS]
if (XapkUnzipStatus.UNZIPPING.name == xapkStatus) {

View File

@ -186,6 +186,6 @@ object DownloadNotificationHelper {
}
private fun getNotificationIcon(): Int {
return if (mShouldUseAlternativeNotificationIcon) R.drawable.ic_notification else R.mipmap.logo
return if (mShouldUseAlternativeNotificationIcon) R.drawable.ic_download_notification else R.mipmap.logo
}
}

View File

@ -6,6 +6,7 @@ import android.app.Application
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.View
import android.widget.ImageView
import android.widget.ProgressBar
import com.gh.base.CurrentActivityHolder
@ -105,7 +106,7 @@ object GameCollectionSquareBrowseTaskHelper {
HaloApp.getInstance().unregisterActivityLifecycleCallbacks(mActivityLifecycleCallbacks)
}
fun resumeTimeCount() {
private fun resumeTimeCount() {
if (!mIsBrowseTimeCountEnabled) return
mIsBrowseTimeCountValid = true
@ -113,30 +114,42 @@ object GameCollectionSquareBrowseTaskHelper {
mThreadService.execute {
while (mIsBrowseTimeCountEnabled && mIsBrowseTimeCountValid) {
val topActivity = CurrentActivityHolder.getCurrentActivity() ?: continue
if (isGameCollectionSquare(topActivity, false) && mIsFirstEnterSquare) {
mIsFirstEnterSquare = false
topActivity.intent.putExtra(KEY_IS_FORM_BROWSE_TASK, true)
}
if (isTopActivityGameCollectionRelated(topActivity)) {
tryWithDefaultCatch {
showOrUpdateFloatView(topActivity, if (mIsFinished) mBrowseTimeTimeout else mBrowseTimeCount)
if (mIsFinished) {
disableBrowseTimeCount()
} else {
mBrowseTimeCount++
if (mBrowseTimeCount >= mBrowseTimeTimeout) {
showOrUpdateFloatView(topActivity, mBrowseTimeTimeout)
postBrowseFinish()
}
}
}
}
checkFirstEnterSquare(topActivity)
runBrowseTask(topActivity)
Thread.sleep(1000)
}
}
}
fun pauseTimeCount() {
private fun checkFirstEnterSquare(topActivity: Activity) {
if (isGameCollectionSquare(topActivity, false) && mIsFirstEnterSquare) {
mIsFirstEnterSquare = false
topActivity.intent.putExtra(KEY_IS_FORM_BROWSE_TASK, true)
}
}
private fun runBrowseTask(topActivity: Activity) {
if (isTopActivityGameCollectionRelated(topActivity)) {
tryWithDefaultCatch {
showOrUpdateFloatView(topActivity, if (mIsFinished) mBrowseTimeTimeout else mBrowseTimeCount)
if (mIsFinished) {
disableBrowseTimeCount()
} else {
countBrowseTimeout(topActivity)
}
}
}
}
private fun countBrowseTimeout(topActivity: Activity) {
mBrowseTimeCount++
if (mBrowseTimeCount >= mBrowseTimeTimeout) {
showOrUpdateFloatView(topActivity, mBrowseTimeTimeout)
postBrowseFinish()
}
}
private fun pauseTimeCount() {
if (!mIsBrowseTimeCountEnabled) return
mIsBrowseTimeCountValid = false
@ -165,49 +178,61 @@ object GameCollectionSquareBrowseTaskHelper {
val isFinished = time == mBrowseTimeTimeout
val floatView = EasyFloat.getFloatView(FLOATING_SQUARE_BROWSE_TASK_VIEW)
if (floatView != null) {
if (mBrowsePro == null) {
mBrowsePro = floatView.findViewById(R.id.browsePro)
}
mBrowsePro?.progress = time
if (isFinished) {
floatView.findViewById<ImageView>(R.id.browsePic)
.setImageResource(R.drawable.pic_browse_square_finish)
}
updateFloatView(floatView, isFinished, time)
} else {
EasyFloat.with(activity)
.setLayout(R.layout.layout_square_browse_task_float)
.setTag(FLOATING_SQUARE_BROWSE_TASK_VIEW)
.setAnimator(null)
.setGravity(Gravity.END.or(Gravity.CENTER_VERTICAL), 0, 0)
.setSidePattern(SidePattern.RIGHT)
.setShowPattern(ShowPattern.CURRENT_ACTIVITY)
.setDragEnable(false)
.registerCallback {
createResult { _, _, view ->
if (isFinished) {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
max = mBrowseTimeTimeout
progress = mBrowseTimeTimeout
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square_finish)
} else {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
mBrowsePro = this
max = mBrowseTimeTimeout
progress = 0
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square)
}
}
}
.show()
showFloatView(activity, isFinished)
}
}
}
fun dismissFloatView() {
private fun showFloatView(activity: Activity, isFinished: Boolean) {
EasyFloat.with(activity)
.setLayout(R.layout.layout_square_browse_task_float)
.setTag(FLOATING_SQUARE_BROWSE_TASK_VIEW)
.setAnimator(null)
.setGravity(Gravity.END.or(Gravity.CENTER_VERTICAL), 0, 0)
.setSidePattern(SidePattern.RIGHT)
.setShowPattern(ShowPattern.CURRENT_ACTIVITY)
.setDragEnable(false)
.registerCallback {
createResult { _, _, view ->
initFloatView(view, isFinished)
}
}
.show()
}
private fun initFloatView(view: View?, isFinished: Boolean) {
if (isFinished) {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
max = mBrowseTimeTimeout
progress = mBrowseTimeTimeout
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square_finish)
} else {
view?.findViewById<ProgressBar>(R.id.browsePro)?.run {
mBrowsePro = this
max = mBrowseTimeTimeout
progress = 0
}
view?.findViewById<ImageView>(R.id.browsePic)
?.setImageResource(R.drawable.pic_browse_square)
}
}
private fun updateFloatView(floatView: View, isFinished: Boolean, time: Int) {
if (mBrowsePro == null) {
mBrowsePro = floatView.findViewById(R.id.browsePro)
}
mBrowsePro?.progress = time
if (isFinished) {
floatView.findViewById<ImageView>(R.id.browsePic)
.setImageResource(R.drawable.pic_browse_square_finish)
}
}
private fun dismissFloatView() {
EasyFloat.dismiss(FLOATING_SQUARE_BROWSE_TASK_VIEW)
}

View File

@ -118,10 +118,9 @@ public class GameUtils {
if (PackagesManager.INSTANCE.isCanUpdate(gameEntity.getId(), apkEntity.getPackageName())) {
updateCount++;
}
if (PackagesManager.INSTANCE.isInstalled(apkEntity.getPackageName())) {
if (PackagesManager.isInstalled(apkEntity.getPackageName())) {
gh_id = PackageUtils.getMetaData(context, apkEntity.getPackageName(), "gh_id");
if (gameEntity.getTag() != null && gameEntity.getTag().size() != 0
&& !TextUtils.isEmpty(apkEntity.getGhVersion())
if (!TextUtils.isEmpty(apkEntity.getGhVersion())
&& !PackageUtils.isSignedByGh(context, apkEntity.getPackageName())
&& apkEntity.isShowPlugin(pluginLocation)) {
pluginCount++;
@ -231,7 +230,6 @@ public class GameUtils {
gameUpdateEntity.setPlatform(apkEntity.getPlatform());
gameUpdateEntity.setEtag(apkEntity.getEtag());
gameUpdateEntity.setPluggable(true);
gameUpdateEntity.setTag(gameEntity.getTag());
gameUpdateEntity.setTagStyle(gameEntity.getTagStyle());
gameUpdateEntity.setBrief(gameEntity.getBrief());
gameUpdateEntity.setPlugin(apkEntity.getPlugin());

View File

@ -5,6 +5,7 @@ import com.gh.common.json.JsonObjectBuilder
import com.gh.common.json.json
import com.gh.common.loghub.LoghubUtils
import com.gh.common.tracker.Tracker
import com.gh.gamecenter.entity.AdditionalParamsEntity
import com.gh.gamecenter.entity.LinkEntity
import com.gh.gamecenter.entity.QuoteCountEntity
import com.gh.gamecenter.entity.WechatConfigEntity
@ -569,12 +570,21 @@ object NewLogUtils {
//分享结果
@JvmStatic
fun logShareResult(shareResult: Boolean) {
fun logShareResult(additionalParams: AdditionalParamsEntity? = null, shareResult: Boolean) {
val json = json {
"location" to "分享面板"
"event" to "share_result"
"meta" to LogUtils.getMetaObject()
"share_success" to shareResult
additionalParams?.let {
"content_type" to it.contentType
"content_id" to it.contentId
"bbs_id" to it.bbsId
"bbs_type" to it.bbsType
"ref_user_id" to it.refUserId
}
"launch_id" to Tracker.launchId
"session_id" to Tracker.sessionId
"timestamp" to System.currentTimeMillis() / 1000
@ -1897,7 +1907,7 @@ object NewLogUtils {
//默认封面点击事件
@JvmStatic
fun logClickGameCollectionDefaultCoverDialog(action: String){
fun logClickGameCollectionDefaultCoverDialog(action: String) {
val json = json {
"event" to "click_dialog_game_collect_chose_default_picture"
"action" to action

View File

@ -1,6 +1,7 @@
package com.gh.common.util
import java.text.DecimalFormat
import kotlin.math.roundToInt
object NumberUtils {
@ -45,8 +46,8 @@ object NumberUtils {
fun transSimpleUsageTime(second: Long): String {
val totalMinute = second / 60
if (totalMinute < 60) return ((if (totalMinute == 0L) 1 else totalMinute).toString() + "分钟")
val hour = Math.round((totalMinute / 60).toFloat())
val minute = Math.round((totalMinute - hour * 60).toFloat())
val hour = (totalMinute / 60).toFloat().roundToInt()
val minute = (totalMinute - hour * 60).toFloat().roundToInt()
return hour.toString() + "小时" + if (minute == 0) "" else minute.toString() + "分钟"
}

View File

@ -82,7 +82,6 @@ public class PackageUtils {
updateEntity.setPlatform(apkEntity.getPlatform());
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateEntity.setDownload(gameEntity.getDownload());
updateEntity.setIndexPlugin(gameEntity.getIndexPlugin());
@ -131,7 +130,6 @@ public class PackageUtils {
updateEntity.setPlatform(apkEntity.getPlatform());
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateEntity.setIndexPlugin(gameEntity.getIndexPlugin());
updateEntity.setPluginDesc(gameEntity.getPluginDesc());
@ -736,7 +734,6 @@ public class PackageUtils {
updateEntity.setPlatform(apkEntity.getPlatform());
updateEntity.setEtag(apkEntity.getEtag());
updateEntity.setBrief(gameEntity.getBrief());
updateEntity.setTag(gameEntity.getTag());
updateEntity.setTagStyle(gameEntity.getTagStyle());
updateEntity.setIndexPlugin(gameEntity.getIndexPlugin());
updateEntity.setPluginDesc(gameEntity.getPluginDesc());

View File

@ -28,6 +28,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.gh.common.constant.Config;
import com.gh.gamecenter.R;
import com.gh.gamecenter.WeiBoShareActivity;
import com.gh.gamecenter.entity.AdditionalParamsEntity;
import com.gh.gamecenter.entity.ShareEntity;
import com.gh.gamecenter.eventbus.EBShare;
import com.lightgame.utils.Utils;
@ -129,6 +130,7 @@ public class ShareUtils {
public static String resourceId = "";//分享内容的id(事件上报用)
public static ShareEntity shareEntity;//分享信息(事件上报用)
private static ShareType mShareType;//分享类型(事件上报用)
public static AdditionalParamsEntity additionalParams;//附加参数(事件上报用)
private WeakReference<Activity> mActivity;
@ -148,7 +150,7 @@ public class ShareUtils {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(true);
NewLogUtils.logShareResult(ShareUtils.additionalParams, true);
} else if (ShareUtils.shareEntrance == ShareEntrance.gameCollection) {
String shareType;
if (mShareType == ShareType.qq) {
@ -176,7 +178,7 @@ public class ShareUtils {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(false);
NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
}
}
@ -191,7 +193,7 @@ public class ShareUtils {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(false);
NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
}
}
@ -417,6 +419,10 @@ public class ShareUtils {
}
public void shareParamsDetail(Activity activity, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, ShareCallBack callBack) {
shareParamsDetail(activity, url, icon, shareTitle, shareSummary, shareEntrance, id, null, callBack);
}
public void shareParamsDetail(Activity activity, String url, String icon, String shareTitle, String shareSummary, ShareEntrance shareEntrance, String id, AdditionalParamsEntity params, ShareCallBack callBack) {
if (activity.isFinishing()) return;
this.mActivity = new WeakReference<>(activity);
this.shareIcon = icon;
@ -424,6 +430,7 @@ public class ShareUtils {
this.mSummary = shareSummary;
this.mTitle = shareTitle;
this.mShareEntrance = shareEntrance;
ShareUtils.additionalParams = params;
ShareUtils.shareEntrance = mShareEntrance;
ShareUtils.resourceId = id;
ShareUtils.shareEntity = new ShareEntity(shareUrl, mTitle, mSummary);

View File

@ -4,7 +4,7 @@ import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.Entity
import androidx.room.PrimaryKey
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import java.util.*
@Keep

View File

@ -170,7 +170,7 @@ public class DownloadProgressBar extends ProgressBar {
case INSTALL_NORMAL:
case H5_GAME:
if (mDownloadStyle == DOWNLOAD_IMAGE_STYLE) {
setProgressDrawable(getResources().getDrawable(R.drawable.detail_download_normal_image_style));
setProgressDrawable(getResources().getDrawable(R.drawable.text_white_background));
mDefaultColor = Color.BLACK;
} else {
setProgressDrawable(getResources().getDrawable(R.drawable.download_button_normal_style));
@ -185,7 +185,7 @@ public class DownloadProgressBar extends ProgressBar {
setProgress(0);
break;
case NONE:
setProgressDrawable(getResources().getDrawable(R.drawable.news_detail_comment));
setProgressDrawable(getResources().getDrawable(R.drawable.button_border_gray_oval));
mDefaultColor = ContextCompat.getColor(getContext(), R.color.hint);
setProgress(0);
break;

View File

@ -4,11 +4,11 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.base.BaseRecyclerViewHolder
import com.gh.base.fragment.BaseDialogFragment
import com.gh.common.util.ImageUtils
import com.gh.common.util.fromHtml
import com.gh.gamecenter.GameDetailActivity
import com.gh.gamecenter.R
@ -23,8 +23,8 @@ class ReserveDialog : BaseDialogFragment() {
private lateinit var mReserveList: List<SimpleGameEntity>
private var mDismissListener: (() -> Unit)? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding: DialogReserveBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_reserve, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
val binding: DialogReserveBinding = DialogReserveBinding.inflate(layoutInflater, null, false)
mReserveList = arguments?.getParcelableArrayList(RESERVE_LIST) ?: arrayListOf()
@ -54,7 +54,8 @@ class ReserveDialog : BaseDialogFragment() {
override fun onBindViewHolder(holder: ReserveDialogItemViewHolder, position: Int) {
val entity = mReserveList[position]
holder.binding.game = entity
ImageUtils.display(holder.binding.icon, entity.icon)
holder.binding.gameNameTv.text = entity.name
holder.itemView.setOnClickListener {
GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(预约弹窗)")
dismissAllowingStateLoss()

View File

@ -0,0 +1,143 @@
package com.gh.common.view
import android.animation.ValueAnimator
import android.content.Context
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.Gravity
import android.view.View
import android.view.animation.AccelerateDecelerateInterpolator
import android.widget.FrameLayout
import android.widget.LinearLayout
import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.core.content.ContextCompat
import com.gh.common.util.dip2px
import com.gh.gamecenter.R
import splitties.views.dsl.core.add
class SegmentedFilterView : FrameLayout {
private var mItemWidth = 0
private var mItemHeight = 0
private var mTextColor: ColorStateList? =
ContextCompat.getColorStateList(context, R.color.game_collection_rg_button_selector)
private var mTextSize = 10F
private var mContainerBackground: Drawable? = null
private var mIndicatorBackground: Drawable? = null
private var mAnimationDuration = 200
private var mContainerPadding = 1F.dip2px()
private lateinit var mContainer: FrameLayout
private lateinit var mRadioGroup: RadioGroup
private lateinit var mIndicator: View
private var mItemList = listOf<String>()
constructor(context: Context) : super(context, null) {
initView(null)
}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs, 0) {
initView(attrs)
}
constructor(context: Context, attrs: AttributeSet, defStyleAttr: Int) : super(
context,
attrs,
defStyleAttr
) {
initView(attrs)
}
private fun initView(attrs: AttributeSet?) {
if (attrs != null) {
val ta = context.obtainStyledAttributes(attrs, R.styleable.SegmentedFilterView)
mContainerBackground =
ta.getDrawable(R.styleable.SegmentedFilterView_containerBackground)
mIndicatorBackground =
ta.getDrawable(R.styleable.SegmentedFilterView_indicatorBackground)
mContainerPadding = ta.getDimensionPixelSize(
R.styleable.SegmentedFilterView_containerPadding,
1F.dip2px()
)
mItemWidth = ta.getDimensionPixelSize(
R.styleable.SegmentedFilterView_sfv_itemWidth,
36F.dip2px()
)
mItemHeight = ta.getDimensionPixelSize(
R.styleable.SegmentedFilterView_sfv_itemHeight,
24F.dip2px()
)
mAnimationDuration = ta.getInt(R.styleable.SegmentedFilterView_animationDuration, 200)
mTextColor = ta.getColorStateList(R.styleable.SegmentedFilterView_sfv_textColor)
mTextSize = ta.getFloat(R.styleable.SegmentedFilterView_sfv_textSize, 10F)
ta.recycle()
}
setPadding(mContainerPadding, mContainerPadding, mContainerPadding, mContainerPadding)
if (mContainerBackground != null) background = mContainerBackground
mContainer = FrameLayout(context)
mIndicator = View(context).apply {
background = mIndicatorBackground
}
mRadioGroup = RadioGroup(context).apply {
gravity = Gravity.CENTER
orientation = LinearLayout.HORIZONTAL
}
add(mContainer, LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT))
mContainer.add(mIndicator, LayoutParams(mItemWidth, mItemHeight))
mContainer.add(
mRadioGroup,
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)
)
}
fun setItemList(itemList: List<String>, defaultCheckPosition: Int) {
mItemList = itemList
mRadioGroup.removeAllViews()
addRadioButton()
if (defaultCheckPosition in 0 until mRadioGroup.childCount) (mRadioGroup.getChildAt(defaultCheckPosition) as RadioButton).isChecked = true
}
fun setOnCheckedCallback(callback: OnCheckedCallback) {
mRadioGroup.setOnCheckedChangeListener { _, checkId ->
for (i in 0 until mRadioGroup.childCount) {
val radioBtn = mRadioGroup.getChildAt(i)
if (checkId == radioBtn.id) {
startIndicatorAnimation(radioBtn.x)
callback.onItemCheck(i)
}
}
}
}
private fun addRadioButton() {
for (item in mItemList) {
val radioButton = RadioButton(context).apply {
background = null
buttonDrawable = null
text = item
gravity = Gravity.CENTER
textSize = mTextSize
setTextColor(mTextColor)
isChecked = false
}
mRadioGroup.add(radioButton, LinearLayout.LayoutParams(mItemWidth, mItemHeight))
}
}
private fun startIndicatorAnimation(x: Float) {
ValueAnimator.ofFloat(mIndicator.x, x).apply {
interpolator = AccelerateDecelerateInterpolator()
duration = mAnimationDuration.toLong()
addUpdateListener {
mIndicator.x = it.animatedValue as Float
}
}.start()
}
interface OnCheckedCallback {
fun onItemCheck(position: Int)
}
}

View File

@ -3,10 +3,11 @@ package com.gh.download.dialog
import android.annotation.SuppressLint
import android.content.Context
import android.os.Bundle
import android.view.*
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.Observer
@ -32,7 +33,6 @@ import com.lightgame.utils.AppManager
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.util.*
class DownloadDialog : BaseDraggableDialogFragment() {
@ -62,17 +62,20 @@ class DownloadDialog : BaseDraggableDialogFragment() {
private val mDataWatcher = object : DataWatcher() {
override fun onDataChanged(downloadEntity: DownloadEntity) {
if (downloadEntity.gameId == mGameEntity?.id &&
DownloadStatus.delete != DownloadManager.getInstance().getStatus(downloadEntity.url)) {
DownloadStatus.delete != DownloadManager.getInstance().getStatus(downloadEntity.url)
) {
mAdapter?.listData?.forEachIndexed { index, entity ->
if (entity.normal?.packageName == downloadEntity.packageName
|| entity.installed?.packageName == downloadEntity.packageName) {
|| entity.installed?.packageName == downloadEntity.packageName
) {
mAdapter?.notifyItemChanged(index)
}
}
mCollectionAdapter?.listData?.forEachIndexed { index, entity ->
if (entity.normal?.packageName == downloadEntity.packageName
|| entity.installed?.packageName == downloadEntity.packageName) {
|| entity.installed?.packageName == downloadEntity.packageName
) {
mCollectionAdapter?.notifyItemChanged(index)
}
}
@ -146,8 +149,8 @@ class DownloadDialog : BaseDraggableDialogFragment() {
}
@SuppressLint("ClickableViewAccessibility")
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
mBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_download, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
mBinding = DialogDownloadBinding.bind(layoutInflater.inflate(R.layout.dialog_download, container, false))
mBinding.title.text = ("选择下载" + mGameEntity.pluginDesc + "版本")
val downloadNotice = mGameEntity.downloadAd
@ -159,9 +162,10 @@ class DownloadDialog : BaseDraggableDialogFragment() {
DialogUtils.showImprintDialog(requireContext(), mGameEntity, downloadNotice.title)
} else {
DirectUtils.directToLinkPage(
requireContext(),
downloadNotice,
mEntrance, "下载多平台弹窗")
requireContext(),
downloadNotice,
mEntrance, "下载多平台弹窗"
)
}
// MtaHelper.onEvent(MTA_KEY, "点击", mViewModel.gameEntity.name + "_" + downloadNotice.title)
}

View File

@ -1,15 +1,13 @@
package com.gh.download.dialog
import android.content.Context
import android.graphics.drawable.GradientDrawable
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.base.OnViewClickListener
import com.gh.common.exposure.ExposureEvent
import com.gh.common.util.DirectUtils
import com.gh.common.util.MtaHelper
import com.gh.common.util.dip2px
import com.gh.common.util.throwExceptionInDebug
import com.gh.common.util.*
import com.gh.gamecenter.NewsDetailActivity
import com.gh.gamecenter.QaActivity
import com.gh.gamecenter.R
@ -18,13 +16,15 @@ import com.gh.gamecenter.entity.GameEntity
import com.lightgame.adapter.BaseRecyclerAdapter
import com.lightgame.utils.Utils
class DownloadDialogAdapter(context: Context,
val viewModel: DownloadViewModel,
val listData: List<DownloadDialogItemData>,
val isCollectionPage: Boolean,
private val mTraceEvent: ExposureEvent?,
private val mEntrance: String,
private val mLocation: String) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
class DownloadDialogAdapter(
context: Context,
val viewModel: DownloadViewModel,
val listData: List<DownloadDialogItemData>,
val isCollectionPage: Boolean,
private val mTraceEvent: ExposureEvent?,
private val mEntrance: String,
private val mLocation: String
) : BaseRecyclerAdapter<RecyclerView.ViewHolder>(context) {
private val mPath = if (isCollectionPage) {
"下载弹窗-二级页"
@ -83,11 +83,13 @@ class DownloadDialogAdapter(context: Context,
} else 0
holder.binding.root.layoutParams = this
}
holder.binding.type = listData[position].section
val section = listData[position].section
holder.binding.title.text = if (section == DownloadDialogSectionType.OTHER) "其它版本" else "我的版本"
holder.binding.otherVersionHint.goneIf(section != DownloadDialogSectionType.OTHER)
}
is DownloadDialogLinkItemViewHolder -> {
holder.binding.links = listData[position].links
holder.binding.clickListener = OnViewClickListener<GameEntity.PluginLink> { _, data ->
val links = listData[position].links
val clickListener = OnViewClickListener<GameEntity.PluginLink> { _, data ->
when (data.linkType) {
"dialog" -> {
DownloadLinkDialog.showDownloadDialog(mContext, data)
@ -109,6 +111,28 @@ class DownloadDialogAdapter(context: Context,
// MtaHelper.onEvent(DownloadDialog.MTA_KEY, "点击", viewModel.gameEntity.name + "_" + data.title)
}
holder.binding.run {
links?.let {
leftLink.setOnClickListener { view ->
clickListener.onClick(view, links[0])
}
rightLink.setOnClickListener { view ->
clickListener.onClick(view, links[1])
}
}
leftLink.visibleIf(!links.isNullOrEmpty())
rightLink.visibleIf(links?.size ?:0 > 1)
leftLink.text = if (links.isNullOrEmpty()) "" else links[0].title
rightLink.text = if (links?.size ?: 0 > 1) links?.get(1)?.title else ""
leftLink.background = GradientDrawable().apply {
cornerRadius = 8F.dip2px().toFloat()
setStroke(0.5F.dip2px(), R.color.divider.toColor())
}
rightLink.background = GradientDrawable().apply {
cornerRadius = 8F.dip2px().toFloat()
setStroke(0.5F.dip2px(), R.color.divider.toColor())
}
}
}
is DownloadDialogInstructionItemViewHolder -> {
holder.bindItem(listData, position, mEntrance)

View File

@ -4,10 +4,7 @@ import android.view.View
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.constant.Config
import com.gh.common.exposure.ExposureEvent
import com.gh.common.util.PackageUtils
import com.gh.common.util.goneIf
import com.gh.common.util.throwExceptionInDebug
import com.gh.common.util.toColor
import com.gh.common.util.*
import com.gh.download.DownloadManager
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DownloadDialogInstalledItemBinding
@ -16,15 +13,28 @@ import com.lightgame.download.DownloadStatus
class DownloadDialogInstalledItemViewHolder(val binding: DownloadDialogInstalledItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
fun bindInstalledItem(apkEntity: ApkEntity, viewModel: DownloadViewModel, traceEvent: ExposureEvent?, entrance: String, path: String, location: String) {
fun bindInstalledItem(
apkEntity: ApkEntity,
viewModel: DownloadViewModel,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String
) {
val gameEntity = viewModel.gameEntity
val apkCollection = apkEntity.apkCollection
binding.pluginDesc = gameEntity.pluginDesc
binding.apk = if (apkCollection != null) {
val pluginDesc = gameEntity.pluginDesc
val apk = if (apkCollection != null) {
ApkEntity(platformIcon = apkCollection.newIcon, platformName = apkCollection.name, remark = apkCollection.remark)
} else apkEntity
ImageUtils.display(binding.icon, apk.getPlatformIcon())
binding.name.text = apk.getPlatformName()
binding.remark.text = apk.remark
binding.root.setBackgroundResource(R.drawable.download_dialog_item_background)
binding.launch.text = "启动${pluginDesc}"
binding.pluggable.text = "${pluginDesc}此版本"
binding.update.text = "更新${pluginDesc}"
if (apkEntity.apkLink != null) {
throwExceptionInDebug("apkLink 不应该出现在这里")
@ -132,6 +142,5 @@ class DownloadDialogInstalledItemViewHolder(val binding: DownloadDialogInstalled
}
DownloadDialogItemViewHolder.setDownloadClickListener(itemView, apkEntity, viewModel, traceEvent, entrance, path, location)
binding.executePendingBindings()
}
}

View File

@ -32,32 +32,45 @@ import com.lightgame.utils.Utils
class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : BaseRecyclerViewHolder<Any>(binding.root) {
fun bindItem(listData: List<DownloadDialogItemData>,
position: Int,
viewModel: DownloadViewModel,
isCollectionPage: Boolean,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String) {
fun bindItem(
listData: List<DownloadDialogItemData>,
position: Int,
viewModel: DownloadViewModel,
isCollectionPage: Boolean,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String
) {
val apkEntity = listData[position].normal!!
val gameEntity = viewModel.gameEntity
val apkLink = apkEntity.apkLink
val apkCollection = apkEntity.apkCollection
binding.apk = when {
val apk = when {
apkLink != null -> ApkEntity(
platformIcon = apkLink.icon,
platformName = apkLink.name,
remark = apkLink.remark)
platformIcon = apkLink.icon,
platformName = apkLink.name,
remark = apkLink.remark
)
apkCollection != null -> ApkEntity(
platformIcon = apkCollection.newIcon,
platformName = apkCollection.name,
recommend = apkCollection.recommend,
remark = apkCollection.remark)
platformIcon = apkCollection.newIcon,
platformName = apkCollection.name,
recommend = apkCollection.recommend,
remark = apkCollection.remark
)
else -> apkEntity
}
ImageUtils.display(binding.icon, apk.getPlatformIcon())
binding.name.text = apk.getPlatformName()
binding.remark.text = apk.remark
binding.recommendDesTv.goneIf(apk.recommend == null)
binding.recommendDesTv.text = apk.recommend?.description
binding.recommendLabel.goneIf(apk.recommend == null)
binding.recommendLabelTv.text = apk.recommend?.subscript
binding.containerView.setBackgroundResource(R.drawable.download_dialog_item_background)
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null)
changeRecommendUI(apkEntity, listData, position)
@ -70,7 +83,12 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
binding.remark.goneIf(apkLink.remark.isEmpty())
binding.status.text = "点击查看"
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_link), null)
binding.status.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_link),
null
)
binding.containerView.setBackgroundResource(R.drawable.download_dialog_installed_background)
itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.LINK)
} else if (apkCollection != null || (!isCollectionPage && apkEntity.downloadInstruction.isNotEmpty())) {
@ -119,11 +137,17 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
binding.status.visibility = View.VISIBLE
binding.status.text = "可更新"
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_update), null)
binding.status.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_update),
null
)
binding.downloadStatusIcon.visibility = View.GONE
itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.UPDATE)
} else if (PackageUtils.getGhId(apkEntity.packageName) == gameEntity.id ||
PackagesManager.isInstalled(apkEntity.packageName) && Config.getSettings()?.gameDownloadBlackList?.contains(apkEntity.packageName) == true) {
PackagesManager.isInstalled(apkEntity.packageName) && Config.getSettings()?.gameDownloadBlackList?.contains(apkEntity.packageName) == true
) {
binding.downloadStatusIcon.visibility = View.GONE
binding.status.visibility = View.VISIBLE
binding.containerView.setBackgroundResource(R.drawable.download_dialog_installed_background)
@ -143,7 +167,12 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
// 点击启动
binding.status.text = "点击启动"
itemView.setTag(DownloadDialogAdapter.ITEM_TAG_KEY, DownloadDialogItemStatus.LAUNCH)
binding.status.setCompoundDrawablesWithIntrinsicBounds(null, null, ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_launch), null)
binding.status.setCompoundDrawablesWithIntrinsicBounds(
null,
null,
ContextCompat.getDrawable(binding.status.context, R.drawable.download_dialog_collection_status_launch),
null
)
}
} else {
binding.downloadStatusIcon.visibility = View.VISIBLE
@ -160,7 +189,6 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
setDownloadClickListener(itemView, apkEntity, viewModel, traceEvent, entrance, path, location)
binding.executePendingBindings()
}
private fun changeRecommendUI(apkEntity: ApkEntity, listData: List<DownloadDialogItemData>, position: Int) {
@ -171,7 +199,8 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
(binding.root.layoutParams as RecyclerView.LayoutParams).apply {
bottomMargin = if (apkEntity.recommend != null) {
if ((position + 1 < listData.size && listData[position + 1].normal?.recommend == null) ||
(position + 2 < listData.size && listData[position + 2].normal?.recommend == null)) {
(position + 2 < listData.size && listData[position + 2].normal?.recommend == null)
) {
20f.dip2px()
} else 16f.dip2px()
} else 8f.dip2px()
@ -192,13 +221,15 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
}
fun setDownloadClickListener(itemView: View,
apkEntity: ApkEntity,
viewModel: DownloadViewModel,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String) {
fun setDownloadClickListener(
itemView: View,
apkEntity: ApkEntity,
viewModel: DownloadViewModel,
traceEvent: ExposureEvent?,
entrance: String,
path: String,
location: String
) {
val gameEntity = viewModel.gameEntity
itemView.setOnClickListener {
@ -215,10 +246,13 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
DownloadDialogItemStatus.DOWNLOADING -> {
// 打开下载管理界面
it.context.startActivity(DownloadManagerActivity.getDownloadMangerIntent(
it.context.startActivity(
DownloadManagerActivity.getDownloadMangerIntent(
it.context,
apkEntity.url,
BaseActivity.mergeEntranceAndPath(entrance, path)))
BaseActivity.mergeEntranceAndPath(entrance, path)
)
)
if (AppManager.getInstance().currentActivity() is DownloadManagerActivity) {
viewModel.dismissLiveData.postValue(Any())
}
@ -237,7 +271,7 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
DownloadDialogItemStatus.INSTALL -> {
val downloadEntity = DownloadManager.getInstance().getDownloadEntityByUrl(apkEntity.url)
?: return@setOnClickListener
?: return@setOnClickListener
if (FileUtils.isEmptyFile(downloadEntity.path)) {
Utils.toast(it.context, R.string.install_failure_hint)
@ -300,13 +334,15 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
}
}
private fun createDownloadTask(context: Context,
apkEntity: ApkEntity,
gameEntity: GameEntity,
downloadMethod: String,
traceEvent: ExposureEvent?,
entrance: String,
location: String) {
private fun createDownloadTask(
context: Context,
apkEntity: ApkEntity,
gameEntity: GameEntity,
downloadMethod: String,
traceEvent: ExposureEvent?,
entrance: String,
location: String
) {
// todo 有时间存储判断统一处理
val msg = FileUtils.isCanDownload(context, apkEntity.size)
if (msg.isNullOrEmpty()) {
@ -318,13 +354,14 @@ class DownloadDialogItemViewHolder(val binding: DownloadDialogItemBinding) : Bas
CertificationDialog.showCertificationDialog(context, gameEntity, DialogUtils.ConfirmListener {
DialogUtils.checkDownload(context, apkEntity.size) { isSubscribe ->
DownloadManager.createDownload(
context,
apkEntity,
gameEntity,
downloadMethod,
entrance,
location,
isSubscribe, traceEvent)
context,
apkEntity,
gameEntity,
downloadMethod,
entrance,
location,
isSubscribe, traceEvent
)
DeviceRemindDialog.showDeviceRemindDialog(context, gameEntity)
}

View File

@ -5,12 +5,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.FragmentActivity
import com.gh.base.fragment.BaseDialogFragment
import com.gh.common.util.dip2px
import com.gh.gamecenter.BuildConfig
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.DialogDownloadLinkBinding
import com.gh.gamecenter.entity.GameEntity
import com.halo.assistant.HaloApp
@ -25,11 +23,14 @@ class DownloadLinkDialog : BaseDialogFragment() {
super.onCreate(savedInstanceState)
mLinkEntity = requireArguments().getParcelable(KEY_LINK_ENTITY)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding: DialogDownloadLinkBinding = DataBindingUtil.inflate(inflater, R.layout.dialog_download_link, container, false)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
val binding: DialogDownloadLinkBinding = DialogDownloadLinkBinding.inflate(layoutInflater, container, false)
binding.title.text = mLinkEntity?.title
binding.webView.loadDataWithBaseURL(null,
mLinkEntity?.content ?: "", "text/html", "utf-8", null)
binding.webView.loadDataWithBaseURL(
null,
mLinkEntity?.content ?: "", "text/html", "utf-8", null
)
binding.confirm.setOnClickListener {
dismissAllowingStateLoss()

View File

@ -49,7 +49,6 @@ import com.gh.download.DownloadManager;
import com.gh.gamecenter.entity.AuthDialogEntity;
import com.gh.gamecenter.entity.DeviceDialogEntity;
import com.gh.gamecenter.entity.PrivacyPolicyEntity;
import com.gh.gamecenter.manager.FilterManager;
import com.gh.gamecenter.retrofit.BiResponse;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -450,15 +449,7 @@ public class SplashScreenActivity extends BaseActivity {
UsageStatsHelper.checkAndPostUsageStats();
GameSubstituteRepositoryHelper.updateGameSubstituteRepository();
// 第一次启动把package.txt文件内容加载进数据库
FilterManager filterManager = new FilterManager(getApplicationContext());
if (!mSharedPreferences.getBoolean("isLoadFilterV2d4", false)) {
filterManager.loadFilter();
}
// 获取过滤包
filterManager.getFilterFromServer(0);
// 更新过滤表获取自动刷新的cd获取版本对应表
// 获取自动刷新的cd获取版本对应表
String time = mSharedPreferences.getString("refresh_time", null);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.getDefault());
String today = format.format(new Date());

View File

@ -788,79 +788,7 @@ public class SuggestionActivity extends ToolBarActivity implements OnRequestCall
public void onClick(View view) {
switch (view.getId()) {
case R.id.suggest_post_btn:
String entrance = "我的光环-反馈-[提交]";
if (mSuggestType != SuggestType.copyright) {
String email = mSuggestEmailEt.getText().toString().trim();
if (TextUtils.isEmpty(mSuggestContentEt.getText().toString()) &&
mSuggestType != SuggestType.functionSuggest &&
mSuggestType != SuggestType.gameCollect) {
toast("请输入反馈内容");
return;
}
if (mSuggestType == SuggestType.crash
&& !mAppCrashTypeIv.isChecked()
&& !mGameCrashTypeIv.isChecked()) {
toast("请选择闪退类型");
return;
}
if (mSuggestGameLl.getVisibility() == View.VISIBLE &&
TextUtils.isEmpty(mSuggestGameName.getText().toString())) {
toast("请选择游戏");
return;
}
if (mSuggestTypeContainer.getVisibility() == View.VISIBLE) {
if (mFunctionType == 3 && TextUtils.isEmpty(mTypeOtherName.getText().toString().trim())) {
toast("请选择功能需求");
return;
}
if (mFunctionType == -1) {
toast("请选择功能需求");
return;
}
}
if (mPlatformContainer.getVisibility() == View.VISIBLE &&
TextUtils.isEmpty(mPlatformEt.getText().toString())) {
toast("请填写游戏平台");
return;
}
if (!TextUtils.isEmpty(mSuggestContent)) {
switch (mSuggestContent) {
case "问题投诉":
entrance = "问题详情-投诉-提交反馈";
break;
case "回答投诉":
entrance = "回答详情-投诉-提交反馈";
break;
case "文章投诉":
entrance = "社区文章详情-投诉-提交反馈";
break;
}
}
// 闪退反馈不需要反馈(由闪退提示框跳转)
if (mSuggestType == SuggestType.crash && !mHideHint.isEmpty()) {
readPostSuggestion(email);
} else {
CheckLoginUtils.checkLogin(this, entrance, () -> {
readPostSuggestion(email);
});
}
} else {
CheckLoginUtils.checkLogin(this, entrance, () -> {
if (checkCopyrightData()) {
postDialog = WaitingDialogFragment.newInstance(getString(R.string.dialog_feedback_doing));
postDialog.show(getSupportFragmentManager(), null);
postCopyrightPic(true);
}
});
}
clickPostBtn();
break;
case R.id.suggest_game_container:
showSelectDialog();
@ -915,34 +843,136 @@ public class SuggestionActivity extends ToolBarActivity implements OnRequestCall
}
}
private void clickPostBtn() {
if (mSuggestType != SuggestType.copyright) {
postNormalSuggestion();
} else {
postCopyrightSuggestion();
}
}
private void postNormalSuggestion() {
boolean isStatusNotPass = !isEnterContent()
|| !isSelectCrashType()
|| !isSelectGame()
|| !isSelectFunctionType()
|| !isEnterPlatform();
if (isStatusNotPass) return;
String email = mSuggestEmailEt.getText().toString().trim();
// 闪退反馈不需要反馈(由闪退提示框跳转)
if (mSuggestType == SuggestType.crash && !mHideHint.isEmpty()) {
readPostSuggestion(email);
} else {
CheckLoginUtils.checkLogin(this, getPostEntrance(), () -> {
readPostSuggestion(email);
});
}
}
private void postCopyrightSuggestion() {
CheckLoginUtils.checkLogin(this, "我的光环-反馈-[提交]", () -> {
if (checkCopyrightData()) {
postDialog = WaitingDialogFragment.newInstance(getString(R.string.dialog_feedback_doing));
postDialog.show(getSupportFragmentManager(), null);
postCopyrightPic(true);
}
});
}
private boolean isEnterContent() {
if (TextUtils.isEmpty(mSuggestContentEt.getText().toString()) &&
mSuggestType != SuggestType.functionSuggest &&
mSuggestType != SuggestType.gameCollect) {
toast("请输入反馈内容");
return false;
}
return true;
}
private boolean isSelectCrashType() {
if (mSuggestType == SuggestType.crash
&& !mAppCrashTypeIv.isChecked()
&& !mGameCrashTypeIv.isChecked()) {
toast("请选择闪退类型");
return false;
}
return true;
}
private boolean isSelectGame() {
if (mSuggestGameLl.getVisibility() == View.VISIBLE &&
TextUtils.isEmpty(mSuggestGameName.getText().toString())) {
toast("请选择游戏");
return false;
}
return true;
}
private boolean isSelectFunctionType() {
if ((mSuggestTypeContainer.getVisibility() == View.VISIBLE) &&
(mFunctionType == -1 || (mFunctionType == 3 && TextUtils.isEmpty(mTypeOtherName.getText().toString().trim())))) {
toast("请选择功能需求");
return false;
}
return true;
}
private boolean isEnterPlatform() {
if (mPlatformContainer.getVisibility() == View.VISIBLE &&
TextUtils.isEmpty(mPlatformEt.getText().toString())) {
toast("请填写游戏平台");
return false;
}
return true;
}
private String getPostEntrance() {
String entrance = "我的光环-反馈-[提交]";
if (!TextUtils.isEmpty(mSuggestContent)) {
switch (mSuggestContent) {
case "问题投诉":
entrance = "问题详情-投诉-提交反馈";
break;
case "回答投诉":
entrance = "回答详情-投诉-提交反馈";
break;
case "文章投诉":
entrance = "社区文章详情-投诉-提交反馈";
break;
}
}
return entrance;
}
private boolean checkCopyrightData() {
if (TextUtils.isEmpty(mSuggestIdentity)) {
ToastUtils.INSTANCE.showToast("请先选择版权方身份");
ToastUtils.showToast("请先选择版权方身份");
return false;
} else {
if (TextUtils.isEmpty(mCredentialsCodeEt.getText().toString())) {
ToastUtils.INSTANCE.showToast(mSuggestIdentity.equals("person") ? "请填写身份证号或护照号等" : "请填写公司营业执照或组织代码等");
ToastUtils.showToast(mSuggestIdentity.equals("person") ? "请填写身份证号或护照号等" : "请填写公司营业执照或组织代码等");
return false;
}
}
if (mCredentialsAdapter.getFileList().size() == 0) {
ToastUtils.INSTANCE.showToast("请先添加版权证明文件");
ToastUtils.showToast("请先添加版权证明文件");
return false;
}
if (TextUtils.isEmpty(mAppNameEt.getText().toString())) {
ToastUtils.INSTANCE.showToast("请先填写侵权的应用名字");
ToastUtils.showToast("请先填写侵权的应用名字");
return false;
}
if (mScreenshotAdapter.getFileList().size() == 0) {
ToastUtils.INSTANCE.showToast("请先添加侵权应用截图");
ToastUtils.showToast("请先添加侵权应用截图");
return false;
}
if (TextUtils.isEmpty(mExplanationEt.getText().toString())) {
ToastUtils.INSTANCE.showToast("请先填写说明");
ToastUtils.showToast("请先填写说明");
return false;
}
if (TextUtils.isEmpty(mContactMethodEt.getText().toString())) {
ToastUtils.INSTANCE.showToast("请先填写联系方式");
ToastUtils.showToast("请先填写联系方式");
return false;
}
return true;

View File

@ -271,7 +271,7 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(true);
NewLogUtils.logShareResult(ShareUtils.additionalParams, true);
} else if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.gameCollection) {
NewLogUtils.logViewOrClickGameCollectionDetail(
"click_game_collect_detail_favorite_success",
@ -298,7 +298,7 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(false);
NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
}
} else {
IntegralLogHelper.INSTANCE.logInviteResult("失败", "微博");
@ -318,7 +318,7 @@ public class WeiBoShareActivity extends Activity implements WbShareCallback {
if (ShareUtils.shareEntrance == ShareUtils.ShareEntrance.askNormal ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.communityArticle ||
ShareUtils.shareEntrance == ShareUtils.ShareEntrance.video) {
NewLogUtils.logShareResult(false);
NewLogUtils.logShareResult(ShareUtils.additionalParams, false);
}
} else {
IntegralLogHelper.INSTANCE.logInviteResult("取消", "微博");

View File

@ -23,7 +23,7 @@ class GameHeadViewHolder(var binding: GameHeadItemBinding) :
return
}
binding.subject = subject
binding.headTitle.text=subject.getFilterName()
binding.headPb.visibility = View.GONE
val text = if ("change" == subject.home) {
"换一批"

View File

@ -2,8 +2,10 @@ package com.gh.gamecenter.adapter.viewholder
import com.facebook.drawee.generic.RoundingParams
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.databind.BindingAdapters
import com.gh.common.util.DisplayUtils
import com.gh.common.util.ImageUtils
import com.gh.common.util.goneIf
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.GameImageItemBinding
import com.gh.gamecenter.entity.GameEntity
@ -12,7 +14,13 @@ class GameImageViewHolder(var binding: GameImageItemBinding) : BaseRecyclerViewH
// 注意:专题详情的大图不能用此方法
fun bindImage(entity: GameEntity, applyRoundCorner: Boolean = false) {
binding.game = entity
binding.run {
gameContainer.goneIf(!(entity.type == "game" && entity.getApk().isNotEmpty()))
gameIcon.displayGameIcon(entity)
gameName.text = entity.name
gameSize.text = if (entity.getApk().isNotEmpty()) entity.getApk()[0].size.toString() else ""
BindingAdapters.setDownloadButton(progressBar, entity, null, null, null, "")
}
val context = binding.root.context
val width = context.resources.displayMetrics.widthPixels - DisplayUtils.dip2px(context, 16F)

View File

@ -4,7 +4,7 @@ import com.gh.gamecenter.databinding.GameTestItemBinding;
public class GameTestViewHolder extends GameViewHolder {
public GameTestItemBinding binding;
private GameTestItemBinding binding;
public GameTestViewHolder(GameTestItemBinding binding) {
super(binding.getRoot());
@ -22,4 +22,8 @@ public class GameTestViewHolder extends GameViewHolder {
gameServerType = binding.home2GameServerType;
}
public GameTestItemBinding getBinding() {
return binding;
}
}

View File

@ -7,7 +7,6 @@ class SearchGameFooterViewHolder(val binding: SearchGameFooterBinding) : BaseRec
class PersonalHomeRatingViewHolder(val binding: PersonalHomeRatingBinding) : BaseRecyclerViewHolder<Any>(binding.root)
class GameColumnCollectionItemViewHolder(val binding: GameColumnCollectionItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
class PrivacyPolicyItemViewHolder(val binding: PrivacyItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
class UserHomeAmwayItemViewHolder(val binding: UserHomeAmwayItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
class CommonCollectionItemViewHolder(val binding: CommonCollectionItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
class CommonCollectionDetailOneItemViewHolder(val binding: CommonCollectionDetailOneItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
class CommonCollectionDetailTwoItemViewHolder(val binding: CommonCollectionDetailTwoItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)

View File

@ -5,7 +5,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.airbnb.lottie.LottieAnimationView
import com.gh.common.constant.ItemViewType
@ -28,22 +27,29 @@ import com.gh.gamecenter.home.LegacyHomeFragmentAdapterAssistant
import com.halo.assistant.fragment.game.GamePluginAdapter
import com.lightgame.download.DownloadEntity
import com.lightgame.view.CheckableImageView
import java.util.*
import java.util.regex.Pattern
class AmwayAdapter(context: Context,
private var mViewModel: AmwayViewModel,
private var mBasicExposureSource: List<ExposureSource>,
private var mLayoutManager: RecyclerView.LayoutManager)
: ListAdapter<AmwayListItemData>(context), IExposable {
class AmwayAdapter(
context: Context,
private var mViewModel: AmwayViewModel,
private var mBasicExposureSource: List<ExposureSource>,
private var mLayoutManager: RecyclerView.LayoutManager
) : ListAdapter<AmwayListItemData>(context), IExposable {
private val mLegacyHomeFragmentAdapterAssistant by lazy {
LegacyHomeFragmentAdapterAssistant(mContext, this, mLayoutInflater, mBasicExposureSource, true, LegacyHomeFragmentAdapterAssistant.OuterType.AMWAY)
LegacyHomeFragmentAdapterAssistant(
mContext,
this,
mLayoutInflater,
mBasicExposureSource,
true,
LegacyHomeFragmentAdapterAssistant.OuterType.AMWAY
)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
ITEM_AMWAY_COMMENT -> AmwayCommentViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.amway_comment_item, parent, false))
ITEM_AMWAY_COMMENT -> AmwayCommentViewHolder(parent.toBinding())
ItemViewType.ITEM_FOOTER -> FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
@ -135,7 +141,8 @@ class AmwayAdapter(context: Context,
fun notifyChildItem(position: Int) {
if (getItemViewType(position) == ItemViewType.VERTICAL_SLIDE_ITEM
|| getItemViewType(position) == ItemViewType.GAME_PLUGIN) {
|| getItemViewType(position) == ItemViewType.GAME_PLUGIN
) {
val view = mLayoutManager.findViewByPosition(position)
val recyclerView = view?.findViewById<RecyclerView>(R.id.recycler_view)
recyclerView?.adapter?.notifyDataSetChanged()
@ -152,7 +159,8 @@ class AmwayAdapter(context: Context,
entryMap[download.platform] = download
}
if (getItemViewType(gameAndPosition.position) == ItemViewType.VERTICAL_SLIDE_ITEM ||
getItemViewType(gameAndPosition.position) == ItemViewType.GAME_PLUGIN) {
getItemViewType(gameAndPosition.position) == ItemViewType.GAME_PLUGIN
) {
val view = mLayoutManager.findViewByPosition(gameAndPosition.position)
val recyclerView = view?.findViewById<RecyclerView>(R.id.recycler_view)
when (val adapter = recyclerView?.adapter) {
@ -169,7 +177,12 @@ class AmwayAdapter(context: Context,
fun bindComment(viewModel: AmwayViewModel, itemData: AmwayListItemData, blockPosition: Int, basicExposureSource: List<ExposureSource>) {
val context = binding.root.context
val amway = itemData.amwayCommentItem!!
binding.amway = amway
binding.gameNameTv.text = amway.game.name
binding.ratingTv.text = amway.game.star.toString()
binding.userNameTv.text = amway.comment.user.name
binding.ratingBar.rating = amway.comment.star.toFloat()
binding.likeCountTv.text = if (amway.comment.vote > 0) NumberUtils.transSimpleCount(amway.comment.vote) else "0"
val user = itemData.amwayCommentItem?.comment?.user
binding.userIcon.display(user?.border, user?.icon, user?.auth?.icon)
val m = Pattern.compile(RatingEditActivity.LABEL_REGEX).matcher(amway.comment.content)
@ -187,8 +200,10 @@ class AmwayAdapter(context: Context,
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_游戏")
}
binding.gameIconView.displayGameIcon(amway.game.rawIcon
?: amway.game.icon, amway.game.iconSubscript)
binding.gameIconView.displayGameIcon(
amway.game.rawIcon
?: amway.game.icon, amway.game.iconSubscript
)
amway.game.tag?.let {
val tags = it.take(3)
@ -201,8 +216,10 @@ class AmwayAdapter(context: Context,
}
binding.commentContainer.setOnClickListener {
val intent = RatingReplyActivity.getIntent(context, amway.game.id, amway.comment, false, viewModel.entrance
?: "", EntranceUtils.ENTRANCE_AMWAY)
val intent = RatingReplyActivity.getIntent(
context, amway.game.id, amway.comment, false, viewModel.entrance
?: "", EntranceUtils.ENTRANCE_AMWAY
)
SyncDataBetweenPageHelper.startActivityForResult(binding.root.context, intent, RatingFragment.RATING_REPLAY_REQUEST, adapterPosition)
MtaHelper.onEvent("安利墙", "点击", "评论${blockPosition}_${amway.game.name}_评论")
}

View File

@ -2,9 +2,8 @@ package com.gh.gamecenter.amway.search
import android.content.Context
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.gh.gamecenter.R
import com.gh.common.util.toBinding
import com.gh.gamecenter.baselist.ListAdapter
import com.gh.gamecenter.entity.GameEntity
@ -15,7 +14,7 @@ class AmwaySearchAdapter(context: Context, val mViewModel: AmwaySearchViewModel)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return AmwaySearchViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.amway_search_item, parent, false), mViewModel)
return AmwaySearchViewHolder(parent.toBinding(), mViewModel)
}
override fun getItemCount(): Int {

View File

@ -6,9 +6,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import com.gh.common.util.DialogHelper
import com.gh.common.util.observeNonNull
import com.gh.common.util.viewModelProviderFromParent
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.FragmentAmwaySearchDefaultBinding
import com.gh.gamecenter.databinding.FragmentSearchDefaultBinding
import com.gh.gamecenter.eventbus.EBSearch
import com.gh.gamecenter.search.SearchDefaultFragment
import com.lightgame.utils.Util_System_Keyboard
@ -29,7 +27,8 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() {
mViewModel = viewModelProviderFromParent()
mViewModel.playedGames.observeNonNull(this) {
mBinding.isExistHotSearch = it.isNotEmpty()
defaultViewModel?.isExistHotSearch = it.isNotEmpty()
updateView()
mBinding.hotList.run {
layoutManager = LinearLayoutManager(context)
adapter = AmwaySearchAdapter(context, mViewModel).apply { setData(it) }
@ -45,8 +44,9 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() {
}
override fun initView() {
mBinding = FragmentSearchDefaultBinding.bind(mCachedView.findViewById(R.id.searchContent))
mBinding.isExistHistory = mHistoryList?.isNotEmpty()
mBinding = mAmwayBinding.searchContent
defaultViewModel?.isExistHistory = mHistoryList?.isNotEmpty() == true
updateView()
mBinding.hotTitle.text = "最近玩过"
mBinding.historyFlexContainer.setLimitHeight(mFlexMaxHeight)
createFlexContent(mBinding.historyFlex, mHistoryList, clickListener = {
@ -59,7 +59,8 @@ class AmwaySearchDefaultFragment : SearchDefaultFragment() {
mBinding.historyClear.setOnClickListener {
DialogHelper.showCenterWarningDialog(requireContext(), "清空记录", "确定清空历史搜索记录?", confirmClickCallback = {
mSearchDao.deleteAll()
mBinding.isExistHistory = false
defaultViewModel?.isExistHistory = false
updateView()
updateNoPlayedGameHint()
})
}

View File

@ -18,7 +18,8 @@ import java.lang.ref.WeakReference
class AmwaySearchViewHolder(var binding: AmwaySearchItemBinding, val mViewModel: AmwaySearchViewModel) : RecyclerView.ViewHolder(binding.root) {
fun bindView(gameEntity: GameEntity) {
binding.game = gameEntity
binding.iconIv.displayGameIcon(gameEntity)
binding.nameTv.text = gameEntity.name
binding.addIv.goneIf(!gameEntity.showComment)
binding.hintTv.goneIf(gameEntity.showComment)

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.util.goneIf
import com.gh.common.util.toBinding
import com.gh.common.util.toColor
import com.gh.gamecenter.R
@ -11,11 +12,12 @@ import com.gh.gamecenter.databinding.CatalogItemBinding
import com.gh.gamecenter.entity.CatalogEntity
import com.lightgame.adapter.BaseRecyclerAdapter
class CatalogAdapter(context: Context,
private val mFragment: CatalogFragment,
private val mViewModel: CatalogViewModel,
private val mList: List<CatalogEntity.SubCatalogEntity>)
: BaseRecyclerAdapter<CatalogAdapter.CatalogItemViewHolder>(context) {
class CatalogAdapter(
context: Context,
private val mFragment: CatalogFragment,
private val mViewModel: CatalogViewModel,
private val mList: List<CatalogEntity.SubCatalogEntity>
) : BaseRecyclerAdapter<CatalogAdapter.CatalogItemViewHolder>(context) {
override fun getItemCount() = mList.size
@ -25,8 +27,8 @@ class CatalogAdapter(context: Context,
override fun onBindViewHolder(holder: CatalogItemViewHolder, position: Int) {
holder.binding.run {
val catalogEntity = mList[position]
entity = catalogEntity
executePendingBindings()
catalogName.text = catalogEntity.name
recommendTag.goneIf(!catalogEntity.recommended)
if (catalogEntity.name == mViewModel.selectedCatalogName) {
selectedTag.visibility = View.VISIBLE
catalogName.setTextColor(R.color.theme_font.toColor())

View File

@ -82,9 +82,8 @@ class NewCatalogListAdapter(context: Context,
val gameEntity = mEntityList[position]
holder.binding.game = gameEntity
holder.bindGameItem(gameEntity)
holder.initServerType(gameEntity)
holder.binding.executePendingBindings()
val sortType = mViewModel.sortType.value
val sortSize = mViewModel.sortSize.text

View File

@ -16,10 +16,7 @@ import com.gh.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.DirectUtils
import com.gh.common.util.dip2px
import com.gh.common.util.doOnPageSelected
import com.gh.common.util.toBinding
import com.gh.common.util.*
import com.gh.gamecenter.R
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder
import com.gh.gamecenter.baselist.ListAdapter
@ -27,9 +24,10 @@ import com.gh.gamecenter.databinding.*
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.subject.SubjectActivity.Companion.startSubjectActivity
class SpecialCatalogAdapter(context: Context,
private val mCatalogViewModel: SpecialCatalogViewModel)
: ListAdapter<SpecialCatalogItemData>(context), IExposable {
class SpecialCatalogAdapter(
context: Context,
private val mCatalogViewModel: SpecialCatalogViewModel
) : ListAdapter<SpecialCatalogItemData>(context), IExposable {
private val mExposureEventSparseArray: SparseArray<ExposureEvent> = SparseArray()
var isAutoScroll = true
@ -133,14 +131,18 @@ class SpecialCatalogAdapter(context: Context,
height = imageWidth / 2
}
entity = imageEntity.image
ImageUtils.display(image, imageEntity.image.url)
title.text = imageEntity.image.title
var exposureEvent: ExposureEvent? = null
if (imageEntity.link.type == "game") {
exposureEvent = ExposureEvent.createEventWithSourceConcat(
GameEntity(id = imageEntity.link.link, name = imageEntity.link.text).apply { outerSequence = mEntityList[position].position },
mCatalogViewModel.basicExposureSource,
listOf(ExposureSource("精选页图片", "")))
GameEntity(id = imageEntity.link.link, name = imageEntity.link.text).apply {
outerSequence = mEntityList[position].position
},
mCatalogViewModel.basicExposureSource,
listOf(ExposureSource("精选页图片", ""))
)
mExposureEventSparseArray.append(position, exposureEvent)
}
root.setOnClickListener {
@ -154,16 +156,19 @@ class SpecialCatalogAdapter(context: Context,
val entity = mEntityList[position].header!!
val specialLink = entity.link
holder.binding.run {
link = specialLink
headTitle.text = specialLink.text
headMore.setOnClickListener {
if (entity.type == "专题合集") {
DirectUtils.directToColumnCollection(mContext, specialLink.link
?: "", -1, "(游戏-专题:" + specialLink.text + "-全部)")
DirectUtils.directToColumnCollection(
mContext, specialLink.link ?: "", -1, "(游戏-专题:" + specialLink.text + "-全部)"
)
} else {
startSubjectActivity(mContext, specialLink.link, specialLink.text, false, "(游戏-专题:" + specialLink.text + "-全部)")
}
mCatalogViewModel.logSpecialCatalogContentClick(entity.type, specialLink.text
?: "", mEntityList[position].position)
mCatalogViewModel.logSpecialCatalogContentClick(
entity.type, specialLink.text
?: "", mEntityList[position].position
)
}
}
}
@ -177,9 +182,11 @@ class SpecialCatalogAdapter(context: Context,
game.subjectName = subject.link.text
game.outerSequence = mEntityList[position].position
val exposureEvent = ExposureEvent.createEventWithSourceConcat(game,
mCatalogViewModel.basicExposureSource,
listOf(ExposureSource("精选页专题", subject.link.text ?: "")))
val exposureEvent = ExposureEvent.createEventWithSourceConcat(
game,
mCatalogViewModel.basicExposureSource,
listOf(ExposureSource("精选页专题", subject.link.text ?: ""))
)
exposureList.add(exposureEvent)
game.exposureEvent = exposureEvent
@ -231,7 +238,8 @@ class SpecialCatalogAdapter(context: Context,
val banners = itemData.banner!!.data
val pagerAdapter = binding.viewPager.adapter
if (banners.isNotEmpty()
&& (pagerAdapter == null || pagerAdapter is BannerAdapter && pagerAdapter.getDataSize() != banners.size)) {
&& (pagerAdapter == null || pagerAdapter is BannerAdapter && pagerAdapter.getDataSize() != banners.size)
) {
binding.root.layoutParams = binding.root.layoutParams.apply {
val rootWidth = mContext.resources.displayMetrics.widthPixels - (80F + 16F + 16F).dip2px()
height = rootWidth / 2
@ -246,9 +254,10 @@ class SpecialCatalogAdapter(context: Context,
val view = View.inflate(mContext, R.layout.banner_indicator_item, null)
view.findViewById<ImageView>(R.id.selectedIv).visibility = if (i == 0) View.VISIBLE else View.GONE
view.findViewById<ImageView>(R.id.unSelectIv).visibility = if (i == 0) View.GONE else View.VISIBLE
view.layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply {
if (i != 0) leftMargin = 4F.dip2px() else 0F.dip2px()
}
view.layoutParams =
LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT).apply {
if (i != 0) leftMargin = 4F.dip2px() else 0F.dip2px()
}
addView(view)
i++
}
@ -267,9 +276,9 @@ class SpecialCatalogAdapter(context: Context,
val childCount = binding.indicatorContainer.childCount
while (j < childCount) {
binding.indicatorContainer.getChildAt(j).findViewById<ImageView>(R.id.selectedIv).visibility =
if (j == it % childCount) View.VISIBLE else View.GONE
if (j == it % childCount) View.VISIBLE else View.GONE
binding.indicatorContainer.getChildAt(j).findViewById<ImageView>(R.id.unSelectIv).visibility =
if (j == it % childCount) View.GONE else View.VISIBLE
if (j == it % childCount) View.GONE else View.VISIBLE
j++
}
}

View File

@ -10,10 +10,11 @@ import com.gh.gamecenter.databinding.CatalogSubjectGameItemBinding
import com.gh.gamecenter.entity.GameEntity
import com.lightgame.adapter.BaseRecyclerAdapter
class SpecialCatalogSubjectAdapter(context: Context,
private val mCatalogViewModel: SpecialCatalogViewModel,
private var mList: List<GameEntity>)
: BaseRecyclerAdapter<SpecialCatalogSubjectAdapter.CatalogSubjectGameItemViewHolder>(context) {
class SpecialCatalogSubjectAdapter(
context: Context,
private val mCatalogViewModel: SpecialCatalogViewModel,
private var mList: List<GameEntity>
) : BaseRecyclerAdapter<SpecialCatalogSubjectAdapter.CatalogSubjectGameItemViewHolder>(context) {
private val mEntrance = "精选分类"
private var countAndKey: Pair<Int, String>? = null
@ -29,8 +30,7 @@ class SpecialCatalogSubjectAdapter(context: Context,
override fun getItemCount() = mList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int)
= CatalogSubjectGameItemViewHolder(parent.toBinding())
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = CatalogSubjectGameItemViewHolder(parent.toBinding())
override fun onBindViewHolder(holder: CatalogSubjectGameItemViewHolder, position: Int) {
holder.binding.run {
@ -39,8 +39,8 @@ class SpecialCatalogSubjectAdapter(context: Context,
}
val entity = mList[position]
game = entity
executePendingBindings()
gameIcon.displayGameIcon(entity)
gameName.text = entity.name
if (!gameName.isSelected) {
gameName.postDelayed({ gameName.isSelected = true }, 500)
@ -49,11 +49,12 @@ class SpecialCatalogSubjectAdapter(context: Context,
root.setOnClickListener {
GameDetailActivity.startGameDetailActivity(mContext, entity.id, "(${mEntrance})", entity.exposureEvent)
mCatalogViewModel.logSpecialCatalogSpecificContentClick(
"专题",
game?.subjectName ?: "",
game?.name ?: "",
mPosition,
position)
"专题",
entity.subjectName ?: "",
entity.name ?: "",
mPosition,
position
)
}
}
}

View File

@ -4,39 +4,45 @@ import android.content.Context
import android.view.ViewGroup
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.util.DialogHelper
import com.gh.common.util.ImageUtils
import com.gh.common.util.goneIf
import com.gh.common.util.toBinding
import com.gh.gamecenter.databinding.SubCatalogItemBinding
import com.gh.gamecenter.entity.CatalogEntity
import com.lightgame.adapter.BaseRecyclerAdapter
class SubCatalogAdapter(context: Context,
private val mCatalogViewModel: CatalogViewModel,
private val mPrimaryCatalog: CatalogEntity,
private var mList: List<CatalogEntity.SubCatalogEntity>)
: BaseRecyclerAdapter<SubCatalogAdapter.SubCatalogItemViewHolder>(context) {
class SubCatalogAdapter(
context: Context,
private val mCatalogViewModel: CatalogViewModel,
private val mPrimaryCatalog: CatalogEntity,
private var mList: List<CatalogEntity.SubCatalogEntity>
) : BaseRecyclerAdapter<SubCatalogAdapter.SubCatalogItemViewHolder>(context) {
private val mTypes = listOf("专题", "标签")
override fun getItemCount() = mList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
SubCatalogItemViewHolder(parent.toBinding())
SubCatalogItemViewHolder(parent.toBinding())
override fun onBindViewHolder(holder: SubCatalogItemViewHolder, position: Int) {
holder.binding.run {
val catalogEntity = mList[position]
entity = catalogEntity
executePendingBindings()
ImageUtils.display(catalogIcon, catalogEntity.icon)
catalogName.text = catalogEntity.name
recommendTag.goneIf(!catalogEntity.recommended)
root.setOnClickListener {
mCatalogViewModel.logSubCatalogContentClick(catalogEntity.name, position)
if (mTypes.contains(catalogEntity.type)) {
root.context.startActivity(NewCatalogListActivity.getIntent(
mContext,
mCatalogViewModel.catalogId,
mCatalogViewModel.catalogTitle,
catalogEntity.name,
mPrimaryCatalog,
catalogEntity.name)
root.context.startActivity(
NewCatalogListActivity.getIntent(
mContext,
mCatalogViewModel.catalogId,
mCatalogViewModel.catalogTitle,
catalogEntity.name,
mPrimaryCatalog,
catalogEntity.name
)
)
} else {
DialogHelper.showUpgradeDialog(mContext)

View File

@ -6,6 +6,8 @@ import android.view.ViewGroup
import android.widget.LinearLayout
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.util.DisplayUtils
import com.gh.common.util.ImageUtils
import com.gh.common.util.IntentUtils
import com.gh.common.util.toBinding
import com.gh.common.view.SubCategoryView
import com.gh.gamecenter.R
@ -34,8 +36,14 @@ class CategoryDirectoryAdapter(context: Context, var categoryTitle: String)
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is CategoryViewHolder -> {
holder.binding.category = mEntityList[position]
holder.binding.title = categoryTitle
val category = mEntityList[position]
holder.binding.run {
containerPrimaryCategory.setOnClickListener {
IntentUtils.startCategoryListActivity(root.context, categoryTitle, category)
}
ImageUtils.display(iconIv, category.icon)
categoryName.text = category.name
}
holder.bindCategory(
category = mEntityList[position],
expandableStatusMap = expandStatusMap,

View File

@ -81,9 +81,8 @@ class NewCategoryListAdapter(context: Context,
if (holder is GameItemViewHolder) {
val gameEntity = mEntityList[position]
holder.binding.game = gameEntity
holder.bindGameItem(gameEntity)
holder.initServerType(gameEntity)
holder.binding.executePendingBindings()
val padTop = if (position == 0) 16F.dip2px() else 8F.dip2px()
holder.itemView.setPadding(16F.dip2px(), padTop, 16F.dip2px(), 8F.dip2px())

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.util.goneIf
import com.gh.common.util.toBinding
import com.gh.common.util.toColor
import com.gh.gamecenter.R
@ -11,22 +12,23 @@ import com.gh.gamecenter.databinding.CategoryV2ItemBinding
import com.gh.gamecenter.entity.SidebarsEntity
import com.lightgame.adapter.BaseRecyclerAdapter
class CategoryV2Adapter(context: Context,
private val mFragment: CategoryV2Fragment,
private val mViewModel: CategoryV2ViewModel,
private val mList: List<SidebarsEntity.SidebarEntity>)
: BaseRecyclerAdapter<CategoryV2Adapter.CategoryV2ItemViewHolder>(context) {
class CategoryV2Adapter(
context: Context,
private val mFragment: CategoryV2Fragment,
private val mViewModel: CategoryV2ViewModel,
private val mList: List<SidebarsEntity.SidebarEntity>
) : BaseRecyclerAdapter<CategoryV2Adapter.CategoryV2ItemViewHolder>(context) {
override fun getItemCount() = mList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
CategoryV2ItemViewHolder(parent.toBinding())
CategoryV2ItemViewHolder(parent.toBinding())
override fun onBindViewHolder(holder: CategoryV2ItemViewHolder, position: Int) {
holder.binding.run {
val catalogEntity = mList[position]
entity = catalogEntity
executePendingBindings()
catalogName.text = catalogEntity.name
recommendTag.goneIf(!catalogEntity.recommended)
if (catalogEntity.name == mViewModel.selectedCategoryName) {
selectedTag.visibility = View.VISIBLE
catalogName.setTextColor(R.color.theme_font.toColor())

View File

@ -237,67 +237,105 @@ class CategoryV2Fragment : LazyFragment() {
}
private fun initView() {
if (mEntity?.sidebars?.isNullOrEmpty() == true || mViewModel == null) return
initSelectedCategory()
initCategoryRv()
initContentFragment()
}
private fun initSelectedCategory() {
mEntity?.run {
mViewModel?.run {
if (sidebars.isNotEmpty()) {
if (mLastSelectedPosition != -1) {
selectedCategoryPosition = mLastSelectedPosition
selectedCategoryName = sidebars[mLastSelectedPosition].name
} else {
selectedCategoryPosition = 0
selectedCategoryName = sidebars[0].name
}
mBinding?.categoryRv?.layoutManager = FixLinearLayoutManager(requireContext())
mBinding?.categoryRv?.adapter = CategoryV2Adapter(
requireContext(),
this@CategoryV2Fragment,
this,
sidebars
)
if (mLastSelectedPosition != -1) {
selectedCategoryPosition = mLastSelectedPosition
selectedCategoryName = sidebars[mLastSelectedPosition].name
} else {
selectedCategoryPosition = 0
selectedCategoryName = sidebars[0].name
}
}
}
}
if (hasSpecial && selectedCategoryPosition == 0) {
mSpecialCatalogFragment = childFragmentManager
.findFragmentByTag(SpecialCatalogFragment::class.java.simpleName)
as? SpecialCatalogFragment ?: SpecialCatalogFragment()
mSpecialCatalogFragment?.arguments = bundleOf(
EntranceUtils.KEY_IS_CATEGORY_V2 to true,
EntranceUtils.KEY_CATALOG_ID to id,
EntranceUtils.KEY_CATALOG_TITLE to mCategoryTitle,
EntranceUtils.KEY_EXPOSURE_SOURCE to arguments?.getParcelable(EntranceUtils.KEY_EXPOSURE_SOURCE)
)
childFragmentManager
.beginTransaction()
.replace(R.id.gamesContainer, mSpecialCatalogFragment!!, SpecialCatalogFragment::class.java.simpleName)
.commitAllowingStateLoss()
} else {
mCategoryV2ListFragment = childFragmentManager
.findFragmentByTag(CategoryV2ListFragment::class.java.simpleName)
as? CategoryV2ListFragment ?: CategoryV2ListFragment()
mCategoryV2ListFragment?.arguments = bundleOf(
EntranceUtils.KEY_CATEGORY_ID to id,
EntranceUtils.KEY_SUB_CATEGORY_ID to sidebars[selectedCategoryPosition].categoryId,
EntranceUtils.KEY_CATEGORY_TITLE to mCategoryTitle,
EntranceUtils.KEY_EXPOSURE_SOURCE to arguments?.getParcelable(EntranceUtils.KEY_EXPOSURE_SOURCE)
)
childFragmentManager
.beginTransaction()
.replace(R.id.gamesContainer, mCategoryV2ListFragment!!, CategoryV2ListFragment::class.java.simpleName)
.commitAllowingStateLoss()
private fun initCategoryRv() {
mEntity?.run {
mViewModel?.run {
mBinding?.categoryRv?.layoutManager = FixLinearLayoutManager(requireContext())
mBinding?.categoryRv?.adapter = CategoryV2Adapter(
requireContext(),
this@CategoryV2Fragment,
this,
sidebars
)
}
}
}
// 第一次点"全部"tab展开全部类别选择框
// 加延迟是为了防止卡顿
if (SPUtils.getBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, true)) {
SPUtils.setBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, false)
mBinding?.drawerLayout?.postDelayed({
tryCatchInRelease { openDrawer() }
}, 500L)
}
private fun initContentFragment() {
mEntity?.apply {
mViewModel?.apply {
if (hasSpecial && selectedCategoryPosition == 0) {
initSpecialCatalogFragment()
} else {
initCategoryV2ListFragment()
// 第一次点"全部"tab展开全部类别选择框
// 加延迟是为了防止卡顿
if (SPUtils.getBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, true)) {
SPUtils.setBoolean(Constants.SP_FIRST_ENTER_CATEGORY_V2, false)
mBinding?.drawerLayout?.postDelayed({
tryCatchInRelease { openDrawer() }
}, 500L)
}
}
}
}
}
private fun initSpecialCatalogFragment() {
mSpecialCatalogFragment = childFragmentManager
.findFragmentByTag(SpecialCatalogFragment::class.java.simpleName)
as? SpecialCatalogFragment ?: SpecialCatalogFragment()
mSpecialCatalogFragment?.arguments = bundleOf(
EntranceUtils.KEY_IS_CATEGORY_V2 to true,
EntranceUtils.KEY_CATALOG_ID to id,
EntranceUtils.KEY_CATALOG_TITLE to mCategoryTitle,
EntranceUtils.KEY_EXPOSURE_SOURCE to arguments?.getParcelable(EntranceUtils.KEY_EXPOSURE_SOURCE)
)
childFragmentManager
.beginTransaction()
.replace(
R.id.gamesContainer,
mSpecialCatalogFragment!!,
SpecialCatalogFragment::class.java.simpleName
)
.commitAllowingStateLoss()
}
private fun initCategoryV2ListFragment() {
mEntity?.run {
mViewModel?.run {
mCategoryV2ListFragment = childFragmentManager
.findFragmentByTag(CategoryV2ListFragment::class.java.simpleName)
as? CategoryV2ListFragment ?: CategoryV2ListFragment()
mCategoryV2ListFragment?.arguments = bundleOf(
EntranceUtils.KEY_CATEGORY_ID to id,
EntranceUtils.KEY_SUB_CATEGORY_ID to sidebars[selectedCategoryPosition].categoryId,
EntranceUtils.KEY_CATEGORY_TITLE to mCategoryTitle,
EntranceUtils.KEY_EXPOSURE_SOURCE to arguments?.getParcelable(EntranceUtils.KEY_EXPOSURE_SOURCE)
)
childFragmentManager
.beginTransaction()
.replace(
R.id.gamesContainer,
mCategoryV2ListFragment!!,
CategoryV2ListFragment::class.java.simpleName
)
.commitAllowingStateLoss()
}
}
}
fun changeCategory(position: Int) {
mEntity?.run {
mViewModel?.run {

View File

@ -7,6 +7,7 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.constant.ItemViewType
import com.gh.common.databind.BindingAdapters
import com.gh.common.exposure.ExposureEvent
import com.gh.common.exposure.ExposureSource
import com.gh.common.exposure.ExposureType
@ -22,7 +23,6 @@ import com.gh.gamecenter.databinding.CategoryGameItemBinding
import com.gh.gamecenter.entity.GameEntity
import com.gh.gamecenter.eventbus.EBDownloadStatus
import com.lightgame.download.DownloadEntity
import java.util.*
class CategoryV2ListAdapter(context: Context,
private val mViewModel: CategoryV2ListViewModel,
@ -83,9 +83,8 @@ class CategoryV2ListAdapter(context: Context,
holder.itemView.setPadding(16F.dip2px(), 8F.dip2px(), 16F.dip2px(), 8F.dip2px())
val gameEntity = mEntityList[position]
holder.binding.game = gameEntity
holder.bindGameItem(gameEntity)
holder.initServerType(gameEntity)
holder.binding.executePendingBindings()
val categoryTitle = mCategoryViewModel.categoryTitle
val selectedCategoryName = mCategoryViewModel.selectedCategoryName
@ -174,6 +173,22 @@ class CategoryV2ListAdapter(context: Context,
inner class CategoryGameItemViewHolder(val binding: CategoryGameItemBinding): BaseRecyclerViewHolder<Any>(binding.root) {
fun bindGameItem(gameEntity: GameEntity) {
binding.run {
gameIconView.displayGameIcon(gameEntity)
BindingAdapters.setGameName(gameName, gameEntity, false, null)
BindingAdapters.setTextSize(gameRating, if (gameEntity.commentCount > 3) 12 else 10)
BindingAdapters.setGameTags(labelList, gameEntity)
gameRating.setCompoundDrawables(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() else R.color.theme.toColor())
gameDes.text = gameEntity.decoratedDes
}
}
fun initServerType(gameEntity: GameEntity) {
val serverLabel = gameEntity.serverLabel
when {

View File

@ -5,28 +5,30 @@ import android.view.View
import android.view.ViewGroup
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.util.ToastUtils
import com.gh.common.util.goneIf
import com.gh.common.util.toColor
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.SubCategoryItemBinding
import com.gh.gamecenter.entity.CategoryEntity
import com.lightgame.adapter.BaseRecyclerAdapter
class SubCategoryAdapter(context: Context,
private val mViewModel: CategoryV2ViewModel,
private val mList: List<CategoryEntity>,
private val mPrimaryIndex: Int)
: BaseRecyclerAdapter<SubCategoryAdapter.SubCategoryItemViewHolder>(context) {
class SubCategoryAdapter(
context: Context,
private val mViewModel: CategoryV2ViewModel,
private val mList: List<CategoryEntity>,
private val mPrimaryIndex: Int
) : BaseRecyclerAdapter<SubCategoryAdapter.SubCategoryItemViewHolder>(context) {
override fun getItemCount() = mList.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
SubCategoryItemViewHolder(SubCategoryItemBinding.inflate(mLayoutInflater))
SubCategoryItemViewHolder(SubCategoryItemBinding.inflate(mLayoutInflater))
override fun onBindViewHolder(holder: SubCategoryItemViewHolder, position: Int) {
holder.binding.run {
val categoryEntity = mList[position]
entity = categoryEntity
executePendingBindings()
name.text = categoryEntity.name
recommendIv.goneIf(categoryEntity.recommend == false)
if (categoryEntity.selected) {
selectedIv.visibility = View.VISIBLE
@ -77,5 +79,5 @@ class SubCategoryAdapter(context: Context,
}
}
class SubCategoryItemViewHolder(val binding: SubCategoryItemBinding): BaseRecyclerViewHolder<Any>(binding.root)
class SubCategoryItemViewHolder(val binding: SubCategoryItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
}

View File

@ -12,7 +12,6 @@ import android.widget.LinearLayout
import android.widget.PopupWindow
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import com.gh.common.constant.ItemViewType
import com.gh.common.syncpage.ISyncAdapterHandler
@ -89,14 +88,7 @@ class GamesCollectionAdapter(
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
ItemViewType.ITEM_BODY -> GameCollectionItemViewHolder(
DataBindingUtil.inflate(
mLayoutInflater,
R.layout.game_collection_item,
parent,
false
)
)
ItemViewType.ITEM_BODY -> GameCollectionItemViewHolder(parent.toBinding())
else -> FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
}
@ -107,8 +99,28 @@ class GamesCollectionAdapter(
is GameCollectionItemViewHolder -> {
val itemEntity = mEntityList[position]
holder.binding.run {
entity = itemEntity
executePendingBindings()
ImageUtils.display(poster, itemEntity.cover)
nameTv.text = itemEntity.title
tagIv.goneIf(itemEntity.stamp.isEmpty())
itemEntity.games?.let {
gameOne.goneIf(it.size == 0)
gameOne.displayGameIcon(it[0].toGameEntity())
gameTwo.goneIf(it.size < 2)
gameTwo.displayGameIcon(it[1].toGameEntity())
gameThree.goneIf(it.size < 3)
gameThree.displayGameIcon(it[2].toGameEntity())
}
moreNumTv.goneIf((itemEntity.count?.game ?: 0) < 4)
moreNumTv.text = "+ " + ((itemEntity.count?.game ?: 0) - 3)
tagContainer.goneIf(itemEntity.count?.game != 0)
timeTv.text = TimeUtils.getFormatTime(itemEntity.time?.update ?: 0, "MM - dd")
ImageUtils.display(userIcon, itemEntity.user?.icon)
userName.text = itemEntity.user?.name
voteCount.text = if (itemEntity.count?.vote == 0) "赞同" else NumberUtils.transNewSimpleCount(itemEntity.count?.vote ?: 0, "#")
voteCount.setTextColor(if (itemEntity.me?.isVoted == true) R.color.theme_font.toColor() else R.color.white.toColor())
voteIcon.isChecked = itemEntity.me?.isVoted == true
commentCount.text =
if (itemEntity.count?.comment == 0) "评论" else NumberUtils.transNewSimpleCount(itemEntity.count?.comment ?: 0, "#")
moreIv.goneIf(
mViewModel.type != TYPE_USER

View File

@ -35,7 +35,7 @@ class GamesCollectionFragment : ListFragment<GamesCollectionEntity, GamesCollect
override fun addSyncPageObserver(): Boolean = true
override fun provideSyncAdapter(): GamesCollectionAdapter = provideListAdapter()
override fun provideSyncAdapter() = mAdapter
override fun onCreate(savedInstanceState: Bundle?) {
mUserId = arguments?.getString(KEY_USER_ID, "") ?: ""

View File

@ -80,7 +80,7 @@ class VideoAdapter(
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is VideoItemViewHolder) {
val entity = mEntityList[position]
holder.binding.video = entity
holder.bindVideoItem(entity)
holder.binding.selectIv.goneIf(mCurrentOption == ManageOption.OPTION_MANAGER)
holder.binding.selectIv.isChecked = selectItems.contains(entity.id)

View File

@ -183,7 +183,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
SpeedUtils.getSpeed(downloadEntity.getSpeed()),
SpeedUtils.getRemainTime(downloadEntity.getSize(), downloadEntity.getProgress(), downloadEntity.getSpeed() * 1024)));
viewHolder.binding.dmItemIvDelete.setVisibility(View.GONE);
viewHolder.binding.dmItemTvStartorpause.setBackgroundResource(R.drawable.game_item_btn_downloading_bg);
viewHolder.binding.dmItemTvStartorpause.setBackgroundResource(R.drawable.button_normal_round_border);
viewHolder.binding.dmItemTvStartorpause.setText("暂停");
viewHolder.binding.dmItemTvStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font));
viewHolder.binding.dmItemTvSpeed.setText(downloadEntity.getPercent() + "%");
@ -195,9 +195,9 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
viewHolder.binding.dmItemTvDownloads.setTextColor(0xFF9A9A9A);
viewHolder.binding.dmItemTvDownloads.setText("等待中");
viewHolder.binding.dmItemIvDelete.setVisibility(View.VISIBLE);
viewHolder.binding.dmItemTvStartorpause.setBackgroundResource(R.drawable.game_item_btn_downloading_bg);
viewHolder.binding.dmItemTvStartorpause.setBackgroundResource(R.drawable.button_round_border_eeeeee);
viewHolder.binding.dmItemTvStartorpause.setText("等待");
viewHolder.binding.dmItemTvStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font));
viewHolder.binding.dmItemTvStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.text_subtitleDesc));
viewHolder.binding.dmItemTvSpeed.setText(downloadEntity.getPercent() + "%");
} else if (status.equals(DownloadStatus.pause)
|| status.equals(DownloadStatus.timeout)
@ -286,7 +286,7 @@ class GameDownloadFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
downloadEntity.getProgress(), downloadEntity.getSpeed() * 1024)));
viewHolder.binding.dmItemIvDelete.setVisibility(View.GONE);
viewHolder.binding.dmItemTvStartorpause.setBackgroundResource(R.drawable.game_item_btn_downloading_bg);
viewHolder.binding.dmItemTvStartorpause.setBackgroundResource(R.drawable.button_normal_round_border);
viewHolder.binding.dmItemTvStartorpause.setText("暂停");
viewHolder.binding.dmItemTvStartorpause.setTextColor(ContextCompat.getColor(mContext, R.color.theme_font));
statusMap.put(url, DownloadStatus.downloading.getStatus());

View File

@ -48,11 +48,9 @@ class NewInstalledGameFragmentAdapter(context: Context, private var mViewModel:
private fun initGameNormal(holder: GameItemViewHolder, gameEntity: GameEntity) {
gameEntity.collection = ArrayList() // 清空集合,防止下载按钮会因为存在集合而清空合集包的状态判断
holder.bindGameItem(gameEntity, isShowPlatform = true)
holder.initServerType(gameEntity)
val binding = holder.binding
binding.game = gameEntity
binding.isShowPlatform = true
binding.executePendingBindings()
val name: String?
if (gameEntity.getApk().size > 0) {
name = String.format(

View File

@ -4,7 +4,6 @@ import android.content.Context
import android.graphics.Paint
import android.view.View
import android.view.ViewGroup
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.StaggeredGridLayoutManager
import com.gh.base.BaseRecyclerViewHolder
@ -19,9 +18,11 @@ import com.gh.gamecenter.entity.CommodityCategoryEntity
import com.gh.gamecenter.entity.CommodityEntity
import io.reactivex.disposables.Disposable
class CommodityAdapter(context: Context,
val entrance: String,
val category: CommodityCategoryEntity): ListAdapter<CommodityEntity>(context) {
class CommodityAdapter(
context: Context,
val entrance: String,
val category: CommodityCategoryEntity
) : ListAdapter<CommodityEntity>(context) {
private val mTimers = ArrayList<Disposable?>()
@ -39,7 +40,7 @@ class CommodityAdapter(context: Context,
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
ItemViewType.ITEM_BODY -> {
CommodityItemViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.commodity_item, parent, false))
CommodityItemViewHolder(parent.toBinding())
}
else -> {
FooterViewHolder(mLayoutInflater.inflate(R.layout.refresh_footerview, parent, false))
@ -66,8 +67,12 @@ class CommodityAdapter(context: Context,
}
val commodity = mEntityList[position]
entity = commodity
executePendingBindings()
ImageUtils.display(coverImageView, commodity.coverImage)
name.text=commodity.name
energy.text=commodity.energy.toString()
originEnergy.goneIf(!commodity.showOriginEnergy)
originEnergy.text="${commodity.originEnergy}光能"
exchangeCountTv.text="已兑${commodity.totalExchangeNum}"
if (commodity.tag != null && commodity.tag.id.isNotBlank()) {
tagTv.visibility = View.VISIBLE
@ -82,11 +87,11 @@ class CommodityAdapter(context: Context,
root.setOnClickListener {
IntegralLogHelper.run {
logCommodity(
"click_goods",
entrance,
commodity?.id ?: "",
category.id,
category.name
"click_goods",
entrance,
commodity?.id ?: "",
category.id,
category.name
)
log("view_goods_detail", "商品详情页")
@ -161,9 +166,9 @@ class CommodityAdapter(context: Context,
is FooterViewHolder -> {
holder.itemView.layoutParams = (holder.itemView.layoutParams as StaggeredGridLayoutManager.LayoutParams)
.apply {
isFullSpan = true
}
.apply {
isFullSpan = true
}
if (entrance == "光能中心") {
holder.itemView.setPadding(0, 0, 0, 40F.dip2px())
holder.itemView.layoutParams = holder.itemView.layoutParams.apply {

View File

@ -3,7 +3,6 @@ package com.gh.gamecenter.energy
import android.content.Context
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.gh.base.BaseRecyclerViewHolder
import com.gh.common.util.*
import com.gh.gamecenter.R
@ -13,16 +12,16 @@ import com.gh.gamecenter.gamedetail.dialog.InviteCodeDialog
import com.gh.gamecenter.manager.UserManager
import com.lightgame.adapter.BaseRecyclerAdapter
class HorizontalTaskAdapter(context: Context,
private val entrance: String,
var list: List<TaskEntity>)
: BaseRecyclerAdapter<HorizontalTaskAdapter.EnergyTaskViewHolder>(context) {
class HorizontalTaskAdapter(
context: Context,
private val entrance: String,
var list: List<TaskEntity>
) : BaseRecyclerAdapter<HorizontalTaskAdapter.EnergyTaskViewHolder>(context) {
override fun getItemCount() = list.size
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int)
= EnergyTaskViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.novice_task_item, parent, false))
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = EnergyTaskViewHolder(parent.toBinding())
override fun onBindViewHolder(holder: EnergyTaskViewHolder, position: Int) {
@ -32,8 +31,8 @@ class HorizontalTaskAdapter(context: Context,
}
val task = list[position]
entity = task
executePendingBindings()
ImageUtils.display(taskIcon, task.icon)
taskName.text = task.name
if (task.status == "finished") {
taskBtn.text = "已完成"
@ -50,11 +49,12 @@ class HorizontalTaskAdapter(context: Context,
root.setOnClickListener {
task.run {
IntegralLogHelper.logTask(
"click_mission",
entrance,
taskId,
name,
"新手任务")
"click_mission",
entrance,
taskId,
name,
"新手任务"
)
}
CheckLoginUtils.checkLogin(mContext, entrance) {

View File

@ -4,7 +4,6 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.gh.base.BaseRecyclerViewHolder
@ -33,13 +32,13 @@ class TaskAdapter(context: Context) : ListAdapter<TaskItemData>(context) {
override fun getItemViewType(position: Int): Int {
val item = mEntityList[position]
return when {
item.noviceTasks != null -> TYPE_NOVICE
item.noviceTasks != null -> TYPE_NOVICE
item.title != null -> TYPE_TITLE
item.title != null -> TYPE_TITLE
item.dailyTask != null -> TYPE_DAILY
item.dailyTask != null -> TYPE_DAILY
else -> TYPE_BOTTOM
else -> TYPE_BOTTOM
}
}
@ -106,13 +105,13 @@ class TaskAdapter(context: Context) : ListAdapter<TaskItemData>(context) {
FooterViewHolder(view)
}
TYPE_NOVICE -> NoviceTasksViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.novice_tasks_item, parent, false))
TYPE_NOVICE -> NoviceTasksViewHolder(parent.toBinding())
TYPE_TITLE -> TaskTitleViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.task_title_item, parent, false))
TYPE_TITLE -> TaskTitleViewHolder(parent.toBinding())
TYPE_BOTTOM -> TaskBottomViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.task_bottom_item, parent, false))
TYPE_BOTTOM -> TaskBottomViewHolder(parent.toBinding())
else -> DailyTaskViewHolder(DataBindingUtil.inflate(mLayoutInflater, R.layout.daily_task_item, parent, false))
else -> DailyTaskViewHolder(parent.toBinding())
}
}
@ -137,8 +136,10 @@ class TaskAdapter(context: Context) : ListAdapter<TaskItemData>(context) {
is DailyTaskViewHolder -> {
val task = mEntityList[position].dailyTask ?: return
holder.binding.run {
entity = task
executePendingBindings()
ImageUtils.display(taskIcon, task.icon)
taskName.text = task.name
progress.goneIf(task.isFixed)
progress.text = "${task.progress}/${task.quota}"
// if (task.isFixed) progress.text = ""
@ -157,11 +158,12 @@ class TaskAdapter(context: Context) : ListAdapter<TaskItemData>(context) {
root.setOnClickListener {
task.run {
IntegralLogHelper.logTask(
"click_mission",
"光能中心",
taskId,
name,
if (isFixed) "常驻任务" else "日常任务")
"click_mission",
"光能中心",
taskId,
name,
if (isFixed) "常驻任务" else "日常任务"
)
}
CheckLoginUtils.checkLogin(mContext, mEntrance) {
@ -192,21 +194,21 @@ class TaskAdapter(context: Context) : ListAdapter<TaskItemData>(context) {
}
is TaskBottomViewHolder -> {
holder.binding.run {
val isLastBottom = mEntityList[position].bottom!!
holder.itemView.layoutParams = (holder.itemView.layoutParams as ViewGroup.MarginLayoutParams).apply {
val marginBottom = if (isLastBottom) 40F.dip2px() else 0
setMargins(16F.dip2px(), 0, 16F.dip2px(), marginBottom)
}
holder.binding.run {
val isLastBottom = mEntityList[position].bottom!!
holder.itemView.layoutParams = (holder.itemView.layoutParams as ViewGroup.MarginLayoutParams).apply {
val marginBottom = if (isLastBottom) 40F.dip2px() else 0
setMargins(16F.dip2px(), 0, 16F.dip2px(), marginBottom)
}
}
}
}
}
inner class NoviceTasksViewHolder(val binding: NoviceTasksItemBinding): BaseRecyclerViewHolder<Any>(binding.root)
inner class TaskTitleViewHolder(val binding: TaskTitleItemBinding): BaseRecyclerViewHolder<Any>(binding.root)
inner class DailyTaskViewHolder(val binding: DailyTaskItemBinding): BaseRecyclerViewHolder<Any>(binding.root)
inner class TaskBottomViewHolder(val binding: TaskBottomItemBinding): BaseRecyclerViewHolder<Any>(binding.root)
inner class NoviceTasksViewHolder(val binding: NoviceTasksItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
inner class TaskTitleViewHolder(val binding: TaskTitleItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
inner class DailyTaskViewHolder(val binding: DailyTaskItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
inner class TaskBottomViewHolder(val binding: TaskBottomItemBinding) : BaseRecyclerViewHolder<Any>(binding.root)
companion object {
private const val TYPE_NOVICE = 900

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class ActivityLabelEntity(

View File

@ -2,8 +2,8 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.IgnoredOnParcel
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
@Parcelize
data class AmwayCommentEntity(

View File

@ -5,7 +5,7 @@ import android.text.TextUtils
import com.gh.common.util.PlatformUtils
import com.google.gson.annotations.SerializedName
import com.halo.assistant.HaloApp
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class ApkEntity(@SerializedName("package")

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class ApplyModeratorStatusEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class ArticleCommentParent(val user: User = User(),

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class AuthDialogEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class Auth(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class AvatarBorderCategoryEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class AvatarBorderEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class BackgroundImageEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class CatalogEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class CategoryEntity(

View File

@ -1,7 +1,7 @@
package com.gh.gamecenter.entity
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class ColorEntity(var color: String = "", var value: String = ""): Parcelable

View File

@ -4,7 +4,7 @@ import android.os.Parcelable
import com.gh.common.annotation.SyncPage
import com.gh.common.syncpage.SyncFieldConstants
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class CommentEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class CommentParentEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class CommodityCategoryEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class CommodityEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
data class CommonCollectionEntity(
@SerializedName("_id")

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class CommunityEntity(

View File

@ -3,7 +3,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Keep
@Parcelize

View File

@ -1,7 +1,7 @@
package com.gh.gamecenter.entity
import android.os.Parcelable
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class EnergyTaskCompleteEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class ForumUnreadEntity(

View File

@ -3,8 +3,8 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.gh.gamecenter.qa.entity.Count
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.IgnoredOnParcel
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
@Parcelize
open class ForumVideoEntity(

View File

@ -3,7 +3,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import androidx.annotation.DrawableRes
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
data class FunctionalGroupEntity(
@SerializedName("_id")

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class GameCollectionCoverEntity(

View File

@ -11,7 +11,7 @@ import com.gh.gamecenter.qa.entity.TimeEntity
import com.gh.gamecenter.room.converter.SimpleGameListConverter
import com.gh.gamecenter.room.converter.TagInfoListConverter
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Entity
@Parcelize

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
/**
* Created by khy on 2016/8/31.

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
@Parcelize
data class GameCollectionTagEntity(

View File

@ -3,8 +3,8 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.gh.common.constant.Config
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.IgnoredOnParcel
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
@Parcelize
class GameDetailEntity(

View File

@ -2,7 +2,7 @@ package com.gh.gamecenter.entity
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
/**
* Created by khy on 20/06/17.

View File

@ -13,10 +13,9 @@ import com.gh.gamecenter.gamedetail.entity.ZoneEntity
import com.google.gson.annotations.SerializedName
import com.halo.assistant.HaloApp
import com.lightgame.download.DownloadEntity
import kotlinx.android.parcel.IgnoredOnParcel
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.IgnoredOnParcel
import kotlinx.parcelize.Parcelize
import java.util.*
import kotlin.collections.ArrayList
@Parcelize
data class GameEntity(
@ -110,7 +109,7 @@ data class GameEntity(
var subjectData: GameSubjectData? = null,
// 所有标签(插件标签和游戏标签)
@SerializedName(value = "tag_style", alternate = arrayOf("new_tag_style"))
@SerializedName(value = "new_tag_style")
private var mTagStyle: ArrayList<TagStyleEntity> = ArrayList(),
var des: String? = null,
// 用来标记在专题中的序号,仅用于曝光记录

View File

@ -26,7 +26,7 @@ data class GameInstall(
gameInstall.name = game.name
gameInstall.icon = game.rawIcon ?: game.icon
gameInstall.iconSubScript = game.iconSubscript
gameInstall.version = PackageUtils.getVersionNameByPackageName(installedPkgName)
gameInstall.version = PackageUtils.getVersionNameByPackageName(installedPkgName) ?: "unknown"
gameInstall.packageName = installedPkgName
return gameInstall
}

View File

@ -2,7 +2,6 @@ package com.gh.gamecenter.entity
import com.gh.common.exposure.ExposureEvent
import com.google.gson.annotations.SerializedName
import java.util.*
data class GameUpdateEntity(
@SerializedName("game_id")
@ -58,7 +57,6 @@ data class GameUpdateEntity(
gameEntity.icon = icon
gameEntity.rawIcon = rawIcon
gameEntity.iconSubscript = iconSubscript
gameEntity.setTag(tag)
gameEntity.tagStyle = tagStyle
gameEntity.brief = brief
gameEntity.download = download

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