package com.example.android.sunshine.app;

import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;

import java.util.ArrayList;


public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        if (savedInstanceState == null) {
            getSupportFragmentManager().beginTransaction()
                    .add(R.id.container, new PlaceholderFragment())
                    .commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    /**
     * A placeholder fragment containing a simple view.
     */
    public static class PlaceholderFragment extends Fragment {

        public PlaceholderFragment() {
        }

        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            View rootView = inflater.inflate(R.layout.fragment_main, container, false);

            ArrayList<String> forecastEntries = new ArrayList<String>();
            forecastEntries.add("Today - Sunny - 88/63");
            forecastEntries.add("Tomorrow - Foggy - 70/46");
            forecastEntries.add("Wed - Cloudy - 72/63");
            forecastEntries.add("Thurs - Rainy - 64/51");
            forecastEntries.add("Fri - Foggy - 70/46");
            forecastEntries.add("Sat - Sunny - 76/68");

            return rootView;
        }
    }
}

@@ -329,16 +329,41 @@
 ayList;%0A
+import java.util.Arrays;%0A
 %0A%0Apublic
@@ -1965,101 +1965,30 @@
     
-ArrayList%3C
 String
-%3E
+%5B%5D
  fore
-castEntries = new ArrayList%3CString%3E();%0A            forecastEntries.add(
+Casts = %7B
 %22Tod
@@ -2002,26 +2002,25 @@
 nny - 88/63%22
-);
+,
 %0A           
@@ -2020,36 +2020,24 @@
         
-forecastEntries.add(
+        
 %22Tomorro
@@ -2046,35 +2046,36 @@
 - Foggy - 70/46%22
-);%0A
+,%0A  
             fore
@@ -2070,36 +2070,22 @@
         
-forecastEntries.add(
+      
 %22Wed - C
@@ -2098,19 +2098,20 @@
 - 72/63%22
-);%0A
+,%0A  
         
@@ -2114,36 +2114,22 @@
         
-forecastEntries.add(
+      
 %22Thurs -
@@ -2143,18 +2143,17 @@
 - 64/51%22
-);
+,
 %0A       
@@ -2157,36 +2157,24 @@
         
-forecastEntries.add(
+        
 %22Fri - F
@@ -2186,19 +2186,20 @@
 - 70/46%22
-);%0A
+,%0A  
         
@@ -2206,28 +2206,14 @@
     
-forecastEntries.add(
+      
 %22Sat
@@ -2229,16 +2229,114 @@
 - 76/68%22
+%7D;%0A%0A            ArrayList%3CString%3E forecastEntries = new ArrayList%3CString%3E(Arrays.asList(foreCasts)
 );%0A%0A    

Remove repeat calls to add by generating filler data in String array