package de.metalmatze.krautreporter.activities;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.ImageView;
import android.widget.TextView;

import com.activeandroid.query.Select;

import java.text.SimpleDateFormat;

import de.metalmatze.krautreporter.R;
import de.metalmatze.krautreporter.models.ArticleModel;

public class ArticleActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.activity_article);
        this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        long id = getIntent().getLongExtra("id", -1);
        ArticleModel model = new Select().from(ArticleModel.class).where("id = ?", id).executeSingle();

        TextView articleTitle = (TextView) findViewById(R.id.article_title);
        TextView articleDate = (TextView) findViewById(R.id.article_date);
        ImageView articleImage = (ImageView) findViewById(R.id.image);
        TextView articleExcerpt = (TextView) findViewById(R.id.article_excerpt);
        TextView articleContent = (TextView) findViewById(R.id.article_content);

        articleTitle.setText(model.title);
        articleDate.setText(new SimpleDateFormat("dd.MM.yyyy").format(model.date.getTime()));
        articleContent.setText(model.content);
    }

}

@@ -117,16 +117,42 @@
 tivity;%0A
+import android.text.Html;%0A
 import a
@@ -176,16 +176,16 @@
 geView;%0A
-
 import a
@@ -753,17 +753,24 @@
 leModel 
-m
+articleM
 odel = n
@@ -1255,25 +1255,32 @@
 tle.setText(
-m
+articleM
 odel.title);
@@ -1350,17 +1350,24 @@
 .format(
-m
+articleM
 odel.dat
@@ -1412,17 +1412,38 @@
 setText(
-m
+Html.fromHtml(articleM
 odel.con
@@ -1447,16 +1447,17 @@
 content)
+)
 ;%0A    %7D%0A

Convert HTML content to spanned to use in content TextView