Permalink
Browse files

Front: Move animate joystick option to touchscreen profile

  • Loading branch information...
Gillou68310 committed Jul 7, 2015
1 parent 58cd8ad commit 6991bc39496774082f8a8a17fdc03a0dce38c2d3
@@ -1,118 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:padding="10dp" >
-
- <RelativeLayout
- android:id="@+id/rowX"
+ android:layout_height="match_parent" >
+ <LinearLayout
android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <Button
- android:id="@+id/buttonXdown"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- android:text="-"
- tools:ignore="HardcodedText,RtlHardcoded" />
-
- <Button
- android:id="@+id/buttonXup"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:text="+"
- tools:ignore="HardcodedText,RtlHardcoded" />
-
- <LinearLayout
- android:id="@+id/seekgroupX"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:padding="10dp" >
+ <RelativeLayout
+ android:id="@+id/rowX"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:orientation="vertical"
- android:paddingBottom="10dp"
- android:paddingLeft="50dp"
- android:paddingRight="50dp"
- android:paddingTop="10dp" >
-
- <TextView
- android:id="@+id/textX"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:text="@string/touchscreenProfileActivity_horizontalSlider"
- android:textIsSelectable="false" />
-
- <SeekBar
- android:id="@+id/seekbarX"
+ android:layout_height="wrap_content" >
+
+ <Button
+ android:id="@+id/buttonXdown"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:text="-"
+ tools:ignore="HardcodedText,RtlHardcoded" />
+
+ <Button
+ android:id="@+id/buttonXup"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:text="+"
+ tools:ignore="HardcodedText,RtlHardcoded" />
+
+ <LinearLayout
+ android:id="@+id/seekgroupX"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:max="100"
- android:progress="50" />
- </LinearLayout>
- </RelativeLayout>
-
-
- <RelativeLayout
- android:id="@+id/rowY"
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <Button
- android:id="@+id/buttonYdown"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_alignParentLeft="true"
- android:layout_centerVertical="true"
- android:text="-"
- tools:ignore="HardcodedText,RtlHardcoded" />
-
- <Button
- android:id="@+id/buttonYup"
- android:layout_width="50dp"
- android:layout_height="50dp"
- android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
- android:text="+"
- tools:ignore="HardcodedText,RtlHardcoded" />
-
- <LinearLayout
- android:id="@+id/seekgroupY"
+ android:layout_centerInParent="true"
+ android:orientation="vertical"
+ android:paddingBottom="10dp"
+ android:paddingLeft="50dp"
+ android:paddingRight="50dp"
+ android:paddingTop="10dp" >
+
+ <TextView
+ android:id="@+id/textX"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/touchscreenProfileActivity_horizontalSlider"
+ android:textIsSelectable="false" />
+
+ <SeekBar
+ android:id="@+id/seekbarX"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:max="100"
+ android:progress="50" />
+ </LinearLayout>
+ </RelativeLayout>
+
+
+ <RelativeLayout
+ android:id="@+id/rowY"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_centerInParent="true"
- android:orientation="vertical"
- android:paddingBottom="10dp"
- android:paddingLeft="50dp"
- android:paddingRight="50dp"
- android:paddingTop="10dp" >
-
- <TextView
- android:id="@+id/textY"
+ android:layout_height="wrap_content" >
+
+ <Button
+ android:id="@+id/buttonYdown"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_alignParentLeft="true"
+ android:layout_centerVertical="true"
+ android:text="-"
+ tools:ignore="HardcodedText,RtlHardcoded" />
+
+ <Button
+ android:id="@+id/buttonYup"
+ android:layout_width="50dp"
+ android:layout_height="50dp"
+ android:layout_alignParentRight="true"
+ android:layout_centerVertical="true"
+ android:text="+"
+ tools:ignore="HardcodedText,RtlHardcoded" />
+
+ <LinearLayout
+ android:id="@+id/seekgroupY"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:text="@string/touchscreenProfileActivity_verticalSlider"
- android:textIsSelectable="false" />
-
- <SeekBar
- android:id="@+id/seekbarY"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:max="100"
- android:progress="50" />
- </LinearLayout>
- </RelativeLayout>
-
- <CheckBox
- android:id="@+id/checkBox_holdable"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/touchscreenProfileActivity_autoHoldable" />
-
-</LinearLayout>
+ android:layout_centerInParent="true"
+ android:orientation="vertical"
+ android:paddingBottom="10dp"
+ android:paddingLeft="50dp"
+ android:paddingRight="50dp"
+ android:paddingTop="10dp" >
+
+ <TextView
+ android:id="@+id/textY"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="center_horizontal"
+ android:text="@string/touchscreenProfileActivity_verticalSlider"
+ android:textIsSelectable="false" />
+
+ <SeekBar
+ android:id="@+id/seekbarY"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:max="100"
+ android:progress="50" />
+ </LinearLayout>
+ </RelativeLayout>
+
+ <CheckBox
+ android:id="@+id/checkBox_holdable"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/touchscreenProfileActivity_autoHoldable" />
+
+ <CheckBox
+ android:id="@+id/checkBox_feedback"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/touchscreenAnimation_summary" />
+ </LinearLayout>
+</ScrollView>
@@ -200,12 +200,6 @@
mupen64:stepSize="10"
mupen64:units="%" />
- <CheckBoxPreference
- android:defaultValue="false"
- android:key="touchscreenAnimation"
- android:summary="@string/touchscreenAnimation_summary"
- android:title="@string/touchscreenAnimation_title" />
-
<CheckBoxPreference
android:defaultValue="false"
android:key="touchscreenFeedback"
@@ -261,10 +261,10 @@ public void onCreateEnd( Bundle savedInstanceState )
// The touch map and overlay are needed to display frame rate and/or controls
mTouchscreenMap = new VisibleTouchMap( mActivity.getResources() );
mTouchscreenMap.load( mGlobalPrefs.touchscreenSkin, mGamePrefs.touchscreenProfile,
- mGlobalPrefs.isTouchscreenAnimated, mGlobalPrefs.isFpsEnabled,
+ mGamePrefs.isTouchscreenAnimated, mGlobalPrefs.isFpsEnabled,
mGlobalPrefs.touchscreenScale, mGlobalPrefs.touchscreenTransparency );
mOverlay.initialize( mTouchscreenMap, !mGamePrefs.isTouchscreenHidden,
- mGlobalPrefs.isFpsEnabled, mGlobalPrefs.isTouchscreenAnimated );
+ mGlobalPrefs.isFpsEnabled, mGamePrefs.isTouchscreenAnimated );
}
// Initialize user interface devices
@@ -177,6 +177,9 @@
/** True if any type of AbstractController is enabled for Player 4. */
public final boolean isPlugged4;
+ /** True if the touchscreen joystick is animated. */
+ public final boolean isTouchscreenAnimated;
+
/** Game CRC */
public final String crc;
@@ -265,6 +268,7 @@ public GamePrefs( Context context, String romMd5, String crc, String headerName,
// Touchscreen prefs
isTouchscreenEnabled = touchscreenProfile != null;
+ isTouchscreenAnimated = touchscreenProfile.get( "touchscreenAnimated", "False" ).equals( "True" );
// Determine the touchscreen layout
boolean isCustom = false;
@@ -287,7 +291,7 @@ public GamePrefs( Context context, String romMd5, String crc, String headerName,
if( layout.equals( "Mupen64Plus-AE-Analog" )
|| layout.equals( "Mupen64Plus-AE-All" ) )
{
- if( globalPrefs.isTouchscreenAnimated )
+ if( isTouchscreenAnimated )
layout += "-Stick";
else
layout += "-Nostick";
@@ -145,9 +145,6 @@
/** True if the touchscreen feedback is enabled. */
public final boolean isTouchscreenFeedbackEnabled;
- /** True if the touchscreen joystick is animated. */
- public final boolean isTouchscreenAnimated;
-
/** The directory of the selected touchscreen skin. */
public final String touchscreenSkin;
@@ -329,7 +326,6 @@ public GlobalPrefs( Context context, AppData appData )
// Touchscreen prefs
isTouchscreenFeedbackEnabled = mPreferences.getBoolean( "touchscreenFeedback", false );
- isTouchscreenAnimated = mPreferences.getBoolean( "touchscreenAnimation", false );
touchscreenScale = ( (float) mPreferences.getInt( "touchscreenScale", 100 ) ) / 100.0f;
touchscreenTransparency = ( 255 * mPreferences.getInt( "touchscreenTransparency", 100 ) ) / 100;
touchscreenSkin = appData.touchscreenSkinsDir + "/" + mPreferences.getString( "touchscreenStyle", "Outline" );
@@ -110,6 +110,9 @@
// Don't enter immersive mode until the ActionBar menus are closed
private boolean actionBarMenuOpen = false;
+ // True if the touchscreen joystick is animated
+ private boolean isTouchscreenAnimated;
+
@SuppressLint( "ClickableViewAccessibility" )
@TargetApi( 11 )
@Override
@@ -183,18 +186,20 @@ public void onMenuVisibilityChanged( boolean isVisible )
});
}
+ isTouchscreenAnimated = mProfile.get( "touchscreenAnimated", "False" ).equals( "True" );
+
// Initialize the touchmap and overlay
mTouchscreenMap = new VisibleTouchMap( getResources() );
mOverlay.setOnTouchListener( this );
- mOverlay.initialize( mTouchscreenMap, true, mGlobalPrefs.isFpsEnabled, mGlobalPrefs.isTouchscreenAnimated );
+ mOverlay.initialize( mTouchscreenMap, true, mGlobalPrefs.isFpsEnabled, isTouchscreenAnimated );
}
@TargetApi( 11 )
private void refresh()
{
// Reposition the assets and refresh the overlay and options menu
mTouchscreenMap.load( mGlobalPrefs.touchscreenSkin, mProfile,
- mGlobalPrefs.isTouchscreenAnimated, true, mGlobalPrefs.touchscreenScale,
+ isTouchscreenAnimated, true, mGlobalPrefs.touchscreenScale,
mGlobalPrefs.touchscreenTransparency );
mOverlay.postInvalidate();
if( AppData.IS_HONEYCOMB )
@@ -562,6 +567,27 @@ public void onValueChanged( int value )
}
} );
+ // Setup the visual feedback checkbox
+ CheckBox feedback = (CheckBox) view.findViewById( R.id.checkBox_feedback );
+ if( assetName.equals("analog") )
+ {
+ feedback.setChecked( isTouchscreenAnimated );
+ feedback.setOnCheckedChangeListener( new OnCheckedChangeListener()
+ {
+ @Override
+ public void onCheckedChanged( CompoundButton buttonView, boolean isChecked )
+ {
+ mProfile.put( "touchscreenAnimated", ( isChecked ? "True" : "False" ) );
+ isTouchscreenAnimated = isChecked;
+ refresh();
+ }
+ } );
+ }
+ else
+ {
+ feedback.setVisibility( View.GONE );
+ }
+
// Setup the auto-holdability checkbox
CheckBox holdable = (CheckBox) view.findViewById( R.id.checkBox_holdable );
if( holdableIndex < 0 )

0 comments on commit 6991bc3

Please sign in to comment.