summaryrefslogtreecommitdiff
path: root/Source/Android/app/src
diff options
context:
space:
mode:
authorEder Bastos <bastos.eder@gmail.com>2015-05-16 20:52:55 -0400
committerEder Bastos <bastos.eder@gmail.com>2015-05-20 19:46:19 -0400
commit5b0c047e0bb9391883e33026798f9e401c8d911b (patch)
treeaed7c1730bf7faed9c11a52d4afb072aa7cbca82 /Source/Android/app/src
parent4c786cb70c03c15183905586a7ff60cf52d92395 (diff)
Android: Remove inheritance from Game model, and improve the relevance of its content
Diffstat (limited to 'Source/Android/app/src')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java6
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/GameGridActivity.java14
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java4
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java4
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/FileListItem.java11
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/Game.java86
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GcGame.java96
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/WiiGame.java53
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java9
-rw-r--r--Source/Android/app/src/main/res/drawable-hdpi/ic_company.pngbin0 -> 288 bytes
-rw-r--r--Source/Android/app/src/main/res/drawable-mdpi/ic_company.pngbin0 -> 255 bytes
-rw-r--r--Source/Android/app/src/main/res/drawable-xhdpi/ic_company.pngbin0 -> 242 bytes
-rw-r--r--Source/Android/app/src/main/res/drawable-xxhdpi/ic_company.pngbin0 -> 367 bytes
-rw-r--r--Source/Android/app/src/main/res/drawable-xxxhdpi/ic_company.pngbin0 -> 411 bytes
-rw-r--r--Source/Android/app/src/main/res/layout/card_game.xml4
-rw-r--r--Source/Android/app/src/main/res/layout/dialog_game_details.xml22
16 files changed, 112 insertions, 197 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java
index 64463fe072..a47ff9c8ed 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/NativeLibrary.java
@@ -134,9 +134,11 @@ public final class NativeLibrary
public static native String GetGameId(String filename);
public static native int GetCountry(String filename);
- public static native String GetDate(String filename);
+
+ public static native String GetCompany(String filename);
public static native long GetFilesize(String filename);
- public static native boolean IsWiiTitle(String filename);
+
+ public static native int GetPlatform(String filename);
/**
* Gets the Dolphin version string.
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/GameGridActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/GameGridActivity.java
index be8c703fd6..e75affe126 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/GameGridActivity.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/GameGridActivity.java
@@ -179,12 +179,14 @@ public final class GameGridActivity extends Activity
// Check that the file has an appropriate extension before trying to read out of it.
if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{
- GcGame game = new GcGame(NativeLibrary.GetTitle(entry.getAbsolutePath()),
- NativeLibrary.GetDescription(entry.getAbsolutePath()).replace("\n", " "),
- NativeLibrary.GetCountry(entry.getAbsolutePath()),
- entry.getAbsolutePath(),
- NativeLibrary.GetGameId(entry.getAbsolutePath()),
- NativeLibrary.GetDate(entry.getAbsolutePath()));
+ String absolutePath = entry.getAbsolutePath();
+ Game game = new Game(NativeLibrary.GetPlatform(absolutePath),
+ NativeLibrary.GetTitle(absolutePath),
+ NativeLibrary.GetDescription(absolutePath).replace("\n", " "),
+ NativeLibrary.GetCountry(absolutePath),
+ absolutePath,
+ NativeLibrary.GetGameId(absolutePath),
+ NativeLibrary.GetCompany(absolutePath));
gameList.add(game);
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java
index 883107a410..d1debf63f6 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.java
@@ -79,9 +79,9 @@ public class GameAdapter extends RecyclerView.Adapter<GameViewHolder> implements
.into(holder.imageScreenshot);
holder.textGameTitle.setText(game.getTitle());
- if (game.getDescription() != null)
+ if (game.getCompany() != null)
{
- holder.textDescription.setText(game.getDescription());
+ holder.textCompany.setText(game.getCompany());
}
holder.path = game.getPath();
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java
index b52a017278..d673da22c9 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java
@@ -39,7 +39,7 @@ public class GameDetailsDialog extends DialogFragment
arguments.putString(ARGUMENT_GAME_TITLE, game.getTitle());
arguments.putString(ARGUMENT_GAME_DESCRIPTION, game.getDescription());
arguments.putInt(ARGUMENT_GAME_COUNTRY, game.getCountry());
- arguments.putString(ARGUMENT_GAME_DATE, game.getDate());
+ arguments.putString(ARGUMENT_GAME_DATE, game.getCompany());
arguments.putString(ARGUMENT_GAME_PATH, game.getPath());
arguments.putString(ARGUMENT_GAME_SCREENSHOT_PATH, game.getScreenPath());
fragment.setArguments(arguments);
@@ -57,7 +57,7 @@ public class GameDetailsDialog extends DialogFragment
CircleImageView circleBanner = (CircleImageView) contents.findViewById(R.id.circle_banner);
TextView textTitle = (TextView) contents.findViewById(R.id.text_game_title);
- TextView textDescription = (TextView) contents.findViewById(R.id.text_game_description);
+ TextView textDescription = (TextView) contents.findViewById(R.id.text_company);
TextView textCountry = (TextView) contents.findViewById(R.id.text_country);
TextView textDate = (TextView) contents.findViewById(R.id.text_date);
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/FileListItem.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/FileListItem.java
index b9c8a571cf..4952412e9d 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/FileListItem.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/FileListItem.java
@@ -10,10 +10,11 @@ import java.util.Set;
public class FileListItem implements Comparable<FileListItem>
{
- public static final int TYPE_FOLDER = 0;
- public static final int TYPE_GC = 1;
- public static final int TYPE_WII = 2;
- public static final int TYPE_OTHER = 3;
+ public static final int TYPE_GC = 0;
+ public static final int TYPE_WII = 1;
+ public static final int TYPE_WII_WARE = 2;
+ public static final int TYPE_OTHER = 4;
+ public static final int TYPE_FOLDER = 5;
private int mType;
private String mFilename;
@@ -48,7 +49,7 @@ public class FileListItem implements Comparable<FileListItem>
// Check that the file has an extension we care about before trying to read out of it.
if (allowedExtensions.contains(fileExtension))
{
- mType = NativeLibrary.IsWiiTitle(mPath) ? TYPE_WII : TYPE_GC;
+ mType = NativeLibrary.GetPlatform(mPath);
}
else
{
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/Game.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/Game.java
index b2ebb51d6f..4c4ea4fc04 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/Game.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/Game.java
@@ -1,6 +1,8 @@
package org.dolphinemu.dolphinemu.model;
-public interface Game
+import java.io.File;
+
+public class Game
{
public static final int PLATFORM_GC = 0;
public static final int PLATFORM_WII = 1;
@@ -22,19 +24,85 @@ public interface Game
public static final int COUNTRY_WORLD = 12;
public static final int COUNTRY_UNKNOWN = 13;
- public int getPlatform();
+ private static final String PATH_SCREENSHOT_FOLDER = "file:///sdcard/dolphin-emu/ScreenShots/";
+
+ private String mTitle;
+ private String mDescription;
+ private String mPath;
+ private String mGameId;
+ private String mScreenshotFolderPath;
+ private String mCompany;
+
+ private int mPlatform;
+ private int mCountry;
+
+ public Game(int platform, String title, String description, int country, String path, String gameId, String company)
+ {
+ mPlatform = platform;
+ mTitle = title;
+ mDescription = description;
+ mCountry = country;
+ mPath = path;
+ mGameId = gameId;
+ mCompany = company;
+ mScreenshotFolderPath = PATH_SCREENSHOT_FOLDER + getGameId() + "/";
+ }
+
+ public int getPlatform()
+ {
+ return mPlatform;
+ }
+
+ public String getTitle()
+ {
+ return mTitle;
+ }
+
+ public String getDescription()
+ {
+ return mDescription;
+ }
+
+ public String getCompany()
+ {
+ return mCompany;
+ }
+
+ public int getCountry()
+ {
+ return mCountry;
+ }
- public String getDate();
+ public String getPath()
+ {
+ return mPath;
+ }
- public String getTitle();
+ public String getGameId()
+ {
+ return mGameId;
+ }
- public String getDescription();
+ public String getScreenshotFolderPath()
+ {
+ return mScreenshotFolderPath;
+ }
- public int getCountry();
+ public String getScreenPath()
+ {
+ // Count how many screenshots are available, so we can use the most recent one.
+ File screenshotFolder = new File(mScreenshotFolderPath.substring(mScreenshotFolderPath.indexOf('s') - 1));
+ int screenCount = 0;
- public String getPath();
+ if (screenshotFolder.isDirectory())
+ {
+ screenCount = screenshotFolder.list().length;
+ }
- public String getGameId();
+ String screenPath = mScreenshotFolderPath
+ + getGameId() + "-"
+ + screenCount + ".png";
- public String getScreenPath();
+ return screenPath;
+ }
}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GcGame.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GcGame.java
deleted file mode 100644
index 72fa77d4c4..0000000000
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/GcGame.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.dolphinemu.dolphinemu.model;
-
-
-import java.io.File;
-
-public final class GcGame implements Game
-{
- private String mTitle;
- private String mDescription;
- private String mPath;
- private String mGameId;
- private String mScreenshotFolderPath;
-
- private String mDate;
-
- private int mCountry;
- private int mPlatform = PLATFORM_GC;
-
- private static final String PATH_SCREENSHOT_FOLDER = "file:///sdcard/dolphin-emu/ScreenShots/";
-
- public GcGame(String title, String description, int country, String path, String gameId, String date)
- {
- mTitle = title;
- mDescription = description;
- mCountry = country;
- mPath = path;
- mGameId = gameId;
- mDate = date;
- mScreenshotFolderPath = PATH_SCREENSHOT_FOLDER + getGameId() + "/";
- }
-
- @Override
- public int getPlatform()
- {
- return mPlatform;
- }
-
- @Override
- public String getTitle()
- {
- return mTitle;
- }
-
- @Override
- public String getDescription()
- {
- return mDescription;
- }
-
- @Override
- public String getDate()
- {
- return mDate;
- }
-
- @Override
- public int getCountry()
- {
- return mCountry;
- }
-
- @Override
- public String getPath()
- {
- return mPath;
- }
-
- public String getGameId()
- {
- return mGameId;
- }
-
- public String getScreenshotFolderPath()
- {
- return mScreenshotFolderPath;
- }
-
- @Override
- public String getScreenPath()
- {
- // Count how many screenshots are available, so we can use the most recent one.
- File screenshotFolder = new File(mScreenshotFolderPath.substring(mScreenshotFolderPath.indexOf('s') - 1));
- int screenCount = 0;
-
- if (screenshotFolder.isDirectory())
- {
- screenCount = screenshotFolder.list().length;
- }
-
- String screenPath = mScreenshotFolderPath
- + getGameId() + "-"
- + screenCount + ".png";
-
- return screenPath;
- }
-}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/WiiGame.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/WiiGame.java
deleted file mode 100644
index d0678f4e95..0000000000
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/model/WiiGame.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.dolphinemu.dolphinemu.model;
-
-
-public final class WiiGame implements Game
-{
- @Override
- public int getPlatform()
- {
- return 0;
- }
-
- @Override
- public String getDate()
- {
- return null;
- }
-
- @Override
- public String getTitle()
- {
- return null;
- }
-
- @Override
- public String getDescription()
- {
- return null;
- }
-
- @Override
- public int getCountry()
- {
- return 13;
- }
-
- @Override
- public String getPath()
- {
- return null;
- }
-
- @Override
- public String getGameId()
- {
- return null;
- }
-
- @Override
- public String getScreenPath()
- {
- return null;
- }
-}
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java
index 18e271e0f5..d578a7a8f2 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/viewholders/GameViewHolder.java
@@ -1,16 +1,11 @@
package org.dolphinemu.dolphinemu.viewholders;
-import android.app.Activity;
-import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.View;
-import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import org.dolphinemu.dolphinemu.R;
-import org.dolphinemu.dolphinemu.dialogs.GameDetailsDialog;
-import org.dolphinemu.dolphinemu.emulation.EmulationActivity;
import org.dolphinemu.dolphinemu.model.Game;
@@ -18,7 +13,7 @@ public class GameViewHolder extends RecyclerView.ViewHolder
{
public ImageView imageScreenshot;
public TextView textGameTitle;
- public TextView textDescription;
+ public TextView textCompany;
// Used to handle onClick(). Set this in onBindViewHolder().
public String path;
@@ -33,6 +28,6 @@ public class GameViewHolder extends RecyclerView.ViewHolder
imageScreenshot = (ImageView) itemView.findViewById(R.id.image_game_screen);
textGameTitle = (TextView) itemView.findViewById(R.id.text_game_title);
- textDescription = (TextView) itemView.findViewById(R.id.text_game_description);
+ textCompany = (TextView) itemView.findViewById(R.id.text_company);
}
}
diff --git a/Source/Android/app/src/main/res/drawable-hdpi/ic_company.png b/Source/Android/app/src/main/res/drawable-hdpi/ic_company.png
new file mode 100644
index 0000000000..69dba7ac8f
--- /dev/null
+++ b/Source/Android/app/src/main/res/drawable-hdpi/ic_company.png
Binary files differ
diff --git a/Source/Android/app/src/main/res/drawable-mdpi/ic_company.png b/Source/Android/app/src/main/res/drawable-mdpi/ic_company.png
new file mode 100644
index 0000000000..481de5052d
--- /dev/null
+++ b/Source/Android/app/src/main/res/drawable-mdpi/ic_company.png
Binary files differ
diff --git a/Source/Android/app/src/main/res/drawable-xhdpi/ic_company.png b/Source/Android/app/src/main/res/drawable-xhdpi/ic_company.png
new file mode 100644
index 0000000000..750d7ff388
--- /dev/null
+++ b/Source/Android/app/src/main/res/drawable-xhdpi/ic_company.png
Binary files differ
diff --git a/Source/Android/app/src/main/res/drawable-xxhdpi/ic_company.png b/Source/Android/app/src/main/res/drawable-xxhdpi/ic_company.png
new file mode 100644
index 0000000000..96fa6ac8f0
--- /dev/null
+++ b/Source/Android/app/src/main/res/drawable-xxhdpi/ic_company.png
Binary files differ
diff --git a/Source/Android/app/src/main/res/drawable-xxxhdpi/ic_company.png b/Source/Android/app/src/main/res/drawable-xxxhdpi/ic_company.png
new file mode 100644
index 0000000000..967aa1fbe2
--- /dev/null
+++ b/Source/Android/app/src/main/res/drawable-xxxhdpi/ic_company.png
Binary files differ
diff --git a/Source/Android/app/src/main/res/layout/card_game.xml b/Source/Android/app/src/main/res/layout/card_game.xml
index dc8321f8f8..b18bc9e7ee 100644
--- a/Source/Android/app/src/main/res/layout/card_game.xml
+++ b/Source/Android/app/src/main/res/layout/card_game.xml
@@ -40,7 +40,7 @@
tools:text="The Legend of Zelda: The Wind Waker"/>
<TextView
- android:id="@+id/text_game_description"
+ android:id="@+id/text_company"
style="@android:style/TextAppearance.Material.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -51,7 +51,7 @@
android:ellipsize="end"
android:lines="1"
android:maxLines="1"
- tools:text="Zany rhythm action!"/>
+ tools:text="Nintendo"/>
</LinearLayout>
diff --git a/Source/Android/app/src/main/res/layout/dialog_game_details.xml b/Source/Android/app/src/main/res/layout/dialog_game_details.xml
index b431991baf..940c69cdc1 100644
--- a/Source/Android/app/src/main/res/layout/dialog_game_details.xml
+++ b/Source/Android/app/src/main/res/layout/dialog_game_details.xml
@@ -32,6 +32,7 @@
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:transitionName="image_game_screen"
+ tools:scaleType="centerCrop"
tools:src="@drawable/placeholder_screenshot"/>
<TextView
@@ -46,12 +47,10 @@
android:layout_marginTop="24dp"
android:layout_toEndOf="@+id/circle_banner"
android:ellipsize="end"
- android:lines="1"
- android:maxLines="1"
tools:text="Rhythm Heaven Fever"/>
<TextView
- android:id="@+id/text_game_description"
+ android:id="@+id/text_company"
style="@android:style/TextAppearance.Material.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -59,7 +58,6 @@
android:layout_alignStart="@+id/text_game_title"
android:layout_below="@+id/text_game_title"
android:layout_marginTop="8dp"
- android:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sed odio vel quam auctor euismod. Pellentesque odio nibh, fermentum ut hendrerit id, ultrices et justo. "
tools:text="Zany rhythm action!"
/>
@@ -69,7 +67,7 @@
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
- android:layout_below="@+id/text_game_description"
+ android:layout_below="@+id/text_company"
android:layout_marginTop="16dp"
android:background="#1F000000"/>
@@ -85,14 +83,14 @@
android:src="@drawable/ic_country"/>
<ImageView
- android:id="@+id/icon_year"
+ android:id="@+id/icon_company"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignStart="@+id/icon_country"
android:layout_below="@+id/icon_country"
android:layout_marginTop="16dp"
android:padding="6dp"
- android:src="@drawable/ic_date"
+ android:src="@drawable/ic_company"
android:layout_marginBottom="16dp"/>
<TextView
@@ -100,22 +98,20 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/icon_country"
- android:layout_alignStart="@+id/text_game_description"
+ android:layout_alignStart="@+id/text_company"
android:layout_alignTop="@+id/icon_country"
android:gravity="center_vertical"
- android:text="United States"
tools:text="United States"/>
<TextView
android:id="@+id/text_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_alignBottom="@+id/icon_year"
+ android:layout_alignBottom="@+id/icon_company"
android:layout_alignStart="@+id/text_country"
- android:layout_alignTop="@+id/icon_year"
+ android:layout_alignTop="@+id/icon_company"
android:gravity="center_vertical"
- android:text="2010"
- tools:text="2010"/>
+ tools:text="Nintendo"/>
<ImageButton
android:id="@+id/button_launch"