SDL: System bar will auto-hide after keyboard was hidden
This commit is contained in:
@@ -352,7 +352,7 @@ public class MainActivity extends Activity
|
||||
_ad.getView().setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.TOP | Gravity.RIGHT));
|
||||
}
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.get().dim(mGLView);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
|
||||
Rect r = new Rect();
|
||||
_videoLayout.getWindowVisibleDisplayFrame(r);
|
||||
@@ -361,12 +361,27 @@ public class MainActivity extends Activity
|
||||
{
|
||||
public void onGlobalLayout()
|
||||
{
|
||||
Rect r = new Rect();
|
||||
final Rect r = new Rect();
|
||||
_videoLayout.getWindowVisibleDisplayFrame(r);
|
||||
int heightDiff = _videoLayout.getRootView().getHeight() - _videoLayout.getHeight(); // Take system bar into consideration
|
||||
int widthDiff = _videoLayout.getRootView().getWidth() - _videoLayout.getWidth(); // Nexus 5 has system bar at the right side
|
||||
final int heightDiff = _videoLayout.getRootView().getHeight() - _videoLayout.getHeight(); // Take system bar into consideration
|
||||
final int widthDiff = _videoLayout.getRootView().getWidth() - _videoLayout.getWidth(); // Nexus 5 has system bar at the right side
|
||||
Log.v("SDL", "Main window visible region changed: " + r.left + ":" + r.top + ":" + r.width() + ":" + r.height() );
|
||||
mGLView.nativeScreenVisibleRect(r.left + widthDiff, r.top + heightDiff, r.width(), r.height());
|
||||
_videoLayout.postDelayed( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
mGLView.nativeScreenVisibleRect(r.left + widthDiff, r.top + heightDiff, r.width(), r.height());
|
||||
}
|
||||
}, 300 );
|
||||
_videoLayout.postDelayed( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
mGLView.nativeScreenVisibleRect(r.left + widthDiff, r.top + heightDiff, r.width(), r.height());
|
||||
}
|
||||
}, 600 );
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -394,7 +409,7 @@ public class MainActivity extends Activity
|
||||
if( mGLView != null )
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.get().dim(mGLView);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
mGLView.onResume();
|
||||
}
|
||||
else
|
||||
@@ -481,7 +496,7 @@ public class MainActivity extends Activity
|
||||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
|
||||
_inputManager.hideSoftInputFromWindow(mGLView.getWindowToken(), 0);
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.get().dim(mGLView);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -626,14 +641,14 @@ public class MainActivity extends Activity
|
||||
mGLView.setFocusable(true);
|
||||
mGLView.requestFocus();
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.get().dim(mGLView);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
|
||||
_videoLayout.postDelayed( new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.get().dim(mGLView);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
}
|
||||
}, 500 );
|
||||
};
|
||||
@@ -748,34 +763,6 @@ public class MainActivity extends Activity
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(final KeyEvent event)
|
||||
{
|
||||
//Log.i("SDL", "dispatchKeyEvent: action " + event.getAction() + " keycode " + event.getKeyCode() + " unicode " + event.getUnicodeChar() + " getCharacters() " + ((event.getCharacters() != null) ? event.getCharacters() : "none"));
|
||||
|
||||
if( event.getAction() == KeyEvent.ACTION_DOWN )
|
||||
return onKeyDown(event.getKeyCode(), event);
|
||||
if( event.getAction() == KeyEvent.ACTION_UP )
|
||||
return onKeyUp(event.getKeyCode(), event);
|
||||
if( event.getAction() == KeyEvent.ACTION_MULTIPLE && event.getKeyCode() == KeyEvent.KEYCODE_UNKNOWN )
|
||||
{
|
||||
// International text input
|
||||
if( mGLView != null && event.getCharacters() != null )
|
||||
{
|
||||
for(int i = 0; i < event.getCharacters().length(); i++ )
|
||||
{
|
||||
mGLView.nativeKey( event.getKeyCode(), 1, event.getCharacters().codePointAt(i) );
|
||||
mGLView.nativeKey( event.getKeyCode(), 0, event.getCharacters().codePointAt(i) );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
//return super.dispatchKeyEvent(event);
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, final KeyEvent event)
|
||||
{
|
||||
@@ -811,7 +798,7 @@ public class MainActivity extends Activity
|
||||
if( keyCode == KeyEvent.KEYCODE_BACK || keyCode == KeyEvent.KEYCODE_MENU )
|
||||
{
|
||||
DimSystemStatusBar.get().dim(_videoLayout);
|
||||
DimSystemStatusBar.get().dim(mGLView);
|
||||
//DimSystemStatusBar.get().dim(mGLView);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user