Minor cleanup in calls to getContext()

This commit is contained in:
Sam Lantinga
2025-10-02 10:49:31 -07:00
parent ed6b6bb7fc
commit 11a66bd18c

View File

@@ -894,7 +894,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
protected static class SDLCommandHandler extends Handler {
@Override
public void handleMessage(Message msg) {
Context context = SDL.getContext();
Context context = getContext();
if (context == null) {
Log.e(TAG, "error handling message, getContext() returned null");
return;
@@ -1018,7 +1018,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
}
if (bShouldWait && (SDLActivity.getContext() != null)) {
if (bShouldWait && (getContext() != null)) {
// We'll wait for the surfaceChanged() method, which will notify us
// when called. That way, we know our current size is really the
// size we need, instead of grabbing a size that's still got
@@ -1028,9 +1028,9 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
// take a surprisingly long time for the surface resize, but
// then we'll just give up and return.
//
synchronized (SDLActivity.getContext()) {
synchronized (getContext()) {
try {
SDLActivity.getContext().wait(500);
getContext().wait(500);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
@@ -1213,7 +1213,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
return false;
}
InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
InputMethodManager imm = (InputMethodManager)getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
return imm.isAcceptingText();
}
@@ -1423,7 +1423,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
params.topMargin = y;
if (mTextEdit == null) {
mTextEdit = new SDLDummyEdit(SDL.getContext());
mTextEdit = new SDLDummyEdit(getContext());
mLayout.addView(mTextEdit, params);
} else {
@@ -1434,7 +1434,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
mTextEdit.setVisibility(View.VISIBLE);
mTextEdit.requestFocus();
InputMethodManager imm = (InputMethodManager) SDL.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(mTextEdit, 0);
mScreenKeyboardShown = true;
@@ -1928,7 +1928,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
}
if (Build.VERSION.SDK_INT >= 24 /* Android 7.0 (N) */) {
try {
mSurface.setPointerIcon(PointerIcon.getSystemIcon(SDL.getContext(), cursor_type));
mSurface.setPointerIcon(PointerIcon.getSystemIcon(getContext(), cursor_type));
} catch (Exception e) {
return false;
}