Skip to content

Commit 064fb7f

Browse files
committed
removed deprecated API 23 function usage
1 parent c4a7474 commit 064fb7f

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

app/src/main/java/io/github/sspanak/tt9/preferences/items/TextInputPreference.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import androidx.annotation.NonNull;
1212
import androidx.annotation.Nullable;
1313
import androidx.appcompat.content.res.AppCompatResources;
14+
import androidx.core.content.ContextCompat;
1415
import androidx.preference.PreferenceViewHolder;
1516

1617
import io.github.sspanak.tt9.R;
@@ -145,7 +146,7 @@ private void setTextFieldIcon(@NonNull EditText textField, int icon) {
145146
final Context context = getContext();
146147
final Drawable searchIcon = AppCompatResources.getDrawable(context, icon);
147148
if (searchIcon != null) {
148-
searchIcon.setTint(context.getResources().getColor(R.color.keyboard_text));
149+
searchIcon.setTint(ContextCompat.getColor(context, R.color.keyboard_text));
149150
}
150151

151152
if (LanguageKind.isRTL(LanguageCollection.getDefault())) {

app/src/main/java/io/github/sspanak/tt9/ui/WebViewSafeClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import android.app.Activity;
44
import android.content.Intent;
5+
import android.webkit.WebResourceRequest;
56
import android.webkit.WebView;
67
import android.webkit.WebViewClient;
78

@@ -21,9 +22,11 @@ public WebViewSafeClient(@NonNull Activity activity) {
2122
}
2223

2324
@Override
24-
public boolean shouldOverrideUrlLoading(WebView view, String url) {
25+
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
26+
final String url = request.getUrl().toString();
27+
2528
if (!url.startsWith("http")) {
26-
return super.shouldOverrideUrlLoading(view, url);
29+
return super.shouldOverrideUrlLoading(view, request);
2730
}
2831

2932
if (!DeviceInfo.AT_LEAST_ANDROID_10 || !shareLink(url)) {

app/src/main/java/io/github/sspanak/tt9/util/colors/ErrorSystemColor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
import android.content.Context;
44

55
import androidx.annotation.NonNull;
6+
import androidx.core.content.ContextCompat;
67

78
import io.github.sspanak.tt9.util.sys.SystemSettings;
89

910
public class ErrorSystemColor extends SystemColor {
1011
public ErrorSystemColor(@NonNull Context context) {
1112
final boolean isDark = SystemSettings.isNightModeOn(context);
1213
final int colorResource = isDark ? android.R.color.holo_red_dark : android.R.color.holo_red_light;
13-
color = context.getResources().getColor(colorResource);
14+
color = ContextCompat.getColor(context, colorResource);
1415
}
1516
}

0 commit comments

Comments
 (0)