/*
 * Copyright (C) 2015 Fabian Schultis
 *
 * This file is part of GGVertretungsplan.
 *
 * GGVertretungsplan 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
 * (at your option) any later version.
 *
 * GGVertretungsplan 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 GGVertretungsplan.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.gebatzens.ggvertretungsplan;
 
import android.annotation.SuppressLint;
import android.content.Context;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.ArrayList;

public class NewsFragmentListAdapter extends BaseAdapter {
    private Context context;
    private NewsFragment.News mArrayList;
    private LayoutInflater inflater;

    /*public NewsFragmentListAdapter(Context pContext, String[] pTitle, String[] pContent, int[] pIcon) {*/
    public NewsFragmentListAdapter(Context pContext, NewsFragment.News pArrayList) {
        context = pContext;
        mArrayList = pArrayList;
    }
 
    @SuppressLint("ViewHolder")
	public View getView(int position, View convertView, ViewGroup parent) {
        inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View itemView = inflater.inflate(R.layout.news_fragment_list_item, parent, false);
        TextView txtDate = (TextView) itemView.findViewById(R.id.newsDate);
        TextView txtTitle = (TextView) itemView.findViewById(R.id.newsTitle);
        TextView txtContent = (TextView) itemView.findViewById(R.id.newsContent);
        ArrayAdapter a;
        ImageView imgIcon = (ImageView) itemView.findViewById(R.id.newsIcon);
        txtDate.setText(mArrayList.get(position)[1]);
        txtTitle.setText(mArrayList.get(position)[4]);
        txtContent.setText(Html.fromHtml(mArrayList.get(position)[5]));
        imgIcon.setImageResource(R.drawable.news_icon);
        //imgIcon.setImageResource(mIcnewson[position]);
        return itemView;
    }

    @Override
    public int getCount() {
        return mArrayList.size();
    }

    @Override
    public Object getItem(int position) {
        return mArrayList.get(position)[4];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }
}
@@ -1135,22 +1135,142 @@
 ava.
-util.ArrayList
+text.DateFormat;%0Aimport java.text.ParseException;%0Aimport java.text.SimpleDateFormat;%0Aimport java.util.ArrayList;%0Aimport java.util.Date
 ;%0A%0Ap
@@ -1434,16 +1434,50 @@
 nflater;
+%0A    private String formattedDate;
 %0A%0A    /*
@@ -2361,24 +2361,25 @@
 sIcon);%0A
+%0A
         
 txtDate.
@@ -2374,51 +2374,473 @@
     
-txtDate.setText(mArrayList.get(position)%5B1%5D
+DateFormat parser = new SimpleDateFormat(%22yyyy-MM-dd hh:mm:ss%22);%0A        DateFormat dateFormatter = new SimpleDateFormat(%22d. MMM%22);%0A        try%0A        %7B%0A            String startDate = mArrayList.get(position)%5B1%5D;%0A            Date parsedDate = parser.parse(startDate);%0A            formattedDate = dateFormatter.format(parsedDate);%0A        %7D%0A        catch (ParseException e)%0A        %7B%0A            e.printStackTrace();%0A        %7D%0A%0A        txtDate.setText(formattedDate
 );%0A 

Update news dateformat