Merge branch 'dev' of gitlab.ghzhushou.com:halo/assistant-android into dev
This commit is contained in:
@ -44,6 +44,8 @@ object DirectUtils {
|
||||
EntranceUtils.HOST_UPDATE -> directToDownloadManagerAndStartUpdate(context, gameId = link, packageName = text, entrance = entrance)
|
||||
|
||||
EntranceUtils.HOST_LIBAO -> directToGiftDetail(context, giftId = link, entrance = entrance)
|
||||
|
||||
EntranceUtils.HOST_COMMUNITY -> directToCommunity(context, id = link, name = text, entrance = entrance)
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,6 +58,16 @@ object DirectUtils {
|
||||
EntranceUtils.jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToCommunity(context: Context, id: String, name: String?, entrance: String? = null) {
|
||||
val bundle = Bundle()
|
||||
bundle.putString(KEY_ENTRANCE, entrance ?: ENTRANCE_BROWSER)
|
||||
bundle.putString(KEY_TO, MainActivity::class.java.simpleName)
|
||||
bundle.putString(KEY_COMMUNITY_ID, id)
|
||||
bundle.putString(KEY_COMMUNITY_NAME, name)
|
||||
EntranceUtils.jumpActivity(context, bundle)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun directToGameDetail(context: Context, id: String, entrance: String? = null, autoDownload: Boolean? = null) {
|
||||
val bundle = Bundle()
|
||||
|
||||
@ -48,6 +48,7 @@ public class EntranceUtils {
|
||||
public static final String ENTRANCE_MIPUSH = "(小米推送)";
|
||||
public static final String ENTRANCE_DOWNLOAD = "(下载跳转)";
|
||||
public static final String ENTRANCE_RECOMMEND = "(落地页)";
|
||||
public static final String ENTRANCE_BLOCK_RECOMMEND = "(推荐入口)";
|
||||
public static final String KEY_SUGGEST_HINT_TYPE = "suggestHintType";
|
||||
public static final String KEY_PACKAGENAME = "packageName";
|
||||
public static final String KEY_PLATFORM = "platform";
|
||||
@ -87,6 +88,8 @@ public class EntranceUtils {
|
||||
public static final String KEY_BLOCK_DATA = "blockData";
|
||||
public static final String KEY_ASK_TAG = "askTag";
|
||||
public static final String KEY_ASK_COLUMN_TAG = "askColumnTag";
|
||||
public static final String KEY_COMMUNITY_ID = "community_id";
|
||||
public static final String KEY_COMMUNITY_NAME = "community_name";
|
||||
public static final String KEY_COMMUNITY_DATA = "communityData";
|
||||
public static final String KEY_TRACE_EVENT = "trace_event";
|
||||
public static final String KEY_SUBJECT_DATA = "subjectData";
|
||||
|
||||
@ -52,6 +52,9 @@ class WelcomeDialog : BaseDialogFragment() {
|
||||
EntranceUtils.HOST_QQ -> {
|
||||
DirectUtils.directToQqConversation(context!!, mWelcomeEntity?.link!!)
|
||||
}
|
||||
EntranceUtils.HOST_COMMUNITY -> {
|
||||
DirectUtils.directToCommunity(context!!, mWelcomeEntity?.link!!, mWelcomeEntity?.text!!, EntranceUtils.ENTRANCE_WELCOME)
|
||||
}
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.gh.gamecenter;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
@ -17,6 +18,7 @@ import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
@ -73,6 +75,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;
|
||||
@ -755,7 +758,21 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
String communityId = intent.getStringExtra(EntranceUtils.KEY_COMMUNITY_ID);
|
||||
if (!TextUtils.isEmpty(communityId)) {
|
||||
jumpToSpecifyCommunity(communityId, intent.getStringExtra(EntranceUtils.KEY_COMMUNITY_NAME));
|
||||
} else {
|
||||
super.onNewIntent(intent);
|
||||
}
|
||||
}
|
||||
|
||||
private void jumpToSpecifyCommunity(String communityId, String name) {
|
||||
UserManager.getInstance().setCommunityData(new CommunityEntity(communityId, name));
|
||||
List<Fragment> fragments = mMainWrapperFragment.getChildFragmentManager().getFragments();
|
||||
for (Fragment fragment : fragments) {
|
||||
fragment.onActivityResult(AskFragment.COMMUNITIES_SELECT_REQUEST, Activity.RESULT_OK, null);
|
||||
}
|
||||
runOnUiThread(() -> mMainWrapperFragment.setCurrentItem(MainWrapperFragment.INDEX_ASK));
|
||||
}
|
||||
|
||||
private void getGhzsSettings() {
|
||||
@ -986,9 +1003,7 @@ public class MainActivity extends BaseActivity {
|
||||
if (EntranceUtils.HOST_COMMUNITY.equals(info.getType())) {
|
||||
openCommunityWithDefaultIdForTheFirsTime = true;
|
||||
UserManager.getInstance().setCommunityData(new CommunityEntity(info.getLink(), info.getText()));
|
||||
runOnUiThread(() -> {
|
||||
mMainWrapperFragment.setCurrentItem(MainWrapperFragment.INDEX_ASK);
|
||||
});
|
||||
runOnUiThread(() -> mMainWrapperFragment.setCurrentItem(MainWrapperFragment.INDEX_ASK));
|
||||
} else {
|
||||
DirectUtils.directToSpecificPage(this, info.getType(), info.getLink(), info.getText(), EntranceUtils.KEY_PLUGIN);
|
||||
}
|
||||
|
||||
@ -14,6 +14,7 @@ import static com.gh.common.util.EntranceUtils.ENTRANCE_BROWSER;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_ANSWER;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_ARTICLE;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_COLUMN;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_COMMUNITY;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_DOWNLOAD;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_GAME;
|
||||
import static com.gh.common.util.EntranceUtils.HOST_QUESTION;
|
||||
@ -46,6 +47,7 @@ public class SkipActivity extends BaseActivity {
|
||||
}
|
||||
String host = uri.getHost();
|
||||
String id = uri.getPath();
|
||||
String name = uri.getQueryParameter("name");
|
||||
if (!TextUtils.isEmpty(id)) {
|
||||
id = id.substring(1);
|
||||
}
|
||||
@ -63,10 +65,10 @@ public class SkipActivity extends BaseActivity {
|
||||
break;
|
||||
case HOST_SUGGESTION:
|
||||
String platform = uri.getQueryParameter(KEY_PLATFORM);
|
||||
String name = PlatformUtils.getInstance(this).getPlatformName(platform);
|
||||
String platformName = PlatformUtils.getInstance(this).getPlatformName(platform);
|
||||
String content = String.format("【%s-%s-V%s】",
|
||||
uri.getQueryParameter(KEY_GAME_NAME),
|
||||
TextUtils.isEmpty(name) ? platform : name,
|
||||
TextUtils.isEmpty(platformName) ? platform : platformName,
|
||||
uri.getQueryParameter(KEY_VERSION));
|
||||
DirectUtils.directToFeedback(this, content, ENTRANCE_BROWSER);
|
||||
break;
|
||||
@ -79,6 +81,9 @@ public class SkipActivity extends BaseActivity {
|
||||
case HOST_QUESTION:
|
||||
DirectUtils.directToQuestionDetail(this, id, ENTRANCE_BROWSER);
|
||||
break;
|
||||
case HOST_COMMUNITY:
|
||||
DirectUtils.directToCommunity(this, id, name, ENTRANCE_BROWSER);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,4 +8,5 @@ data class WelcomeDialogEntity(
|
||||
var link: String? = "",
|
||||
var icon: String? = "",
|
||||
var type: String? = "",
|
||||
var text: String? = "",
|
||||
var time: Long? = 0)
|
||||
@ -133,7 +133,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
holder.binding.headMore.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
holder.binding.headMore.setOnClickListener({
|
||||
holder.binding.headMore.setOnClickListener {
|
||||
if ("all" == column?.home) {
|
||||
DataUtils.onMtaEvent(mContext, "游戏专题", "全部", column.name)
|
||||
SubjectActivity.startSubjectActivity(mContext, column.id, column.name, column.isOrder, "(游戏-专题:" + column.name + "-全部)")
|
||||
@ -142,7 +142,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
holder.binding.headPb.visibility = View.VISIBLE
|
||||
mViewModel.changeSubjectGame(column?.id!!)
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (holder is GamePluginViewHolder) {
|
||||
val pluginList = mItemDataList[position].pluginList
|
||||
var adapter = holder.mPluginRv.adapter
|
||||
@ -159,7 +159,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
}
|
||||
|
||||
holder.mHeadTitle.text = String.format(Locale.getDefault(), "你有%d个游戏可以升级插件版", pluginList?.size)
|
||||
holder.mPluginHead.setOnClickListener({
|
||||
holder.mPluginHead.setOnClickListener {
|
||||
if (mIsOpenPluginList) {
|
||||
mIsOpenPluginList = false
|
||||
holder.mHeadOpen.setImageResource(R.drawable.gamedetail_open_icon)
|
||||
@ -168,7 +168,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
holder.mHeadOpen.setImageResource(R.drawable.gamedetail_colse_icon)
|
||||
}
|
||||
notifyItemChanged(holder.adapterPosition)
|
||||
})
|
||||
}
|
||||
} else if (holder is GameItemViewHolder) {
|
||||
val itemData = mItemDataList[position]
|
||||
val gameEntity = itemData.game
|
||||
@ -264,6 +264,8 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
DataCollectionUtils.uploadPosition(mContext, "游戏", (5).toString(), entity.name)
|
||||
} else if (entity.type == "game") {
|
||||
GameDetailActivity.startGameDetailActivity(mContext, entity.link, "(推荐入口)")
|
||||
} else if (entity.type == EntranceUtils.HOST_COMMUNITY) {
|
||||
DirectUtils.directToCommunity(mContext, entity.link!!, entity.text, EntranceUtils.ENTRANCE_BLOCK_RECOMMEND)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -375,7 +377,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
holder.binding.gameContainer.layoutParams.height = (width * scale).toInt()
|
||||
}
|
||||
})
|
||||
holder.binding.gameImageIcon.setOnClickListener({
|
||||
holder.binding.gameImageIcon.setOnClickListener {
|
||||
DataCollectionUtils.uploadClick(mContext, "$name-大图", "游戏-专题")
|
||||
DataUtils.onMtaEvent(mContext, "游戏专题", "大图", name)
|
||||
when (entity?.type) {
|
||||
@ -389,7 +391,7 @@ class GameFragmentAdapter(context: Context, model: GameViewModel, var blockName:
|
||||
}
|
||||
"column" -> SubjectActivity.startSubjectActivity(mContext, link, name, false, "(游戏-专题:$name-大图)")
|
||||
}
|
||||
})
|
||||
}
|
||||
} else if (holder is GameHorizontalListViewHolder) {
|
||||
val subjectEntity = mItemDataList[position].horizontalColumn
|
||||
val exposureEventList = arrayListOf<ExposureEvent>()
|
||||
|
||||
@ -158,7 +158,6 @@ public class AskFragment extends BaseFragment {
|
||||
initViewPager();
|
||||
setTabbarPosition(INDEX_HOT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@OnClick({R.id.ask_selectgame, R.id.ask_search, R.id.ask_hot, R.id.ask_questions, R.id.ask_column, R.id.reuse_no_connection})
|
||||
|
||||
Reference in New Issue
Block a user