From b1268bfcd2395a9e8b30e09d437df49182b96c16 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 2 Oct 2013 15:28:02 -0400 Subject: [PATCH] [Android] General documentation cleanup and additions. Adjusts the documentation to conform to the multitude of changes that have been made over time. Very minor code changes were made as well (of which were mostly for formatting). Such as adding override annotations to methods from the Comparable interface, so that they are clearly marked as such. --- .../dolphinemu/DolphinEmulator.java | 3 +-- .../dolphinemu/dolphinemu/NativeLibrary.java | 1 - .../emulation/EmulationActivity.java | 6 ++++++ .../emulation/NativeGLSurfaceView.java | 3 ++- .../folderbrowser/FolderBrowser.java | 2 +- .../folderbrowser/FolderBrowserAdapter.java | 21 +++++++++++++------ .../folderbrowser/FolderBrowserItem.java | 5 +++-- .../dolphinemu/gamelist/GameListActivity.java | 4 +++- .../dolphinemu/gamelist/GameListAdapter.java | 19 ++++++++++++----- .../dolphinemu/gamelist/GameListItem.java | 1 + 10 files changed, 46 insertions(+), 19 deletions(-) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index 9c27615b14..836cb9f857 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -17,7 +17,7 @@ import org.dolphinemu.dolphinemu.settings.UserPreferences; import java.io.*; /** - * The main activity of this emulator. + * The main activity of this emulator front-end. */ public final class DolphinEmulator extends Activity { @@ -51,7 +51,6 @@ public final class DolphinEmulator extends Activity } } - /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java index d52532fb2e..80fcf64ff6 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -120,7 +120,6 @@ public final class NativeLibrary /** * Creates the initial folder structure in /sdcard/dolphin-emu/ - * */ public static native void CreateUserFolders(); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java index 70e0e44209..50674666ff 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java @@ -1,3 +1,9 @@ +/** + * Copyright 2013 Dolphin Emulator Project + * Licensed under GPLv2 + * Refer to the license.txt file included. + */ + package org.dolphinemu.dolphinemu.emulation; import android.app.Activity; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/NativeGLSurfaceView.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/NativeGLSurfaceView.java index 31f23385ce..90acf05e8e 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/NativeGLSurfaceView.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/NativeGLSurfaceView.java @@ -14,7 +14,7 @@ import android.view.SurfaceHolder; import android.view.SurfaceView; /** - * The surface that rendering is done to. + * The {@link SurfaceView} that rendering is performed on. */ public final class NativeGLSurfaceView extends SurfaceView { @@ -26,6 +26,7 @@ public final class NativeGLSurfaceView extends SurfaceView * Constructor. * * @param context The current {@link Context}. + * @param attribs An AttributeSet for retrieving data from XML files. */ public NativeGLSurfaceView(Context context, AttributeSet attribs) { diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java index fe7fd2641c..1697311fe3 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java @@ -24,7 +24,7 @@ import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.gamelist.GameListActivity; /** - * A basic folder browser {@link Fragment} that allows + * A basic folder browser {@link ListFragment} that allows * the user to select ISOs/ROMs for playing within the * emulator. *

diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java index cae56338bd..8efe78b367 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java @@ -14,6 +14,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; +import android.widget.ListView; import android.widget.TextView; import org.dolphinemu.dolphinemu.R; @@ -22,7 +23,7 @@ import org.dolphinemu.dolphinemu.R; * The {@link ArrayAdapter} that backs the file browser. *

* This is responsible for correctly handling the display - * of the items for the UI. + * of the items for the {@link FolderBrowser} UI. */ public final class FolderBrowserAdapter extends ArrayAdapter { @@ -30,12 +31,20 @@ public final class FolderBrowserAdapter extends ArrayAdapter private final int id; private final List items; - public FolderBrowserAdapter(Context context, int textViewResourceId, List objects) + /** + * Constructor + * + * @param context The current {@link Context}. + * @param resourceId The resource ID for a layout file containing a layout to use when instantiating views. + * @param objects The objects to represent in the {@link ListView}. + */ + public FolderBrowserAdapter(Context context, int resourceId, List objects) { - super(context, textViewResourceId, objects); - c = context; - id = textViewResourceId; - items = objects; + super(context, resourceId, objects); + + this.c = context; + this.id = resourceId; + this.items = objects; } @Override diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java index 0017859797..e419162ed3 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java @@ -9,7 +9,7 @@ package org.dolphinemu.dolphinemu.folderbrowser; import java.io.File; /** - * Represents an item in the folder browser list. + * Represents an item in the {@link FolderBrowser} list. */ public final class FolderBrowserItem implements Comparable { @@ -22,7 +22,7 @@ public final class FolderBrowserItem implements Comparable * Constructor * * @param name The name of the file/folder represented by this item. - * @param subtitle The subtitle of this FolderBrowserItem to display. + * @param subtitle The subtitle of this FolderBrowserItem. * @param path The path of the file/folder represented by this item. */ public FolderBrowserItem(String name, String subtitle, String path) @@ -99,6 +99,7 @@ public final class FolderBrowserItem implements Comparable return underlyingFile.isDirectory(); } + @Override public int compareTo(FolderBrowserItem other) { if(name != null) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java index 0486fdee2f..745e722920 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java @@ -179,6 +179,7 @@ public final class GameListActivity extends Activity protected void onPostCreate(Bundle savedInstanceState) { super.onPostCreate(savedInstanceState); + // Sync the toggle state after onRestoreInstanceState has occurred. mDrawerToggle.syncState(); } @@ -187,6 +188,7 @@ public final class GameListActivity extends Activity public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); + // Pass any configuration change to the drawer toggle mDrawerToggle.onConfigurationChanged(newConfig); } @@ -195,7 +197,7 @@ public final class GameListActivity extends Activity public boolean onCreateOptionsMenu(Menu menu) { // Only show this in the game list. - if (this.mCurFragmentNum == 0) + if (mCurFragmentNum == 0) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.gamelist_menu, menu); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java index 365a8200c5..9ff3d62d34 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java @@ -12,6 +12,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; +import android.widget.ListView; import android.widget.TextView; import java.util.List; @@ -29,12 +30,20 @@ public final class GameListAdapter extends ArrayAdapter private final int id; private final Listitems; - public GameListAdapter(Context context, int textViewResourceId, List objects) + /** + * Constructor + * + * @param context The current {@link Context}. + * @param resourceId The resource ID for a layout file containing a layout to use when instantiating views. + * @param objects The objects to represent in the {@link ListView}. + */ + public GameListAdapter(Context context, int resourceId, List objects) { - super(context, textViewResourceId, objects); - c = context; - id = textViewResourceId; - items = objects; + super(context, resourceId, objects); + + this.c = context; + this.id = resourceId; + this.items = objects; } @Override diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java index f0c9c8a262..1b72da7b9b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java @@ -112,6 +112,7 @@ public final class GameListItem implements Comparable return image; } + @Override public int compareTo(GameListItem o) { if (name != null)