优化h5小游戏全屏展示
This commit is contained in:
@ -42,8 +42,8 @@ import com.gh.common.view.DrawableView;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.dialog.DownloadDialog;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
import com.gh.gamecenter.H5GameActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.baselist.LoadStatus;
|
||||
import com.gh.gamecenter.databinding.KaifuAddItemBinding;
|
||||
import com.gh.gamecenter.databinding.KaifuDetailItemRowBinding;
|
||||
@ -485,7 +485,7 @@ public class BindingAdapters {
|
||||
HistoryHelper.insertGameEntity(gameEntity);
|
||||
}
|
||||
|
||||
Intent i = new Intent(H5GameActivity.getIntentForWebGame(progressBar.getContext(), linkEntity.getLink(), gameEntity.getName(), isPlay));
|
||||
Intent i = new Intent(WebActivity.getIntentForWebGame(progressBar.getContext(), linkEntity.getLink(), gameEntity.getName(), isPlay));
|
||||
progressBar.getContext().startActivity(i);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -18,8 +18,8 @@ import com.gh.common.repository.ReservationRepository;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.dialog.DownloadDialog;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
import com.gh.gamecenter.H5GameActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.adapter.viewholder.GameViewHolder;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
@ -434,7 +434,7 @@ public class DownloadItemUtils {
|
||||
HistoryHelper.insertGameEntity(gameEntity);
|
||||
}
|
||||
|
||||
Intent i = H5GameActivity.getIntentForWebGame(context, gameEntity.getH5Link().getLink(), gameEntity.getName(), isPlay);
|
||||
Intent i = WebActivity.getIntentForWebGame(context, gameEntity.getH5Link().getLink(), gameEntity.getName(), isPlay);
|
||||
context.startActivity(i);
|
||||
});
|
||||
} else if (gameEntity.getApk().size() == 1) {
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
package com.gh.gamecenter
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.gh.base.BaseActivity
|
||||
import com.gh.common.util.EntranceUtils
|
||||
import com.halo.assistant.fragment.WebFragment
|
||||
|
||||
class H5GameActivity : BaseActivity() {
|
||||
|
||||
override fun getLayoutId(): Int = R.layout.activity_h5_game
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val containerFragment = WebFragment().with(intent.extras)
|
||||
// 若 placeholder 外层为 RelativeLayout 的话,会出现莫名的偏移
|
||||
supportFragmentManager.beginTransaction().replace(R.id.placeholder, containerFragment).commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun getIntentForWebGame(context: Context?, url: String?, gameName: String?, interveneBackpress: Boolean): Intent {
|
||||
val intent = Intent(context, H5GameActivity::class.java)
|
||||
intent.putExtra(EntranceUtils.KEY_URL, url)
|
||||
intent.putExtra(WebFragment.KEY_GAME_NAME, gameName)
|
||||
intent.putExtra(WebFragment.KEY_LEAVE_WEB_PAGE_TO_HANDLE_TITLE, true)
|
||||
if (interveneBackpress) {
|
||||
intent.putExtra(WebFragment.KEY_REQUIRE_BACK_CONFIRMATION, true)
|
||||
intent.putExtra(WebFragment.KEY_BACK_CONFIRMATION_CONTENT, "退出后将不保存当前游戏进度,确定退出吗?")
|
||||
}
|
||||
return intent
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.gh.gamecenter;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.common.constant.Constants;
|
||||
@ -18,12 +19,31 @@ import java.util.Locale;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import static com.halo.assistant.fragment.WebFragment.KEY_GAME_NAME;
|
||||
import static com.halo.assistant.fragment.WebFragment.KEY_REQUIRE_BACK_CONFIRMATION;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/10/18.
|
||||
*/
|
||||
@Deprecated
|
||||
public class WebActivity extends NormalActivity {
|
||||
|
||||
private boolean mIsFullScreen;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
String mGameName = getIntent().getBundleExtra(NORMAL_FRAGMENT_BUNDLE).getString(KEY_GAME_NAME);
|
||||
boolean mIsBackpressRequireConfirmation = getIntent().getBundleExtra(NORMAL_FRAGMENT_BUNDLE).getBoolean(KEY_REQUIRE_BACK_CONFIRMATION, false);
|
||||
mIsFullScreen = !TextUtils.isEmpty(mGameName) && mIsBackpressRequireConfirmation;
|
||||
if (mIsFullScreen) {
|
||||
setTheme(R.style.AppFullScreenTheme);
|
||||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
if (mIsFullScreen) {
|
||||
hideToolbar(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent provideNormalIntent() {
|
||||
return getTargetIntent(this, WebActivity.class, WebFragment.class);
|
||||
@ -200,17 +220,17 @@ public class WebActivity extends NormalActivity {
|
||||
return getTargetIntent(context, WebActivity.class, WebFragment.class, bundle);
|
||||
}
|
||||
|
||||
/*public static Intent getIntentForWebGame(Context context, String url, String gameName, boolean interveneBackpress) {
|
||||
public static Intent getIntentForWebGame(Context context, String url, String gameName, boolean interveneBackpress) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_URL, url);
|
||||
bundle.putString(WebFragment.KEY_GAME_NAME, gameName);
|
||||
bundle.putString(KEY_GAME_NAME, gameName);
|
||||
bundle.putBoolean(WebFragment.KEY_LEAVE_WEB_PAGE_TO_HANDLE_TITLE, true);
|
||||
if (interveneBackpress) {
|
||||
bundle.putBoolean(WebFragment.KEY_REQUIRE_BACK_CONFIRMATION, true);
|
||||
bundle.putBoolean(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() {
|
||||
|
||||
@ -27,8 +27,8 @@ import com.gh.common.view.DownloadProgressBar;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.dialog.DownloadDialog;
|
||||
import com.gh.gamecenter.DownloadManagerActivity;
|
||||
import com.gh.gamecenter.H5GameActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.WebActivity;
|
||||
import com.gh.gamecenter.entity.ApkEntity;
|
||||
import com.gh.gamecenter.entity.GameEntity;
|
||||
import com.gh.gamecenter.entity.LinkEntity;
|
||||
@ -253,7 +253,7 @@ public class DetailViewHolder {
|
||||
HistoryHelper.insertGameEntity(mGameEntity);
|
||||
}
|
||||
|
||||
Intent i = new Intent(H5GameActivity.getIntentForWebGame(mViewHolder.context, linkEntity.getLink(), mGameEntity.getName(),isPlay));
|
||||
Intent i = new Intent(WebActivity.getIntentForWebGame(mViewHolder.context, linkEntity.getLink(), mGameEntity.getName(),isPlay));
|
||||
mViewHolder.context.startActivity(i);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user