activity入口整理(涉及到外部启动(插件跳转/推送)的未完成)

This commit is contained in:
kehaoyuan
2017-09-25 17:22:07 +08:00
parent b483f7cdb6
commit ce0e28dad6
12 changed files with 58 additions and 78 deletions

View File

@ -167,12 +167,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener,
*/
public static void startNewsDetailActivity(Context context, NewsEntity newsEntity, String entrance) {
if (!TextUtils.isEmpty(newsEntity.getLink())) {
Intent intent = new Intent(context, WebActivity.class);
intent.putExtra("url", newsEntity.getLink());
intent.putExtra("gameName", newsEntity.getGameName());
intent.putExtra("newsId", newsEntity.getId());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
context.startActivity(intent);
context.startActivity(WebActivity.getIntentByNews(context, newsEntity, entrance));
} else {
Intent intent = new Intent(context, NewsDetailActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@ -189,11 +184,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener,
*/
public static void startNewsDetailByCollection(Context context, NewsEntity newsEntity, String entrance) {
if (!TextUtils.isEmpty(newsEntity.getLink())) {
Intent intent = new Intent(context, WebActivity.class);
intent.putExtra("url", newsEntity.getLink());
intent.putExtra("gameName", newsEntity.getGameName());
intent.putExtra("newsId", newsEntity.getId());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
Intent intent = WebActivity.getIntentByNews(context, newsEntity, entrance);
context.startActivity(intent);
} else {
Intent intent = new Intent(context, NewsDetailActivity.class);

View File

@ -71,8 +71,7 @@ public class SuggestSelectActivity extends BaseActivity {
return;
}
Intent intent = new Intent(this, SuggestionActivity.class);
intent.putExtra("suggestType", type);
Intent intent = SuggestionActivity.getIntent(this, type);
startActivityForResult(intent, SUGGEST_TYPE_REQUEST);
}

View File

@ -11,6 +11,7 @@ import android.os.Bundle;
import android.os.Environment;
import android.preference.PreferenceManager;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
@ -24,7 +25,6 @@ import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.TextView;
import com.halo.assistant.HaloApp;
import com.gh.base.BaseActivity;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.constant.Config;
@ -46,6 +46,7 @@ import com.gh.gamecenter.suggest.SuggestPicAdapter;
import com.gh.gamecenter.suggest.SuggestSelectGameAdapter;
import com.gh.gamecenter.suggest.SuggestTypeAdapter;
import com.google.gson.Gson;
import com.halo.assistant.HaloApp;
import com.lightgame.download.FileUtils;
import com.lightgame.utils.Util_System_Keyboard;
import com.lightgame.utils.Util_System_Phone_State;
@ -124,6 +125,13 @@ public class SuggestionActivity extends BaseActivity implements SuggestTypeAdapt
private SharedPreferences sp;
@NonNull
public static Intent getIntent(Context context, int suggestType) {
Intent intent = new Intent(context, SuggestionActivity.class);
intent.putExtra("suggestType", suggestType);
return intent;
}
public static void startSuggestionActivity(Context context, int suggestType, String suggestHintType, String content) {
Intent intent = new Intent(context, SuggestionActivity.class);
intent.putExtra("suggestType", suggestType);

View File

@ -22,8 +22,10 @@ import com.gh.base.BaseActivity;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.CollectionUtils;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ShareUtils;
import com.gh.gamecenter.entity.CommentnumEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.ToolBoxEntity;
import com.gh.gamecenter.entity.UserDataEntity;
import com.gh.gamecenter.retrofit.Response;
@ -84,16 +86,33 @@ public class WebActivity extends BaseActivity {
}
@NonNull
public static void startWebByCollectionTools(Context context, ToolBoxEntity toolBoxEntity) {
public static void startWebByCollectionTools(Context context, ToolBoxEntity toolBoxEntity, boolean isCollectionTools) {
Intent intent = new Intent(context, WebActivity.class);
intent.putExtra("url", toolBoxEntity.getUrl());
intent.putExtra("isTools", true);
intent.putExtra("gameName", toolBoxEntity.getName());
intent.putExtra("ToolBoxEntity", toolBoxEntity);
intent.putExtra("isCollectionTools", true);
intent.putExtra("isCollectionTools", isCollectionTools);
context.startActivity(intent);
}
@NonNull
public static Intent getIntentByNews(Context context, NewsEntity newsEntity, String entrance) {
Intent intent = new Intent(context, WebActivity.class);
intent.putExtra("url", newsEntity.getLink());
intent.putExtra("gameName", newsEntity.getGameName());
intent.putExtra("newsId", newsEntity.getId());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
return intent;
}
@NonNull
public static Intent getIntentByUrl(Context context, String url) {
Intent intent = new Intent(context, WebActivity.class);
intent.putExtra("url", url);
return intent;
}
@Override
protected int getLayoutId() {
return R.layout.activity_web;

View File

@ -31,6 +31,7 @@ import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.NewsDigestViewHolder;
import com.gh.gamecenter.entity.CommentEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.manager.VisitManager;
import com.gh.gamecenter.retrofit.JSONObjectResponse;
import com.gh.gamecenter.retrofit.OkHttpCache;
@ -303,12 +304,11 @@ public class MessageDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
statNewsViews(mConcernEntity.getId());
if (mConcernEntity.getLink() != null) {
Intent intent = new Intent(mContext, WebActivity.class);
intent.putExtra("url", mConcernEntity.getLink());
intent.putExtra("gameName", mConcernEntity.getGameName());
intent.putExtra("newsId", mConcernEntity.getId());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString(mEntrance, "+(消息详情)"));
mContext.startActivity(intent);
NewsEntity newsEntity = new NewsEntity();
newsEntity.setLink(mConcernEntity.getLink());
newsEntity.setGameName(mConcernEntity.getGameName());
newsEntity.setId(mConcernEntity.getId());
mContext.startActivity(WebActivity.getIntentByNews(mContext, newsEntity ,StringUtils.buildString(mEntrance, "+(消息详情)")));
} else {
Intent intent = new Intent(mContext, NewsDetailActivity.class);
intent.putExtra("newsId", mConcernEntity.getId());

View File

@ -12,7 +12,6 @@ import android.view.inputmethod.InputMethodManager;
import android.widget.TextView;
import com.gh.base.OnRequestCallBackListener;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.LoginUtils;
import com.gh.gamecenter.NewsDetailActivity;
@ -319,18 +318,11 @@ public class ToolBoxRvAdapter extends BaseRecyclerAdapter {
String url = toolBoxEntity.getUrl();
// http://www.ghzs666.com/article/59291e7ce9a64a496cfd6897.html
if (url.contains("http://www.ghzs666.com/article/")) {
String newsId = url.substring(url.lastIndexOf("/") + 1, url.length() - 5);
Intent intent = new Intent(mContext, NewsDetailActivity.class);
intent.putExtra("newsId", newsId);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, "工具箱列表");
String newsId = url.substring(url.lastIndexOf("/") + 1, url.length() - 5); // 5: ".html"
Intent intent = NewsDetailActivity.getIntentById(mContext, newsId, "工具箱列表");
mContext.startActivity(intent);
} else {
Intent intent = new Intent(mContext, WebActivity.class);
intent.putExtra("url", toolBoxEntity.getUrl());
intent.putExtra("isTools", true);
intent.putExtra("gameName", toolBoxEntity.getName());
intent.putExtra("ToolBoxEntity", toolBoxEntity);
mContext.startActivity(intent);
WebActivity.startWebByCollectionTools(mContext, toolBoxEntity, false);
}
}
});

View File

@ -190,7 +190,7 @@ public class ToolsAdapter extends BaseRecyclerAdapter {
intent.putExtra(EntranceUtils.KEY_ENTRANCE, "(收藏:工具箱)");
mContext.startActivity(intent);
} else {
WebActivity.startWebByCollectionTools(mContext, toolBoxEntity);
WebActivity.startWebByCollectionTools(mContext, toolBoxEntity, true);
}
}
});

View File

@ -8,7 +8,6 @@ import android.view.ViewGroup;
import com.gh.common.constant.Config;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.gamecenter.NewsDetailActivity;
import com.gh.gamecenter.R;
@ -78,17 +77,10 @@ public class GameDetailToolsAdapter extends BaseRecyclerAdapter {
if (url.contains(Config.URL_ARTICLE)) {
// 写个注释例子, http://www.ghzs666.com/article/${articleId}.html
String newsId = url.substring(url.lastIndexOf("/") + 1, url.length() - ".html".length());
Intent intent = new Intent(mContext, NewsDetailActivity.class);
intent.putExtra("newsId", newsId);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, "工具箱列表");
Intent intent = NewsDetailActivity.getIntentById(mContext, newsId, "游戏详情-工具箱");
mContext.startActivity(intent);
} else {
Intent intent = new Intent(mContext, WebActivity.class);
intent.putExtra("url", toolBoxEntity.getUrl());
intent.putExtra("isTools", true);
intent.putExtra("gameName", toolBoxEntity.getName());
intent.putExtra("ToolBoxEntity", toolBoxEntity);
mContext.startActivity(intent);
WebActivity.startWebByCollectionTools(mContext, toolBoxEntity, false);
}
}
});

