Compare commits
33 Commits
v3.7.2
...
v3.7.3-spl
| Author | SHA1 | Date | |
|---|---|---|---|
| 811e1bf875 | |||
| 5c929ba308 | |||
| 3c4cc4ff7f | |||
| 150d640977 | |||
| a3599af9d1 | |||
| 1ac1196b20 | |||
| 6c5e863a5b | |||
| 15376a5e13 | |||
| eaf5b24044 | |||
| f05c6540f1 | |||
| 25dd3ca4df | |||
| 6281b4f510 | |||
| 2cbc0b0e17 | |||
| f18a0ef72c | |||
| 98fb4fc412 | |||
| 73c995c31f | |||
| 60dcafe0c1 | |||
| c118d7e4ad | |||
| babc55739b | |||
| df8790c6ff | |||
| 30ccdcd750 | |||
| 79d23bb203 | |||
| b2c5e6551b | |||
| ec49d7f20a | |||
| 5a35d13d70 | |||
| dcfa4fdaaf | |||
| 43324ca44e | |||
| 8e778e8172 | |||
| 928a98831e | |||
| 3dc678bc27 | |||
| d2b19a128d | |||
| cc75cb497d | |||
| 4840c5c604 |
@ -133,9 +133,9 @@ public abstract class BaseActivity extends BaseAppCompatActivity implements Easy
|
||||
shareSummary,
|
||||
shareType);
|
||||
if (shareType == ShareUtils.ShareType.game || shareType == ShareUtils.ShareType.plugin) {
|
||||
MtaHelper.onEvent("内容分享", shareTitle + shareSummary);
|
||||
MtaHelper.onEvent("内容分享", "内容分享", shareTitle + shareSummary);
|
||||
} else {
|
||||
MtaHelper.onEvent("内容分享", shareTitle);
|
||||
MtaHelper.onEvent("内容分享", "内容分享", shareTitle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -56,6 +56,8 @@ object LoghubUtils {
|
||||
|
||||
private fun commitSavedLoghubEvents() {
|
||||
loghubEventExecutor.execute {
|
||||
if (loghubEventSet.isEmpty()) return@execute
|
||||
|
||||
val exposureList = loghubEventSet.toList()
|
||||
|
||||
createLogGroupAndUpload()
|
||||
|
||||
@ -238,18 +238,12 @@ public class DataUtils {
|
||||
}
|
||||
|
||||
public static void onError(Context context, Throwable throwable) {
|
||||
// MTA主动上传错误
|
||||
//bugly 作为默认处理异常的类库,已经上报了,此处不重复上报
|
||||
try {
|
||||
StatService.reportException(context, throwable);
|
||||
CrashReport.postCatchedException(throwable);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
||||
// //bugly 作为默认处理异常的类库,已经上报了,此处不重复上报
|
||||
// try {
|
||||
// CrashReport.postCatchedException(throwable);
|
||||
// } catch (Exception e) {
|
||||
// }
|
||||
|
||||
//talkingdata
|
||||
try {
|
||||
TCAgent.onError(context, throwable);
|
||||
|
||||
@ -39,7 +39,6 @@ import com.lightgame.download.DownloadConfig;
|
||||
import com.lightgame.download.DownloadDao;
|
||||
import com.lightgame.download.DownloadEntity;
|
||||
import com.lightgame.download.DownloadService;
|
||||
import com.lightgame.download.DownloadSpeedController;
|
||||
import com.lightgame.download.DownloadStatus;
|
||||
import com.lightgame.download.DownloadStatusListener;
|
||||
import com.lightgame.download.DownloadStatusManager;
|
||||
@ -622,8 +621,8 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
}
|
||||
}
|
||||
|
||||
// 开启下载服务
|
||||
startDownloadServiceInBackground();
|
||||
// 开启下载服务, Fuck me, 即便是在启动页调用的方法,依然有可能触发 `unable is in background`
|
||||
startDownloadService();
|
||||
}
|
||||
|
||||
public void addObserver(DataWatcher dataWatcher) {
|
||||
@ -636,11 +635,19 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
DataChanger.INSTANCE.deleteObserver(dataWatcher);
|
||||
}
|
||||
|
||||
public void startDownloadServiceInBackground() {
|
||||
mContext.startService(new Intent(mContext, DownloadService.class));
|
||||
private void startDownloadService() {
|
||||
Intent serviceIntent = new Intent(mContext, DownloadService.class);
|
||||
// 当满足系统版本大于 8.0 、应用在后台运行时以前台服务开启
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
&& !HaloApp.getInstance().isRunningForeground) {
|
||||
serviceIntent.putExtra(DownloadService.KEY_SERVICE_ACTION, DownloadService.START_FOREGROUND);
|
||||
mContext.startForegroundService(serviceIntent);
|
||||
} else {
|
||||
mContext.startService(serviceIntent);
|
||||
}
|
||||
}
|
||||
|
||||
public void startDownloadService(DownloadEntity downloadEntity, DownloadStatus status) {
|
||||
private void startDownloadService(DownloadEntity downloadEntity, DownloadStatus status) {
|
||||
// 在启动服务时添加该条下载的网络状态
|
||||
if (status == DownloadStatus.add || status == DownloadStatus.resume) {
|
||||
String network = DeviceUtils.getNetwork(mContext);
|
||||
@ -664,11 +671,11 @@ public class DownloadManager implements DownloadStatusListener {
|
||||
}
|
||||
|
||||
public void disableDownloadSpeedLimit() {
|
||||
DownloadSpeedController.disableSpeedLimit();
|
||||
// DownloadSpeedController.disableSpeedLimit();
|
||||
}
|
||||
|
||||
public void updateSpeedLimitationReleaseDelay(int delay) {
|
||||
DownloadSpeedController.updateLimitationReleaseDelay(delay);
|
||||
// DownloadSpeedController.updateLimitationReleaseDelay(delay);
|
||||
}
|
||||
|
||||
public void checkRetryDownload() {
|
||||
|
||||
@ -2,6 +2,7 @@ package com.gh.download.cache;
|
||||
|
||||
import com.danikula.videocache.file.FileNameGenerator;
|
||||
import com.danikula.videocache.file.Md5FileNameGenerator;
|
||||
import com.gh.common.AppExecutor;
|
||||
import com.halo.assistant.HaloApp;
|
||||
import com.shuyu.gsyvideoplayer.utils.StorageUtils;
|
||||
|
||||
@ -11,9 +12,9 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
@ -29,12 +30,12 @@ import okhttp3.Response;
|
||||
|
||||
public class CacheManager {
|
||||
private static final AtomicReference<CacheManager> INSTANCE = new AtomicReference<>();
|
||||
private volatile HashMap<String, Call> downCalls;
|
||||
private volatile ConcurrentHashMap<String, Call> downCalls;
|
||||
private OkHttpClient mClient;
|
||||
private File cacheDirectory = StorageUtils.getIndividualCacheDirectory(HaloApp.getInstance().getApplication());
|
||||
private FileNameGenerator generator = new Md5FileNameGenerator();
|
||||
private final String TEMP_POSTFIX = ".download";
|
||||
private final int preLength = 5 * 1024 * 1024;//预加载大小
|
||||
// private final int preLength = 5 * 1024 * 1024;//预加载大小
|
||||
|
||||
|
||||
public static CacheManager getInstance() {
|
||||
@ -51,11 +52,11 @@ public class CacheManager {
|
||||
}
|
||||
|
||||
private CacheManager() {
|
||||
downCalls = new HashMap<>();
|
||||
downCalls = new ConcurrentHashMap<>();
|
||||
mClient = new OkHttpClient.Builder().build();
|
||||
}
|
||||
|
||||
private synchronized HashMap<String, Call> getDownCalls() {
|
||||
private synchronized ConcurrentHashMap<String, Call> getDownCalls() {
|
||||
return downCalls;
|
||||
}
|
||||
|
||||
@ -130,13 +131,15 @@ public class CacheManager {
|
||||
String url = cacheInfo.getUrl();
|
||||
final long[] downloadLength = {cacheInfo.getProgress()};//已经下载好的长度
|
||||
long contentLength = cacheInfo.getTotal();//文件的总长度
|
||||
if (downloadLength[0] >= preLength) {
|
||||
// if (downloadLength[0] >= preLength) {
|
||||
if (downloadLength[0] >= contentLength) {
|
||||
e.onComplete();
|
||||
return;
|
||||
}
|
||||
e.onNext(cacheInfo);
|
||||
Request request = new Request.Builder()
|
||||
.addHeader("RANGE", "bytes=" + downloadLength[0] + "-" + (contentLength > preLength ? preLength : contentLength))
|
||||
// .addHeader("RANGE", "bytes=" + downloadLength[0] + "-" + (contentLength > preLength ? preLength : contentLength))
|
||||
.addHeader("RANGE", "bytes=" + downloadLength[0] + "-" + contentLength)
|
||||
.url(url)
|
||||
.build();
|
||||
Call call = mClient.newCall(request);
|
||||
@ -214,10 +217,12 @@ public class CacheManager {
|
||||
}
|
||||
|
||||
public void removeAllCall() {
|
||||
for (Map.Entry<String, Call> entry : getDownCalls().entrySet()) {
|
||||
entry.getValue().cancel();
|
||||
}
|
||||
getDownCalls().clear();
|
||||
AppExecutor.getIoExecutor().execute(() -> {
|
||||
for (Map.Entry<String, Call> entry : getDownCalls().entrySet()) {
|
||||
entry.getValue().cancel();
|
||||
}
|
||||
AppExecutor.getUiExecutor().execute(() -> getDownCalls().clear());
|
||||
});
|
||||
}
|
||||
|
||||
private List<File> getAllFile() {
|
||||
|
||||
@ -25,9 +25,6 @@ import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
|
||||
import com.gh.base.AppUncaughtHandler;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.base.fragment.BaseFragment_ViewPager;
|
||||
@ -130,6 +127,8 @@ import java.util.UUID;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
@ -391,23 +390,24 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
//启动app删除视频缓存文件
|
||||
AppExecutor.getIoExecutor().execute(() -> {
|
||||
File cacheFileDirectory = StorageUtils.getIndividualCacheDirectory(this);
|
||||
if (cacheFileDirectory.exists() && cacheFileDirectory.isDirectory()) {
|
||||
for (File file : cacheFileDirectory.listFiles()) {
|
||||
FileUtils.deleteFile(file.getPath());
|
||||
}
|
||||
}
|
||||
//创建nomedia文件
|
||||
File noMediaFile = new File(cacheFileDirectory.getParent(), ".nomedia");
|
||||
|
||||
if (!cacheFileDirectory.exists()) {
|
||||
cacheFileDirectory.mkdirs();
|
||||
}
|
||||
try {
|
||||
File cacheFileDirectory = StorageUtils.getIndividualCacheDirectory(this);
|
||||
if (cacheFileDirectory.exists() && cacheFileDirectory.isDirectory()) {
|
||||
for (File file : cacheFileDirectory.listFiles()) {
|
||||
FileUtils.deleteFile(file.getPath());
|
||||
}
|
||||
}
|
||||
//创建nomedia文件
|
||||
File noMediaFile = new File(cacheFileDirectory.getParent(), ".nomedia");
|
||||
|
||||
if (!cacheFileDirectory.exists()) {
|
||||
cacheFileDirectory.mkdirs();
|
||||
}
|
||||
|
||||
if (!noMediaFile.exists()) {
|
||||
noMediaFile.createNewFile();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
|
||||
@ -19,12 +19,6 @@ import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
||||
|
||||
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView;
|
||||
import com.facebook.drawee.backends.pipeline.Fresco;
|
||||
import com.facebook.imagepipeline.core.ImagePipeline;
|
||||
@ -60,6 +54,11 @@ import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.viewpager.widget.ViewPager.OnPageChangeListener;
|
||||
import butterknife.BindView;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
@ -291,8 +290,13 @@ public class ViewImageActivity extends BaseActivity implements OnPageChangeListe
|
||||
|
||||
private void loadImage(String url, final BigImageView imageView) {
|
||||
// 添加GIF支持
|
||||
imageView.setImageViewFactory(new FrescoImageViewFactory());
|
||||
imageView.showImage(Uri.parse(url));
|
||||
try {
|
||||
imageView.setImageViewFactory(new FrescoImageViewFactory());
|
||||
imageView.showImage(Uri.parse(url));
|
||||
} catch (Exception ignored) {
|
||||
// parse Uri 可能会有异常 java.lang.NullPointerException
|
||||
// url 为 null? 暂时不管了,统一捕抓异常
|
||||
}
|
||||
}
|
||||
|
||||
private class ViewImageAdapter extends PagerAdapter implements OnSingleTapListener {
|
||||
|
||||
@ -508,7 +508,7 @@ public class PlatformAdapter extends BaseRecyclerAdapter<PlatformViewHolder> {
|
||||
|
||||
if (downloadEntity == null) return;
|
||||
|
||||
String path = mEntryMap.get(downloadEntity).getPath();
|
||||
String path = downloadEntity.getPath();
|
||||
if (FileUtils.isEmptyFile(path)) {
|
||||
Utils.toast(mContext, R.string.install_failure_hint);
|
||||
mEntryMap.remove(apkEntity.getUrl());
|
||||
|
||||
@ -131,7 +131,7 @@ public class GameDownloadFragment extends BaseFragment implements View.OnClickLi
|
||||
downloadEntity.getPath()), downloadEntity.getUrl());
|
||||
|
||||
// 用户焦点在下载管理页面时有任务完成,直接把所有下载完成的任务标记为已读
|
||||
DownloadManager.getInstance(requireContext()).markDownloadedTaskAsRead();
|
||||
DownloadManager.getInstance(HaloApp.getInstance().getApplication()).markDownloadedTaskAsRead();
|
||||
} else if (DownloadStatus.cancel.equals(downloadEntity.getStatus())) { // 有可能由于网络劫持造成的
|
||||
adapter.initMap();
|
||||
adapter.notifyDataSetChanged();
|
||||
|
||||
@ -124,7 +124,7 @@ class GameDetailEntity(
|
||||
data class Video(
|
||||
@SerializedName("video_id")
|
||||
var videoId: String = "",
|
||||
@SerializedName("video_count")
|
||||
@SerializedName("new_video_count", alternate = ["video_count"]) // 选用 JSON 最后一个值作为 videoCount 的值
|
||||
var videoCount: Int = 0,
|
||||
var poster: String = "",
|
||||
var title: String = "",
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.gh.gamecenter.gamedetail
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Application
|
||||
import android.os.Build
|
||||
import androidx.lifecycle.AndroidViewModel
|
||||
@ -13,9 +12,7 @@ import com.gh.common.util.ConcernUtils
|
||||
import com.gh.common.util.DataUtils
|
||||
import com.gh.gamecenter.entity.GameDetailEntity
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.GameVideoInfo
|
||||
import com.gh.gamecenter.mvvm.Resource
|
||||
import com.gh.gamecenter.retrofit.BiResponse
|
||||
import com.gh.gamecenter.retrofit.Response
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
@ -96,8 +93,7 @@ class GameDetailViewModel(application: Application,
|
||||
displayTopVideo = response.topVideo != null
|
||||
&& Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
|
||||
|
||||
getGameVideoInfo(response)
|
||||
// gameDetailLiveData.postValue(Resource.success(response))
|
||||
gameDetailLiveData.postValue(Resource.success(response))
|
||||
}
|
||||
|
||||
override fun onFailure(e: HttpException?) {
|
||||
@ -106,25 +102,6 @@ class GameDetailViewModel(application: Application,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private fun getGameVideoInfo(response: GameDetailEntity) {
|
||||
mApi.getGameVideoInfo(game?.id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(object : BiResponse<GameVideoInfo>() {
|
||||
override fun onSuccess(data: GameVideoInfo) {
|
||||
response.introVideo?.videoCount = data.videoCount
|
||||
gameDetailLiveData.postValue(Resource.success(response))
|
||||
}
|
||||
|
||||
override fun onFailure(exception: Exception) {
|
||||
gameDetailLiveData.postValue(Resource.success(response))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
fun concernCommand(isConcern: Boolean) {
|
||||
val listener = object : ConcernUtils.onConcernListener {
|
||||
override fun onSuccess() {
|
||||
|
||||
@ -185,6 +185,7 @@ class DescViewModel(application: Application,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
fun unvoteComment(commentId: String, callback: () -> Unit) {
|
||||
RetrofitManager.getInstance(getApplication())
|
||||
.api
|
||||
|
||||
@ -28,9 +28,11 @@ import com.gh.gamecenter.adapter.OnCommentCallBackListener
|
||||
import com.gh.gamecenter.baselist.ListAdapter
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.entity.CommentEntity
|
||||
import com.gh.gamecenter.eventbus.EBReuse
|
||||
import com.gh.gamecenter.qa.answer.detail.AnswerDetailFragment
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.utils.Util_System_Keyboard
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>(), OnCommentCallBackListener, KeyboardHeightObserver {
|
||||
|
||||
@ -172,11 +174,14 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
|
||||
if (this !is NewCommentConversationFragment) {
|
||||
mKeyboardHeightProvider?.setKeyboardHeightObserver(this)
|
||||
}
|
||||
|
||||
EventBus.getDefault().post(EBReuse(COMMENT_RESUME))
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mKeyboardHeightProvider?.setKeyboardHeightObserver(null)
|
||||
mBaseHandler.postDelayed({EventBus.getDefault().post(EBReuse(COMMENT_PAUSE))},1000)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
@ -351,6 +356,10 @@ open class NewCommentFragment : ListFragment<CommentEntity, NewCommentViewModel>
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
const val COMMENT_PAUSE = "comment_pause"
|
||||
const val COMMENT_RESUME = "comment_resume"
|
||||
|
||||
fun getAnswerCommentInstance(answerId: String,
|
||||
showSoftKeyboardOnStartUp: Boolean,
|
||||
commentCount: Int,
|
||||
|
||||
@ -13,6 +13,7 @@ import com.gh.gamecenter.R
|
||||
import com.gh.gamecenter.baselist.ListFragment
|
||||
import com.gh.gamecenter.baselist.LoadType
|
||||
import com.gh.gamecenter.entity.GameEntity
|
||||
import com.gh.gamecenter.entity.SubjectData
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.game.columncollection.detail.ColumnCollectionDetailActivity
|
||||
@ -66,7 +67,10 @@ class SubjectListFragment : ListFragment<GameEntity, SubjectListViewModel>(), On
|
||||
val factory = SubjectListViewModel.Factory(HaloApp.getInstance().application
|
||||
, arguments?.getParcelable(EntranceUtils.KEY_SUBJECT_DATA)!!)
|
||||
if (requireContext() is SubjectActivity) {
|
||||
mSubjectViewModel = viewModelProviderFromParent()
|
||||
requireActivity().intent.getParcelableExtra<SubjectData>(EntranceUtils.KEY_SUBJECT_DATA)?.let {
|
||||
val f = SubjectViewModel.Factory(HaloApp.getInstance().application, it)
|
||||
mSubjectViewModel = viewModelProviderFromParent(f)
|
||||
}
|
||||
}
|
||||
return ViewModelProviders.of(this, factory).get(SubjectListViewModel::class.java)
|
||||
}
|
||||
|
||||
@ -31,8 +31,11 @@ import com.gh.gamecenter.entity.LinkEntity
|
||||
import com.gh.gamecenter.entity.VideoEntity
|
||||
import com.gh.gamecenter.eventbus.EBDownloadStatus
|
||||
import com.gh.gamecenter.eventbus.EBPackage
|
||||
import com.gh.gamecenter.eventbus.EBReuse
|
||||
import com.gh.gamecenter.manager.UserManager
|
||||
import com.gh.gamecenter.qa.comment.CommentActivity
|
||||
import com.gh.gamecenter.qa.comment.NewCommentFragment
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.download.DataWatcher
|
||||
import com.lightgame.download.DownloadEntity
|
||||
import com.lightgame.listeners.OnBackPressedListener
|
||||
@ -142,6 +145,9 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
if (!isShowSlide) {
|
||||
showSlideGuide()
|
||||
}
|
||||
if (mIsHomeVideo) {
|
||||
setAdvertisement(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -184,10 +190,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
mViewModel.needToUpdateVideoInfo.observeNonNull(this) {
|
||||
findFirstCompletelyVisibleVideoViewByPosition()?.updateViewDetail(it)
|
||||
}
|
||||
|
||||
if (mIsHomeVideo) {
|
||||
setAdvertisement(0)
|
||||
}
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
@ -439,7 +441,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
|
||||
videoView?.run {
|
||||
if (videoView.isInPlayingState) {
|
||||
// CustomManager.onResume("detail_${mViewModel.uuid}", false)
|
||||
videoView.onVideoResume(false)
|
||||
} else {//快速切换视频后再切换页面可能没有播放
|
||||
videoView.startButton?.performClick()
|
||||
@ -469,7 +470,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
videoView.uploadVideoStreamingPlaying("暂停页面")
|
||||
if (pauseVideo[mViewModel.uuid] == true) {
|
||||
if (videoView.isInPlayingState) {
|
||||
// CustomManager.onPause("detail_${mViewModel.uuid}")
|
||||
videoView.onVideoPause()
|
||||
} else {
|
||||
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
|
||||
@ -482,7 +482,6 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
}
|
||||
SPUtils.setBoolean(Constants.SP_SHOW_SLIDE_GUIDE, true)
|
||||
|
||||
CacheManager.getInstance().removeAllCall()
|
||||
val proxy = CustomProxyCacheManager.getProxy(requireContext(), null)
|
||||
runOnIoThread {
|
||||
proxy.allClients.forEach {
|
||||
@ -497,6 +496,7 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
serverSocket.close()
|
||||
}*/
|
||||
super.onPause()
|
||||
CacheManager.getInstance().removeAllCall()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
@ -505,12 +505,12 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
mBaseHandler.postDelayed({
|
||||
CustomManager.releaseAllVideos("detail_${mViewModel.uuid}")
|
||||
}, 500)
|
||||
CacheManager.getInstance().removeAllCall()
|
||||
if (mAdCountDownTimer != null && !mAdCountDownTimer!!.isDisposed) {
|
||||
mAdCountDownTimer?.dispose()
|
||||
}
|
||||
pauseVideo.remove(mViewModel.uuid)
|
||||
super.onDestroyView()
|
||||
CacheManager.getInstance().removeAllCall()
|
||||
}
|
||||
|
||||
private fun findFirstCompletelyVisibleVideoViewByPosition(): DetailPlayerView? {
|
||||
@ -654,6 +654,32 @@ class VideoDetailContainerFragment : BaseLazyFragment(), OnBackPressedListener {
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onEventMainThread(status: EBReuse) {
|
||||
val videoView = findFirstCompletelyVisibleVideoViewByPosition()
|
||||
//处理打开评论页面,按手机Home键回到桌面,还会听到视频的声音
|
||||
if (NewCommentFragment.COMMENT_PAUSE == status.type) {
|
||||
if (!HaloApp.getInstance().isRunningForeground) {
|
||||
videoView?.onVideoPause()
|
||||
}
|
||||
}
|
||||
//产品没说回到前台需要继续恢复播放,先注释掉
|
||||
/*else if (NewCommentFragment.COMMENT_RESUME == status.type) {
|
||||
val activityStack = AppManager.getInstance().activityStack
|
||||
var i = activityStack.size - 1
|
||||
while (i >= 0) {
|
||||
val activity = activityStack[i]
|
||||
if (activity is VideoDetailActivity || activity is MainActivity) {
|
||||
if (requireActivity().componentName == activity.componentName) {
|
||||
videoView?.onVideoResume(false)
|
||||
}
|
||||
break
|
||||
}
|
||||
i--
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
override fun onHandleBackPressed(): Boolean {
|
||||
if (::mAdapter.isInitialized) {
|
||||
return mAdapter.onBackPressed(findFirstCompletelyVisibleVideoViewByPosition())
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 919 KiB After Width: | Height: | Size: 1.3 MiB |
@ -227,8 +227,8 @@
|
||||
|
||||
<View
|
||||
android:id="@+id/main_iv_message_hint"
|
||||
android:layout_width="8dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_width="4dp"
|
||||
android:layout_height="4dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:background="@drawable/oval_message_hint_bg"
|
||||
android:visibility="gone" />
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_rating"
|
||||
visibleGone="@{game.commentCount >= 10 && game.star >= 7}"
|
||||
visibleGone="@{game.commentCount >= 3 && game.star >= 7}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/home_game_rating"
|
||||
|
||||
@ -144,7 +144,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/game_rating"
|
||||
visibleGone="@{data.commentCount >= 10 && data.star >= 7}"
|
||||
visibleGone="@{data.commentCount >= 3 && data.star >= 7}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/home_game_rating"
|
||||
|
||||
@ -7,8 +7,8 @@ ext {
|
||||
targetSdkVersion = 26
|
||||
|
||||
// application info
|
||||
versionCode = 130
|
||||
versionName = "3.7.2"
|
||||
versionCode = 131
|
||||
versionName = "3.7.3"
|
||||
applicationId = "com.gh.gamecenter"
|
||||
|
||||
// AndroidX
|
||||
|
||||
@ -54,8 +54,8 @@ DATA_HOST=https\://data.ghzs.com/
|
||||
|
||||
# 请不要手动改动下面的值,除非你明确需要以某个apk作为基准包,需要打包请以scripts/tinker*.sh为准
|
||||
TINKER_ENABLE=
|
||||
TINKER_ID=06ec87b
|
||||
TINKER_BASE_APK_DIR=app-0117-15-19-59_06ec87b
|
||||
TINKER_ID=5c929ba30
|
||||
TINKER_BASE_APK_DIR=app-0219-17-08-22_5c929ba30
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
|
||||
|
||||
Submodule libraries/LGLibrary updated: 6fedc92974...f939aedbc0
@ -98,17 +98,18 @@ public class HttpUrlSource implements Source {
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.disconnect();
|
||||
} catch (NullPointerException | IllegalArgumentException e) {
|
||||
} catch (Exception e) {
|
||||
String message = "Wait... but why? WTF!? " +
|
||||
"Really shouldn't happen any more after fixing https://github.com/danikula/AndroidVideoCache/issues/43. " +
|
||||
"If you read it on your device log, please, notify me danikula@gmail.com or create issue here " +
|
||||
"https://github.com/danikula/AndroidVideoCache/issues.";
|
||||
throw new RuntimeException(message, e);
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
e.printStackTrace();
|
||||
// throw new RuntimeException(message, e);
|
||||
} /*catch (ArrayIndexOutOfBoundsException e) {
|
||||
HttpProxyCacheDebuger.printfError("Error closing connection correctly. Should happen only on Android L. " +
|
||||
"If anybody know how to fix it, please visit https://github.com/danikula/AndroidVideoCache/issues/88. " +
|
||||
"Until good solution is not know, just ignore this issue :(", e);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user