SaveBundleUtils.java
8.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
package com.wd.foundation.bean.utils;
import java.io.Serializable;
import android.os.Bundle;
import android.os.Parcelable;
/**
* 描述:
*
* @author : lvjinhui
* @since: 2022/12/16
*/
public final class SaveBundleUtils {
private SaveBundleUtils() {
}
public static String getString(Bundle bundle, String key, String defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getString(key, defaultValue);
} catch (Exception var4) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static int getInt(Bundle bundle, String key, int defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getInt(key, defaultValue);
} catch (Exception var4) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static long getLong(Bundle bundle, String key, long defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getLong(key, defaultValue);
} catch (Exception var5) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static float getFloat(Bundle bundle, String key, float defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getFloat(key, defaultValue);
} catch (Exception var4) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static double getDouble(Bundle bundle, String key, double defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getDouble(key, defaultValue);
} catch (Exception var5) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static boolean getBoolean(Bundle bundle, String key, boolean defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getBoolean(key, defaultValue);
} catch (Exception var4) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static byte getByte(Bundle bundle, String key, byte defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getByte(key, defaultValue);
} catch (Exception var4) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static short getShort(Bundle bundle, String key, short defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getShort(key, defaultValue);
} catch (Exception var4) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static char getChar(Bundle bundle, String key, char defaultValue) {
if (null != bundle && null != key) {
try {
return bundle.getChar(key, defaultValue);
} catch (Exception var4) {
return defaultValue;
}
} else {
return defaultValue;
}
}
public static CharSequence getCharSequence(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getCharSequence(key);
} catch (Exception var3) {
return null;
}
} else {
return null;
}
}
public static Serializable getSerializable(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getSerializable(key);
} catch (Exception var3) {
return null;
}
} else {
return null;
}
}
public static <T extends Parcelable> T getParcelable(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getParcelable(key);
} catch (Exception var3) {
return null;
}
} else {
return null;
}
}
public static Parcelable[] getParcelableArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getParcelableArray(key);
} catch (Exception var3) {
return new Parcelable[0];
}
} else {
return new Parcelable[0];
}
}
public static boolean[] getBooleanArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getBooleanArray(key);
} catch (Exception var3) {
return new boolean[0];
}
} else {
return new boolean[0];
}
}
public static byte[] getByteArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getByteArray(key);
} catch (Exception var3) {
return new byte[0];
}
} else {
return new byte[0];
}
}
public static short[] getShortArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getShortArray(key);
} catch (Exception var3) {
return new short[0];
}
} else {
return new short[0];
}
}
public static char[] getCharArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getCharArray(key);
} catch (Exception var3) {
return new char[0];
}
} else {
return new char[0];
}
}
public static int[] getIntArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getIntArray(key);
} catch (Exception var3) {
return new int[0];
}
} else {
return new int[0];
}
}
public static long[] getLongArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getLongArray(key);
} catch (Exception var3) {
return new long[0];
}
} else {
return new long[0];
}
}
public static float[] getFloatArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getFloatArray(key);
} catch (Exception var3) {
return new float[0];
}
} else {
return new float[0];
}
}
public static double[] getDoubleArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getDoubleArray(key);
} catch (Exception var3) {
return new double[0];
}
} else {
return new double[0];
}
}
public static String[] getStringArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getStringArray(key);
} catch (Exception var3) {
return new String[0];
}
} else {
return new String[0];
}
}
public static CharSequence[] getCharSequenceArray(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getCharSequenceArray(key);
} catch (Exception var3) {
return new CharSequence[0];
}
} else {
return new CharSequence[0];
}
}
public static Bundle getBundle(Bundle bundle, String key) {
if (null != bundle && null != key) {
try {
return bundle.getBundle(key);
} catch (Exception var3) {
return null;
}
} else {
return null;
}
}
}