<commit_before>package com.icaynia.soundki.Fragment;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.icaynia.soundki.Activity.MainActivity;
import com.icaynia.soundki.Data.MusicFileManager;
import com.icaynia.soundki.Global;
import com.icaynia.soundki.Model.MusicDto;
import com.icaynia.soundki.R;
import com.icaynia.soundki.View.MusicListAdapter;

import java.util.ArrayList;

import static com.facebook.FacebookSdk.getApplicationContext;


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

public class MyMusicListFragment extends Fragment
{
    private View v;
    private Global global;

    private ListView listView;
    private MusicFileManager mMusicManager;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        v = inflater.inflate(R.layout.fragment_mymusic, container, false);
        setHasOptionsMenu(true);
        mMusicManager = new MusicFileManager(getContext());
        ArrayList<MusicDto> list = mMusicManager.getMusicList();
        listView = (ListView) v.findViewById(R.id.listview);
        listView.setAdapter(new MusicListAdapter(getContext(), list));
        global = (Global) getContext().getApplicationContext();

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                String songId = view.getTag().toString();
                MusicDto song = mMusicManager.getMusicDto(songId);
                ((MainActivity)getContext()).onSnackbarController();

                Log.e("MyMusicListFragment", "Song : " + song.title + " Artist : " + song.artist);
                global.playMusic(Integer.parseInt(songId));
            }
        });
        registerForContextMenu(listView);

        return v;
    }

    //Context Menu-------------------------------------
    private ContextMenu cmenu;
    private View cv;
    private ContextMenu.ContextMenuInfo cmenuInfo;
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v,
                                    ContextMenu.ContextMenuInfo menuInfo) {
        // TODO Auto-generated method stub

        menu.setHeaderTitle("메뉴");
        menu.add(0, v.getId(), 0, "재생목록에 추가");

        this.cmenu = menu;
        this.cv = v;
        this.cmenuInfo = menuInfo;

        super.onCreateContextMenu(menu, v, menuInfo);
    }<commit_msg>Code refactor<commit_after>package com.icaynia.soundki.Fragment;

import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.ContextMenu;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.Toast;

import com.icaynia.soundki.Activity.MainActivity;
import com.icaynia.soundki.Data.MusicFileManager;
import com.icaynia.soundki.Global;
import com.icaynia.soundki.Model.MusicDto;
import com.icaynia.soundki.R;
import com.icaynia.soundki.View.MusicListAdapter;

import java.util.ArrayList;

import static com.facebook.FacebookSdk.getApplicationContext;


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

public class MyMusicListFragment extends Fragment
{
    private View v;
    private Global global;

    private ListView listView;
    private MusicFileManager mMusicManager;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        v = inflater.inflate(R.layout.fragment_mymusic, container, false);
        setHasOptionsMenu(true);
        mMusicManager = new MusicFileManager(getContext());
        ArrayList<MusicDto> list = mMusicManager.getMusicList();
        listView = (ListView) v.findViewById(R.id.listview);
        listView.setAdapter(new MusicListAdapter(getContext(), list));
        global = (Global) getContext().getApplicationContext();

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id)
            {
                String songId = view.getTag().toString();
                MusicDto song = mMusicManager.getMusicDto(songId);
                ((MainActivity)getContext()).onSnackbarController();

                Log.e("MyMusicListFragment", "Song : " + song.title + " Artist : " + song.artist);
                global.playMusic(Integer.parseInt(songId));
            }
        });
        registerForContextMenu(listView);

        return v;
    }

    //Context Menu-------------------------------------

    @Override
    public void onCreateContextMenu(ContextMenu menu, View v,
                                    ContextMenu.ContextMenuInfo menuInfo) {
        // TODO Auto-generated method stub

        menu.setHeaderTitle("메뉴");
        menu.add(0, v.getId(), 0, "재생목록에 추가");

        super.onCreateContextMenu(menu, v, menuInfo);
    }
{'fraction_non_alphanumeric': 0.11101752021563342, 'fraction_numerical': 0.0033692722371967657, 'mean_word_length': 3.1751054852320677, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3141750', 'n_tokens_mistral': 1686, 'n_tokens_neox': 1650, 'n_words': 342}