Skip to content

Commit 27bb6b6

Browse files
committed
Fix linting issues
1 parent ac854ec commit 27bb6b6

File tree

67 files changed

+208
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+208
-211
lines changed

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/adapter/EnumSelectionRecyclerViewAdapter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616

1717
public class EnumSelectionRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
1818

19-
private Font font;
20-
private LayoutInflater layoutInflater;
19+
private final Font font;
20+
private final LayoutInflater layoutInflater;
2121

22-
private Context context;
23-
private Object[] enums;
24-
private EnumSelectionCallback callback;
22+
private final Context context;
23+
private final Object[] enums;
24+
private final EnumSelectionCallback callback;
2525

2626

2727
public EnumSelectionRecyclerViewAdapter(Context context, Object[] enums, EnumSelectionCallback callback) {
@@ -60,8 +60,8 @@ public int getItemCount() {
6060

6161
public class EnumSelectionViewHolder extends RecyclerView.ViewHolder {
6262

63-
private RelativeLayout enumRelativeLayout;
64-
private TextView enumTextView;
63+
private final RelativeLayout enumRelativeLayout;
64+
private final TextView enumTextView;
6565

6666
private String title;
6767

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/adapter/InAppMessageRecyclerViewAdapter.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323

2424
public class InAppMessageRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
2525

26-
private Animate animate;
27-
private LayoutInflater layoutInflater;
28-
private Toaster toaster;
26+
private final Animate animate;
27+
private final LayoutInflater layoutInflater;
28+
private final Toaster toaster;
2929

30-
private Context context;
31-
private InAppMessage[] inAppMessages;
30+
private final Context context;
31+
private final InAppMessage[] inAppMessages;
3232

3333

3434
public InAppMessageRecyclerViewAdapter(Context context, InAppMessage[] inAppMessages) {
@@ -67,10 +67,10 @@ public int getItemCount() {
6767

6868
public class InAppMessageViewHolder extends RecyclerView.ViewHolder {
6969

70-
private LinearLayout inAppMessageLinearLayout;
71-
private ImageView inAppMessageImageView;
72-
private ProgressBar inAppMessageProgressBar;
73-
private TextView inAppMessageTextView;
70+
private final LinearLayout inAppMessageLinearLayout;
71+
private final ImageView inAppMessageImageView;
72+
private final ProgressBar inAppMessageProgressBar;
73+
private final TextView inAppMessageTextView;
7474

7575
private InAppMessage inAppMessage;
7676

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/adapter/NotificationRecyclerViewAdapter.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
2525

26-
private Animate animate;
27-
private LayoutInflater layoutInflater;
26+
private final Animate animate;
27+
private final LayoutInflater layoutInflater;
2828

29-
private Context context;
30-
private Notification[] notifications;
29+
private final Context context;
30+
private final Notification[] notifications;
3131

3232

3333
public NotificationRecyclerViewAdapter(Context context, Notification[] notifications) {
@@ -65,10 +65,10 @@ public int getItemCount() {
6565

6666
public class NotificationViewHolder extends RecyclerView.ViewHolder {
6767

68-
private LinearLayout notificationLinearLayout;
69-
private ImageView notificationImageView;
70-
private ProgressBar notificationProgressBar;
71-
private TextView notificationTextView;
68+
private final LinearLayout notificationLinearLayout;
69+
private final ImageView notificationImageView;
70+
private final ProgressBar notificationProgressBar;
71+
private final TextView notificationTextView;
7272

7373
private Notification notification;
7474

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/adapter/PairRecyclerViewAdapter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818

1919
public class PairRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
2020

21-
private LayoutInflater layoutInflater;
21+
private final LayoutInflater layoutInflater;
2222

23-
private Context context;
23+
private final Context context;
2424

25-
private ArrayList<Map.Entry> tags;
26-
private PairItemActionCallback callback;
25+
private final ArrayList<Map.Entry> tags;
26+
private final PairItemActionCallback callback;
2727

2828
public PairRecyclerViewAdapter(Context context, ArrayList<Map.Entry> tags, PairItemActionCallback callback) {
2929
this.context = context;
@@ -54,9 +54,9 @@ public int getItemCount() {
5454

5555
public class PairViewHolder extends RecyclerView.ViewHolder {
5656

57-
private RelativeLayout pairRelativeLayout;
58-
private TextView pairKeyTextView;
59-
private TextView pairValueTextView;
57+
private final RelativeLayout pairRelativeLayout;
58+
private final TextView pairKeyTextView;
59+
private final TextView pairValueTextView;
6060

6161
private Map.Entry pair;
6262

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/adapter/SingleRecyclerViewAdapter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818

1919
public class SingleRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
2020

21-
private LayoutInflater layoutInflater;
21+
private final LayoutInflater layoutInflater;
2222

23-
private Context context;
23+
private final Context context;
2424

25-
private ArrayList<Object> values;
26-
private SingleItemActionCallback callback;
25+
private final ArrayList<Object> values;
26+
private final SingleItemActionCallback callback;
2727

2828
public SingleRecyclerViewAdapter(Context context, ArrayList<Object> values, SingleItemActionCallback callback) {
2929
this.context = context;
@@ -54,8 +54,8 @@ public int getItemCount() {
5454

5555
public class SingleViewHolder extends RecyclerView.ViewHolder {
5656

57-
private RelativeLayout singleRelativeLayout;
58-
private TextView singleTextView;
57+
private final RelativeLayout singleRelativeLayout;
58+
private final TextView singleTextView;
5959

6060
private Object item;
6161

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/adapter/SubscriptionRecyclerViewAdapter.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121

2222
public class SubscriptionRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
2323

24-
private LayoutInflater layoutInflater;
24+
private final LayoutInflater layoutInflater;
2525

26-
private Context context;
26+
private final Context context;
2727

28-
private ArrayList<ISubscription> subscriptions;
29-
private SubscriptionItemActionCallback callback;
28+
private final ArrayList<ISubscription> subscriptions;
29+
private final SubscriptionItemActionCallback callback;
3030

3131
public SubscriptionRecyclerViewAdapter(Context context, ArrayList<ISubscription> subscriptions, SubscriptionItemActionCallback callback) {
3232
this.context = context;
@@ -57,10 +57,10 @@ public int getItemCount() {
5757

5858
public class SubscriptionViewHolder extends RecyclerView.ViewHolder {
5959

60-
private LinearLayout singleLinearLayout;
61-
private TextView idTextView;
62-
private TextView addressTitleTextView;
63-
private TextView addressTextView;
60+
private final LinearLayout singleLinearLayout;
61+
private final TextView idTextView;
62+
private final TextView addressTitleTextView;
63+
private final TextView addressTextView;
6464

6565
private ISubscription item;
6666

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/MainActivityViewModel.java

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,7 @@ public void run() {
490490
aliasArrayList.clear();
491491
aliasArrayList.addAll(aliasSet.entrySet());
492492

493-
if (aliasArrayList.size() > 0) {
494-
animate.toggleAnimationView(false, View.GONE, aliasesRecyclerView, noAliasesTextView);
495-
} else {
496-
animate.toggleAnimationView(true, View.GONE, aliasesRecyclerView, noAliasesTextView);
497-
}
493+
animate.toggleAnimationView(aliasArrayList.size() <= 0, View.GONE, aliasesRecyclerView, noAliasesTextView);
498494

499495
aliasesRecyclerViewAdapter.notifyDataSetChanged();
500496
}
@@ -510,16 +506,16 @@ public void onPushSubscriptionChange(@NonNull PushSubscriptionChangedState state
510506
public void onUserStateChange(@NonNull UserChangedState state) {
511507
UserState currentState = state.getCurrent();
512508
UserState prevState = state.getPrevious();
513-
Logging.debug("onUserStateChanged; previous onesignalId: " + String.valueOf(prevState.getOnesignalId())
514-
+ ", previous externalId: " + String.valueOf(prevState.getExternalId())
515-
+ ", current onesignalId: " + String.valueOf(currentState.getOnesignalId())
516-
+ ", current externalId: " + String.valueOf(currentState.getExternalId()),
509+
Logging.debug("onUserStateChanged; previous onesignalId: " + prevState.getOnesignalId()
510+
+ ", previous externalId: " + prevState.getExternalId()
511+
+ ", current onesignalId: " + currentState.getOnesignalId()
512+
+ ", current externalId: " + currentState.getExternalId(),
517513
null);
518514
}
519515

520516
private class DummySubscription implements ISubscription {
521517

522-
private String _id;
518+
private final String _id;
523519
public DummySubscription(String id) {
524520
_id = id;
525521
}
@@ -626,11 +622,7 @@ public void run() {
626622
tagArrayList.clear();
627623
tagArrayList.addAll(tagSet.entrySet());
628624

629-
if (tagArrayList.size() > 0) {
630-
animate.toggleAnimationView(false, View.GONE, tagsRecyclerView, noTagsTextView);
631-
} else {
632-
animate.toggleAnimationView(true, View.GONE, tagsRecyclerView, noTagsTextView);
633-
}
625+
animate.toggleAnimationView(tagArrayList.size() <= 0, View.GONE, tagsRecyclerView, noTagsTextView);
634626

635627
tagPairRecyclerViewAdapter.notifyDataSetChanged();
636628
}
@@ -653,11 +645,7 @@ private void setupEmailRecyclerView() {
653645

654646
private void refreshEmailRecyclerView() {
655647
getActivity().runOnUiThread(() -> {
656-
if (emailArrayList.size() > 0) {
657-
animate.toggleAnimationView(false, View.GONE, emailsRecyclerView, noEmailsTextView);
658-
} else {
659-
animate.toggleAnimationView(true, View.GONE, emailsRecyclerView, noEmailsTextView);
660-
}
648+
animate.toggleAnimationView(emailArrayList.size() <= 0, View.GONE, emailsRecyclerView, noEmailsTextView);
661649

662650
emailsRecyclerViewAdapter.notifyDataSetChanged();
663651
});
@@ -679,11 +667,7 @@ private void setupSMSRecyclerView() {
679667

680668
private void refreshSMSRecyclerView() {
681669
getActivity().runOnUiThread(() -> {
682-
if (smsArrayList.size() > 0) {
683-
animate.toggleAnimationView(false, View.GONE, smssRecyclerView, noSmssTextView);
684-
} else {
685-
animate.toggleAnimationView(true, View.GONE, smssRecyclerView, noSmssTextView);
686-
}
670+
animate.toggleAnimationView(smsArrayList.size() <= 0, View.GONE, smssRecyclerView, noSmssTextView);
687671

688672
smssRecyclerViewAdapter.notifyDataSetChanged();
689673
});
@@ -769,11 +753,7 @@ public void run() {
769753
triggerArrayList.clear();
770754
triggerArrayList.addAll(triggerSet.entrySet());
771755

772-
if (triggerArrayList.size() > 0) {
773-
animate.toggleAnimationView(false, View.GONE, triggersRecyclerView, noTriggersTextView);
774-
} else {
775-
animate.toggleAnimationView(true, View.GONE, triggersRecyclerView, noTriggersTextView);
776-
}
756+
animate.toggleAnimationView(triggerArrayList.size() <= 0, View.GONE, triggersRecyclerView, noTriggersTextView);
777757

778758
triggerPairRecyclerViewAdapter.notifyDataSetChanged();
779759
}

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/model/SplashActivityViewModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class SplashActivityViewModel implements ActivityViewModel {
2020

2121
private Context context;
2222

23-
private boolean[] tasks = {false, false, false};
23+
private final boolean[] tasks = {false, false, false};
2424

2525
@Override
2626
public Activity getActivity() {

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/type/ToastType.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ public enum ToastType {
99
WARNING(R.drawable.ic_alert_white_48dp, R.color.colorToastWarning),
1010
ERROR(R.drawable.ic_alert_octagon_white_48dp, R.color.colorToastError);
1111

12-
private int icon;
13-
private int color;
12+
private final int icon;
13+
private final int color;
1414

1515
ToastType(int icon, int color) {
1616
this.icon = icon;

Examples/OneSignalDemo/app/src/main/java/com/onesignal/sdktest/ui/CustomAlertDialogBuilder.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class CustomAlertDialogBuilder extends AlertDialog.Builder {
3333
private Button positiveButton;
3434
private Button negativeButton;
3535

36-
private View view;
36+
private final View view;
3737
private Boolean mCancelOnTouchOutside = null;
3838
private boolean isCancelable = true;
3939

@@ -115,9 +115,8 @@ public AlertDialog show() {
115115
alertDialogBuilder.setOnKeyListener(new DialogInterface.OnKeyListener() {
116116
@Override
117117
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
118-
switch (keyCode) {
119-
case KeyEvent.KEYCODE_BACK:
120-
return !isCancelable;
118+
if (keyCode == KeyEvent.KEYCODE_BACK) {
119+
return !isCancelable;
121120
}
122121
return false;
123122
}

0 commit comments

Comments
 (0)