package com.gh.gamecenter.search;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.gh.base.AppController;
import com.gh.gamecenter.R;

public class SearchHistoryFragment extends Fragment {

	public static final String TAG = SearchHistoryFragment.class.getSimpleName();

	private View view;

	@Override
	public void onCreate(@Nullable Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		view = View.inflate(getActivity(), R.layout.fm_search_history, null);

		RecyclerView search_history = (RecyclerView) view.findViewById(R.id.search_history);
		search_history.setHasFixedSize(true);
		search_history.setLayoutManager(new LinearLayoutManager(getActivity()));
		search_history.setAdapter(new SearchHistoryFragmentAdapter(getActivity()));
	}

	@Nullable
	@Override
	public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
							 @Nullable Bundle savedInstanceState) {
		if (container != null) {
			container.removeView(view);
		}
		return view;
	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		AppController.canclePendingRequests(TAG);
		view = null;
	}

}
