mirror of https://github.com/axmolengine/axmol.git
hide virtual button by default
This commit is contained in:
parent
925e938724
commit
8634773be3
|
@ -12,4 +12,4 @@
|
|||
|
||||
android.library=true
|
||||
# Project target.
|
||||
target=android-10
|
||||
target=android-21
|
||||
|
|
|
@ -39,6 +39,7 @@ import android.preference.PreferenceManager.OnActivityResultListener;
|
|||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -258,6 +259,8 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
protected void onCreate(final Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
this.hideVirtualButton();
|
||||
|
||||
onLoadNativeLibraries();
|
||||
|
||||
sContext = this;
|
||||
|
@ -301,6 +304,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
protected void onResume() {
|
||||
Log.d(TAG, "onResume()");
|
||||
super.onResume();
|
||||
this.hideVirtualButton();
|
||||
resumeIfHasFocus();
|
||||
}
|
||||
|
||||
|
@ -308,6 +312,7 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
public void onWindowFocusChanged(boolean hasFocus) {
|
||||
Log.d(TAG, "onWindowFocusChanged() hasFocus=" + hasFocus);
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
this.hideVirtualButton();
|
||||
|
||||
this.hasFocus = hasFocus;
|
||||
resumeIfHasFocus();
|
||||
|
@ -411,6 +416,20 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
return glSurfaceView;
|
||||
}
|
||||
|
||||
protected void hideVirtualButton() {
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
|
||||
getWindow().getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
|
||||
| View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
|
||||
| View.SYSTEM_UI_FLAG_IMMERSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
private final static boolean isAndroidEmulator() {
|
||||
String model = Build.MODEL;
|
||||
Log.d(TAG, "model=" + model);
|
||||
|
|
Loading…
Reference in New Issue