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

# 请输入一个提交信息以解释此合并的必要性,尤其是将一个更新后的上游分支
# 合并到主题分支。
#
# 以 '#' 开头的行将被忽略,而且空提交说明将会终止提交。
This commit is contained in:
kehaoyuan
2018-10-28 18:46:59 +08:00
parent ccc367a376
commit ee3b06d4aa
11 changed files with 69 additions and 46 deletions

View File

@ -9,7 +9,11 @@ object TimeUtil {
}
fun currentTime(): Int {
return ( ( corrector.delta + System.currentTimeMillis() ) / 1000 ).toInt()
return if (::corrector.isInitialized) {
((corrector.delta + System.currentTimeMillis()) / 1000).toInt()
} else {
(System.currentTimeMillis() / 1000).toInt()
}
}
/**

View File

@ -279,7 +279,7 @@ object DirectUtils {
}
UserManager.getInstance().setCommunityData(community)
// 这里换个线程操作是为了做一点延时,不换的话有记录出现社区选择指示出不来的情况
// 这里换个线程操作是为了做一点延时
AppExecutor.ioExecutor.execute {
EventBus.getDefault().post(EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 1))
EventBus.getDefault().post(EBReuse(AskFragment.EB_RETRY_PAGE))

View File

@ -20,6 +20,7 @@ import android.support.annotation.Nullable;
import android.text.Html;
import android.text.Spanned;
import android.text.TextUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
@ -79,6 +80,7 @@ import com.gh.gamecenter.manager.PackageManager;
import com.gh.gamecenter.manager.UpdateManager;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.normal.NormalFragment;
import com.gh.gamecenter.qa.AskFragment;
import com.gh.gamecenter.retrofit.ObservableUtil;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
@ -141,6 +143,7 @@ public class MainActivity extends BaseActivity {
public final static String EB_SKIP_GAMEFRAGMENT = "GameFragment";
public final static String SHOULD_INIT_IM = "should_init_im";
public final static String SWITCH_TO_COMMUNITY = "switch_to_community";
private MainWrapperFragment mMainWrapperFragment;
@ -783,13 +786,31 @@ public class MainActivity extends BaseActivity {
handler.postDelayed(ImManager::attachIm, 1000);
}
// 获取可用(呈显示在)的社区列表
// 获取可用(没有被隐藏的)的社区列表
CommunityHelper.getAvailableCommunityList();
handler.postDelayed(this::switchToCommunityTabAndRefresh, 800);
// 执行跳转事件
handler.postDelayed(skipRun, 500);
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
switchToCommunityTabAndRefresh();
}
private void switchToCommunityTabAndRefresh() {
// 跳转到问答社区并刷新
if (getIntent().getBooleanExtra(SWITCH_TO_COMMUNITY, false)) {
getIntent().putExtra(SWITCH_TO_COMMUNITY, false);
Log.e("Switch", "true");
EventBus.getDefault().post(new EBSkip(MainActivity.EB_SKIP_GAMEFRAGMENT, 1));
EventBus.getDefault().post(new EBReuse(AskFragment.EB_RETRY_PAGE));
}
}
private void getGhzsSettings() {
String channel = HaloApp.getInstance().getChannel();
RetrofitManager.getInstance(this)
@ -950,15 +971,12 @@ public class MainActivity extends BaseActivity {
"<font color='#ff0000'>读取应用列表</font>”选择为打开" +
"“<font color='#ff0000'>允许</font>”,否则光环助手将无法帮您安装插件加速版的游戏");
DialogUtils.showWarningDialog(this, "提示", content, "忽略", "去开启",
new DialogUtils.ConfirmListener() {
@Override
public void onConfirm() {
// 跳转应用信息界面
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivityForResult(intent, SKIP_SETTING_REQUEST);
}
() -> {
// 跳转应用信息界面
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", getPackageName(), null);
intent.setData(uri);
startActivityForResult(intent, SKIP_SETTING_REQUEST);
}, null);
} else {
getInstalledListFromServer();

View File

@ -1,5 +1,6 @@
package com.gh.gamecenter;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
@ -7,7 +8,9 @@ import android.text.TextUtils;
import com.gh.base.BaseActivity;
import com.gh.common.util.DirectUtils;
import com.gh.common.util.PlatformUtils;
import com.gh.common.util.RunningUtils;
import com.gh.gamecenter.entity.CommunityEntity;
import com.gh.gamecenter.manager.UserManager;
import com.lightgame.config.CommonDebug;
import com.lightgame.utils.Utils;
@ -85,7 +88,20 @@ public class SkipActivity extends BaseActivity {
DirectUtils.directToQuestionDetail(this, id, ENTRANCE_BROWSER, "浏览器");
break;
case HOST_COMMUNITY:
DirectUtils.directToCommunity(this, new CommunityEntity(id, name));
Intent intent;
UserManager.getInstance().setCommunityData(new CommunityEntity(id, name));
// 把切换放到 MainActivity 处理
if (RunningUtils.isRunning(this)
&& MainActivity.class.getName().equals(RunningUtils.getBaseActivity(this))) {
intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(MainActivity.SWITCH_TO_COMMUNITY, true);
} else {
Bundle bundle = new Bundle();
bundle.putBoolean(MainActivity.SWITCH_TO_COMMUNITY, true);
intent = SplashScreenActivity.getSplashScreenIntent(this, bundle);
}
startActivity(intent);
break;
case HOST_COMMUNITY_ARTICLE:
DirectUtils.directToCommunityArticle(this, uri.getQueryParameter("articleId"), uri.getQueryParameter("communityId"), ENTRANCE_BROWSER);

View File

@ -134,8 +134,8 @@ public class MainWrapperFragment extends BaseFragment_ViewPager_Checkable {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBSkip skip) {
if (EB_SKIP_GAMEFRAGMENT.equals(skip.getType())) {
EventBus.getDefault().post(new EBUISwitch(EB_MAINACTIVITY_TAG, INDEX_GAME));
checkIndex(INDEX_GAME);
EventBus.getDefault().post(new EBUISwitch(EB_MAINACTIVITY_TAG, skip.getCurrentItem()));
checkIndex(skip.getCurrentItem());
EventBus.getDefault().post(new EBSkip(EB_MAINACTIVITY_TAG, skip.getCurrentItem()));
mViewPager.setCurrentItem(skip.getCurrentItem(), false);
}

View File

@ -54,7 +54,6 @@ class DescAdapter(context: Context,
private var isFuliNoData: Boolean = false
private var mIsPluginExpanded = false
private var mIsBasicInfoExpanded = false
private var mIsUpdateInfoExpanded = false
private var mIsIntroExpanded = false
@ -258,7 +257,6 @@ class DescAdapter(context: Context,
val tips = descItemData.basicInfo?.info
val tag = descItemData.basicInfo?.infoTag
val linearLayoutManager = LinearLayoutManager(mContext)
val layoutManager = GridLayoutManager(mContext, 3)
layoutManager.spanSizeLookup = object : GridLayoutManager.SpanSizeLookup() {
override fun getSpanSize(position: Int): Int {
@ -274,23 +272,9 @@ class DescAdapter(context: Context,
viewHolder.gamedetailPluginOpen.visibility = View.INVISIBLE
}
if (mIsBasicInfoExpanded) {
viewHolder.gameDetailPluginRv.layoutManager = linearLayoutManager
viewHolder.gamedetailPluginExpandIv.setImageResource(R.drawable.ic_category_arrow_up)
} else {
viewHolder.gameDetailPluginRv.layoutManager = layoutManager
viewHolder.gamedetailPluginExpandIv.setImageResource(R.drawable.ic_category_arrow_down)
}
viewHolder.gameDetailPluginRv.adapter = GameDetailPluginAdapter(tag, tips, mIsBasicInfoExpanded, mContext)
viewHolder.gamedetailPluginOpen.setOnClickListener { _ ->
mIsBasicInfoExpanded = !mIsBasicInfoExpanded
if (mIsBasicInfoExpanded) {
DataUtils.onMtaEvent(mContext, "游戏详情", "展开基本信息", gameName)
} else {
DataUtils.onMtaEvent(mContext, "游戏详情", "收起基本信息", gameName)
}
notifyItemChanged(viewHolder.adapterPosition)
}
viewHolder.gameDetailPluginRv.layoutManager = layoutManager
viewHolder.gamedetailPluginExpandIv.visibility = View.GONE
viewHolder.gameDetailPluginRv.adapter = GameDetailPluginAdapter(tag, tips, false, mContext)
}
private fun initPluginViewHolder(viewHolder: GameDetailPluginViewHolder, descItemData: DescItemData) {

View File

@ -19,8 +19,6 @@ import com.gh.gamecenter.databinding.RatingItemBinding
import com.gh.gamecenter.entity.Rating
import com.gh.gamecenter.entity.RatingComment
import com.gh.gamecenter.gamedetail.rating.edit.RatingEditActivity
import com.gh.gamecenter.manager.InstallManager
import com.lightgame.utils.Utils
class RatingAdapter(context: Context,
private val mListViewModel: RatingViewModel,
@ -112,14 +110,14 @@ class RatingAdapter(context: Context,
private fun skipRatingEdit(starCount: Float) {
CheckLoginUtils.checkLogin(mContext) {
if (InstallManager(mContext).findInstallById(mListViewModel.game.id) != null) {
// if (InstallManager(mContext).findInstallById(mListViewModel.game.id) != null) {
if (mContext is Activity) {
val intent = RatingEditActivity.getIntent(mContext, mListViewModel.game.id!!, ratingData?.device, starCount)
(mContext as Activity).startActivityForResult(intent, RatingFragment.RATING_EDIT_REQUEST)
}
} else {
Utils.toast(mContext, "安装游戏后才能评论哦")
}
// } else {
// Utils.toast(mContext, "安装游戏后才能评论哦")
// }
}
}

View File

@ -282,7 +282,7 @@ public class ConcernFragment extends NormalFragment implements SwipeRefreshLayou
}
}
RemenkapaiRepository.INSTANCE
RemenkapaiRepository
.getRemenkapai(4)
.map(list1 -> {
// 根据热门卡牌顺序进行排序

View File

@ -64,7 +64,7 @@ class QuestionsInviteViewModel(application: Application, var questionId: String?
// 找第一个不是我的关注的项目,并插入头部
for ((index, value) in inviteList.withIndex()) {
if (value.isFollowers == false) {
if (value.me == null || value.me?.isFollower == false) {
inviteList.add(index, InviteEntity(isHeaderItem = true, headerName = "系统推荐"))
break
}
@ -72,7 +72,7 @@ class QuestionsInviteViewModel(application: Application, var questionId: String?
// 找第一个是我的关注的项目,并插入头部
for ((index, value) in inviteList.withIndex()) {
if (value.isFollowers == true) {
if (value.me?.isFollower == true) {
inviteList.add(index, InviteEntity(isHeaderItem = true, headerName = "我的关注"))
break
}