123 lines
5.3 KiB
Java
123 lines
5.3 KiB
Java
package com.gh.gamecenter;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
import android.view.View;
|
|
|
|
import com.gh.common.util.EntranceUtils;
|
|
import com.gh.gamecenter.entity.ConcernEntity;
|
|
import com.gh.gamecenter.entity.NewsEntity;
|
|
import com.gh.gamecenter.entity.ToolBoxEntity;
|
|
import com.halo.assistant.fragment.WebFragment;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
/**
|
|
* Created by khy on 2016/10/18.
|
|
*/
|
|
@Deprecated
|
|
public class WebActivity extends NormalActivity {
|
|
|
|
@Override
|
|
protected Intent provideNormalIntent() {
|
|
return getTargetIntent(this, WebActivity.class, WebFragment.class);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getCommunityRuleIntent(Context context) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, context.getString(R.string.community_rule_title));
|
|
bundle.putString(EntranceUtils.KEY_URL, context.getString(R.string.community_rule_url));
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getWebIntent(Context context) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, context.getString(R.string.disclaimer_title));
|
|
bundle.putString(EntranceUtils.KEY_URL, context.getString(R.string.disclaimer_url));
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getUploadProtocolIntent(Context context) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, context.getString(R.string.upload_protocol_title));
|
|
bundle.putString(EntranceUtils.KEY_URL, context.getString(R.string.upload_protocol_url));
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
|
|
@NonNull
|
|
public static Intent getPrivacyPolicyIntent(Context context) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, context.getString(R.string.privacy_policy_title));
|
|
bundle.putString(EntranceUtils.KEY_URL, context.getString(R.string.privacy_policy_url));
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
@NonNull
|
|
public static Intent getUploadPolicyIntent(Context context) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, context.getString(R.string.upload_game_policy_title));
|
|
bundle.putString(EntranceUtils.KEY_URL, context.getString(R.string.upload_game_policy_url));
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getCommentRulesIntent(Context context) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, context.getString(R.string.comment_rules_title));
|
|
bundle.putString(EntranceUtils.KEY_URL, context.getString(R.string.comment_rules_url));
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getWebByCollectionTools(Context context, ToolBoxEntity toolBoxEntity, boolean isCollectionTools) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_URL, toolBoxEntity.getUrl());
|
|
bundle.putBoolean(WebFragment.KEY_ISTOOLS, true);
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, toolBoxEntity.getName());
|
|
bundle.putParcelable(ToolBoxEntity.TAG, toolBoxEntity);
|
|
bundle.putBoolean(WebFragment.KEY_ISCOLLECTIONTOOLS, isCollectionTools);
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getIntentByNews(Context context, ConcernEntity concernEntity, String entrance) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_URL, concernEntity.getLink());
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, concernEntity.getGameName());
|
|
bundle.putString(EntranceUtils.KEY_NEWSID, concernEntity.getId());
|
|
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getIntentByNews(Context context, NewsEntity newsEntity, String entrance) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_URL, newsEntity.getLink());
|
|
bundle.putString(EntranceUtils.KEY_GAMENAME, newsEntity.getGameName());
|
|
bundle.putString(EntranceUtils.KEY_NEWSID, newsEntity.getId());
|
|
bundle.putString(EntranceUtils.KEY_ENTRANCE, entrance);
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@NonNull
|
|
public static Intent getIntentByUrl(Context context, String url) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putString(EntranceUtils.KEY_URL, url);
|
|
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
|
}
|
|
|
|
@Override
|
|
protected View.OnClickListener provideNavigationItemClickListener() {
|
|
Bundle bundle = getIntent().getBundleExtra(NORMAL_FRAGMENT_BUNDLE);
|
|
if (bundle != null && bundle.getBoolean(WebFragment.KEY_ISTOOLS, false)) {
|
|
return view -> finish();
|
|
} else {
|
|
return super.provideNavigationItemClickListener();
|
|
}
|
|
}
|
|
}
|