diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/MainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/MainActivity.java
index 087684e2984f..daabf7dc03a5 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/MainActivity.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/MainActivity.java
@@ -5,6 +5,7 @@
import android.content.Intent;
import android.content.Loader;
import android.content.SharedPreferences;
+import android.content.res.ColorStateList;
import android.database.Cursor;
import android.os.Bundle;
import android.preference.PreferenceManager;
@@ -19,6 +20,9 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.Interpolator;
+import android.view.animation.OvershootInterpolator;
import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
@@ -48,6 +52,10 @@ public final class MainActivity extends AppCompatActivity implements LoaderManag
private ViewPager mViewPager;
private PlatformPagerAdapter mPlatformPagerAdapter;
+ private FloatingActionButton mButtonAddDirectory;
+
+ private static Interpolator mHideInterpolator = new AccelerateInterpolator();
+ private static Interpolator mShowInterpolator = new OvershootInterpolator();
@Override
protected void onCreate(Bundle savedInstanceState)
@@ -74,8 +82,8 @@ protected void onCreate(Bundle savedInstanceState)
tabLayout.setupWithViewPager(mViewPager);
// Set up the FAB.
- FloatingActionButton buttonAddDirectory = (FloatingActionButton) findViewById(R.id.button_add_directory);
- buttonAddDirectory.setOnClickListener(new View.OnClickListener()
+ mButtonAddDirectory = (FloatingActionButton) findViewById(R.id.button_add_directory);
+ mButtonAddDirectory.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view)
@@ -87,6 +95,41 @@ public void onClick(View view)
}
});
+ mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener()
+ {
+ @Override
+ public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels)
+ {
+ }
+
+ @Override
+ public void onPageScrollStateChanged(int state)
+ {
+ }
+
+ @Override
+ public void onPageSelected(int position)
+ {
+ Log.i("DolphinEmu", "[MainActivity] Page selected: " + position);
+
+ switch (position)
+ {
+ case Game.PLATFORM_GC:
+ changeFabColor(R.color.fab_gamecube);
+ break;
+
+ case Game.PLATFORM_WII:
+ changeFabColor(R.color.fab_wii);
+ break;
+
+ case Game.PLATFORM_WII_WARE:
+ changeFabColor(R.color.fab_wiiware);
+ break;
+ }
+ }
+
+ });
+
// Stuff in this block only happens when this activity is newly created (i.e. not a rotation)
if (savedInstanceState == null)
{
@@ -105,6 +148,34 @@ public void onClick(View view)
}
}
+ private void changeFabColor(int colorResourceId)
+ {
+ final ColorStateList tint = getResources().getColorStateList(colorResourceId);
+
+ // Hide the button.
+ mButtonAddDirectory.animate()
+ .withLayer()
+ .setDuration(100)
+ .setInterpolator(mHideInterpolator)
+ .scaleX(0.0f)
+ .scaleY(0.0f)
+ .withEndAction(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ // Change the button's color, then show it again.
+ mButtonAddDirectory.setBackgroundTintList(tint);
+ mButtonAddDirectory.animate()
+ .withLayer()
+ .setDuration(150)
+ .setInterpolator(mShowInterpolator)
+ .scaleX(1.0f)
+ .scaleY(1.0f);
+ }
+ });
+ }
+
/**
* Callback from AddDirectoryActivity. Applies any changes necessary to the GameGridActivity.
*
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/PlatformGamesFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/PlatformGamesFragment.java
index 4957090ed3fb..2648d0b97a77 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/PlatformGamesFragment.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/PlatformGamesFragment.java
@@ -7,6 +7,7 @@
import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.Nullable;
+import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
@@ -53,12 +54,13 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.grid_games);
// Specifying the LayoutManager determines how the RecyclerView arranges views.
-
RecyclerView.LayoutManager layoutManager = new GridLayoutManager(getActivity(),
getResources().getInteger(R.integer.game_grid_columns));
- recyclerView.setLayoutManager(layoutManager);
+ recyclerView.setLayoutManager(layoutManager);
recyclerView.addItemDecoration(new GameAdapter.SpacesItemDecoration(8));
+ recyclerView.setItemAnimator(new DefaultItemAnimator());
+ recyclerView.setHasFixedSize(true);
// Create an adapter that will relate the dataset to the views on-screen. +1 because of LOADER_ID_ALL
getLoaderManager().initLoader(mPlatform, null,
diff --git a/Source/Android/app/src/main/res/color/fab_gamecube.xml b/Source/Android/app/src/main/res/color/fab_gamecube.xml
new file mode 100644
index 000000000000..9ca7bd3fdc07
--- /dev/null
+++ b/Source/Android/app/src/main/res/color/fab_gamecube.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Source/Android/app/src/main/res/color/fab_wii.xml b/Source/Android/app/src/main/res/color/fab_wii.xml
new file mode 100644
index 000000000000..7df01ec7305f
--- /dev/null
+++ b/Source/Android/app/src/main/res/color/fab_wii.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Source/Android/app/src/main/res/color/fab_wiiware.xml b/Source/Android/app/src/main/res/color/fab_wiiware.xml
new file mode 100644
index 000000000000..7aef8a14cb9e
--- /dev/null
+++ b/Source/Android/app/src/main/res/color/fab_wiiware.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Source/Android/app/src/main/res/layout/activity_main.xml b/Source/Android/app/src/main/res/layout/activity_main.xml
index 53d4de6e7233..fe7afb061d91 100644
--- a/Source/Android/app/src/main/res/layout/activity_main.xml
+++ b/Source/Android/app/src/main/res/layout/activity_main.xml
@@ -43,6 +43,7 @@
android:layout_margin="32dp"
android:src="@drawable/ic_add"
app:borderWidth="0dp"
+ app:backgroundTint="@color/fab_gamecube"
app:rippleColor="?android:colorPrimaryDark"
app:layout_anchor="@+id/pager_platforms"
app:layout_anchorGravity="bottom|right|end"/>
diff --git a/Source/Android/app/src/main/res/layout/fragment_grid.xml b/Source/Android/app/src/main/res/layout/fragment_grid.xml
index eb46ff84585f..1ac674b3dc9e 100644
--- a/Source/Android/app/src/main/res/layout/fragment_grid.xml
+++ b/Source/Android/app/src/main/res/layout/fragment_grid.xml
@@ -11,5 +11,8 @@
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
- tools:listitem="@layout/grid_card_game"/>
+ android:paddingTop="8dp"
+ android:paddingBottom="8dp"
+ android:clipToPadding="false"
+ tools:listitem="@layout/card_game"/>
\ No newline at end of file