package com

package com.ebooksapp.ebooks.view;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ebooksapp.ebooks.R;
import com.ebooksapp.ebooks.models.adapters.BookListAdapter;
import com.ebooksapp.ebooks.models.dtos.Ebook;
import com.ebooksapp.ebooks.models.listeners.OnRecyclerViewItemClickListener;
import com.ebooksapp.ebooks.models.utils.SpacesItemDecoration;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class CategoryFragment extends Fragment implements OnRecyclerViewItemClickListener {

@BindView(R.id.recycler_viewLiveUserList)
RecyclerView liveUserListRecyclerView;

public static List ebookList;
BookListAdapter liveUserListAdapter;
GridLayoutManager gridLayoutManager;

private Ebook ebook;

public CategoryFragment() {
// Required empty public constructor
}

public static CategoryFragment newInstance(String param1, String param2) {
CategoryFragment fragment = new CategoryFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_category, container, false);
}

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
try {
super.onViewCreated(view, savedInstanceState);

ButterKnife.bind(this,view);

ebookList = new ArrayList();

// set up the RecyclerView
gridLayoutManager = new GridLayoutManager(getContext(), 2);
liveUserListRecyclerView.setHasFixedSize(true);
liveUserListRecyclerView.setLayoutManager(gridLayoutManager);
int spacingInPixels = getResources().getDimensionPixelSize(R.dimen._2sdp);
liveUserListRecyclerView.addItemDecoration(new SpacesItemDecoration(spacingInPixels));
liveUserListAdapter = new BookListAdapter(getContext(), ebookList);
liveUserListAdapter.setOnRecyclerViewItemClickListener(this);
liveUserListRecyclerView.setAdapter(liveUserListAdapter);

getBookCategoryDetail();

} catch (Throwable t) {
t.printStackTrace();
}
}

package com.ebooksapp.ebooks.view;

import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ebooksapp.ebooks.R;

public class PopularFragment extends Fragment {

public PopularFragment() {
// Required empty public constructor
}

public static PopularFragment newInstance(String param1, String param2) {
PopularFragment fragment = new PopularFragment();
Bundle args = new Bundle();
fragment.setArguments(args);
return fragment;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
}
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_popular, container, false);
}

@Override
public void onAttach(Context context) {
super.onAttach(context);
}

@Override
public void onDetach() {
super.onDetach();
}
}