Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
whats-open-android
Commits
1b7b3efd
Commit
1b7b3efd
authored
Jan 15, 2017
by
Robert Hitt
Browse files
Merge branch 'master' of
https://git.gmu.edu/srct/whats-open-android
into notifications
parents
77979569
27b69afb
Changes
3
Show whitespace changes
Inline
Side-by-side
app/src/main/java/srct/whatsopen/presenters/FacilityPresenter.java
View file @
1b7b3efd
package
srct.whatsopen.presenters
;
import
android.content.Context
;
import
android.content.SharedPreferences
;
import
android.content.res.Resources
;
import
android.graphics.Path
;
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
);
toast
.
show
();
mFacilityView
.
changeFavoriteIcon
(
status
);
// Get Realm instance and SharedPreferences
...
...
app/src/main/java/srct/whatsopen/views/adapters/FacilityListAdapter.java
View file @
1b7b3efd
...
...
@@ -3,6 +3,7 @@ package srct.whatsopen.views.adapters;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.res.Resources
;
import
android.graphics.Typeface
;
import
android.support.v4.content.ContextCompat
;
import
android.support.v7.widget.RecyclerView
;
...
...
@@ -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
;
...
...
app/src/main/res/values/strings.xml
View file @
1b7b3efd
<resources>
<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>
</resources>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment