package com.icaynia.soundki.Fragment;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.icaynia.soundki.Data.PlayListManager;
import com.icaynia.soundki.R;
import com.icaynia.soundki.View.PlayListsAdapter;

import java.util.ArrayList;

/**
 * Created by icaynia on 2017. 2. 8..
 */

public class HomeFragment extends Fragment
{
    private View v;

    private ListView playListView;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        v = inflater.inflate(R.layout.fragment_home, container, false);
        setHasOptionsMenu(true);
        viewInitialize();

        prepare();

        return v;
    }

    private void viewInitialize()
    {
        playListView = (ListView) v.findViewById(R.id.playlistview);
    }

    private void prepare()
    {
        PlayListManager plm = new PlayListManager(getContext());
        ArrayList<String> arrayList = plm.getPlayListList();
        PlayListsAdapter playListsAdapter = new PlayListsAdapter(getContext(), arrayList);
        playListView.setAdapter(playListsAdapter);
    }


}

@@ -32,16 +32,47 @@
 gment;%0A%0A
+import android.content.Intent;%0A
 import a
@@ -244,26 +244,115 @@
 .widget.
-ListView;%0A
+AdapterView;%0Aimport android.widget.ListView;%0A%0Aimport com.icaynia.soundki.Activity.PlayListActivity;
 %0Aimport 
@@ -650,16 +650,57 @@
 istView;
+%0A    private ArrayList%3CString%3E arrayList;
 %0A%0A    @O
@@ -1210,33 +1210,16 @@
 ));%0A
+%0A
        
- ArrayList%3CString%3E
  arr
@@ -1396,14 +1396,577 @@
 r);%0A
-    %7D%0A%0A%0A%7D
+%0A        playListView.setOnItemClickListener(itemclick);%0A    %7D%0A%0A    private AdapterView.OnItemClickListener itemclick = new AdapterView.OnItemClickListener()%0A    %7B%0A        @Override%0A        public void onItemClick(AdapterView%3C?%3E parent, View view, int position, long id)%0A        %7B%0A            onPlayListActivity(arrayList.get(position));%0A        %7D%0A    %7D;%0A%0A    private void onPlayListActivity(String extra)%0A    %7B%0A        Intent intent = new Intent(this.getContext(), PlayListActivity.class);%0A        intent.putExtra(%22list%22, extra);%0A        startActivity(intent);%0A%0A    %7D%0A%7D%0A%0A
 %0A

Add PlayList Itemclick listener