-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpluginClientSdkLib.patch
More file actions
646 lines (590 loc) · 34 KB
/
pluginClientSdkLib.patch
File metadata and controls
646 lines (590 loc) · 34 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
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtilTest.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtilTest.java
index 096ba91..0621c0a 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtilTest.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtilTest.java
@@ -14,11 +14,14 @@
*/
package com.twofortyfouram.locale.sdk.client.internal;
import android.content.pm.PackageInfo;
-import android.support.annotation.NonNull;
+
+import androidx.test.filters.SmallTest;
+import androidx.annotation.NonNull;
+
import android.test.AndroidTestCase;
import android.test.mock.MockPackageManager;
import android.test.suitebuilder.annotation.SmallTest;
import com.twofortyfouram.locale.sdk.client.internal.HostPackageUtil;
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/ui/activity/PluginType.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/ui/activity/PluginType.java
index e1debb6..3a61a5b 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/ui/activity/PluginType.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/androidTest/java/com/twofortyfouram/locale/sdk/client/ui/activity/PluginType.java
@@ -36,11 +36,11 @@ public enum PluginType {
private final String mActivityIntentAction;
@NonNull
private final String mReceiverIntentAction;
- private PluginType(@NonNull final String activityIntentAction,
+ PluginType(@NonNull final String activityIntentAction,
@NonNull final String receiverIntentAction) {
assertNotEmpty(activityIntentAction, "activityIntentAction"); //$NON-NLS-1$
assertNotEmpty(receiverIntentAction, "receiverIntentAction"); //$NON-NLS-1$
mActivityIntentAction = activityIntentAction;
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtil.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtil.java
index 9f70830..d9a7d88 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtil.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/HostPackageUtil.java
@@ -15,15 +15,16 @@
package com.twofortyfouram.locale.sdk.client.internal;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import net.jcip.annotations.ThreadSafe;
+
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/PluginActivityDelegate.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/PluginActivityDelegate.java
index bd5da1b..5c4589e 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/PluginActivityDelegate.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/internal/PluginActivityDelegate.java
@@ -1,12 +1,13 @@
package com.twofortyfouram.locale.sdk.client.internal;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import com.twofortyfouram.assertion.BundleAssertions;
import com.twofortyfouram.locale.sdk.client.ui.activity.IPluginActivity;
import com.twofortyfouram.log.Lumberjack;
import com.twofortyfouram.spackle.bundle.BundleComparer;
@@ -88,11 +89,11 @@ public final class PluginActivityDelegate<T extends Activity & IPluginActivity>
final String blurb = activity.getResultBlurb(resultBundle);
assertNotNull(blurb, "blurb"); //$NON-NLS-1$
if (!BundleComparer.areBundlesEqual(resultBundle, activity.getPreviousBundle())
|| !blurb.equals(activity.getPreviousBlurb())) {
- final Intent resultIntent = new Intent();
+ final Intent resultIntent = activity.getResultIntent();
resultIntent.putExtra(com.twofortyfouram.locale.api.Intent.EXTRA_BUNDLE,
resultBundle);
resultIntent.putExtra(
com.twofortyfouram.locale.api.Intent.EXTRA_STRING_BLURB,
blurb);
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractAsyncReceiver.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractAsyncReceiver.java
index 6df4c3d..bc01fad 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractAsyncReceiver.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractAsyncReceiver.java
@@ -20,13 +20,14 @@ import android.content.BroadcastReceiver;
import android.os.Build.VERSION_CODES;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
-import android.support.annotation.NonNull;
import android.util.Pair;
+import androidx.annotation.NonNull;
+
import com.twofortyfouram.spackle.AndroidSdkVersion;
import com.twofortyfouram.spackle.ThreadUtil;
import com.twofortyfouram.spackle.ThreadUtil.ThreadPriority;
import net.jcip.annotations.ThreadSafe;
@@ -136,13 +137,13 @@ import static com.twofortyfouram.assertion.Assertions.assertNotNull;
private static void quitJellybeanMr2() {
Looper.myLooper().quitSafely();
}
}
- /* package */static interface AsyncCallback {
+ /* package */ interface AsyncCallback {
/**
* @return The result code to be set if this is an ordered broadcast.
*/
- public int runAsync();
+ int runAsync();
}
}
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginConditionReceiver.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginConditionReceiver.java
index 44a9045..0afbcba 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginConditionReceiver.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginConditionReceiver.java
@@ -18,15 +18,15 @@ package com.twofortyfouram.locale.sdk.client.receiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.IntDef;
-import android.support.annotation.NonNull;
-import com.twofortyfouram.annotation.VisibleForTesting;
-import com.twofortyfouram.annotation.VisibleForTesting.Visibility;
+import androidx.annotation.NonNull;
+import androidx.annotation.IntDef;
+import androidx.annotation.VisibleForTesting;
+
import com.twofortyfouram.log.Lumberjack;
import com.twofortyfouram.spackle.AndroidSdkVersion;
import com.twofortyfouram.spackle.bundle.BundleScrubber;
import java.lang.annotation.Retention;
@@ -50,13 +50,18 @@ import java.lang.annotation.RetentionPolicy;
* RESULT_CONDITION_UNKNOWN} and
* returns. If the bundle is valid, then the lifecycle continues.</li>
* <li>{@link #isAsync()} is called to determine whether the remaining work should be performed on
* a
* background thread.</li>
- * <li>{@link #getPluginConditionResult(android.content.Context, android.os.Bundle)} is called to
- * determine the plug-in's status, and the return value of this method is set as the receiver's
- * result code.</li>
+ * <li>{@link #getPluginConditionResult(Context, Intent, Bundle)} and
+ * {@link #getPluginConditionResult(Context, Bundle)} is called to
+ * determine the plug-in's status, and the return value of the
+ * method is set as the receiver's result code. To maintain support
+ * of existing implementations the partially abstract implementation
+ * of the function {@link #getPluginConditionResult(Context, Intent, Bundle)}
+ * only calls {@link #getPluginConditionResult(Context, Bundle)}. Only one of
+ * the function should be overriden by the client.</li>
* </ol>
* <p>
* Implementations of this BroadcastReceiver must be registered in the Android
* Manifest with an Intent filter for
* {@link com.twofortyfouram.locale.api.Intent#ACTION_QUERY_CONDITION ACTION_QUERY_CONDITION}. The
@@ -128,35 +133,38 @@ public abstract class AbstractPluginConditionReceiver extends AbstractAsyncRecei
final AsyncCallback callback = new AsyncCallback() {
@NonNull
private final Context mContext = context;
@NonNull
+ private final Intent mIntent = intent;
+
+ @NonNull
private final Bundle mBundle = bundle;
@Override
public int runAsync() {
- final int pluginResult = getPluginConditionResult(mContext, mBundle);
+ final int pluginResult = getPluginConditionResult(mContext, mIntent, mBundle);
assertResult(pluginResult);
return pluginResult;
}
};
goAsyncWithCallback(callback, isOrderedBroadcast());
} else {
- final int pluginState = getPluginConditionResult(context, bundle);
+ final int pluginState = getPluginConditionResult(context, intent, bundle);
assertResult(pluginState);
setResultCode(pluginState);
}
}
/**
* @param result One of the acceptable plug-in result codes.
* @throws AssertionError if {@code result} is not one of the three
* acceptable values.
*/
- @VisibleForTesting(Visibility.PRIVATE)
+ @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
/* package */ static void assertResult(final int result) {
if (com.twofortyfouram.locale.api.Intent.RESULT_CONDITION_SATISFIED != result
&& com.twofortyfouram.locale.api.Intent.RESULT_CONDITION_UNSATISFIED != result
&& com.twofortyfouram.locale.api.Intent.RESULT_CONDITION_UNKNOWN != result) {
throw new AssertionError(
@@ -186,10 +194,11 @@ public abstract class AbstractPluginConditionReceiver extends AbstractAsyncRecei
protected abstract boolean isBundleValid(@NonNull final Bundle bundle);
/**
* Configures the receiver whether it should process the Intent in a
* background thread. Plug-ins should return true if their
+ * {@link #getPluginConditionResult(Context, Intent, Bundle)} or
* {@link #getPluginConditionResult(Context, Bundle)} method performs any
* sort of disk IO (ContentProvider query, reading SharedPreferences, etc.).
* or other work that may be slow.
* <p>
* Asynchronous BroadcastReceivers are not supported prior to Honeycomb, so
@@ -207,13 +216,16 @@ public abstract class AbstractPluginConditionReceiver extends AbstractAsyncRecei
*
* If {@link #isAsync()} returns true, this method will be called on a
* background thread. If {@link #isAsync()} returns false, this method will
* be called on the main thread. Regardless of which thread this method is
* called on, this method MUST return within 10 seconds per the requirements
- * for BroadcastReceivers.
+ * for BroadcastReceivers. Either override this method or
+ * {@link #getPluginConditionResult(Context, Bundle)}.
+ * Do not override both or call super of this method.
*
* @param context BroadcastReceiver context.
+ * @param intent The intent received by the BroadcastReceiver from the host.
* @param bundle The plug-in's Bundle previously returned by the edit
* Activity.
* @return One of the Locale plug-in query results:
* {@link com.twofortyfouram.locale.api.Intent#RESULT_CONDITION_SATISFIED
* RESULT_CONDITION_SATISFIED}
@@ -226,12 +238,48 @@ public abstract class AbstractPluginConditionReceiver extends AbstractAsyncRecei
* . If {@code bundle} is invalid, implementations must return
* {@link com.twofortyfouram.locale.api.Intent#RESULT_CONDITION_UNKNOWN
* RESULT_CONDITION_UNKNOWN}
*/
@ConditionResult
- protected abstract int getPluginConditionResult(@NonNull final Context context,
- @NonNull final Bundle bundle);
+ protected int getPluginConditionResult(@NonNull final Context context,
+ @NonNull final Intent intent,
+ @NonNull final Bundle bundle) {
+ return getPluginConditionResult(context, bundle);
+ }
+
+ /**
+ * Determines the state of the plug-in.
+ *
+ * If {@link #isAsync()} returns true, this method will be called on a
+ * background thread. If {@link #isAsync()} returns false, this method will
+ * be called on the main thread. Regardless of which thread this method is
+ * called on, this method MUST return within 10 seconds per the requirements
+ * for BroadcastReceivers. Either override this method or
+ * {@link #getPluginConditionResult(Context, Intent, Bundle)}.
+ * Do not override both.
+ *
+ * @param context BroadcastReceiver context.
+ * @param bundle The plug-in's Bundle previously returned by the edit
+ * Activity.
+ * @return One of the Locale plug-in query results:
+ * {@link com.twofortyfouram.locale.api.Intent#RESULT_CONDITION_SATISFIED
+ * RESULT_CONDITION_SATISFIED}
+ * ,
+ * {@link com.twofortyfouram.locale.api.Intent#RESULT_CONDITION_UNSATISFIED
+ * RESULT_CONDITION_UNSATISFIED}
+ * , or
+ * {@link com.twofortyfouram.locale.api.Intent#RESULT_CONDITION_UNKNOWN
+ * RESULT_CONDITION_UNKNOWN}
+ * . If {@code bundle} is invalid, implementations must return
+ * {@link com.twofortyfouram.locale.api.Intent#RESULT_CONDITION_UNKNOWN
+ * RESULT_CONDITION_UNKNOWN}
+ */
+ @ConditionResult
+ protected int getPluginConditionResult(@NonNull final Context context,
+ @NonNull final Bundle bundle) {
+ return com.twofortyfouram.locale.api.Intent.RESULT_CONDITION_UNKNOWN;
+ }
@IntDef({com.twofortyfouram.locale.api.Intent.RESULT_CONDITION_SATISFIED, com.twofortyfouram
.locale.api.Intent.RESULT_CONDITION_UNKNOWN, com.twofortyfouram.locale.api.Intent
.RESULT_CONDITION_UNSATISFIED})
@Retention(RetentionPolicy.SOURCE)
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginSettingReceiver.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginSettingReceiver.java
index 10f90e0..072e83e 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginSettingReceiver.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/receiver/AbstractPluginSettingReceiver.java
@@ -20,34 +20,40 @@ import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
-import android.support.annotation.NonNull;
+
+import androidx.annotation.NonNull;
import com.twofortyfouram.log.Lumberjack;
import com.twofortyfouram.spackle.AndroidSdkVersion;
import com.twofortyfouram.spackle.bundle.BundleScrubber;
/**
* <p>Abstract superclass for a plug-in setting BroadcastReceiver implementation.</p>
* <p>The plug-in receiver lifecycle is as follows:</p>
* <ol>
- * <li>{@link #onReceive(android.content.Context, android.content.Intent)} is called by the Android
+ * <li>{@link #onReceive(Context, Intent)} is called by the Android
* frameworks.
* onReceive() will verify that the Intent is valid. If the Intent is invalid, the receiver
* returns
* immediately. If the Intent appears to be valid, then the lifecycle continues.</li>
- * <li>{@link #isBundleValid(android.os.Bundle)} is called to determine whether {@link
+ * <li>{@link #isBundleValid(Bundle)} is called to determine whether {@link
* com.twofortyfouram.locale.api.Intent#EXTRA_BUNDLE EXTRA_BUNDLE} is valid. If the Bundle is
* invalid, then the
* receiver returns immediately. If the bundle is valid, then the lifecycle continues.</li>
* <li>{@link #isAsync()} is called to determine whether the remaining work should be performed on
* a
* background thread.</li>
- * <li>{@link #firePluginSetting(android.content.Context, android.os.Bundle)} is called to trigger
- * the plug-in setting's action.</li>
+ * <li>{@link #firePluginSetting(Context, Intent, Bundle)} and
+ * {@link #firePluginSetting(Context, Bundle)} are called to trigger
+ * the plug-in setting's action and should be overriden by the client.
+ * To maintain support of existing implementations the partially abstract implementation
+ * of the function {@link #firePluginSetting(Context, Intent, Bundle)}
+ * only calls {@link #firePluginSetting(Context, Bundle)}. Only one of
+ * the function should be overriden by the client.</li>
* </ol>
* <p>
* Implementations of this BroadcastReceiver must be registered in the Android
* Manifest with an Intent filter for
* {@link com.twofortyfouram.locale.api.Intent#ACTION_FIRE_SETTING ACTION_FIRE_SETTING}. The
@@ -119,23 +125,26 @@ public abstract class AbstractPluginSettingReceiver extends AbstractAsyncReceive
@NonNull
private final Context mContext = context;
@NonNull
+ private final Intent mIntent = intent;
+
+ @NonNull
private final Bundle mBundle = bundle;
@Override
public int runAsync() {
- firePluginSetting(mContext, mBundle);
+ firePluginSetting(mContext, mIntent, mBundle);
return Activity.RESULT_OK;
}
};
goAsyncWithCallback(callback, isOrderedBroadcast());
} else {
- firePluginSetting(context, bundle);
+ firePluginSetting(context, intent, bundle);
}
}
/**
* <p>Gives the plug-in receiver an opportunity to validate the Bundle, to
@@ -153,12 +162,13 @@ public abstract class AbstractPluginSettingReceiver extends AbstractAsyncReceive
protected abstract boolean isBundleValid(@NonNull final Bundle bundle);
/**
* Configures the receiver whether it should process the Intent in a
* background thread. Plug-ins should return true if their
- * {@link #firePluginSetting(android.content.Context, android.os.Bundle)} method performs any
- * sort of disk IO (ContentProvider query, reading SharedPreferences, etc.).
+ * {@link #firePluginSetting(Context, Intent, Bundle)} or
+ * {@link #firePluginSetting(Context, Bundle)}
+ * method performs any sort of disk IO (ContentProvider query, reading SharedPreferences, etc.).
* or other work that may be slow.
* <p>
* Asynchronous BroadcastReceivers are not supported prior to Honeycomb, so
* with older platforms broadcasts will always be processed on the BroadcastReceiver's Looper
* (which for Manifest registered receivers will be the main thread).
@@ -172,14 +182,36 @@ public abstract class AbstractPluginSettingReceiver extends AbstractAsyncReceive
/**
* If {@link #isAsync()} returns true, this method will be called on a
* background thread. If {@link #isAsync()} returns false, this method will
* be called on the main thread. Regardless of which thread this method is
* called on, this method MUST return within 10 seconds per the requirements
- * for BroadcastReceivers.
+ * for BroadcastReceivers. Either override this method or
+ * {@link #firePluginSetting(Context, Bundle)}.
+ * Do not override both or call super of this method.
*
* @param context BroadcastReceiver context.
+ * @param intent The intent received by the BroadcastReceiver from the host.
* @param bundle The plug-in's Bundle previously returned by the edit
* Activity.
*/
- protected abstract void firePluginSetting(@NonNull final Context context,
- @NonNull final Bundle bundle);
+ protected void firePluginSetting(@NonNull final Context context, @NonNull final Intent intent, @NonNull final Bundle bundle) {
+ firePluginSetting(context,bundle);
+ }
+
+ /**
+ * If {@link #isAsync()} returns true, this method will be called on a
+ * background thread. If {@link #isAsync()} returns false, this method will
+ * be called on the main thread. Regardless of which thread this method is
+ * called on, this method MUST return within 10 seconds per the requirements
+ * for BroadcastReceivers. Either override this method or
+ * {@link #firePluginSetting(Context, Intent, Bundle)}.
+ * Do not override both.
+ *
+ * @param context BroadcastReceiver context.
+ * @param bundle The plug-in's Bundle previously returned by the edit
+ * Activity.
+ */
+ protected void firePluginSetting(@NonNull final Context context,
+ @NonNull final Bundle bundle) {
+
+ }
}
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractAppCompatPluginActivity.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractAppCompatPluginActivity.java
index dc561bd..ad92d03 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractAppCompatPluginActivity.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractAppCompatPluginActivity.java
@@ -13,14 +13,17 @@
* limitations under the License.
*/
package com.twofortyfouram.locale.sdk.client.ui.activity;
+import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import androidx.appcompat.app.AppCompatActivity;
import com.twofortyfouram.locale.sdk.client.internal.PluginActivityDelegate;
/**
* <p>NOTE: This class is for compatibility with Material Design via the appcompat-v7 library. To use this
@@ -53,12 +56,13 @@ import com.twofortyfouram.locale.sdk.client.internal.PluginActivityDelegate;
* {@link #onPostCreateWithPreviousResult(android.os.Bundle, String)} during the
* Activity's {@link #onPostCreate(android.os.Bundle)} phase when the Activity is first
* created.</li>
* </ul>
* <p>During
- * the Activity's {@link #finish()} lifecycle callback, this class will call {@link
- * #getResultBundle()} and {@link #getResultBlurb(android.os.Bundle)}, which should return the
+ * the Activity's {@link #finish()} lifecycle callback, this class will call
+ * {@link #getResultIntent()}, {@link #getResultBundle()} and {@link
+ * #getResultBlurb(android.os.Bundle)}, which should return the
* Bundle and blurb data the Activity would like to save back to the host.
* </p>
* <p>
* Note that all of these behaviors only apply if the Intent
* starting the Activity is one of the plug-in "edit" Intent actions.
@@ -106,10 +110,15 @@ public abstract class AbstractAppCompatPluginActivity extends AppCompatActivity
* first, then the Activity result will be lost.
*/
super.finish();
}
+ @NonNull
+ public Intent getResultIntent() {
+ return new Intent();
+ }
+
/**
* @return The {@link com.twofortyfouram.locale.api.Intent#EXTRA_BUNDLE EXTRA_BUNDLE} that was
* previously saved to the host and subsequently passed back to this Activity for further
* editing. Internally, this method relies on {@link #isBundleValid(android.os.Bundle)}. If
* the bundle exists but is not valid, this method will return null.
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractFragmentPluginActivity.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractFragmentPluginActivity.java
index 066a253..2d66595 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractFragmentPluginActivity.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractFragmentPluginActivity.java
@@ -13,14 +13,16 @@
* limitations under the License.
*/
package com.twofortyfouram.locale.sdk.client.ui.activity;
+import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v4.app.FragmentActivity;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import androidx.fragment.app.FragmentActivity;
import com.twofortyfouram.locale.sdk.client.internal.PluginActivityDelegate;
/**
* <p>NOTE: This class is for backwards compatibility via the support-v4 library. To use this
@@ -53,12 +55,13 @@ import com.twofortyfouram.locale.sdk.client.internal.PluginActivityDelegate;
* {@link #onPostCreateWithPreviousResult(Bundle, String)} during the
* Activity's {@link #onPostCreate(Bundle)} phase when the Activity is first
* created.</li>
* </ul>
* <p>During
- * the Activity's {@link #finish()} lifecycle callback, this class will call {@link
- * #getResultBundle()} and {@link #getResultBlurb(android.os.Bundle)}, which should return the
+ * the Activity's {@link #finish()} lifecycle callback, this class will call
+ * {@link #getResultIntent()}, {@link #getResultBundle()} and {@link
+ * #getResultBlurb(android.os.Bundle)}, which should return the
* Bundle and blurb data the Activity would like to save back to the host.
* </p>
* <p>
* Note that all of these behaviors only apply if the Intent
* starting the Activity is one of the plug-in "edit" Intent actions.
@@ -106,10 +109,15 @@ public abstract class AbstractFragmentPluginActivity extends FragmentActivity im
* first, then the Activity result will be lost.
*/
super.finish();
}
+ @NonNull
+ public Intent getResultIntent() {
+ return new Intent();
+ }
+
/**
* @return The {@link com.twofortyfouram.locale.api.Intent#EXTRA_BUNDLE EXTRA_BUNDLE} that was
* previously saved to the host and subsequently passed back to this Activity for further
* editing. Internally, this method relies on {@link #isBundleValid(android.os.Bundle)}. If
* the bundle exists but is not valid, this method will return null.
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractPluginActivity.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractPluginActivity.java
index 31f708c..0ba6201 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractPluginActivity.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/AbstractPluginActivity.java
@@ -14,13 +14,15 @@
*/
package com.twofortyfouram.locale.sdk.client.ui.activity;
import android.app.Activity;
+import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import com.twofortyfouram.locale.sdk.client.internal.PluginActivityDelegate;
import net.jcip.annotations.NotThreadSafe;
@@ -104,10 +106,15 @@ public abstract class AbstractPluginActivity extends Activity implements IPlugin
* first, then the Activity result will be lost.
*/
super.finish();
}
+ @NonNull
+ public Intent getResultIntent() {
+ return new Intent();
+ }
+
/**
* @return The {@link com.twofortyfouram.locale.api.Intent#EXTRA_BUNDLE EXTRA_BUNDLE} that was
* previously saved to the host and subsequently passed back to this Activity for further
* editing. Internally, this method relies on {@link #isBundleValid(android.os.Bundle)}. If
* the bundle exists but is not valid, this method will return null.
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/IPluginActivity.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/IPluginActivity.java
index 2ceccda..3211578 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/IPluginActivity.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/IPluginActivity.java
@@ -1,10 +1,11 @@
package com.twofortyfouram.locale.sdk.client.ui.activity;
+import android.content.Intent;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
/**
* Common interface for plug-in Activities.
*/
public interface IPluginActivity {
@@ -50,16 +51,22 @@ public interface IPluginActivity {
* called
* when the Activity is recreated (e.g. {@code savedInstanceState != null}) such as after a
* configuration change like a screen rotation.</p>
*
* @param previousBundle Previous bundle that the Activity saved.
- * @param previousBlurb Previous blurb that the Activity saved
+ * @param previousBlurb Previous blurb that the Activity saved.
*/
void onPostCreateWithPreviousResult(
@NonNull final Bundle previousBundle, @NonNull final String previousBlurb);
/**
+ * @return Intent for the plug-in or {@code null}.
+ */
+ @NonNull
+ Intent getResultIntent();
+
+ /**
* @return Bundle for the plug-in or {@code null} if a valid Bundle cannot
* be generated.
*/
@Nullable
Bundle getResultBundle();
diff --git a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/InfoActivity.java b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/InfoActivity.java
index 1ba73cc..87392df 100755
--- a/repos/android-plugin-client-sdk-for-locale-master/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/InfoActivity.java
+++ b/android-locale-plugin-libraries/android-locale-plugin-libraries/pluginClientSdkLib/src/main/java/com/twofortyfouram/locale/sdk/client/ui/activity/InfoActivity.java
@@ -19,12 +19,13 @@ import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import com.twofortyfouram.locale.sdk.client.R;
import com.twofortyfouram.log.Lumberjack;
import net.jcip.annotations.NotThreadSafe;