Android: Format Java code

This commit is contained in:
Connor McLaughlin 2020-10-24 16:04:27 +10:00
parent 076d3d3479
commit 9a7999f158
11 changed files with 71 additions and 104 deletions

View file

@ -6,8 +6,6 @@ import android.util.Log;
import android.view.Surface; import android.view.Surface;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.snackbar.Snackbar;
public class AndroidHostInterface { public class AndroidHostInterface {
public final static int DISPLAY_ALIGNMENT_TOP_OR_LEFT = 0; public final static int DISPLAY_ALIGNMENT_TOP_OR_LEFT = 0;
public final static int DISPLAY_ALIGNMENT_CENTER = 1; public final static int DISPLAY_ALIGNMENT_CENTER = 1;
@ -72,11 +70,13 @@ public class AndroidHostInterface {
public native void setDisplayAlignment(int alignment); public native void setDisplayAlignment(int alignment);
public native CheatCode[] getCheatList(); public native CheatCode[] getCheatList();
public native void setCheatEnabled(int index, boolean enabled); public native void setCheatEnabled(int index, boolean enabled);
public native void addOSDMessage(String message, float duration); public native void addOSDMessage(String message, float duration);
public native boolean hasAnyBIOSImages(); public native boolean hasAnyBIOSImages();
public native String importBIOSImage(byte[] data); public native String importBIOSImage(byte[] data);
static { static {

View file

@ -2,8 +2,6 @@ package com.github.stenzek.duckstation;
import android.app.Activity; import android.app.Activity;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.content.Context;
import android.util.Log;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
@ -31,6 +29,7 @@ public class AndroidProgressCallback {
mDialog.setTitle(text); mDialog.setTitle(text);
}); });
} }
public void setStatusText(String text) { public void setStatusText(String text) {
mContext.runOnUiThread(() -> { mContext.runOnUiThread(() -> {
mDialog.setMessage(text); mDialog.setMessage(text);

View file

@ -11,7 +11,15 @@ public class CheatCode {
mEnabled = enabled; mEnabled = enabled;
} }
public int getIndex() { return mIndex; } public int getIndex() {
public String getName() { return mName; } return mIndex;
public boolean isEnabled() { return mEnabled; } }
public String getName() {
return mName;
}
public boolean isEnabled() {
return mEnabled;
}
} }

View file

@ -1,31 +1,21 @@
package com.github.stenzek.duckstation; package com.github.stenzek.duckstation;
import android.annotation.SuppressLint;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.hardware.input.InputManager; import android.hardware.input.InputManager;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.util.AndroidException;
import android.util.Log; import android.util.Log;
import android.view.Menu;
import android.view.SurfaceHolder; import android.view.SurfaceHolder;
import android.view.View; import android.view.View;
import android.view.MenuItem;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.appcompat.widget.PopupMenu; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
/** /**
@ -253,8 +243,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
AndroidHostInterface.getInstance().setDisplayAlignment(AndroidHostInterface.DISPLAY_ALIGNMENT_CENTER); AndroidHostInterface.getInstance().setDisplayAlignment(AndroidHostInterface.DISPLAY_ALIGNMENT_CENTER);
} }
private void enableFullscreenImmersive() private void enableFullscreenImmersive() {
{
getWindow().getDecorView().setSystemUiVisibility( getWindow().getDecorView().setSystemUiVisibility(
View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
@ -271,8 +260,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
private void showMenu() { private void showMenu() {
AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setItems(R.array.emulation_menu, (dialogInterface, i) -> { builder.setItems(R.array.emulation_menu, (dialogInterface, i) -> {
switch (i) switch (i) {
{
case 0: // Quick Load case 0: // Quick Load
{ {
AndroidHostInterface.getInstance().loadState(false, mSaveStateSlot); AndroidHostInterface.getInstance().loadState(false, mSaveStateSlot);
@ -333,8 +321,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
builder.setTitle(mGameTitle); builder.setTitle(mGameTitle);
builder.setItems(R.array.emulation_more_menu, (dialogInterface, i) -> { builder.setItems(R.array.emulation_more_menu, (dialogInterface, i) -> {
switch (i) switch (i) {
{
case 0: // Reset case 0: // Reset
{ {
AndroidHostInterface.getInstance().resetSystem(); AndroidHostInterface.getInstance().resetSystem();
@ -434,6 +421,7 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
} }
private InputManager.InputDeviceListener mInputDeviceListener; private InputManager.InputDeviceListener mInputDeviceListener;
private void registerInputDeviceListener() { private void registerInputDeviceListener() {
if (mInputDeviceListener != null) if (mInputDeviceListener != null)
return; return;
@ -458,18 +446,19 @@ public class EmulationActivity extends AppCompatActivity implements SurfaceHolde
} }
}; };
InputManager inputManager = ((InputManager)getSystemService(Context.INPUT_SERVICE)); InputManager inputManager = ((InputManager) getSystemService(Context.INPUT_SERVICE));
if (inputManager != null) if (inputManager != null)
inputManager.registerInputDeviceListener(mInputDeviceListener, null); inputManager.registerInputDeviceListener(mInputDeviceListener, null);
} }
private void unregisterInputDeviceListener() { private void unregisterInputDeviceListener() {
if (mInputDeviceListener == null) if (mInputDeviceListener == null)
return; return;
InputManager inputManager = ((InputManager)getSystemService(Context.INPUT_SERVICE)); InputManager inputManager = ((InputManager) getSystemService(Context.INPUT_SERVICE));
if (inputManager != null) if (inputManager != null)
inputManager.unregisterInputDeviceListener(mInputDeviceListener); inputManager.unregisterInputDeviceListener(mInputDeviceListener);
mInputDeviceListener = null; mInputDeviceListener = null;
} }
} }

View file

@ -1,11 +1,8 @@
package com.github.stenzek.duckstation; package com.github.stenzek.duckstation;
import android.content.Context; import android.content.Context;
import android.hardware.input.InputManager;
import android.util.ArrayMap;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log; import android.util.Log;
import android.util.Pair;
import android.view.InputDevice; import android.view.InputDevice;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
@ -194,10 +191,7 @@ public class EmulationSurfaceView extends SurfaceView {
if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) if ((sources & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD)
return true; return true;
if ((sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD) return (sources & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD;
return true;
return false;
} }
public boolean initControllerMapping(String controllerType) { public boolean initControllerMapping(String controllerType) {

View file

@ -1,21 +1,14 @@
package com.github.stenzek.duckstation; package com.github.stenzek.duckstation;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.util.ArraySet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.TextView;
import androidx.preference.PreferenceManager;
import java.util.Arrays; import java.util.Arrays;
import java.util.Comparator; import java.util.Comparator;
import java.util.Set;
public class GameList { public class GameList {
private Activity mContext; private Activity mContext;

View file

@ -1,49 +1,34 @@
package com.github.stenzek.duckstation; package com.github.stenzek.duckstation;
import android.Manifest; import android.Manifest;
import android.content.ContentResolver; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import android.view.Gravity;
import com.google.android.material.snackbar.Snackbar; import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.Toast;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.documentfile.provider.DocumentFile;
import androidx.preference.PreferenceManager; import androidx.preference.PreferenceManager;
import android.content.Intent;
import androidx.collection.ArraySet;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.PopupMenu;
import android.widget.Toast;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.prefs.Preferences;
import static com.google.android.material.snackbar.Snackbar.make;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private static final int REQUEST_EXTERNAL_STORAGE_PERMISSIONS = 1; private static final int REQUEST_EXTERNAL_STORAGE_PERMISSIONS = 1;
@ -188,7 +173,8 @@ public class MainActivity extends AppCompatActivity {
.setMessage("Failed to get path for the selected file. Please make sure the file is in internal/external storage.\n\n" + .setMessage("Failed to get path for the selected file. Please make sure the file is in internal/external storage.\n\n" +
"Tap the overflow button in the directory selector.\nSelect \"Show Internal Storage\".\n" + "Tap the overflow button in the directory selector.\nSelect \"Show Internal Storage\".\n" +
"Tap the menu button and select your device name or SD card.") "Tap the menu button and select your device name or SD card.")
.setPositiveButton("OK", (dialog, button) -> {}) .setPositiveButton("OK", (dialog, button) -> {
})
.create() .create()
.show(); .show();
return null; return null;
@ -205,7 +191,8 @@ public class MainActivity extends AppCompatActivity {
.setMessage("Failed to get path for the selected directory. Please make sure the directory is in internal/external storage.\n\n" + .setMessage("Failed to get path for the selected directory. Please make sure the directory is in internal/external storage.\n\n" +
"Tap the overflow button in the directory selector.\nSelect \"Show Internal Storage\".\n" + "Tap the overflow button in the directory selector.\nSelect \"Show Internal Storage\".\n" +
"Tap the menu button and select your device name or SD card.") "Tap the menu button and select your device name or SD card.")
.setPositiveButton("OK", (dialog, button) -> {}) .setPositiveButton("OK", (dialog, button) -> {
})
.create() .create()
.show(); .show();
return null; return null;
@ -323,7 +310,8 @@ public class MainActivity extends AppCompatActivity {
.setTitle("Missing BIOS Image") .setTitle("Missing BIOS Image")
.setMessage("No BIOS image was found in DuckStation's bios directory. Do you with to locate and import a BIOS image now?") .setMessage("No BIOS image was found in DuckStation's bios directory. Do you with to locate and import a BIOS image now?")
.setPositiveButton("Yes", (dialog, button) -> importBIOSImage()) .setPositiveButton("Yes", (dialog, button) -> importBIOSImage())
.setNegativeButton("No", (dialog, button) -> {}) .setNegativeButton("No", (dialog, button) -> {
})
.create() .create()
.show(); .show();
@ -362,7 +350,8 @@ public class MainActivity extends AppCompatActivity {
} catch (IOException e) { } catch (IOException e) {
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setMessage("Failed to read BIOS image: " + e.getMessage()) .setMessage("Failed to read BIOS image: " + e.getMessage())
.setPositiveButton("OK", (dialog, button) -> {}) .setPositiveButton("OK", (dialog, button) -> {
})
.create() .create()
.show(); .show();
return; return;
@ -372,9 +361,10 @@ public class MainActivity extends AppCompatActivity {
String message = (importResult == null) ? "This BIOS image is invalid, or has already been imported." : ("BIOS '" + importResult + "' imported."); String message = (importResult == null) ? "This BIOS image is invalid, or has already been imported." : ("BIOS '" + importResult + "' imported.");
new AlertDialog.Builder(this) new AlertDialog.Builder(this)
.setMessage(message) .setMessage(message)
.setPositiveButton("OK", (dialog, button) -> {}) .setPositiveButton("OK", (dialog, button) -> {
.create() })
.show(); .create()
.show();
} }
} }

View file

@ -46,6 +46,7 @@ public class SettingsActivity extends AppCompatActivity {
public static class SettingsFragment extends PreferenceFragmentCompat { public static class SettingsFragment extends PreferenceFragmentCompat {
private int resourceId; private int resourceId;
public SettingsFragment(int resourceId) { public SettingsFragment(int resourceId) {
this.resourceId = resourceId; this.resourceId = resourceId;
} }

View file

@ -4,7 +4,6 @@ import android.content.Context;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.View; import android.view.View;
public class TouchscreenControllerAxisView extends View { public class TouchscreenControllerAxisView extends View {
@ -84,21 +83,21 @@ public class TouchscreenControllerAxisView extends View {
} }
public void setPressed(int pointerId, float pointerX, float pointerY) { public void setPressed(int pointerId, float pointerX, float pointerY) {
final float dx = pointerX - (float)(getX() + (float)(getWidth() / 2)); final float dx = pointerX - (float) (getX() + (float) (getWidth() / 2));
final float dy = pointerY - (float)(getY() + (float)(getHeight() / 2)); final float dy = pointerY - (float) (getY() + (float) (getHeight() / 2));
// Log.i("SetPressed", String.format("px=%f,py=%f dx=%f,dy=%f", pointerX, pointerY, dx, dy)); // Log.i("SetPressed", String.format("px=%f,py=%f dx=%f,dy=%f", pointerX, pointerY, dx, dy));
final float pointerDistance = Math.max(Math.abs(dx), Math.abs(dy)); final float pointerDistance = Math.max(Math.abs(dx), Math.abs(dy));
final float angle = (float)Math.atan2((double)dy, (double)dx); final float angle = (float) Math.atan2((double) dy, (double) dx);
final float maxDistance = (float)Math.min((getWidth() - getPaddingLeft() - getPaddingRight()) / 2, (getHeight() - getPaddingTop() - getPaddingBottom()) / 2); final float maxDistance = (float) Math.min((getWidth() - getPaddingLeft() - getPaddingRight()) / 2, (getHeight() - getPaddingTop() - getPaddingBottom()) / 2);
final float length = Math.min(pointerDistance / maxDistance, 1.0f); final float length = Math.min(pointerDistance / maxDistance, 1.0f);
// Log.i("SetPressed", String.format("pointerDist=%f,angle=%f,w=%d,h=%d,maxDist=%f,length=%f", pointerDistance, angle, getWidth(), getHeight(), maxDistance, length)); // Log.i("SetPressed", String.format("pointerDist=%f,angle=%f,w=%d,h=%d,maxDist=%f,length=%f", pointerDistance, angle, getWidth(), getHeight(), maxDistance, length));
final float xValue = (float)Math.cos((double)angle) * length; final float xValue = (float) Math.cos((double) angle) * length;
final float yValue = (float)Math.sin((double)angle) * length; final float yValue = (float) Math.sin((double) angle) * length;
mDrawXPos = (int)(xValue * maxDistance); mDrawXPos = (int) (xValue * maxDistance);
mDrawYPos = (int)(yValue * maxDistance); mDrawYPos = (int) (yValue * maxDistance);
boolean doUpdate = (pointerId != mPointerId || !mPressed || (xValue != mXValue || yValue != mYValue)); boolean doUpdate = (pointerId != mPointerId || !mPressed || (xValue != mXValue || yValue != mYValue));
mPointerId = pointerId; mPointerId = pointerId;
@ -128,7 +127,7 @@ public class TouchscreenControllerAxisView extends View {
hostInterface.setControllerButtonState(mControllerIndex, mRightButtonCode, (mXValue >= BUTTON_THRESHOLD)); hostInterface.setControllerButtonState(mControllerIndex, mRightButtonCode, (mXValue >= BUTTON_THRESHOLD));
if (mUpButtonCode >= 0) if (mUpButtonCode >= 0)
hostInterface.setControllerButtonState(mControllerIndex, mUpButtonCode, (mYValue <= -BUTTON_THRESHOLD)); hostInterface.setControllerButtonState(mControllerIndex, mUpButtonCode, (mYValue <= -BUTTON_THRESHOLD));
if (mDownButtonCode >= 0) if (mDownButtonCode >= 0)
hostInterface.setControllerButtonState(mControllerIndex, mDownButtonCode, (mYValue >= BUTTON_THRESHOLD)); hostInterface.setControllerButtonState(mControllerIndex, mDownButtonCode, (mYValue >= BUTTON_THRESHOLD));
} }

View file

@ -5,8 +5,6 @@ import android.content.res.TypedArray;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
/** /**

View file

@ -42,8 +42,7 @@ public class TouchscreenControllerView extends FrameLayout {
removeAllViews(); removeAllViews();
LayoutInflater inflater = LayoutInflater.from(getContext()); LayoutInflater inflater = LayoutInflater.from(getContext());
switch (viewType) switch (viewType) {
{
case "digital": case "digital":
mMainView = inflater.inflate(R.layout.layout_touchscreen_controller_digital, this, true); mMainView = inflater.inflate(R.layout.layout_touchscreen_controller_digital, this, true);
break; break;
@ -95,7 +94,7 @@ public class TouchscreenControllerView extends FrameLayout {
if (buttonView == null) if (buttonView == null)
return; return;
int code = AndroidHostInterface.getInstance().getControllerButtonCode(mControllerType, buttonName); int code = AndroidHostInterface.getControllerButtonCode(mControllerType, buttonName);
Log.i("TouchscreenController", String.format("%s -> %d", buttonName, code)); Log.i("TouchscreenController", String.format("%s -> %d", buttonName, code));
if (code >= 0) { if (code >= 0) {
@ -112,8 +111,8 @@ public class TouchscreenControllerView extends FrameLayout {
if (axisView == null) if (axisView == null)
return false; return false;
int xCode = AndroidHostInterface.getInstance().getControllerAxisCode(mControllerType, axisName + "X"); int xCode = AndroidHostInterface.getControllerAxisCode(mControllerType, axisName + "X");
int yCode = AndroidHostInterface.getInstance().getControllerAxisCode(mControllerType, axisName + "Y"); int yCode = AndroidHostInterface.getControllerAxisCode(mControllerType, axisName + "Y");
Log.i("TouchscreenController", String.format("%s -> %d/%d", axisName, xCode, yCode)); Log.i("TouchscreenController", String.format("%s -> %d/%d", axisName, xCode, yCode));
if (xCode < 0 && yCode < 0) if (xCode < 0 && yCode < 0)
return false; return false;
@ -128,10 +127,10 @@ public class TouchscreenControllerView extends FrameLayout {
if (axisView == null) if (axisView == null)
return false; return false;
int leftCode = AndroidHostInterface.getInstance().getControllerButtonCode(mControllerType, buttonPrefix + "Left"); int leftCode = AndroidHostInterface.getControllerButtonCode(mControllerType, buttonPrefix + "Left");
int rightCode = AndroidHostInterface.getInstance().getControllerButtonCode(mControllerType, buttonPrefix + "Right"); int rightCode = AndroidHostInterface.getControllerButtonCode(mControllerType, buttonPrefix + "Right");
int upCode = AndroidHostInterface.getInstance().getControllerButtonCode(mControllerType, buttonPrefix + "Up"); int upCode = AndroidHostInterface.getControllerButtonCode(mControllerType, buttonPrefix + "Up");
int downCode = AndroidHostInterface.getInstance().getControllerButtonCode(mControllerType, buttonPrefix + "Down"); int downCode = AndroidHostInterface.getControllerButtonCode(mControllerType, buttonPrefix + "Down");
Log.i("TouchscreenController", String.format("%s(ButtonAxis) -> %d,%d,%d,%d", buttonPrefix, leftCode, rightCode, upCode, downCode)); Log.i("TouchscreenController", String.format("%s(ButtonAxis) -> %d,%d,%d,%d", buttonPrefix, leftCode, rightCode, upCode, downCode));
if (leftCode < 0 && rightCode < 0 && upCode < 0 && downCode < 0) if (leftCode < 0 && rightCode < 0 && upCode < 0 && downCode < 0)
return false; return false;
@ -142,10 +141,8 @@ public class TouchscreenControllerView extends FrameLayout {
} }
private boolean handleTouchEvent(MotionEvent event) { private boolean handleTouchEvent(MotionEvent event) {
switch (event.getActionMasked()) switch (event.getActionMasked()) {
{ case MotionEvent.ACTION_UP: {
case MotionEvent.ACTION_UP:
{
for (TouchscreenControllerButtonView buttonView : mButtonViews) { for (TouchscreenControllerButtonView buttonView : mButtonViews) {
buttonView.setPressed(false); buttonView.setPressed(false);
} }
@ -160,8 +157,7 @@ public class TouchscreenControllerView extends FrameLayout {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_POINTER_DOWN:
case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_POINTER_UP:
case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_MOVE: {
{
Rect rect = new Rect(); Rect rect = new Rect();
final int pointerCount = event.getPointerCount(); final int pointerCount = event.getPointerCount();
final int liftedPointerIndex = (event.getActionMasked() == MotionEvent.ACTION_POINTER_UP) ? event.getActionIndex() : -1; final int liftedPointerIndex = (event.getActionMasked() == MotionEvent.ACTION_POINTER_UP) ? event.getActionIndex() : -1;