Fix some lint issues
This commit is contained in:
parent
751472d27c
commit
322f8def76
|
@ -5,6 +5,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId "dummydomain.yetanothercallblocker"
|
||||
minSdkVersion 14
|
||||
//noinspection OldTargetApi: required for call blocking
|
||||
targetSdkVersion 28
|
||||
versionCode 4030
|
||||
versionName "0.4.3"
|
||||
|
|
|
@ -95,6 +95,7 @@ public class CallReceiver extends BroadcastReceiver {
|
|||
|
||||
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
try {
|
||||
@SuppressLint("DiscouragedPrivateApi") // no choice
|
||||
Method m = tm.getClass().getDeclaredMethod("getITelephony");
|
||||
m.setAccessible(true);
|
||||
ITelephony telephony = (ITelephony)m.invoke(tm);
|
||||
|
|
|
@ -68,7 +68,7 @@ public class DebugActivity extends AppCompatActivity {
|
|||
FeaturedDatabaseItem featuredItem = DatabaseSingleton.getFeaturedDatabase()
|
||||
.getDbItemByNumber(getNumber());
|
||||
|
||||
return new Pair(item, featuredItem);
|
||||
return new Pair<>(item, featuredItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package dummydomain.yetanothercallblocker;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
@ -12,6 +13,7 @@ public class EventHandler {
|
|||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EventHandler.class);
|
||||
|
||||
@SuppressLint("StaticFieldLeak") // same lifecycle
|
||||
private static EventHandler instance;
|
||||
|
||||
private Context context;
|
||||
|
|
|
@ -8,7 +8,6 @@ import androidx.annotation.ColorRes;
|
|||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.core.widget.ImageViewCompat;
|
||||
|
||||
import dummydomain.yetanothercallblocker.data.NumberInfo;
|
||||
|
@ -34,7 +33,7 @@ class IconAndColor {
|
|||
|
||||
@ColorInt
|
||||
int getColorInt(@NonNull Context context) {
|
||||
return ResourcesCompat.getColor(context.getResources(), colorResId, context.getTheme());
|
||||
return UiUtils.getColorInt(context, colorResId);
|
||||
}
|
||||
|
||||
void setOnImageView(AppCompatImageView imageView) {
|
||||
|
|
|
@ -165,7 +165,7 @@ public class NotificationHelper {
|
|||
NotificationCompat.Builder builder = new NotificationCompat.Builder(
|
||||
context, CHANNEL_ID_BLOCKED_INFO)
|
||||
.setSmallIcon(R.drawable.ic_brick_24dp)
|
||||
.setColor(context.getResources().getColor(R.color.rateNegative))
|
||||
.setColor(UiUtils.getColorInt(context, R.color.rateNegative))
|
||||
.setContentTitle(title)
|
||||
.setContentText(text)
|
||||
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package dummydomain.yetanothercallblocker;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
|
||||
public class UiUtils {
|
||||
|
||||
@ColorInt
|
||||
public static int getColorInt(@NonNull Context context, @ColorRes int colorResId) {
|
||||
return ResourcesCompat.getColor(context.getResources(), colorResId, context.getTheme());
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,5 @@
|
|||
<color name="ratePositive">#679f41</color>
|
||||
<color name="rateNeutral">#ffb300</color>
|
||||
<color name="rateNegative">#d40000</color>
|
||||
<color name="rateUnknown">#999999</color>
|
||||
<color name="notFound">#999999</color>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in New Issue