package com.caju.uheer.activities;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import com.caju.uheer.R;

public class ChannelsActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_channels);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_channels, 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);
    }
}

@@ -29,16 +29,71 @@
 ities;%0A%0A
+import android.os.AsyncTask;%0Aimport android.os.Bundle;%0A
 import a
@@ -115,24 +115,24 @@
 v7.app.A
-ctionBar
+ppCompat
 Activity
@@ -144,33 +144,32 @@
 ort android.
-os.Bundle
+util.Log
 ;%0Aimport and
@@ -239,16 +239,245 @@
 uheer.R;
+%0Aimport com.caju.uheer.core.Channel;%0Aimport com.caju.uheer.infrastructure.interfaces.Routes;%0A%0Aimport org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;%0Aimport org.springframework.web.client.RestTemplate;
 %0A%0Apublic
@@ -513,16 +513,16 @@
 ds A
-ctionBar
+ppCompat
 Acti
@@ -695,16 +695,58 @@
 annels);
+%0A%0A        new AllChannelsTask().execute();
 %0A    %7D%0A%0A
@@ -815,89 +815,8 @@
 ) %7B%0A
-        // Inflate the menu; this adds items to the action bar if it is present.%0A
     
@@ -986,329 +986,749 @@
     
-// Handle action bar item clicks here. The action bar will%0A        // automatically handle clicks on the Home/Up button, so long%0A        // as you specify a parent activity in AndroidManifest.xml.%0A        int id = item.getItemId();%0A%0A        //noinspection SimplifiableIfStatement%0A        if (id == R.id.action_settings) %7B
+int id = item.getItemId();%0A        if (id == R.id.action_settings) %7B%0A            return true;%0A        %7D%0A%0A        return super.onOptionsItemSelected(item);%0A    %7D%0A%0A    private class AllChannelsTask extends AsyncTask%3CVoid, Void, Channel%5B%5D%3E %7B%0A        @Override%0A        protected Channel%5B%5D doInBackground(Void... params) %7B%0A            Channel%5B%5D channels = null;%0A%0A            try %7B%0A                RestTemplate restTemplate = new RestTemplate();%0A                restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());%0A%0A                channels = restTemplate.getForObject(Routes.CHANNELS, Channel%5B%5D.class);%0A            %7D catch (Exception e) %7B%0A                Log.e(%22ChannelsActivity%22, e.getMessage(), e);%0A            %7D%0A
 %0A   
@@ -1735,36 +1735,40 @@
          return 
-true
+channels
 ;%0A        %7D%0A%0A   
@@ -1776,49 +1776,204 @@
     
-return super.onOptionsItemSelected(item);
+@Override%0A        protected void onPostExecute(Channel%5B%5D channels) %7B%0A            for (Channel channel : channels) %7B%0A                Log.d(%22ChannelsActivity%22, channel.Name);%0A            %7D%0A        %7D
 %0A   

Update ChannelsActivity