View File

@ -7,12 +7,11 @@ import android.view.ViewGroup;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.ViewImageActivity;
import com.lightgame.adapter.BaseRecyclerAdapter;
import com.gh.gamecenter.adapter.viewholder.GameGalleryViewHolder;
import com.lightgame.adapter.BaseRecyclerAdapter;
import java.util.ArrayList;
import java.util.HashMap;
@ -52,10 +51,7 @@ class GameGalleryAdapter extends BaseRecyclerAdapter<GameGalleryViewHolder> {
DataCollectionUtils.uploadClick(mContext, "游戏介绍", "游戏详情");
Intent intent = new Intent(mContext, ViewImageActivity.class);
intent.putExtra("urls", gallery);
intent.putExtra("current", holder.getPosition());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, entrance);
Intent intent = ViewImageActivity.getViewImageIntent(mContext, gallery, holder.getAdapterPosition(), entrance);
mContext.startActivity(intent);
}
});

View File

@ -285,9 +285,7 @@ public class KeFuFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
break;
case "web":
if (!TextUtils.isEmpty(keFuEntity.getLink().getUrl())) {
Intent intent1 = new Intent(mContext, WebActivity.class);
intent1.putExtra("url", keFuEntity.getLink().getUrl());
mContext.startActivity(intent1);
mContext.startActivity(WebActivity.getIntentByUrl(mContext, keFuEntity.getLink().getUrl()));
}
break;
case "QQ群":

