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
383665c8
Commit
383665c8
authored
Jan 15, 2017
by
Tanner Grehawick
Browse files
display toast when changing favorite status of facility
closes
#12
parent
4216ea5a
Pipeline
#766
passed with stages
in 4 minutes and 46 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/srct/whatsopen/views/adapters/FacilityListAdapter.java
View file @
383665c8
...
...
@@ -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
;
...
...
@@ -136,6 +138,12 @@ public class FacilityListAdapter extends
@OnClick
(
R
.
id
.
favorite_button
)
public
void
setFavorite
()
{
mPresenter
.
toggleFavorite
(
data
);
Context
context
=
getContext
();
Resources
res
=
context
.
getResources
();
int
formatName
=
data
.
isFavorited
()
?
R
.
string
.
toast_unset_favorite
:
R
.
string
.
toast_set_favorite
;
String
msg
=
String
.
format
(
res
.
getString
(
formatName
),
data
.
getName
());
Toast
toast
=
Toast
.
makeText
(
context
,
msg
,
Toast
.
LENGTH_SHORT
);
toast
.
show
();
}
@Override
...
...
app/src/main/res/values/strings.xml
View file @
383665c8
<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