diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
index 7aa2800ea4..a534f16304 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java
@@ -16,6 +16,7 @@ import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.view.InputDevice;
import android.view.KeyEvent;
+import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
@@ -24,6 +25,8 @@ import android.view.ViewTreeObserver;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
+import android.widget.SeekBar;
+import android.widget.TextView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
@@ -395,12 +398,25 @@ public final class EmulationActivity extends AppCompatActivity
{
switch (id)
{
+ // Edit the placement of the controls
+ case R.id.menu_emulation_edit_layout:
+ EmulationFragment emulationFragment = (EmulationFragment) getFragmentManager().findFragmentById(R.id.frame_emulation_fragment);
+ if (emulationFragment.isConfiguringControls())
+ {
+ emulationFragment.stopConfiguringControls();
+ }
+ else
+ {
+ emulationFragment.startConfiguringControls();
+ }
+ break;
+
// Enable/Disable specific buttons or the entire input overlay.
- case R.id.menu_emulation_input_overlay:
+ case R.id.menu_emulation_toggle_controls:
{
boolean[] enabledButtons = new boolean[11];
AlertDialog.Builder builder = new AlertDialog.Builder(this);
- builder.setTitle(R.string.emulation_toggle_input);
+ builder.setTitle(R.string.emulation_toggle_controls);
if (mIsGameCubeGame)
{
for (int i = 0; i < enabledButtons.length; i++)
@@ -485,17 +501,60 @@ public final class EmulationActivity extends AppCompatActivity
return;
}
- case R.id.menu_emulation_configure_controls:
- EmulationFragment emulationFragment = (EmulationFragment) getFragmentManager().findFragmentById(R.id.frame_emulation_fragment);
- if (emulationFragment.isConfiguringControls())
+ // Adjust the scale of the overlay controls.
+ case R.id.menu_emulation_adjust_scale:
+ {
+ LayoutInflater inflater = LayoutInflater.from(this);
+ View view = inflater.inflate(R.layout.dialog_seekbar, null);
+
+ final SeekBar seekbar = (SeekBar) view.findViewById(R.id.seekbar);
+ final TextView value = (TextView) view.findViewById(R.id.text_value);
+ final TextView units = (TextView) view.findViewById(R.id.text_units);
+
+ seekbar.setMax(150);
+ seekbar.setProgress(mPreferences.getInt("controlScale", 50));
+ seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
{
- emulationFragment.stopConfiguringControls();
- }
- else
+ public void onStartTrackingTouch(SeekBar seekBar)
+ {
+ // Do nothing
+ }
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
+ {
+ value.setText(String.valueOf(progress + 50));
+ }
+ public void onStopTrackingTouch(SeekBar seekBar)
+ {
+ // Do nothing
+ }
+ });
+
+ value.setText(String.valueOf(seekbar.getProgress() + 50));
+ units.setText("%");
+
+ AlertDialog.Builder builder = new AlertDialog.Builder(this);
+ builder.setTitle(R.string.emulation_control_scale);
+ builder.setView(view);
+ builder.setPositiveButton(getString(R.string.emulation_done), new DialogInterface.OnClickListener()
{
- emulationFragment.startConfiguringControls();
- }
- break;
+ @Override
+ public void onClick(DialogInterface dialogInterface, int i)
+ {
+ SharedPreferences.Editor editor = mPreferences.edit();
+ editor.putInt("controlScale", seekbar.getProgress());
+ editor.apply();
+
+ EmulationFragment emulationFragment = (EmulationFragment) getFragmentManager()
+ .findFragmentByTag(EmulationFragment.FRAGMENT_TAG);
+ emulationFragment.refreshInputOverlay();
+ }
+ });
+
+ AlertDialog alertDialog = builder.create();
+ alertDialog.show();
+
+ return;
+ }
case R.id.menu_refresh_wiimotes:
NativeLibrary.RefreshWiimotes();
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java
index 5b90b43b6a..b13892f3e3 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java
@@ -489,7 +489,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// SharedPreference to retrieve the X and Y coordinates for the InputOverlayDrawableButton.
final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context);
- // Decide scale based on button ID
+ // Decide scale based on button ID and user preference
float scale;
switch (buttonId)
@@ -525,6 +525,9 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
break;
}
+ scale *= (sPrefs.getInt("controlScale", 50) + 50);
+ scale /= 100;
+
// Initialize the InputOverlayDrawableButton.
final Bitmap bitmap = resizeBitmap(context, BitmapFactory.decodeResource(res, resId), scale);
final InputOverlayDrawableButton overlayDrawable = new InputOverlayDrawableButton(res, bitmap, buttonId);
@@ -572,7 +575,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// SharedPreference to retrieve the X and Y coordinates for the InputOverlayDrawableDpad.
final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context);
- // Decide scale based on button ID
+ // Decide scale based on button ID and user preference
float scale;
switch (buttonUp)
@@ -588,6 +591,9 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
break;
}
+ scale *= (sPrefs.getInt("controlScale", 50) + 50);
+ scale /= 100;
+
// Initialize the InputOverlayDrawableDpad.
final Bitmap bitmap = resizeBitmap(context, BitmapFactory.decodeResource(res, resId), scale);
final InputOverlayDrawableDpad overlayDrawable = new InputOverlayDrawableDpad(res, bitmap,
@@ -632,8 +638,13 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// SharedPreference to retrieve the X and Y coordinates for the InputOverlayDrawableJoystick.
final SharedPreferences sPrefs = PreferenceManager.getDefaultSharedPreferences(context);
+ // Decide scale based on user preference
+ float scale = 0.275f;
+ scale *= (sPrefs.getInt("controlScale", 50) + 50);
+ scale /= 100;
+
// Initialize the InputOverlayDrawableJoystick.
- final Bitmap bitmapOuter = resizeBitmap(context, BitmapFactory.decodeResource(res, resOuter), 0.275f);
+ final Bitmap bitmapOuter = resizeBitmap(context, BitmapFactory.decodeResource(res, resOuter), scale);
final Bitmap bitmapInner = BitmapFactory.decodeResource(res, resInner);
// The X and Y coordinates of the InputOverlayDrawableButton on the InputOverlay.
@@ -642,15 +653,15 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
int drawableY = (int) sPrefs.getFloat(joystick+"-Y", 0f);
// Decide inner scale based on joystick ID
- float scale;
+ float innerScale;
switch (joystick)
{
case ButtonType.STICK_C:
- scale = 1.833f;
+ innerScale = 1.833f;
break;
default:
- scale = 1.375f;
+ innerScale = 1.375f;
break;
}
@@ -658,7 +669,7 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener
// This will dictate where on the screen (and the what the size) the InputOverlayDrawableJoystick will be.
int outerSize = bitmapOuter.getWidth();
Rect outerRect = new Rect(drawableX, drawableY, drawableX + outerSize, drawableY + outerSize);
- Rect innerRect = new Rect(0, 0, (int) (outerSize / scale), (int) (outerSize / scale));
+ Rect innerRect = new Rect(0, 0, (int) (outerSize / innerScale), (int) (outerSize / innerScale));
// Send the drawableId to the joystick so it can be referenced when saving control position.
final InputOverlayDrawableJoystick overlayDrawable
diff --git a/Source/Android/app/src/main/res/layout/dialog_seekbar.xml b/Source/Android/app/src/main/res/layout/dialog_seekbar.xml
index 4d81af8d81..314f348261 100644
--- a/Source/Android/app/src/main/res/layout/dialog_seekbar.xml
+++ b/Source/Android/app/src/main/res/layout/dialog_seekbar.xml
@@ -9,12 +9,12 @@
android:id="@+id/seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginLeft="@dimen/spacing_xlarge"
- android:layout_marginRight="@dimen/spacing_xlarge"
+ android:layout_marginLeft="@dimen/spacing_large"
+ android:layout_marginRight="@dimen/spacing_large"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/text_value"
- android:layout_marginBottom="@dimen/spacing_xlarge"/>
+ android:layout_marginBottom="@dimen/spacing_medlarge"/>
+ android:layout_marginTop="@dimen/spacing_medlarge"
+ android:layout_marginBottom="@dimen/spacing_medlarge"/>
-
-
-
- -
-
-
+
+ -
+
+
diff --git a/Source/Android/app/src/main/res/values/arrays.xml b/Source/Android/app/src/main/res/values/arrays.xml
index a536582275..12fe053076 100644
--- a/Source/Android/app/src/main/res/values/arrays.xml
+++ b/Source/Android/app/src/main/res/values/arrays.xml
@@ -211,7 +211,7 @@
- 2
- +
- -
- - Home
+ - Home
- C
- Z
- D-Pad
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index 8b91ea74ac..8e47f68acd 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -355,13 +355,15 @@
Cancel
- Toggle Touch Controls
- Toggle All
Quick Save
Quick Load
Refresh Wiimotes
Configure Controls
+ Edit Layout
Done
+ Toggle Controls
+ Toggle All
+ Adjust Scale
Enable Vibration