Skip to content

Commit 17d52da

Browse files
committed
Update various deprecated methods
1 parent 2cdacdb commit 17d52da

5 files changed

Lines changed: 38 additions & 30 deletions

File tree

app/src/main/java/com/weberbox/pifire/service/NotificationServiceExtension.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ public void remoteNotificationReceived(Context context, OSNotificationReceivedEv
4242
return builder;
4343
});
4444

45-
//JSONObject data = notification.getAdditionalData();
46-
//Timber.d( "Received Notification Data: %s", data);
47-
4845
receivedEvent.complete(mutableNotification);
4946
}
5047
}

app/src/main/java/com/weberbox/pifire/ui/dialogs/ProbeEditDialog.java

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.widget.ArrayAdapter;
99
import android.widget.AutoCompleteTextView;
1010

11+
import androidx.annotation.NonNull;
1112
import androidx.appcompat.app.AlertDialog;
1213

1314
import com.google.android.material.textfield.TextInputEditText;
@@ -49,24 +50,7 @@ public AlertDialog showDialog() {
4950
dialog.setTitle(R.string.dialog_probe_edit);
5051

5152
final TextInputEditText probeNameTv = binding.probeEditNameTv;
52-
final AutoCompleteTextView probeProfileTv = binding.probeEditProfileTv;
53-
54-
List<String> profileNames = new ArrayList<>();
55-
56-
ProbeProfileModel probeProfile = probeInfo.getProbeProfile();
57-
58-
if (probeProfile != null) {
59-
probeProfileTv.setText(probeProfile.getName());
60-
}
61-
62-
for (ProbeProfileModel profile : profiles) {
63-
profileNames.add(profile.getName());
64-
}
65-
66-
ArrayAdapter<String> profileAdapter = new ArrayAdapter<>(context,
67-
R.layout.item_menu_popup, profileNames);
68-
69-
probeProfileTv.setAdapter(profileAdapter);
53+
final AutoCompleteTextView probeProfileTv = getAutoCompleteTextView(binding);
7054

7155
String probeName = probeInfo.getName();
7256

@@ -119,6 +103,29 @@ public void afterTextChanged(Editable editable) {
119103

120104
return alertDialog;
121105
}
106+
107+
@NonNull
108+
private AutoCompleteTextView getAutoCompleteTextView(DialogProbeEditBinding binding) {
109+
final AutoCompleteTextView probeProfileTv = binding.probeEditProfileTv;
110+
111+
List<String> profileNames = new ArrayList<>();
112+
113+
ProbeProfileModel probeProfile = probeInfo.getProbeProfile();
114+
115+
if (probeProfile != null) {
116+
probeProfileTv.setText(probeProfile.getName());
117+
}
118+
119+
for (ProbeProfileModel profile : profiles) {
120+
profileNames.add(profile.getName());
121+
}
122+
123+
ArrayAdapter<String> profileAdapter = new ArrayAdapter<>(context,
124+
R.layout.item_menu_popup, profileNames);
125+
126+
probeProfileTv.setAdapter(profileAdapter);
127+
return probeProfileTv;
128+
}
122129
}
123130

124131

app/src/main/java/com/weberbox/pifire/ui/utils/AnimUtils.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313
import android.view.animation.OvershootInterpolator;
1414
import android.view.animation.TranslateAnimation;
1515

16-
import androidx.core.view.ViewCompat;
17-
1816
import com.google.android.material.floatingactionbutton.FloatingActionButton;
1917
import com.weberbox.pifire.constants.Constants;
2018

2119
public class AnimUtils {
2220

2321
public static void rotateFabBackwards(FloatingActionButton fab) {
24-
ViewCompat.animate(fab)
22+
fab.animate()
2523
.rotation(180)
2624
.withLayer()
2725
.setDuration(300L)
@@ -30,7 +28,7 @@ public static void rotateFabBackwards(FloatingActionButton fab) {
3028
}
3129

3230
public static void rotateFabForwards(FloatingActionButton fab) {
33-
ViewCompat.animate(fab)
31+
fab.animate()
3432
.rotation(0)
3533
.withLayer()
3634
.setDuration(300L)

app/src/main/java/com/weberbox/pifire/ui/utils/RichDrawableHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import android.graphics.Rect;
66
import android.graphics.drawable.Drawable;
77
import android.util.AttributeSet;
8+
import android.view.View;
89
import android.widget.TextView;
910

1011
import androidx.annotation.ColorInt;
1112
import androidx.annotation.DrawableRes;
1213
import androidx.annotation.NonNull;
1314
import androidx.core.content.res.ResourcesCompat;
1415
import androidx.core.graphics.drawable.DrawableCompat;
15-
import androidx.core.view.ViewCompat;
1616

1717
import com.weberbox.pifire.R;
1818
import com.weberbox.pifire.interfaces.DrawableEnriched;
@@ -89,7 +89,7 @@ private void initCompoundDrawables(TextView textView, int drawableStartVectorId,
8989
private void inflateVectors(TextView textView, int drawableStartVectorId,
9090
int drawableTopVectorId, int drawableEndVectorId,
9191
int drawableBottomVectorId, Drawable[] drawables) {
92-
boolean rtl = ViewCompat.getLayoutDirection(textView) == ViewCompat.LAYOUT_DIRECTION_RTL;
92+
boolean rtl = textView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;
9393

9494
if (drawableStartVectorId != UNDEFINED) {
9595
drawables[rtl ? RIGHT_DRAWABLE_INDEX : LEFT_DRAWABLE_INDEX] =

app/src/main/java/com/weberbox/pifire/ui/views/SwipeButton.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ private void expandButton() {
364364
});
365365

366366

367+
AnimatorSet animatorSet = getAnimatorSet();
368+
369+
animatorSet.playTogether(positionAnimator, widthAnimator);
370+
animatorSet.start();
371+
}
372+
373+
@NonNull
374+
private AnimatorSet getAnimatorSet() {
367375
AnimatorSet animatorSet = new AnimatorSet();
368376
animatorSet.addListener(new AnimatorListenerAdapter() {
369377
@Override
@@ -382,9 +390,7 @@ public void onAnimationEnd(Animator animation) {
382390
}
383391
}
384392
});
385-
386-
animatorSet.playTogether(positionAnimator, widthAnimator);
387-
animatorSet.start();
393+
return animatorSet;
388394
}
389395

390396
private void moveButtonBack() {

0 commit comments

Comments
 (0)