Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Android] Format all Java files to be consistent.
  • Loading branch information
lioncash committed Aug 22, 2013
1 parent f09cafb commit 7c99b06
Show file tree
Hide file tree
Showing 17 changed files with 970 additions and 966 deletions.
72 changes: 36 additions & 36 deletions Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
Expand Up @@ -20,59 +20,59 @@
import org.dolphinemu.dolphinemu.settings.UserPreferences;

public final class DolphinEmulator<MainActivity> extends Activity
{
static private NativeGLSurfaceView GLview = null;
static private boolean Running = false;
{
private static NativeGLSurfaceView GLview = null;
private static boolean Running = false;

private float screenWidth;
private float screenHeight;

private void CopyAsset(String asset, String output)
{
InputStream in = null;
OutputStream out = null;
try
{
in = getAssets().open(asset);
out = new FileOutputStream(output);
copyFile(in, out);
in.close();
out.close();
}
catch(IOException e)
{
Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e);
}
InputStream in = null;
OutputStream out = null;

try
{
in = getAssets().open(asset);
out = new FileOutputStream(output);
copyFile(in, out);
in.close();
out.close();
}
catch (IOException e)
{
Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e);
}
}

private void copyFile(InputStream in, OutputStream out) throws IOException
{
byte[] buffer = new byte[1024];
int read;
while((read = in.read(buffer)) != -1)
{
out.write(buffer, 0, read);
}
byte[] buffer = new byte[1024];
int read;

while ((read = in.read(buffer)) != -1)
{
out.write(buffer, 0, read);
}
}

@Override
public void onStop()
{
super.onStop();
if (Running)
NativeLibrary.StopEmulation();
}

@Override
public void onPause()
{
super.onPause();
if (Running)
NativeLibrary.PauseEmulation();
}

@Override
public void onResume()
{
Expand All @@ -81,7 +81,7 @@ public void onResume()
NativeLibrary.UnPauseEmulation();
}

/** Called when the activity is first created. */
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
Expand All @@ -90,12 +90,12 @@ public void onCreate(Bundle savedInstanceState)
{
Intent ListIntent = new Intent(this, GameListActivity.class);
startActivityForResult(ListIntent, 1);

// Make the assets directory
String BaseDir = Environment.getExternalStorageDirectory()+File.separator+"dolphin-emu";
File directory = new File(BaseDir);
directory.mkdirs();

String ConfigDir = BaseDir + File.separator + "Config";
directory = new File(ConfigDir);
directory.mkdirs();
Expand Down Expand Up @@ -144,7 +144,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data)
wm.getDefaultDisplay().getMetrics(displayMetrics);
screenWidth = displayMetrics.widthPixels;
screenHeight = displayMetrics.heightPixels;

String FileName = data.getStringExtra("Select");
GLview = new NativeGLSurfaceView(this);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
Expand All @@ -155,14 +155,14 @@ public void onActivityResult(int requestCode, int resultCode, Intent data)
Running = true;
}
}

@Override
public boolean onTouchEvent(MotionEvent event)
{
float X = event.getX();
float Y = event.getY();
int Action = event.getActionMasked();

// Converts button locations 0 - 1 to OGL screen coords -1.0 - 1.0
float ScreenX = ((X / screenWidth) * 2.0f) - 1.0f;
float ScreenY = ((Y / screenHeight) * -2.0f) + 1.0f;
Expand Down Expand Up @@ -228,7 +228,7 @@ public boolean dispatchGenericMotionEvent(MotionEvent event)

for (InputDevice.MotionRange range : motions)
{
NativeLibrary.onGamePadMoveEvent(InputConfigFragment.getInputDesc(input), range.getAxis(), event.getAxisValue(range.getAxis()));
NativeLibrary.onGamePadMoveEvent(InputConfigFragment.getInputDesc(input), range.getAxis(), event.getAxisValue(range.getAxis()));
}

return true;
Expand Down
Expand Up @@ -6,9 +6,9 @@

public final class NativeGLSurfaceView extends SurfaceView
{
static private Thread myRun;
static private boolean Running = false;
static private boolean Created = false;
private static Thread myRun;
private static boolean Running = false;
private static boolean Created = false;

public NativeGLSurfaceView(Context context)
{
Expand All @@ -18,21 +18,22 @@ public NativeGLSurfaceView(Context context)
myRun = new Thread()
{
@Override
public void run() {
NativeLibrary.Run(getHolder().getSurface());
}
public void run() {
NativeLibrary.Run(getHolder().getSurface());
}
};

getHolder().addCallback(new SurfaceHolder.Callback() {
public void surfaceCreated(SurfaceHolder holder)
{
// TODO Auto-generated method stub
if (!Running)
{
myRun.start();
Running = true;
}
}

getHolder().addCallback(new SurfaceHolder.Callback()
{
public void surfaceCreated(SurfaceHolder holder)
{
// TODO Auto-generated method stub
if (!Running)
{
myRun.start();
Running = true;
}
}

public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3)
{
Expand All @@ -44,7 +45,7 @@ public void surfaceDestroyed(SurfaceHolder arg0)
// TODO Auto-generated method stub
}
});

Created = true;
}
}
Expand Down
Expand Up @@ -30,7 +30,7 @@ public FolderBrowserItem getItem(int i)
{
return items.get(i);
}

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
Expand All @@ -40,11 +40,11 @@ public View getView(int position, View convertView, ViewGroup parent)
LayoutInflater vi = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(id, parent, false);
}

final FolderBrowserItem item = items.get(position);
if (item != null)
{
ImageView iconView = (ImageView) v.findViewById(R.id.ImageIcon);
ImageView iconView = (ImageView) v.findViewById(R.id.ImageIcon);
TextView mainText = (TextView) v.findViewById(R.id.FolderTitle);
TextView subtitleText = (TextView) v.findViewById(R.id.FolderSubTitle);

Expand All @@ -57,7 +57,7 @@ public View getView(int position, View convertView, ViewGroup parent)
mainText.setTextColor(0xFFFF0000);
}
}

if(subtitleText != null)
{
// Remove the subtitle for all folders, except for the parent directory folder.
Expand All @@ -70,19 +70,18 @@ public View getView(int position, View convertView, ViewGroup parent)
subtitleText.setText(item.getSubtitle());
}
}

if (iconView != null)
{
if (item.isDirectory())
{
iconView.setImageResource(R.drawable.ic_menu_folder);
}
else
{
iconView.setImageResource(R.drawable.ic_menu_file);
}
if (item.isDirectory())
{
iconView.setImageResource(R.drawable.ic_menu_folder);
}
else
{
iconView.setImageResource(R.drawable.ic_menu_file);
}
}

}
return v;
}
Expand Down

0 comments on commit 7c99b06

Please sign in to comment.