View File

@ -2,7 +2,6 @@ package com.gh.gamecenter.news;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.text.Html;
@ -18,7 +17,6 @@ import com.gh.common.util.ConcernContentUtils;
import com.gh.common.util.DataCollectionUtils;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.LibaoUtils;
import com.gh.common.util.LoginUtils;
@ -38,6 +36,7 @@ import com.gh.gamecenter.entity.CommentnumEntity;
import com.gh.gamecenter.entity.ConcernEntity;
import com.gh.gamecenter.entity.LibaoEntity;
import com.gh.gamecenter.entity.LibaoStatusEntity;
import com.gh.gamecenter.entity.NewsEntity;
import com.gh.gamecenter.entity.UserDataEntity;
import com.gh.gamecenter.entity.UserDataLibaoEntity;
import com.gh.gamecenter.entity.ViewsEntity;
@ -518,18 +517,7 @@ public class News2FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
shareContent = concernEntity.getContent();
}
if (concernEntity.getImg() != null && concernEntity.getImg().size() > 0) {
Intent intent = new Intent(mContext, ShareCardPicActivity.class);
Bundle bundle = new Bundle();
bundle.putString("gameName", concernEntity.getGameName());
bundle.putString("gameIconUrl", concernEntity.getGameIcon());
bundle.putString("shareContent", shareContent);
if (concernEntity.getLink() == null) {
bundle.putString("newsId", concernEntity.getId());
}
bundle.putStringArrayList("shareArrImg", (ArrayList<String>) concernEntity.getImg());
intent.putExtras(bundle);
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString("(资讯:关注[" + viewHolder.getAdapterPosition() + "])"));
mContext.startActivity(intent);
ShareCardPicActivity.startShareCardPicActivity(mContext, concernEntity, StringUtils.buildString("(资讯:关注[" + viewHolder.getAdapterPosition() + "])"));
} else {
Intent intent = ShareCardActivity.getIntent(mContext, concernEntity, shareContent);
mContext.startActivity(intent);
@ -552,11 +540,12 @@ public class News2FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
HaloApp.put("ConcernEntity", concernEntity);
skipPosition = viewHolder.getPosition();
if (concernEntity.getLink() != null) {
Intent intent = new Intent(mContext, WebActivity.class);
intent.putExtra("url", concernEntity.getLink());
intent.putExtra("gameName", concernEntity.getGameName());
intent.putExtra("newsId", concernEntity.getId());
intent.putExtra(EntranceUtils.KEY_ENTRANCE, StringUtils.buildString("(资讯:关注[" + viewHolder.getAdapterPosition() + "])"));
NewsEntity newsEntity = new NewsEntity();
newsEntity.setLink(concernEntity.getLink());
newsEntity.setGameName(concernEntity.getGameName());
newsEntity.setId(concernEntity.getId());
Intent intent = WebActivity.getIntentByNews(mContext, newsEntity,
StringUtils.buildString("(资讯:关注[" + viewHolder.getAdapterPosition() + "])"));
fragment.startActivityForResult(intent, NEWS2_ARTICLE_REQUEST);
} else {
Intent intent = NewsDetailActivity.getIntentById(mContext, concernEntity.getId(), StringUtils.buildString("(资讯:关注[" + viewHolder.getAdapterPosition() + "])"));

View File

@ -696,12 +696,8 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
current = i;
}
}
Intent checkIntent = new Intent(context, ViewImageActivity.class);
checkIntent.putExtra("urls", imgs);
checkIntent.putExtra("current", current);
checkIntent.putExtra("ScaleType", "FIT_CENTER");
checkIntent.putExtra(EntranceUtils.KEY_ENTRANCE, mEntrance + "+(新闻详情[" + mTitle + "])");
context.startActivity(checkIntent);
Intent intent = ViewImageActivity.getViewImageIntent(mContext, imgs, current, mEntrance + "+(新闻详情[" + mTitle + "])");
context.startActivity(intent);
}
@JavascriptInterface