package ca.ualberta.cmput301f17t08.habitrabbit;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;

/**
 * Created by yuxuanzhao on 2017-11-07.
 */

public class FeedActivity extends AppCompatActivity {

    private ArrayList<HabitEvent> feedList;
    private feedAdapter cAdapt;
    private RecyclerView feedRecyclerView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.feed);
        feedRecyclerView = (RecyclerView) findViewById(R.id.feed_recycle);
        feedRecyclerView.setLayoutManager(new LinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false));
        feedList = LoginManager.getInstance().getCurrentUser().getHistory();

        ArrayList<Integer> frequency = new ArrayList<Integer>(Arrays.asList(new Integer[]{1,0,1,0,1,0,1}));
        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("America/Edmonton"));
        Date now = calendar.getTime();

        cAdapt = new feedAdapter(LoginManager.getInstance().getCurrentUser().getUsername(),feedList);
        feedRecyclerView.setAdapter(cAdapt);
    }

    public void showMenu(View v){
        Intent intent = new Intent(this, MenuActivity.class);
        startActivity(intent);
    }
}

@@ -510,17 +510,67 @@
 ivity %7B%0A
+    //initialize the variables needed in the class
 %0A
-
     priv
@@ -753,16 +753,59 @@
 tate) %7B%0A
+        // get the element from the Layout%0A
         
@@ -1080,24 +1080,67 @@
 L, false));%0A
+        //get the current user's feed list%0A
         feed
@@ -1204,25 +1204,24 @@
 tory();%0A
-%0A
         
 ArrayLis
@@ -1216,239 +1216,29 @@
     
-ArrayList%3CInteger%3E frequency = new ArrayList%3CInteger%3E(Arrays.asList(new Integer%5B%5D%7B1,0,1,0,1,0,1%7D));%0A        Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone(%22America/Edmonton%22));%0A        Date now = calendar.getTime();%0A
+// set up the adapter
 %0A   

fix the code style and add comment to feed activity