Commit 1b7b3efd authored by Robert Hitt's avatar Robert Hitt
Browse files

Merge branch 'master' of into notifications

parents 77979569 27b69afb
package srct.whatsopen.presenters;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.preference.PreferenceManager;
import android.widget.Toast;
import java.text.ParseException;
import java.text.SimpleDateFormat;
......@@ -12,6 +15,7 @@ import java.util.Date;
import io.realm.Realm;
import io.realm.RealmList;
import srct.whatsopen.R;
import srct.whatsopen.model.Facility;
import srct.whatsopen.model.OpenTimes;
import srct.whatsopen.model.SpecialSchedule;
......@@ -33,6 +37,14 @@ public class FacilityPresenter {
// and updates the favorite status in SharedPreferences
public void toggleFavorite(Facility facility) {
final boolean status = !facility.isFavorited();
Context context = mFacilityView.getContext();
Resources res = context.getResources();
int formatName = status ? R.string.toast_set_favorite : R.string.toast_unset_favorite;
String msg = String.format(res.getString(formatName), facility.getName());
Toast toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);;
// Get Realm instance and SharedPreferences
......@@ -3,6 +3,7 @@ package srct.whatsopen.views.adapters;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
......@@ -12,6 +13,7 @@ import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Calendar;
<string name="app_name">What\'s Open</string>
<string name="toast_set_favorite">Added %s to Favorites</string>
<string name="toast_unset_favorite">Removed %s from Favorites</string>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment