// Path: app/src/main/java/com/appmatic/baseapp/api/models/Content.java
// public class Content {
//     public static final String TABLE_COLUMN_DIVIDER = ":::";
//     public static final String TABLE_ROW_DIVIDER = ";;;";
// 
//     public static final String TYPE_SEPARATOR = "TYPE_SEPARATOR";
//     public static final String TYPE_IMAGE = "TYPE_IMAGE";
//     public static final String TYPE_TABLE = "TYPE_TABLE";
//     public static final String TYPE_TEXT = "TYPE_TEXT";
//     public static final String TYPE_TITLE = "TYPE_TITLE";
//     public static final String TYPE_YOUTUBE = "TYPE_YOUTUBE";
// 
//     public static final String EXTRA_DELIMITER = "ǁ";
//     public static final String EXTRA_HAS_STRIPES = "HAS_STRIPES";
//     public static final String EXTRA_HAS_HEADER = "HAS_HEADER";
// 
//     private String content;
//     private String extras;
//     private String type;
// 
//     public Content(String type, String extras, String content) {
//         this.type = type;
//         this.extras = extras;
//         this.content = content;
//     }
// 
//     public String getType() {
//         return this.type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public String getExtras() {
//         return this.extras;
//     }
// 
//     public void setExtras(String extras) {
//         this.extras = extras;
//     }
// 
//     public String getContent() {
//         return this.content;
//     }
// 
//     public void setContent(String content) {
//         this.content = content;
//     }
// }


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.text.method.LinkMovementMethod;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.appmatic.baseapp.R;
import com.appmatic.baseapp.api.models.Content;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.google.android.youtube.player.YouTubeStandalonePlayer;
import com.pixplicity.htmlcompat.HtmlCompat;
import java.util.Arrays;
package com.appmatic.baseapp.utils;




/**
 * Appmatic
 * Copyright (C) 2016 - Nulltilus
 *
 * This file is part of Appmatic.
 *
 * Appmatic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * Appmatic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Appmatic.  If not, see <http://www.gnu.org/licenses/>.
 */

public class ViewParsingUtils {
    private static int halfMargin = -1;
    private static int defaultMargin = -1;

    public static View parseContent(@NonNull final Context context, final Content content, boolean isFirstView,
                                    boolean isLastView) {
        String[] extras = content.getExtras().split(Content.EXTRA_DELIMITER);

        if (halfMargin == -1 || defaultMargin == -1) {
            halfMargin = (int) context.getResources().getDimension(R.dimen.half_default_margin);
            defaultMargin = (int) context.getResources().getDimension(R.dimen.default_margin);
        }

        switch (content.getType()) {
            case Content.TYPE_SEPARATOR:
                return inflateSeparator(context, isFirstView, isLastView);
            case Content.TYPE_TEXT:
                return inflateText(context, content.getContent(), isFirstView, isLastView);
// Path: app/src/main/java/com/appmatic/baseapp/api/models/Content.java
// public class Content {
//     public static final String TABLE_COLUMN_DIVIDER = ":::";
//     public static final String TABLE_ROW_DIVIDER = ";;;";
// 
//     public static final String TYPE_SEPARATOR = "TYPE_SEPARATOR";
//     public static final String TYPE_IMAGE = "TYPE_IMAGE";
//     public static final String TYPE_TABLE = "TYPE_TABLE";
//     public static final String TYPE_TEXT = "TYPE_TEXT";
//     public static final String TYPE_TITLE = "TYPE_TITLE";
//     public static final String TYPE_YOUTUBE = "TYPE_YOUTUBE";
// 
//     public static final String EXTRA_DELIMITER = "ǁ";
//     public static final String EXTRA_HAS_STRIPES = "HAS_STRIPES";
//     public static final String EXTRA_HAS_HEADER = "HAS_HEADER";
// 
//     private String content;
//     private String extras;
//     private String type;
// 
//     public Content(String type, String extras, String content) {
//         this.type = type;
//         this.extras = extras;
//         this.content = content;
//     }
// 
//     public String getType() {
//         return this.type;
//     }
// 
//     public void setType(String type) {
//         this.type = type;
//     }
// 
//     public String getExtras() {
//         return this.extras;
//     }
// 
//     public void setExtras(String extras) {
//         this.extras = extras;
//     }
// 
//     public String getContent() {
//         return this.content;
//     }
// 
//     public void setContent(String content) {
//         this.content = content;
//     }
// }


// Path: app/src/main/java/com/appmatic/baseapp/utils/ViewParsingUtils.java
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Typeface;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.support.v4.view.GravityCompat;
import android.text.method.LinkMovementMethod;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import com.appmatic.baseapp.R;
import com.appmatic.baseapp.api.models.Content;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.drawable.GlideDrawable;
import com.bumptech.glide.request.animation.GlideAnimation;
import com.bumptech.glide.request.target.SimpleTarget;
import com.google.android.youtube.player.YouTubeStandalonePlayer;
import com.pixplicity.htmlcompat.HtmlCompat;
import java.util.Arrays;

package com.appmatic.baseapp.utils;




/**
 * Appmatic
 * Copyright (C) 2016 - Nulltilus
 *
 * This file is part of Appmatic.
 *
 * Appmatic is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * Appmatic is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Appmatic.  If not, see <http://www.gnu.org/licenses/>.
 */

public class ViewParsingUtils {
    private static int halfMargin = -1;
    private static int defaultMargin = -1;

    public static View parseContent(@NonNull final Context context, final Content content, boolean isFirstView,
                                    boolean isLastView) {
        String[] extras = content.getExtras().split(Content.EXTRA_DELIMITER);

        if (halfMargin == -1 || defaultMargin == -1) {
            halfMargin = (int) context.getResources().getDimension(R.dimen.half_default_margin);
            defaultMargin = (int) context.getResources().getDimension(R.dimen.default_margin);
        }

        switch (content.getType()) {
            case Content.TYPE_SEPARATOR:
                return inflateSeparator(context, isFirstView, isLastView);
            case Content.TYPE_TEXT:
                return inflateText(context, content.getContent(), isFirstView, isLastView);
            case Content.TYPE_IMAGE: