From 6530958b01c100da402e148f150c1f65eec7a531 Mon Sep 17 00:00:00 2001 From: seanleavy Date: Mon, 21 Aug 2017 22:47:53 +0100 Subject: [PATCH] added strings and assets --- .../fragments/FavouritesFragment.java | 22 +++++++++++++++++-- .../wiimmfiitus/helpers/SnackBarHelper.java | 2 +- app/src/main/res/layout/activity_lobby.xml | 3 ++- app/src/main/res/values/dimens.xml | 2 +- app/src/main/res/values/strings.xml | 1 + 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/wii/sean/wiimmfiitus/fragments/FavouritesFragment.java b/app/src/main/java/com/wii/sean/wiimmfiitus/fragments/FavouritesFragment.java index bb7172e..baa27b9 100644 --- a/app/src/main/java/com/wii/sean/wiimmfiitus/fragments/FavouritesFragment.java +++ b/app/src/main/java/com/wii/sean/wiimmfiitus/fragments/FavouritesFragment.java @@ -1,6 +1,8 @@ package com.wii.sean.wiimmfiitus.fragments; +import android.app.Activity; import android.content.Context; +import android.content.ContextWrapper; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; @@ -16,8 +18,6 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; import android.widget.Toast; import com.google.common.base.Predicate; @@ -153,6 +153,13 @@ public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { }; miiItemTouchHelper = new ItemTouchHelper(callback); miiItemTouchHelper.attachToRecyclerView(wiiCyclerView); + RecyclerItemClickSupport.addTo(wiiCyclerView).setOnItemLongClickListener(new RecyclerItemClickSupport.OnItemLongClickListener() { + @Override + public boolean onItemLongClicked(RecyclerView recyclerView, int position, View v) { + SnackBarHelper.showSnackBar(getContext(), getParentActivity().findViewById(R.id.homescreen_main_layout), getContext().getString(R.string.drag_reorder_message), 2000, null); + return true; + } + }); } @Override @@ -296,4 +303,15 @@ private void processResult(Object result) { wiiCyclerViewAdapter.notifyDataSetChanged(); setOnBoarding(); } + + private Activity getParentActivity() { + Context context = getContext(); + while (context instanceof ContextWrapper) { + if (context instanceof Activity) { + return (Activity)context; + } + context = ((ContextWrapper)context).getBaseContext(); + } + return null; + } } diff --git a/app/src/main/java/com/wii/sean/wiimmfiitus/helpers/SnackBarHelper.java b/app/src/main/java/com/wii/sean/wiimmfiitus/helpers/SnackBarHelper.java index 7c3fb0b..5515bf1 100644 --- a/app/src/main/java/com/wii/sean/wiimmfiitus/helpers/SnackBarHelper.java +++ b/app/src/main/java/com/wii/sean/wiimmfiitus/helpers/SnackBarHelper.java @@ -13,7 +13,7 @@ //create a build pattern public class SnackBarHelper { - +//todo change this to a builder pattern public static void showSnackBar(Context context, View v, String resource, int length, Drawable d, final View... args) { Snackbar snackbar = Snackbar.make(v, resource, length); snackbar.setActionTextColor(context.getResources().getColor(android.R.color.holo_red_dark)); diff --git a/app/src/main/res/layout/activity_lobby.xml b/app/src/main/res/layout/activity_lobby.xml index a4225d4..aec8842 100644 --- a/app/src/main/res/layout/activity_lobby.xml +++ b/app/src/main/res/layout/activity_lobby.xml @@ -95,7 +95,8 @@ android:visibility="gone" /> 16dp 35dp 10dp - 65dp + 60dp 8dp 1dp 2dp diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ca37610..3718b64 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -19,6 +19,7 @@ Mii Search "Hold the SEARCH button if you're from Roscommon" + Drag to reorder your favourites Saved Miis Mii Search History