|
@@ -1,10 +1,10 @@
|
1
|
1
|
package com.reactnativenavigation.params.parsers;
|
2
|
2
|
|
3
|
3
|
import android.os.Bundle;
|
|
4
|
+import android.support.design.widget.Snackbar;
|
4
|
5
|
|
5
|
6
|
import com.reactnativenavigation.params.AppStyle;
|
6
|
7
|
import com.reactnativenavigation.params.SnackbarParams;
|
7
|
|
-import com.reactnativenavigation.params.StyleParams;
|
8
|
8
|
|
9
|
9
|
public class SnackbarParamsParser extends Parser {
|
10
|
10
|
public SnackbarParams parse(Bundle params) {
|
|
@@ -13,6 +13,20 @@ public class SnackbarParamsParser extends Parser {
|
13
|
13
|
result.textColor = getColor(params, "textColor", AppStyle.appStyle.snackbarTextColor);
|
14
|
14
|
result.buttonText = params.getString("buttonText");
|
15
|
15
|
result.buttonColor = getColor(params, "buttonColor", AppStyle.appStyle.snackbarButtonColor);
|
|
16
|
+ result.duration = getDuration(params.getString("duration", "short"));
|
16
|
17
|
return result;
|
17
|
18
|
}
|
|
19
|
+
|
|
20
|
+ private int getDuration(String duration) {
|
|
21
|
+ switch (duration) {
|
|
22
|
+ case "short":
|
|
23
|
+ return Snackbar.LENGTH_SHORT;
|
|
24
|
+ case "long":
|
|
25
|
+ return Snackbar.LENGTH_LONG;
|
|
26
|
+ case "indefinite":
|
|
27
|
+ return Snackbar.LENGTH_INDEFINITE;
|
|
28
|
+ default:
|
|
29
|
+ return Snackbar.LENGTH_SHORT;
|
|
30
|
+ }
|
|
31
|
+ }
|
18
|
32
|
}
|