package com.globallogic.rss_reader.model;

import android.util.Log;

import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by diego.rotondale on 11/05/2015.
 */
@Root(strict = false)
public class Item {
    private static String LOG_TAG = Item.class.getSimpleName();

    @Element
    public String title;
    @Element
    public String link;
    @Element
    public String pubDate;
    @Element
    public String description;

    public String getDescription() {
        String descriptionWithoutFooter = "";
        String readHere = "Leer nota completa";
        if (description.contains(readHere)) {
            descriptionWithoutFooter = description.substring(0, description.indexOf(readHere));
        } else {
            descriptionWithoutFooter = description.substring(0, description.indexOf("<p>La entrada"));
        }
        return descriptionWithoutFooter;
    }

    public String getPubDate() {
        if (pubDate == null)
            return "";
        SimpleDateFormat format = new SimpleDateFormat("ccc, dd LLLL yyyy HH:mm:ss Z", Locale.ENGLISH);
        Date date = new Date();
        try {
            date = format.parse(pubDate);
            System.out.println(date);
        } catch (ParseException e) {
            Log.e(LOG_TAG, e.getMessage());
        }
        SimpleDateFormat sdf = new SimpleDateFormat("ccc dd LLLL yyyy", Locale.getDefault());
        return sdf.format(date);
    }
}

@@ -610,24 +610,208 @@
 ription() %7B%0A
+        String desc = this.description;%0A        desc = removeFooter(desc);%0A        desc = removeImage(desc);%0A        return desc;%0A    %7D%0A%0A    private String removeFooter(String desc) %7B%0A
         Stri
@@ -840,18 +840,20 @@
 ooter = 
-%22%22
+desc
 ;%0A      
@@ -910,23 +910,16 @@
 if (desc
-ription
 .contain
@@ -968,39 +968,32 @@
 outFooter = desc
-ription
 .substring(0, de
@@ -986,39 +986,32 @@
 ubstring(0, desc
-ription
 .indexOf(readHer
@@ -1075,23 +1075,16 @@
 r = desc
-ription
 .substri
@@ -1093,23 +1093,16 @@
 (0, desc
-ription
 .indexOf
@@ -1175,24 +1175,429 @@
 ter;%0A    %7D%0A%0A
+    private String removeImage(String desc) %7B%0A        String descriptionWithoutImage = desc;%0A        String tagToRemove = %22%3C/div%3E%3Cdiv%3E%22;%0A        if (desc.contains(tagToRemove)) %7B%0A            descriptionWithoutImage = desc.substring(desc.indexOf(tagToRemove), desc.length());%0A            descriptionWithoutImage = %22%3Cdiv%3E%22 + descriptionWithoutImage;%0A        %7D%0A        return descriptionWithoutImage;%0A    %7D%0A%0A
     public S

Remove image of the html