| | |
| | | import android.util.Log; |
| | | import android.view.KeyEvent; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | | import android.widget.FrameLayout; |
| | | import android.widget.RelativeLayout; |
| | | import android.widget.Toast; |
| | |
| | | private RelativeLayout m_MainContainer; |
| | | private int mType; |
| | | private boolean isNotch = false; |
| | | |
| | | private int gameWidth; |
| | | private int gameHeight; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) |
| | |
| | | |
| | | DisplayMetrics dm = new DisplayMetrics(); |
| | | this.getWindowManager().getDefaultDisplay().getMetrics(dm); |
| | | if(gameWidth == 0){ |
| | | gameWidth = dm.widthPixels; |
| | | } |
| | | |
| | | if(gameHeight == 0) |
| | | { |
| | | gameHeight = dm.heightPixels; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | public void onConfigurationChanged(Configuration newConfig) |
| | | { |
| | | //LogUtil.i(TAG, "onConfigurationChanged"); |
| | | NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer); |
| | | if (isNotch) |
| | | { |
| | | NotchPhoneUtil.onConfigurationChanged(this, isNotch, mType, m_MainContainer); |
| | | } |
| | | else |
| | | { |
| | | mUnityPlayer.getView().getLayoutParams().width = gameWidth; |
| | | mUnityPlayer.getView().getLayoutParams().height = gameHeight; |
| | | } |
| | | |
| | | H2EngineSDK.onConfigurationChanged(newConfig); |
| | | |
| | | super.onConfigurationChanged(newConfig); |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |