This commit is contained in:
chenjuntao
2019-12-13 15:23:41 +08:00
parent a9428ddb3b
commit fd7b9263bf
9 changed files with 288 additions and 157 deletions

View File

@ -125,7 +125,7 @@ public class WebActivity extends NormalActivity {
url = String.format(Locale.CHINA, "%s?user_id=%s&name=%s&icon=%s&timestamp=%d", url, userId, name, URLEncoder.encode(icon), Math.round(new Date().getTime() / 1000));
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_URL, url);
bundle.putBoolean(WebFragment.KEY_IS_BADGE_CENTER, true);
bundle.putBoolean(WebFragment.KEY_LEAVE_WEB_PAGE_TO_HANDLE_TITLE, true);
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
}
@ -154,9 +154,29 @@ public class WebActivity extends NormalActivity {
public static Intent getIntentByUrl(Context context, String url) {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_URL, url);
return getIntentByUrl(context, url, false);
}
@NonNull
public static Intent getIntentByUrl(Context context, String url, boolean leaveWebPageHandleTitle) {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_URL, url);
bundle.putBoolean(WebFragment.KEY_LEAVE_WEB_PAGE_TO_HANDLE_TITLE, leaveWebPageHandleTitle);
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
}
public static Intent getIntentForWebGame(Context context, String url, String gameName, boolean disableWebviewBackStack) {
Bundle bundle = new Bundle();
bundle.putString(EntranceUtils.KEY_URL, url);
bundle.putString(WebFragment.KEY_GAME_NAME, gameName);
bundle.putBoolean(WebFragment.KEY_LEAVE_WEB_PAGE_TO_HANDLE_TITLE, true);
if (disableWebviewBackStack) {
bundle.putBoolean(WebFragment.KEY_REQUIRE_BACK_CONFIRMATION, true);
bundle.putString(WebFragment.KEY_BACK_CONFIRMATION_CONTENT, "退出后将不保存当前游戏进度,确定退出吗?");
}
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
}
@Override
protected View.OnClickListener provideNavigationItemClickListener() {
Bundle bundle = getIntent().getBundleExtra(NORMAL_FRAGMENT_BUNDLE);