Add input menu to Android 2.3 and re-order to match 3.0+

This commit is contained in:
TwistedUmbrella 2014-01-19 20:51:53 -05:00
parent 9f733b6b89
commit 11c8854301
2 changed files with 45 additions and 35 deletions

View File

@ -28,17 +28,6 @@
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="32dp" />
<ImageView
android:id="@+id/options"
android:layout_width="48dp"
android:layout_height="fill_parent"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:scaleType="fitCenter"
android:src="@drawable/open_folder" />
<ImageView
android:id="@+id/config"
android:layout_width="48dp"
@ -59,6 +48,28 @@
android:layout_marginTop="2dp"
android:scaleType="fitCenter"
android:src="@drawable/question" />
<ImageView
android:id="@+id/options"
android:layout_width="48dp"
android:layout_height="fill_parent"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:scaleType="fitCenter"
android:src="@drawable/open_folder" />
<ImageView
android:id="@+id/input"
android:layout_width="48dp"
android:layout_height="fill_parent"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:scaleType="fitCenter"
android:src="@drawable/input" />
</LinearLayout>
<FrameLayout

View File

@ -169,6 +169,25 @@ public class MainActivity extends FragmentActivity implements
}
} else {
findViewById(R.id.config).setOnClickListener(new OnClickListener() {
public void onClick(View view) {
ConfigureFragment configFrag = (ConfigureFragment) getSupportFragmentManager()
.findFragmentByTag("CONFIG_FRAG");
if (configFrag != null) {
if (configFrag.isVisible()) {
return;
}
}
configFrag = new ConfigureFragment();
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, configFrag,
"CONFIG_FRAG").addToBackStack(null)
.commit();
}
});
findViewById(R.id.options).setOnClickListener(
new OnClickListener() {
public void onClick(View view) {
@ -185,34 +204,14 @@ public class MainActivity extends FragmentActivity implements
.replace(R.id.fragment_container,
optionsFrag, "OPTIONS_FRAG")
.addToBackStack(null).commit();
/*
* AlertDialog.Builder alertDialogBuilder = new
* AlertDialog.Builder( MainActivity.this);
*
* // set title
* alertDialogBuilder.setTitle("Configure");
*
* // set dialog message alertDialogBuilder
* .setMessage("No configuration for now :D")
* .setCancelable(false)
* .setPositiveButton("Oh well",new
* DialogInterface.OnClickListener() { public void
* onClick(DialogInterface dialog,int id) {
* //FileBrowser.this.finish(); } });
*
* // create alert dialog AlertDialog alertDialog =
* alertDialogBuilder.create();
*
* // show it alertDialog.show();
*/
}
});
findViewById(R.id.config).setOnClickListener(new OnClickListener() {
findViewById(R.id.input).setOnClickListener(new OnClickListener() {
public void onClick(View view) {
ConfigureFragment configFrag = (ConfigureFragment) getSupportFragmentManager()
.findFragmentByTag("CONFIG_FRAG");
.findFragmentByTag("INPUT_FRAG");
if (configFrag != null) {
if (configFrag.isVisible()) {
return;
@ -222,7 +221,7 @@ public class MainActivity extends FragmentActivity implements
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, configFrag,
"CONFIG_FRAG").addToBackStack(null)
"INPUT_FRAG").addToBackStack(null)
.commit();
}