diff --git a/demo/src/main/java/com/flipkart/android/proteus/demo/LogbackConfigureHelper.java b/demo/src/main/java/com/flipkart/android/proteus/demo/LogbackConfigureHelper.java deleted file mode 100644 index 00717028..00000000 --- a/demo/src/main/java/com/flipkart/android/proteus/demo/LogbackConfigureHelper.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2016 Flipkart Internet Pvt. Ltd. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.flipkart.android.proteus.demo; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.LoggerContext; -import ch.qos.logback.classic.android.LogcatAppender; -import ch.qos.logback.classic.encoder.PatternLayoutEncoder; - -/** - * LogbackConfigureHelper - * This helper method configures logback for logging. - * We are doing it using code since config using logback.xml caused issues of not logging sometimes. - * - * @author aditya.sharat - */ -public class LogbackConfigureHelper { - - public static void configure() { - LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); - lc.reset(); - - PatternLayoutEncoder encoder = new PatternLayoutEncoder(); - encoder.setContext(lc); - encoder.setPattern("%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n"); - encoder.start(); - - LogcatAppender logcatAppender = new LogcatAppender(); - logcatAppender.setContext(lc); - logcatAppender.setEncoder(encoder); - logcatAppender.start(); - - ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); - root.setLevel(Level.OFF); - root.addAppender(logcatAppender); - } -} diff --git a/demo/src/performance/java/com/flipkart/android/proteus/demo/performance/BaseActivity.java b/demo/src/performance/java/com/flipkart/android/proteus/demo/performance/BaseActivity.java index d748b1f3..8b06ca8b 100644 --- a/demo/src/performance/java/com/flipkart/android/proteus/demo/performance/BaseActivity.java +++ b/demo/src/performance/java/com/flipkart/android/proteus/demo/performance/BaseActivity.java @@ -21,8 +21,6 @@ import android.view.View; import android.widget.Toast; -import com.flipkart.android.proteus.demo.LogbackConfigureHelper; - /** * BaseActivity * @@ -38,8 +36,6 @@ public BaseActivity() { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - LogbackConfigureHelper.configure(); - long startTime = System.currentTimeMillis(); View view = createAndBindView(); diff --git a/library/build.gradle b/library/build.gradle index 972ebc82..13458657 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -48,7 +48,6 @@ dependencies { compile 'com.android.support:support-annotations:24.1.0' compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.code.gson:gson:2.4' - compile 'org.slf4j:slf4j-api:1.7.6' testCompile 'junit:junit:4.12' } diff --git a/library/src/main/java/com/flipkart/android/proteus/DataContext.java b/library/src/main/java/com/flipkart/android/proteus/DataContext.java index 480fec0d..4c38591f 100644 --- a/library/src/main/java/com/flipkart/android/proteus/DataContext.java +++ b/library/src/main/java/com/flipkart/android/proteus/DataContext.java @@ -26,9 +26,6 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Map; import java.util.regex.Pattern; @@ -37,7 +34,6 @@ */ public class DataContext { - private static Logger logger = LoggerFactory.getLogger(DataContext.class); private final boolean isClone; private JsonObject data; @Nullable diff --git a/library/src/main/java/com/flipkart/android/proteus/builder/DataParsingLayoutBuilder.java b/library/src/main/java/com/flipkart/android/proteus/builder/DataParsingLayoutBuilder.java index 32966b47..69e01e1a 100644 --- a/library/src/main/java/com/flipkart/android/proteus/builder/DataParsingLayoutBuilder.java +++ b/library/src/main/java/com/flipkart/android/proteus/builder/DataParsingLayoutBuilder.java @@ -19,6 +19,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.text.TextUtils; +import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -39,9 +40,6 @@ import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.HashMap; import java.util.Map; import java.util.regex.Matcher; @@ -51,7 +49,7 @@ */ public class DataParsingLayoutBuilder extends SimpleLayoutBuilder { - private static Logger logger = LoggerFactory.getLogger(DataAndViewParsingLayoutBuilder.class); + private static final String TAG = "LayoutBuilder"; private Map formatter = new HashMap<>(); protected DataParsingLayoutBuilder(@NonNull IdGenerator idGenerator) { @@ -65,7 +63,7 @@ protected void handleChildren(LayoutHandler handler, ProteusView view) { JsonObject layout = viewManager.getLayout(); if (ProteusConstants.isLoggingEnabled()) { - logger.debug("Parsing children for view with " + Utils.getLayoutIdentifier(layout)); + Log.d(TAG, "Parsing children for view with " + Utils.getLayoutIdentifier(layout)); } if (layout == null) { @@ -188,7 +186,7 @@ private JsonElement findAndReplaceValues(LayoutHandler handler, ProteusView view DataContext dataContext = viewManager.getDataContext(); if (ProteusConstants.isLoggingEnabled()) { - logger.debug("Find '" + stringValue + "' for " + attribute + " for view with " + Utils.getLayoutIdentifier(viewManager.getLayout())); + Log.d(TAG, "Find '" + stringValue + "' for " + attribute + " for view with " + Utils.getLayoutIdentifier(viewManager.getLayout())); } char firstChar = TextUtils.isEmpty(stringValue) ? 0 : stringValue.charAt(0); @@ -318,7 +316,7 @@ public JsonObject getChildLayout(JsonElement type, JsonObject source, ProteusVie @Nullable protected JsonObject onLayoutRequired(String type, ProteusView parent) { if (ProteusConstants.isLoggingEnabled()) { - logger.debug("Fetching child layout: " + type); + Log.d(TAG, "Fetching child layout: " + type); } if (listener != null) { return listener.onLayoutRequired(type, parent); diff --git a/library/src/main/java/com/flipkart/android/proteus/builder/SimpleLayoutBuilder.java b/library/src/main/java/com/flipkart/android/proteus/builder/SimpleLayoutBuilder.java index 367e0d5d..b19de1a5 100644 --- a/library/src/main/java/com/flipkart/android/proteus/builder/SimpleLayoutBuilder.java +++ b/library/src/main/java/com/flipkart/android/proteus/builder/SimpleLayoutBuilder.java @@ -18,6 +18,7 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -34,9 +35,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.HashMap; import java.util.Map; @@ -46,6 +44,8 @@ */ public class SimpleLayoutBuilder implements LayoutBuilder { + private static final String TAG = "SimpleLayoutBuilder"; + @Nullable protected LayoutBuilderCallback listener; private HashMap layoutHandlers = new HashMap<>(); @@ -54,8 +54,6 @@ public class SimpleLayoutBuilder implements LayoutBuilder { private boolean isSynchronousRendering = false; - private static Logger logger = LoggerFactory.getLogger(SimpleLayoutBuilder.class); - private IdGenerator idGenerator; protected SimpleLayoutBuilder(@NonNull IdGenerator idGenerator) { @@ -150,7 +148,7 @@ protected void onAfterCreateView(LayoutHandler handler, ProteusView view, ViewGr protected ProteusViewManager createViewManager(LayoutHandler handler, View parent, JsonObject layout, JsonObject data, int index, Styles styles) { if (ProteusConstants.isLoggingEnabled()) { - logger.debug("ProteusView created with " + Utils.getLayoutIdentifier(layout)); + Log.d(TAG, "ProteusView created with " + Utils.getLayoutIdentifier(layout)); } ProteusViewManagerImpl viewManager = new ProteusViewManagerImpl(); @@ -169,7 +167,7 @@ protected ProteusViewManager createViewManager(LayoutHandler handler, View paren protected void handleChildren(LayoutHandler handler, ProteusView view) { if (ProteusConstants.isLoggingEnabled()) { - logger.debug("Parsing children for view with " + Utils.getLayoutIdentifier(view.getViewManager().getLayout())); + Log.d(TAG, "Parsing children for view with " + Utils.getLayoutIdentifier(view.getViewManager().getLayout())); } handler.handleChildren(view); @@ -177,7 +175,7 @@ protected void handleChildren(LayoutHandler handler, ProteusView view) { public boolean handleAttribute(LayoutHandler handler, ProteusView view, String attribute, JsonElement value) { if (ProteusConstants.isLoggingEnabled()) { - logger.debug("Handle '" + attribute + "' : " + value.toString() + " for view with " + Utils.getLayoutIdentifier(view.getViewManager().getLayout())); + Log.d(TAG, "Handle '" + attribute + "' : " + value.toString() + " for view with " + Utils.getLayoutIdentifier(view.getViewManager().getLayout())); } //noinspection unchecked return handler.handleAttribute((View) view, attribute, value); @@ -192,7 +190,7 @@ protected void onUnknownAttributeEncountered(String attribute, JsonElement value @Nullable protected ProteusView onUnknownViewEncountered(String type, ViewGroup parent, JsonObject layout, JsonObject data, int index, Styles styles) { if (ProteusConstants.isLoggingEnabled()) { - logger.debug("No LayoutHandler for: " + type); + Log.d(TAG, "No LayoutHandler for: " + type); } if (listener != null) { return listener.onUnknownViewType(type, parent, layout, data, index, styles); diff --git a/library/src/main/java/com/flipkart/android/proteus/parser/ParseHelper.java b/library/src/main/java/com/flipkart/android/proteus/parser/ParseHelper.java index bd5721f5..53bfde35 100644 --- a/library/src/main/java/com/flipkart/android/proteus/parser/ParseHelper.java +++ b/library/src/main/java/com/flipkart/android/proteus/parser/ParseHelper.java @@ -24,6 +24,7 @@ import android.os.Build; import android.text.TextUtils; import android.util.DisplayMetrics; +import android.util.Log; import android.util.Pair; import android.util.TypedValue; import android.view.Gravity; @@ -38,9 +39,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; @@ -55,6 +53,8 @@ */ public class ParseHelper { + private static final String TAG = "ParseHelper"; + private static final String TRUE = "true"; private static final String FALSE = "false"; @@ -125,7 +125,6 @@ public class ParseHelper { private static final Map sImageScaleType = new HashMap<>(); private static Map styleMap = new HashMap<>(); private static Map attributeMap = new HashMap<>(); - private static Logger logger = LoggerFactory.getLogger(ParseHelper.class); static { sStateMap.put("state_pressed", android.R.attr.state_pressed); @@ -201,7 +200,7 @@ public static int parseInt(String attributeValue) { number = Integer.parseInt(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error(attributeValue + " is NAN. Error: " + e.getMessage()); + Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } @@ -217,7 +216,7 @@ public static float parseFloat(String attributeValue) { number = Float.parseFloat(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error(attributeValue + " is NAN. Error: " + e.getMessage()); + Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } @@ -233,7 +232,7 @@ public static double parseDouble(String attributeValue) { number = Double.parseDouble(attributeValue); } catch (NumberFormatException e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error(attributeValue + " is NAN. Error: " + e.getMessage()); + Log.e(TAG, attributeValue + " is NAN. Error: " + e.getMessage()); } number = 0; } @@ -324,7 +323,7 @@ public static float parseDimension(final String dimension, Context context) { value = (int) context.getResources().getDimension(resourceId); } catch (Exception e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error("could not find a dimension with name " + dimension + ". Error: " + e.getMessage()); + Log.e(TAG, "could not find a dimension with name " + dimension + ". Error: " + e.getMessage()); } value = 0; } @@ -353,7 +352,7 @@ public static float parseDimension(final String dimension, Context context) { a.recycle(); } catch (Exception e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error("could not find a dimension with name " + dimension + ". Error: " + e.getMessage()); + Log.e(TAG, "could not find a dimension with name " + dimension + ". Error: " + e.getMessage()); } value = 0; } @@ -400,15 +399,15 @@ public static int getAttributeId(Context context, String attribute) { } catch (ClassNotFoundException e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error(e.getMessage() + ""); + Log.e(TAG, e.getMessage() + ""); } } catch (NoSuchFieldException e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error(e.getMessage() + ""); + Log.e(TAG, e.getMessage() + ""); } } catch (IllegalAccessException e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error(e.getMessage() + ""); + Log.e(TAG, e.getMessage() + ""); } } } @@ -424,7 +423,7 @@ public static int parseColor(String color) { return Color.parseColor(color); } catch (IllegalArgumentException ex) { if (ProteusConstants.isLoggingEnabled()) { - logger.error("Invalid color : " + color + ". Using #000000"); + Log.e(TAG, "Invalid color : " + color + ". Using #000000"); } return Color.BLACK; } @@ -438,7 +437,7 @@ public static Integer parseId(String id) { return Integer.valueOf(id); } catch (NumberFormatException ex) { if (ProteusConstants.isLoggingEnabled()) { - logger.error(id + " is not a valid resource ID."); + Log.e(TAG, id + " is not a valid resource ID."); } } return null; @@ -460,7 +459,7 @@ public static void addRelativeLayoutRule(View view, int verb, int anchor) { view.setLayoutParams(params); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("cannot add relative layout rules when container is not relative"); + Log.e(TAG, "cannot add relative layout rules when container is not relative"); } } } diff --git a/library/src/main/java/com/flipkart/android/proteus/parser/Parser.java b/library/src/main/java/com/flipkart/android/proteus/parser/Parser.java index f6135544..f5836570 100644 --- a/library/src/main/java/com/flipkart/android/proteus/parser/Parser.java +++ b/library/src/main/java/com/flipkart/android/proteus/parser/Parser.java @@ -17,6 +17,7 @@ package com.flipkart.android.proteus.parser; import android.content.res.XmlResourceParser; +import android.util.Log; import android.view.View; import android.view.ViewGroup; @@ -28,8 +29,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -47,8 +46,9 @@ */ public abstract class Parser implements LayoutHandler { + private static final String TAG = "Parser"; + private static XmlResourceParser sParser = null; - private static Logger logger = LoggerFactory.getLogger(Parser.class); private Map handlers = new HashMap<>(); @Override @@ -63,7 +63,7 @@ public void onAfterCreateView(V view, ViewGroup parent, JsonObject layout, JsonO view.setLayoutParams(layoutParams); } catch (Exception e) { if (ProteusConstants.isLoggingEnabled()) { - logger.error("#createView()", e.getMessage() + ""); + Log.e(TAG, "#createView() : " + e.getMessage()); } } } diff --git a/library/src/main/java/com/flipkart/android/proteus/parser/ViewParser.java b/library/src/main/java/com/flipkart/android/proteus/parser/ViewParser.java index aeec015d..7dbd19ce 100644 --- a/library/src/main/java/com/flipkart/android/proteus/parser/ViewParser.java +++ b/library/src/main/java/com/flipkart/android/proteus/parser/ViewParser.java @@ -19,6 +19,7 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.text.TextUtils; +import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityNodeInfo; @@ -44,9 +45,6 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.HashMap; import java.util.Map; @@ -55,13 +53,12 @@ */ public class ViewParser extends Parser { + private static final String TAG = "ViewParser"; + private static final String ID_STRING_START_PATTERN = "@+id/"; private static final String ID_STRING_START_PATTERN1 = "@id/"; private static final String ID_STRING_NORMALIZED_PATTERN = ":id/"; - - private static Logger logger = LoggerFactory.getLogger(ViewParser.class); - @Override public ProteusView createView(ViewGroup parent, JsonObject layout, JsonObject data, Styles styles, int index) { return new ProteusAndroidView(parent.getContext()); @@ -121,7 +118,7 @@ public void handle(String attributeKey, String attributeValue, V view) { view.setLayoutParams(layoutParams); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error(attributeKey + " is only supported for LinearLayouts"); + Log.e(TAG, attributeKey + " is only supported for LinearLayouts"); } } } @@ -142,7 +139,7 @@ public void handle(String attributeKey, String attributeValue, V view) { view.setLayoutParams(layoutParams); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error(attributeKey + " is only supported for LinearLayout and FrameLayout"); + Log.e(TAG, attributeKey + " is only supported for LinearLayout and FrameLayout"); } } } @@ -187,7 +184,7 @@ public void setDimension(float dimension, V view, String key, JsonElement value) view.setLayoutParams(layoutParams); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("margins can only be applied to views with parent ViewGroup"); + Log.e(TAG, "margins can only be applied to views with parent ViewGroup"); } } } @@ -202,7 +199,7 @@ public void setDimension(float dimension, V view, String key, JsonElement value) view.setLayoutParams(layoutParams); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("margins can only be applied to views with parent ViewGroup"); + Log.e(TAG, "margins can only be applied to views with parent ViewGroup"); } } } @@ -217,7 +214,7 @@ public void setDimension(float dimension, V view, String key, JsonElement value) view.setLayoutParams(layoutParams); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("margins can only be applied to views with parent ViewGroup"); + Log.e(TAG, "margins can only be applied to views with parent ViewGroup"); } } } @@ -232,7 +229,7 @@ public void setDimension(float dimension, V view, String key, JsonElement value) view.setLayoutParams(layoutParams); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("margins can only be applied to views with parent ViewGroup"); + Log.e(TAG, "margins can only be applied to views with parent ViewGroup"); } } } @@ -247,7 +244,7 @@ public void setDimension(float dimension, V view, String key, JsonElement value) view.setLayoutParams(layoutParams); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("margins can only be applied to views with parent ViewGroup"); + Log.e(TAG, "margins can only be applied to views with parent ViewGroup"); } } } diff --git a/library/src/main/java/com/flipkart/android/proteus/processor/DrawableResourceProcessor.java b/library/src/main/java/com/flipkart/android/proteus/processor/DrawableResourceProcessor.java index 5fe7145a..46f25c81 100644 --- a/library/src/main/java/com/flipkart/android/proteus/processor/DrawableResourceProcessor.java +++ b/library/src/main/java/com/flipkart/android/proteus/processor/DrawableResourceProcessor.java @@ -29,6 +29,7 @@ import android.os.Build; import android.support.annotation.Nullable; import android.text.TextUtils; +import android.util.Log; import android.util.Pair; import android.view.View; import android.webkit.URLUtil; @@ -46,9 +47,6 @@ import com.google.gson.JsonObject; import com.google.gson.annotations.SerializedName; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.List; @@ -57,7 +55,8 @@ */ public abstract class DrawableResourceProcessor extends AttributeProcessor { - private static final String TAG = DrawableResourceProcessor.class.getSimpleName(); + private static final String TAG = "DrawableResource"; + private static final String DRAWABLE_SELECTOR = "selector"; private static final String DRAWABLE_SHAPE = "shape"; private static final String DRAWABLE_LAYER_LIST = "layer-list"; @@ -78,7 +77,6 @@ public abstract class DrawableResourceProcessor extends Attribut private static final String RADIAL_GRADIENT = "radial"; private static final String SWEEP_GRADIENT = "sweep"; private static Gson sGson = new Gson(); - private static Logger logger = LoggerFactory.getLogger(DrawableResourceProcessor.class); public static GradientDrawable loadGradientDrawable(Context context, JsonObject value) { ShapeDrawableJson shapeDrawable = sGson.fromJson(value, ShapeDrawableJson.class); @@ -93,7 +91,7 @@ public void handle(String key, JsonElement value, V view) { handleElement(key, value, view); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("Resource for key: " + key + " must be a primitive or an object. value -> " + value.toString()); + Log.e(TAG, "Resource for key: " + key + " must be a primitive or an object. value -> " + value.toString()); } } } diff --git a/library/src/main/java/com/flipkart/android/proteus/processor/TweenAnimationResourceProcessor.java b/library/src/main/java/com/flipkart/android/proteus/processor/TweenAnimationResourceProcessor.java index 4cf7d921..b6ac2947 100644 --- a/library/src/main/java/com/flipkart/android/proteus/processor/TweenAnimationResourceProcessor.java +++ b/library/src/main/java/com/flipkart/android/proteus/processor/TweenAnimationResourceProcessor.java @@ -16,6 +16,7 @@ package com.flipkart.android.proteus.processor; +import android.util.Log; import android.view.View; import android.view.animation.Animation; @@ -23,15 +24,12 @@ import com.flipkart.android.proteus.toolbox.ProteusConstants; import com.google.gson.JsonElement; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** * Use this as the base processor for references like @anim */ public abstract class TweenAnimationResourceProcessor extends AttributeProcessor { - private static Logger logger = LoggerFactory.getLogger(TweenAnimationResourceProcessor.class); + private static final String TAG = "TweenAnimationResource"; @Override public void handle(String key, JsonElement value, V view) { @@ -40,8 +38,7 @@ public void handle(String key, JsonElement value, V view) { setAnimation(view, animation); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("Resource for key: " + key - + " must be a primitive or an object. value -> " + value.toString()); + Log.e(TAG, "Resource for key: " + key + " must be a primitive or an object. value -> " + value.toString()); } } } diff --git a/library/src/main/java/com/flipkart/android/proteus/toolbox/AnimationUtils.java b/library/src/main/java/com/flipkart/android/proteus/toolbox/AnimationUtils.java index c92da894..a38a1a75 100644 --- a/library/src/main/java/com/flipkart/android/proteus/toolbox/AnimationUtils.java +++ b/library/src/main/java/com/flipkart/android/proteus/toolbox/AnimationUtils.java @@ -20,6 +20,7 @@ import android.content.Context; import android.content.res.Resources; import android.os.Build; +import android.util.Log; import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateInterpolator; import android.view.animation.AlphaAnimation; @@ -45,14 +46,12 @@ import com.google.gson.JsonPrimitive; import com.google.gson.annotations.SerializedName; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - /** * Defines common utilities for working with animations. */ public class AnimationUtils { + private static final String TAG = "AnimationUtils"; private static final String LINEAR_INTERPOLATOR = "linearInterpolator"; private static final String ACCELERATE_INTERPOLATOR = "accelerateInterpolator"; @@ -76,8 +75,6 @@ public class AnimationUtils { private static final String PERCENT_SELF = "%"; private static final String PERCENT_RELATIVE_PARENT = "%p"; - private static final String TAG = AnimationUtils.class.getSimpleName(); - private static Logger logger = LoggerFactory.getLogger(AnimationUtils.class); private static Gson sGson = new Gson(); /** @@ -96,7 +93,7 @@ public static Animation loadAnimation(Context context, JsonElement value) throws anim = handleElement(context, value.getAsJsonObject()); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("Could not load animation for : " + value.toString()); + Log.e(TAG, "Could not load animation for : " + value.toString()); } } return anim; @@ -157,7 +154,7 @@ public static Interpolator loadInterpolator(Context context, JsonElement value) interpolator = handleElementInterpolator(context, value.getAsJsonObject()); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("Could not load interpolator for : " + value.toString()); + Log.e(TAG, "Could not load interpolator for : " + value.toString()); } } return interpolator; @@ -205,7 +202,7 @@ private static Interpolator handleElementInterpolator(Context c, JsonObject valu interpolatorProperties = sGson.fromJson(value, PathInterpolatorProperties.class); } else { if (ProteusConstants.isLoggingEnabled()) { - logger.error("Unknown interpolator name: " + interpolatorType); + Log.e(TAG, "Unknown interpolator name: " + interpolatorType); } throw new RuntimeException("Unknown interpolator name: " + interpolatorType); } diff --git a/library/src/main/java/com/flipkart/android/proteus/toolbox/ColorUtils.java b/library/src/main/java/com/flipkart/android/proteus/toolbox/ColorUtils.java index 9fc2790a..8549cf46 100644 --- a/library/src/main/java/com/flipkart/android/proteus/toolbox/ColorUtils.java +++ b/library/src/main/java/com/flipkart/android/proteus/toolbox/ColorUtils.java @@ -22,6 +22,7 @@ import android.content.res.Resources; import android.graphics.Color; import android.text.TextUtils; +import android.util.Log; import android.util.StateSet; import android.webkit.ValueCallback; @@ -30,17 +31,13 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.HashMap; import java.util.Map; import java.util.Set; public class ColorUtils { - private static final String TAG = ColorUtils.class.getSimpleName(); + private static final String TAG = "ColorUtils"; private static HashMap sAttributesMap = null; - private static Logger logger = LoggerFactory.getLogger(ColorUtils.class); /** * @param context Application context used to access resources @@ -56,7 +53,7 @@ public static void loadColor(Context context, JsonElement value, ValueCallback