@@ -138,41 +138,6 @@ public void showSnackbar(Snackbar snackbar) {
138
138
mPopup .announceforAccessibility ();
139
139
}
140
140
141
- /**
142
- * TODO(newt): delete this method. Update callers to use {@link #showSnackbar(Snackbar)}.
143
- * Shows a snackbar with description text and an action button.
144
- * @param template Teamplate used to compose full description.
145
- * @param description Text for description showing at start of snackbar.
146
- * @param actionText Text for action button to show.
147
- * @param actionData Data bound to this snackbar entry. Will be returned to listeners when
148
- * action be clicked or snackbar be dismissed.
149
- * @param controller Listener for this snackbar entry.
150
- */
151
- public void showSnackbar (String template , String description , String actionText ,
152
- Object actionData , SnackbarController controller ) {
153
- showSnackbar (Snackbar .make (description , controller ).setTemplateText (template )
154
- .setAction (actionText , actionData ));
155
- }
156
-
157
- /**
158
- * TODO(newt): delete this method. Update callers to use {@link #showSnackbar(Snackbar)}.
159
- * Shows a snackbar for the given timeout duration with description text and an action button.
160
- * Allows overriding the default timeout of {@link #DEFAULT_SNACKBAR_DURATION_MS} with
161
- * a custom value.
162
- * @param template Teamplate used to compose full description.
163
- * @param description Text for description showing at start of snackbar.
164
- * @param actionText Text for action button to show.
165
- * @param actionData Data bound to this snackbar entry. Will be returned to listeners when
166
- * action be clicked or snackbar be dismissed.
167
- * @param controller Listener for this snackbar entry.
168
- * @param timeoutMs The timeout to use in ms.
169
- */
170
- public void showSnackbar (String template , String description , String actionText ,
171
- Object actionData , SnackbarController controller , int timeoutMs ) {
172
- showSnackbar (Snackbar .make (description , controller ).setTemplateText (template )
173
- .setAction (actionText , actionData ).setDuration (timeoutMs ));
174
- }
175
-
176
141
/**
177
142
* Dismisses snackbar, clears out all entries in stack and prevents future remove callbacks from
178
143
* happening. This method also unregisters this class from global layout notifications.
@@ -200,11 +165,11 @@ public void dismissSnackbar(boolean isTimeout) {
200
165
}
201
166
202
167
/**
203
- * Removes all entries for certain type of controller. This method is used when a controller
204
- * wants to remove all entries it posted to snackbar manager before.
205
- * @param controller This method only removes entries posted by this controller .
168
+ * Removes all snackbars that have a certain controller.
169
+ *
170
+ * @param controller Only snackbars with this controller will be removed .
206
171
*/
207
- public void removeSnackbarEntry (SnackbarController controller ) {
172
+ public void removeMatchingSnackbars (SnackbarController controller ) {
208
173
boolean isFound = false ;
209
174
Snackbar [] snackbars = new Snackbar [mStack .size ()];
210
175
mStack .toArray (snackbars );
@@ -216,21 +181,19 @@ public void removeSnackbarEntry(SnackbarController controller) {
216
181
}
217
182
if (!isFound ) return ;
218
183
219
- finishSnackbarEntryRemoval (controller );
184
+ finishSnackbarRemoval (controller );
220
185
}
221
186
222
187
/**
223
- * Removes all entries for certain type of controller and with specified data. This method is
224
- * used when a controller wants to remove some entries it posted to snackbar manager before.
225
- * However it does not affect other controllers' entries. Note that this method assumes
226
- * different types of snackbar controllers are not sharing the same instance.
227
- * @param controller This method only removes entries posted by this controller.
228
- * @param data Identifier of an entry to be removed from stack.
188
+ * Removes all snackbars that have a certain controller and action data.
189
+ *
190
+ * @param controller Only snackbars with this controller will be removed.
191
+ * @param actionData Only snackbars whose action data is equal to actionData will be removed.
229
192
*/
230
- public void removeSnackbarEntry (SnackbarController controller , Object data ) {
193
+ public void removeMatchingSnackbars (SnackbarController controller , Object actionData ) {
231
194
boolean isFound = false ;
232
195
for (Snackbar snackbar : mStack ) {
233
- if (snackbar .getActionData () != null && snackbar .getActionData ().equals (data )
196
+ if (snackbar .getActionData () != null && snackbar .getActionData ().equals (actionData )
234
197
&& snackbar .getController () == controller ) {
235
198
mStack .remove (snackbar );
236
199
isFound = true ;
@@ -239,10 +202,10 @@ public void removeSnackbarEntry(SnackbarController controller, Object data) {
239
202
}
240
203
if (!isFound ) return ;
241
204
242
- finishSnackbarEntryRemoval (controller );
205
+ finishSnackbarRemoval (controller );
243
206
}
244
207
245
- private void finishSnackbarEntryRemoval (SnackbarController controller ) {
208
+ private void finishSnackbarRemoval (SnackbarController controller ) {
246
209
controller .onDismissForEachType (false );
247
210
248
211
if (mStack .isEmpty ()) {
0 commit comments