Permalink
Browse files

Front: Move animate joystick option to touchscreen profile

  • Loading branch information...
Gillou68310
Gillou68310 committed Jul 7, 2015
1 parent a701a39 commit abd09c4830bf3ac9a4c30a1333abd5cbc20c3bb3
@@ -114,5 +114,11 @@
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>
@@ -215,12 +215,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"
@@ -232,10 +232,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
@@ -178,6 +178,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;
private final SharedPreferences mPreferences;
private final RomHeader mHeader;
@@ -268,6 +271,7 @@ public GamePrefs( Context context, String romMd5, RomHeader header )
// Touchscreen prefs
isTouchscreenEnabled = touchscreenProfile != null;
isTouchscreenAnimated = touchscreenProfile.get( "touchscreenAnimated", "False" ).equals( "True" );
// Determine the touchscreen layout
boolean isCustom = false;
@@ -290,7 +294,7 @@ public GamePrefs( Context context, String romMd5, RomHeader header )
if( layout.equals( "Mupen64Plus-AE-Analog" )
|| layout.equals( "Mupen64Plus-AE-All" ) )
{
if( globalPrefs.isTouchscreenAnimated )
if( isTouchscreenAnimated )
layout += "-Stick";
else
layout += "-Nostick";
@@ -133,9 +133,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;
@@ -324,7 +321,6 @@ public GlobalPrefs( Context context )
// 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
public boolean isTouchscreenAnimated;
@SuppressLint( "ClickableViewAccessibility" )
@TargetApi( 11 )
@Override
@@ -182,18 +185,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 )
@@ -560,6 +565,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 abd09c4

Please sign in to comment.