package com.icaynia.soundki.Activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ListView;

import com.icaynia.soundki.Global;
import com.icaynia.soundki.R;
import com.icaynia.soundki.View.PlayListAdapter;

import java.util.List;

public class PlayListActivity extends AppCompatActivity
{
    public Global global;
    public ListView mainListView;
    public PlayListAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_play_list);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View view)
            {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
            }
        });

        viewInitialize();
        global = (Global) this.getApplicationContext();

        Intent intent = getIntent();
        String listuid = intent.getStringExtra("list");
        onList(listuid);
    }

    public void viewInitialize()
    {
        mainListView = (ListView) findViewById(R.id.listview);
    }

    public void onList(String listuid)
    {
        // when 'listuid' value is 0, it means show now playlist.
        if (listuid.equals("0"))
        {
            this.getSupportActionBar().setTitle("현재 재생중 ー 0곡");

            adapter = new PlayListAdapter(this, global.nowPlayingList);

        }
    }
}

@@ -1823,17 +1823,52 @@
 %EC%9E%AC %EC%9E%AC%EC%83%9D%EC%A4%91 %E3%83%BC 
-0
+%22 + global.nowPlayingList.size() + %22
 %EA%B3%A1%22);%0A%0A  
@@ -1934,24 +1934,72 @@
 yingList);%0A%0A
+            mainListView.setAdapter(adapter);%0A%0A%0A
         %7D%0A  

connect adapter to mainlistview