Commit 3efe5868 by Karthik Ponnam

deprecation fixed

parent f470178b
...@@ -17,6 +17,12 @@ rootProject.allprojects { ...@@ -17,6 +17,12 @@ rootProject.allprojects {
google() google()
jcenter() jcenter()
} }
// gradle.projectsEvaluated {
// tasks.withType(JavaCompile) {
// options.compilerArgs << "-Xlint:deprecation"
// }
// }
} }
apply plugin: 'com.android.library' apply plugin: 'com.android.library'
...@@ -34,4 +40,5 @@ android { ...@@ -34,4 +40,5 @@ android {
} }
dependencies { dependencies {
// implementation fileTree(dir: 'libs', include: ['*.jar']) // implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-compat:28.0.0'
} }
...@@ -4,6 +4,7 @@ import android.content.Context; ...@@ -4,6 +4,7 @@ import android.content.Context;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.os.Build; import android.os.Build;
import android.support.v4.content.res.ResourcesCompat;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -78,13 +79,10 @@ public class FluttertoastPlugin implements MethodCallHandler { ...@@ -78,13 +79,10 @@ public class FluttertoastPlugin implements MethodCallHandler {
Drawable shapeDrawable; Drawable shapeDrawable;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
shapeDrawable = ctx.getResources().getDrawable(R.drawable.toast_bg, ctx.getTheme());
} else {
shapeDrawable = ctx.getResources().getDrawable(R.drawable.toast_bg);
}
if (bgcolor != null) { shapeDrawable = ResourcesCompat.getDrawable(ctx.getResources(), R.drawable.toast_bg, null);
if (bgcolor != null && shapeDrawable != null) {
shapeDrawable.setColorFilter(bgcolor.intValue(), PorterDuff.Mode.SRC_IN); shapeDrawable.setColorFilter(bgcolor.intValue(), PorterDuff.Mode.SRC_IN);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment