Merge branch 'dev' of gitlab.ghzs.com:halo/assistant-android into dev

This commit is contained in:
kehaoyuan
2020-05-28 19:55:34 +08:00
14 changed files with 59 additions and 33 deletions

View File

@ -30,6 +30,8 @@ public class Constants {
public static final String EB_QUIT_LOGIN = "quit_login";
public static final String GAME_ID_DIVIDER = ":"; // 用于避免历史下载掺和到普通下载状态的 ID 修饰符
public static final String GAME_NAME_DECORATOR = " "; // 用于避免历史下载影响到部分依赖名字作为数据更新条件的修饰符
// 最近显示的弹窗信息
public static final String SP_LAST_OPENING_ID = "last_opening_dialog_id";

View File

@ -4,6 +4,7 @@ import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.Entity
import androidx.room.PrimaryKey
import com.gh.common.constant.Constants
import com.gh.common.exposure.meta.Meta
import com.gh.common.exposure.meta.MetaUtil
import com.gh.common.exposure.time.TimeUtil
@ -28,7 +29,7 @@ data class ExposureEvent(
fun createEvent(gameEntity: GameEntity?, source: List<ExposureSource>, eTrace: List<ExposureEvent>? = null, event: ExposureType = ExposureType.EXPOSURE): ExposureEvent {
return ExposureEvent(
payload = ExposureEntity(gameId = gameEntity?.id,
gameName = gameEntity?.name,
gameName = gameEntity?.name?.removeSuffix(Constants.GAME_NAME_DECORATOR),
sequence = gameEntity?.sequence,
platform = gameEntity?.platform,
downloadType = gameEntity?.downloadType,

View File

@ -13,6 +13,8 @@ import com.lightgame.download.DownloadEntity;
import java.util.HashMap;
import java.util.Map;
import kotlin.text.StringsKt;
/**
* Created by LGT on 2016/12/9.
* 数据收集 工具类data.ghzs666.com
@ -32,7 +34,7 @@ public class DataCollectionUtils {
// 上传下载数据(开始、完成)
public static void uploadDownload(Context context, DownloadEntity downloadEntity, String status) {
Map<String, Object> map = new HashMap<>();
map.put("game", downloadEntity.getName());
map.put("game", StringsKt.removeSuffix(downloadEntity.getName(), Constants.GAME_NAME_DECORATOR));
map.put("game_id", downloadEntity.getRealGameId(Constants.GAME_ID_DIVIDER));
if (downloadEntity.isPluggable()) {
map.put("method", "插件化");

View File

@ -19,7 +19,10 @@ import com.gh.gamecenter.retrofit.RetrofitManager
import com.gh.gamecenter.suggest.SuggestType
import com.halo.assistant.HaloApp
import com.halo.assistant.fragment.SettingsFragment
import com.lightgame.download.*
import com.lightgame.download.DataWatcher
import com.lightgame.download.DownloadEntity
import com.lightgame.download.DownloadStatus
import com.lightgame.download.FileUtils
import com.lightgame.utils.AppManager
import com.lightgame.utils.Util_System_Phone_State
import com.lightgame.utils.Utils
@ -221,7 +224,7 @@ object DownloadObserver {
}
ExposureUtils.logADownloadCompleteExposureEvent(
GameEntity(id = downloadEntity.getRealGameId(Constants.GAME_ID_DIVIDER), mName = downloadEntity.name),
GameEntity(id = downloadEntity.getRealGameId(Constants.GAME_ID_DIVIDER), mName = downloadEntity.name.removeSuffix(Constants.GAME_NAME_DECORATOR)),
downloadEntity.platform,
downloadEntity.exposureTrace,
type)

View File

@ -468,7 +468,7 @@ fun Context.doOnMainProcessOnly(callback: EmptyCallback) {
doOnMainProcessOnly { callback.onCallback() }
}
fun Context.doOnMainProcessOnly(f: () -> Unit) {
inline fun Context.doOnMainProcessOnly(f: () -> Unit) {
val processName = PackageUtils.obtainProcessName(this)
if (processName == null || BuildConfig.APPLICATION_ID == processName) {
f.invoke()

View File

@ -33,7 +33,7 @@ class HistoryApkListViewModel(application: Application, var game: GameEntity)
// 改变 id 避免其它地方根据原有 game id 变更状态
this.isReservable = false
this.id = game.id + Constants.GAME_ID_DIVIDER + apk.version
this.name = game.name + " " // 历史版本加个空格避免其他用游戏名来判定是否待安装的地方错误判断
this.name = game.name + Constants.GAME_NAME_DECORATOR // 历史版本加个空格避免其他用游戏名来判定是否待安装的地方错误判断
this.setApk(arrayListOf(apk))
})
}

View File

@ -242,8 +242,8 @@ class RatingCommentItemViewHolder(val binding: RatingCommentItemBinding) : BaseR
private fun getSpan(context: Context, name: String, commentData: RatingComment): SpannableStringBuilder {
val spanned = SpanBuilder(name)
.color(context, 0, commentData.replyData?.user?.name!!.length, R.color.text_666666)
.size(0, commentData.replyData?.user?.name!!.length, 12)
.color(context, 0, commentData.replyData?.user?.name!!.length, R.color.text_333333)
.size(0, commentData.replyData?.user?.name!!.length, 13)
.build()
val contentSpan = TextHelper.getHighlightedSpannableStringThatIsWrappedInsideWrapper(context, spanned)

View File

@ -61,6 +61,7 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
@BindView(R.id.scrollView)
lateinit var mScrollView: ScrollView
@Nullable
@BindView(R.id.shadowView)
lateinit var mShadowView: View

View File

@ -25,7 +25,6 @@ import com.gh.common.TimeElapsedHelper;
import com.gh.common.constant.Constants;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.CollectionUtils;
import com.gh.common.util.DialogHelper;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.GsonUtils;
@ -141,7 +140,7 @@ public class WebFragment extends NormalFragment {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) closeBtn.getLayoutParams();
params.topMargin = params.topMargin + DisplayUtils.getStatusBarHeight(getResources());
closeBtn.setLayoutParams(params);
closeBtn.setOnClickListener(v -> onBackPressed());
closeBtn.setOnClickListener(v -> requireActivity().finish());
}
} else {
initMenu();
@ -419,7 +418,8 @@ public class WebFragment extends NormalFragment {
@Override
public boolean onBackPressed() {
if (mIsBackpressRequireConfirmation) {
DialogHelper.showDialog(
//v4.0.1统一去掉这个弹窗
/*DialogHelper.showDialog(
requireContext(),
"注意",
mBackConfirmationContent,
@ -427,8 +427,10 @@ public class WebFragment extends NormalFragment {
"暂不",
() -> requireActivity().finish(),
() -> {
}, true, "H5页面", "退出弹窗");
return true;
}, true, "H5页面", "退出弹窗");*/
return false;
} else if (!TextUtils.isEmpty(mGameName)) {
return false;
} else if (mWebView.canGoBack()) {
mWebView.goBack();
return true;