Fix: Remove usage of deprecated Handler constructor

This commit is contained in:
Mathias-Boulay 2022-12-22 07:45:21 +01:00
parent 33ec184108
commit 63e822325c
3 changed files with 4 additions and 5 deletions

View File

@ -44,7 +44,6 @@ import org.lwjgl.glfw.CallbackBridge;
* Class dealing with showing minecraft surface and taking inputs to dispatch them to minecraft
*/
public class MinecraftGLSurface extends View implements GrabListener{
Handler uiThreadHandler = new Handler();
/* Gamepad object for gamepad inputs, instantiated on need */
private Gamepad mGamepad = null;
/* Pointer Debug textview, used to show info about the pointer state */
@ -647,7 +646,7 @@ public class MinecraftGLSurface extends View implements GrabListener{
@Override
public void onGrabState(boolean isGrabbing) {
uiThreadHandler.post(()->updateGrabState(isGrabbing));
post(()->updateGrabState(isGrabbing));
}
private void updateGrabState(boolean isGrabbing) {

View File

@ -33,7 +33,6 @@ public class Touchpad extends FrameLayout implements GrabListener{
private final ImageView mMousePointerImageView = new ImageView(getContext());
/* Detect a classic android Tap */
private final GestureDetector mSingleTapDetector = new GestureDetector(getContext(), new SingleTapConfirm());
private final Handler uiThreadHandler = new Handler();
/* Resolution scaler option, allow downsizing a window */
private final float mScaleFactor = DEFAULT_PREF.getInt("resolutionRatio",100)/100f;
/* Current pointer ID to move the mouse */
@ -181,7 +180,7 @@ public class Touchpad extends FrameLayout implements GrabListener{
@Override
public void onGrabState(boolean isGrabbing) {
uiThreadHandler.post(()->updateGrabState(isGrabbing));
post(()->updateGrabState(isGrabbing));
}
private void updateGrabState(boolean isGrabbing) {
if(!isGrabbing) {

View File

@ -7,6 +7,7 @@ import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Process;
import android.util.Log;
@ -28,7 +29,7 @@ import net.kdt.pojavlaunch.progresskeeper.TaskCountListener;
*/
public class ProgressService extends Service implements TaskCountListener {
private final Handler mainThreadHandler = new Handler();
private final Handler mainThreadHandler = new Handler(Looper.getMainLooper());
private NotificationManagerCompat notificationManagerCompat;
/** Simple wrapper to start the service */