Add switch for resize on keyboard

This commit is contained in:
mittorn 2016-07-02 22:31:25 +00:00
parent e55c292c81
commit d19f81fef1
3 changed files with 21 additions and 3 deletions

View file

@ -270,6 +270,19 @@
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:layout_marginTop="10dp"/> android:layout_marginTop="10dp"/>
<ToggleButton
android:id="@+id/enableResizeWorkaround"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:text="enableResizeWorkaround"
android:textOff="Keyboard does not resize screen"
android:textOn="Keyboard resizes screen" />
<TextView <TextView
android:id="@+id/textView7" android:id="@+id/textView7"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"

View file

@ -39,6 +39,7 @@ public class LauncherActivity extends Activity {
public final static int sdk = Integer.valueOf(Build.VERSION.SDK); public final static int sdk = Integer.valueOf(Build.VERSION.SDK);
static EditText cmdArgs; static EditText cmdArgs;
static ToggleButton useVolume; static ToggleButton useVolume;
static ToggleButton resizeWorkaround;
static EditText resPath; static EditText resPath;
static SharedPreferences mPref; static SharedPreferences mPref;
static Spinner pixelSpinner; static Spinner pixelSpinner;
@ -78,8 +79,8 @@ public class LauncherActivity extends Activity {
"32 bit (RGBA8888)", "32 bit (RGBA8888)",
"24 bit (RGB888)", "24 bit (RGB888)",
"16 bit (RGB565)", "16 bit (RGB565)",
"15 bit (RGBA5551)", "16 bit (RGBA5551)",
"12 bit (RGBA4444)", "16 bit (RGBA4444)",
"8 bit (RGB332)" "8 bit (RGB332)"
}; };
pixelSpinner = (Spinner) findViewById(R.id.pixelSpinner); pixelSpinner = (Spinner) findViewById(R.id.pixelSpinner);
@ -119,6 +120,8 @@ public class LauncherActivity extends Activity {
cmdArgs.setText(mPref.getString("argv","-dev 3 -log")); cmdArgs.setText(mPref.getString("argv","-dev 3 -log"));
useVolume = ( ToggleButton ) findViewById( R.id.useVolume ); useVolume = ( ToggleButton ) findViewById( R.id.useVolume );
useVolume.setChecked(mPref.getBoolean("usevolume",true)); useVolume.setChecked(mPref.getBoolean("usevolume",true));
resizeWorkaround = ( ToggleButton ) findViewById( R.id.enableResizeWorkaround );
resizeWorkaround.setChecked(mPref.getBoolean("enableResizeWorkaround",true));
resPath = ( EditText ) findViewById( R.id.cmdPath ); resPath = ( EditText ) findViewById( R.id.cmdPath );
tvResPath = ( TextView ) findViewById( R.id.textView_path ); tvResPath = ( TextView ) findViewById( R.id.textView_path );
updatePath(mPref.getString("basedir", getDefaultPath())); updatePath(mPref.getString("basedir", getDefaultPath()));
@ -150,6 +153,7 @@ public class LauncherActivity extends Activity {
editor.putBoolean("usevolume",useVolume.isChecked()); editor.putBoolean("usevolume",useVolume.isChecked());
editor.putString("basedir", resPath.getText().toString()); editor.putString("basedir", resPath.getText().toString());
editor.putInt("pixelformat", pixelSpinner.getSelectedItemPosition()); editor.putInt("pixelformat", pixelSpinner.getSelectedItemPosition());
editor.putBoolean("enableResizeWorkaround",resizeWorkaround.isChecked());
editor.commit(); editor.commit();
startActivity(intent); startActivity(intent);
} }

View file

@ -127,7 +127,8 @@ public class XashActivity extends Activity {
mPixelFormat = mPref.getInt("pixelformat", 0); mPixelFormat = mPref.getInt("pixelformat", 0);
mUseVolume = mPref.getBoolean("usevolume", false); mUseVolume = mPref.getBoolean("usevolume", false);
AndroidBug5497Workaround.assistActivity(this); if( mPref.getBoolean("enableResizeWorkaround", true) )
AndroidBug5497Workaround.assistActivity(this);
} }
// Events // Events