Compare commits

..

4 Commits

Author SHA1 Message Date
82a859e820 tinker-base-3.7.4-bugfix 2020-03-24 10:40:08 +08:00
c7db58f6ea 处理一些闪退异常 2020-03-23 15:18:27 +08:00
79ff887375 修复一些闪退问题 2020-03-23 13:35:46 +08:00
4f68f30576 修复玩过的游戏统计异常 2020-03-23 11:27:37 +08:00
11 changed files with 37 additions and 23 deletions

View File

@ -32,7 +32,7 @@ import okhttp3.MediaType
import okhttp3.RequestBody
import org.greenrobot.eventbus.EventBus
import org.json.JSONObject
import java.util.HashMap
import java.util.*
object DownloadObserver {
@ -174,7 +174,7 @@ object DownloadObserver {
val kv2 = HashMap<String, Any>()
kv2["版本"] = downloadEntity.platform
kv2["状态"] = "下载完成"
kv2["位置"] = downloadEntity.entrance
kv2["位置"] = downloadEntity.entrance ?: "null"
kv2["游戏分平台"] = downloadEntity.name + "-" + platform
kv2["光环助手版本"] = BuildConfig.VERSION_NAME
DataUtils.onEvent(mApplication, "游戏下载位置", downloadEntity.name, kv2)
@ -183,7 +183,7 @@ object DownloadObserver {
val kv3 = HashMap<String, Any>()
kv3["下载"] = "下载完成"
kv3["版本"] = downloadEntity.platform
kv3["位置"] = downloadEntity.entrance
kv3["位置"] = downloadEntity.entrance ?: "null"
type = ExposureUtils.DownloadType.PLUGIN_DOWNLOAD
DataUtils.onEvent(mApplication, "插件化", downloadEntity.name, kv3)

View File

@ -648,9 +648,10 @@ public class DownloadManager implements DownloadStatusListener {
private void startDownloadService() {
Intent serviceIntent = new Intent(mContext, DownloadService.class);
// 当满足系统版本大于 8.0 、应用在后台运行时以前台服务开启
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
&& !HaloApp.getInstance().isRunningForeground) {
// 当满足系统版本大于 8.0 就以前台服务开启 DownloadService
// (因为即便在 SplashActivity 里初始化,也有可能报 not allowed to start service, app is in background 的错误)
// DownloadService 会调用 stopForeground 方法,理论上会去掉 `光环助手正在运行中` 的通知
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
serviceIntent.putExtra(DownloadService.KEY_SERVICE_ACTION, DownloadService.START_FOREGROUND);
mContext.startForegroundService(serviceIntent);
} else {

View File

@ -53,6 +53,10 @@ public class AnswerFragment extends ListFragment<AnswerEntity, AnswerViewModel>
@Override
protected AnswerViewModel provideListViewModel() {
AnswerViewModel viewModel = ViewModelProviders.of(this).get(AnswerViewModel.class);
// TODO 因为 mType 是从外面传进来的,所以在应用回收重构时会为空,这里设置为 Type.Collection 只是为了不闪退,会影响逻辑(譬如当前类型为历史的时候)
if (mType == null) {
mType = Type.COLLECTION;
}
viewModel.setType(mType);
return viewModel;
}

View File

@ -92,7 +92,7 @@ class HomeSlideListViewHolder(val binding: HomeSlideListBinding) : BaseRecyclerV
// 缩放控制
fun updateZoomAnimation() {
val childCount = binding.recyclerView.childCount
val width = binding.recyclerView.getChildAt(0).width
val width = binding.recyclerView.getChildAt(0)?.width ?: return
val padding = (binding.recyclerView.width - width) / 2
for (j in 0 until childCount) {

View File

@ -189,7 +189,10 @@ class MyPlayedGameAdapter(context: Context, private val mViewModel: PlayedGameVi
playedGameRemoveView.findViewById<View>(R.id.remove_container).setOnClickListener {
popupWindow.dismiss()
mViewModel.deletePlayedGame(mEntityList[holder.adapterPosition])
val adapterPosition = holder.adapterPosition
if (adapterPosition != RecyclerView.NO_POSITION) {
mViewModel.deletePlayedGame(mEntityList[adapterPosition])
}
}
popupWindow.isTouchable = true

View File

@ -788,7 +788,9 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
public void setFontSize(int fontsize) {
mWebSettings.setTextZoom(defaultTextZoom + 15 * fontsize);
if (mWebSettings != null) {
mWebSettings.setTextZoom(defaultTextZoom + 15 * fontsize);
}
}
public class JsInterface {

View File

@ -1,11 +1,12 @@
package com.gh.gamecenter.qa.search;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import android.text.TextUtils;
import android.view.View;
import com.gh.base.fragment.BaseFragment_TabLayout;
import com.gh.common.util.EntranceUtils;
@ -88,7 +89,7 @@ public class AskSearchFragment extends BaseFragment_TabLayout {
void updateSearch(String key) {
for (Fragment fragment : mFragmentsList) {
if (fragment instanceof BaseAskSearchFragment) {
if (fragment instanceof BaseAskSearchFragment && isAdded()) {
((BaseAskSearchFragment) fragment).search(key);
Bundle arguments = fragment.getArguments();
// 处于 state saved 状态的 fragment 不可 setArguments

View File

@ -2070,7 +2070,7 @@ public interface ApiService {
/**
* 记录用户成功安装应用(用于玩过的游戏)
*/
@POST("users/{user_id}/played_games/")
@POST("users/{user_id}/played_games")
Single<ResponseBody> postPlayedGame(@Path("user_id") String userId, @Body RequestBody body);
/**

View File

@ -8,6 +8,13 @@ import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import com.gh.base.fragment.BaseFragment;
import com.gh.common.exposure.ExposureListener;
import com.gh.common.util.DownloadItemUtils;
@ -29,12 +36,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.OnClick;
@ -136,6 +137,8 @@ public class GameServersContentFragment extends BaseFragment {
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
int position = mLayoutManager.findFirstVisibleItemPosition();
if (RecyclerView.NO_POSITION == position) return;
List<GameEntity> dataList = mAdapter.getDataList();
GameEntity gameEntity = dataList.get(position + 1);
Long kaifuTimeHint = gameEntity.getKaifuTimeHint();
@ -271,7 +274,7 @@ public class GameServersContentFragment extends BaseFragment {
@Override
public void loadError() {
if (!isAdded()) return;
super.loadError();
toast(R.string.loading_failed_hint);
mKaiFuTimeLl.setVisibility(View.GONE);

View File

@ -54,8 +54,8 @@ DATA_HOST=https\://data.ghzs.com/
# 请不要手动改动下面的值除非你明确需要以某个apk作为基准包需要打包请以scripts/tinker*.sh为准
TINKER_ENABLE=
TINKER_ID=f1194d4
TINKER_BASE_APK_DIR=app-0318-18-35-30_f1194d4
TINKER_ID=c7db58f
TINKER_BASE_APK_DIR=app-0324-09-41-17_c7db58f
android.useAndroidX=true
android.enableJetifier=true