Removed 'reicast' header from file browser layout. Relocated to layout for fragment container.

This commit is contained in:
Shaun Thompson 2013-12-22 08:30:26 -07:00
parent 614fe19d20
commit 5737e44bdc
4 changed files with 135 additions and 114 deletions

View File

@ -5,51 +5,7 @@
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/header_list"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginBottom="2dp"
android:orientation="horizontal" >
<ImageView
android:id="@+id/header_icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="32dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/config"
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/config" />
<ImageView
android:id="@+id/about"
android:layout_width="48dp"
android:layout_height="fill_parent"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp"
android:scaleType="fitCenter"
android:src="@drawable/question" />
</LinearLayout>
<View
android:layout_width="fill_parent"

View File

@ -1,6 +1,61 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/header_list"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginBottom="2dp"
android:orientation="horizontal" >
<ImageView
android:id="@+id/header_icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="32dp"
android:layout_weight="1" />
<ImageView
android:id="@+id/config"
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/config" />
<ImageView
android:id="@+id/about"
android:layout_width="48dp"
android:layout_height="fill_parent"
android:layout_marginBottom="2dp"
android:layout_marginLeft="2dp"
android:layout_marginTop="2dp"
android:scaleType="fitCenter"
android:src="@drawable/question" />
</LinearLayout>
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@ -105,71 +105,7 @@ public class FileBrowser extends Fragment {
vib=(Vibrator) parentActivity.getSystemService(Context.VIBRATOR_SERVICE);
parentActivity.findViewById(R.id.config).setOnClickListener(
new OnClickListener() {
public void onClick(View view) {
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
parentActivity);
// 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();
}
});
parentActivity.findViewById(R.id.about).setOnTouchListener(
new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
if (event.getActionMasked()==MotionEvent.ACTION_DOWN)
{
vib.vibrate(50);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
parentActivity);
// set title
alertDialogBuilder.setTitle("About reicast");
// set dialog message
alertDialogBuilder
.setMessage("reicast is a dreamcast emulator")
.setCancelable(false)
.setPositiveButton("Dismiss",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
//FileBrowser.this.finish();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
return true;
}
else
return false;
}
});
/*
OnTouchListener viblist=new OnTouchListener() {
@ -315,7 +251,7 @@ public class FileBrowser extends Fragment {
mCallback.onFolderSelected(Uri.fromFile(new File(root_sd.getAbsolutePath())));
vib.vibrate(250);
}
else
else if(ImgBrowse)
{
vib.vibrate(50);
mCallback.onGameSelected(Uri.fromFile(f));

View File

@ -1,10 +1,16 @@
package com.reicast.emulator;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
public class MainActivity extends FragmentActivity implements
FileBrowser.OnItemSelectedListener{
@ -28,7 +34,7 @@ public class MainActivity extends FragmentActivity implements
// Create a new Fragment to be placed in the activity layout
FileBrowser firstFragment = new FileBrowser();
Bundle args = new Bundle();
args.putBoolean("ImgBrowse", false);
args.putBoolean("ImgBrowse", true); // specify ImgBrowse option. true = images, false = folders only
firstFragment.setArguments(args);
// In case this activity was started with special instructions from
// an
@ -39,9 +45,77 @@ public class MainActivity extends FragmentActivity implements
getSupportFragmentManager().beginTransaction()
.add(R.id.fragment_container, firstFragment).commit();
}
findViewById(R.id.config).setOnClickListener(
new OnClickListener() {
public void onClick(View view) {
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.about).setOnTouchListener(
new OnTouchListener()
{
public boolean onTouch(View v, MotionEvent event)
{
if (event.getActionMasked()==MotionEvent.ACTION_DOWN)
{
//vib.vibrate(50);
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
MainActivity.this);
// set title
alertDialogBuilder.setTitle("About reicast");
// set dialog message
alertDialogBuilder
.setMessage("reicast is a dreamcast emulator")
.setCancelable(false)
.setPositiveButton("Dismiss",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, close
// current activity
//FileBrowser.this.finish();
}
});
// create alert dialog
AlertDialog alertDialog = alertDialogBuilder.create();
// show it
alertDialog.show();
return true;
}
else
return false;
}
});
}
public void onGameSelected(Uri uri){
Intent inte = new Intent(Intent.ACTION_VIEW,uri,getBaseContext(),GL2JNIActivity.class);
startActivity(inte);