// Path: app/src/main/java/org/xdty/kindle/contract/MainContract.java
// public interface MainContract {
// 
//     interface View extends BaseView<Presenter> {
//         void refresh(List<Book> books);
//     }
// 
//     interface Presenter extends BasePresenter {
//         void loadBooks();
// 
//         void getBookNodes(Book book);
// 
//         void getReviews(String itemId);
// 
//         void setMode(Mode mode);
//     }
// }
// 
// Path: app/src/main/java/org/xdty/kindle/data/Mode.java
// public enum Mode {
//     DAILY_DEALS,
//     FREE_CN,
//     FREE_EN
// }
// 
// Path: app/src/main/java/org/xdty/kindle/di/modules/MainModule.java
// @Module
// public class MainModule {
// 
//     private MainContract.View mView;
// 
//     public MainModule(MainContract.View view) {
//         mView = view;
//     }
// 
//     @Provides
//     MainContract.View provideView() {
//         return mView;
//     }
// 
//     @Provides
//     MainContract.Presenter providePresenter() {
//         return new MainPresenter(mView);
//     }
// 
// }
// 
// Path: app/src/main/java/org/xdty/kindle/view/BooksAdapter.java
// public class BooksAdapter extends RecyclerView.Adapter<BooksAdapter.ViewHolder> {
// 
//     @Inject
//     RequestManager mGlideRequest;
//     private List<Book> mBooks = new ArrayList<>();
//     private ItemClickListener mItemClickListener;
// 
//     public BooksAdapter() {
//         Application.getAppComponent().inject(this);
//     }
// 
//     @Override
//     public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// 
//         View view = LayoutInflater.from(parent.getContext())
//                 .inflate(R.layout.item_book, parent, false);
// 
//         return new ViewHolder(view);
//     }
// 
//     @Override
//     public void onBindViewHolder(ViewHolder holder, int position) {
//         holder.bind(mBooks.get(position));
//     }
// 
//     @Override
//     public int getItemCount() {
//         return mBooks.size();
//     }
// 
//     public void refresh(List<Book> books) {
//         mBooks.clear();
//         mBooks.addAll(books);
//         notifyDataSetChanged();
//     }
// 
//     public void setItemClickListener(ItemClickListener itemClickListener) {
//         mItemClickListener = itemClickListener;
//     }
// 
//     public interface ItemClickListener {
//         void onItemClick(Book book);
//     }
// 
//     class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
// 
//         private Book mBook;
// 
//         private ImageView thumbnail;
//         private TextView title;
//         private TextView author;
//         private TextView pages;
//         private TextView price;
// 
//         ViewHolder(View view) {
//             super(view);
// 
//             thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
//             title = (TextView) view.findViewById(R.id.title);
//             author = (TextView) view.findViewById(R.id.author);
//             pages = (TextView) view.findViewById(R.id.pages);
//             price = (TextView) view.findViewById(R.id.price);
//             view.setOnClickListener(this);
//         }
// 
//         void bind(Book book) {
//             mBook = book;
//             title.setText(book.getTitle());
//             author.setText(book.getAuthor());
//             pages.setText(book.getPages());
//             price.setText(getString(R.string.price, book.getPrice()));
// 
//             mGlideRequest.load(book.getLargeImageUrl())
//                     .crossFade()
//                     .into(thumbnail);
//         }
// 
//         String getString(int resId, Object... formatArgs) {
//             return itemView.getContext().getString(resId, formatArgs);
//         }
// 
//         @Override
//         public void onClick(View view) {
//             if (mItemClickListener != null) {
//                 mItemClickListener.onItemClick(mBook);
//             }
//         }
//     }
// }


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import org.xdty.kindle.contract.MainContract;
import org.xdty.kindle.data.Mode;
import org.xdty.kindle.di.DaggerMainComponent;
import org.xdty.kindle.di.modules.MainModule;
import org.xdty.kindle.module.Book;
import org.xdty.kindle.view.BooksAdapter;
import java.util.List;
import javax.inject.Inject;
package org.xdty.kindle;





public class MainActivity extends AppCompatActivity
        implements MainContract.View, NavigationView.OnNavigationItemSelectedListener,
        BooksAdapter.ItemClickListener {

    private static final String TAG = MainActivity.class.getSimpleName();

    @Inject
    MainContract.Presenter mPresenter;

    private RecyclerView mRecyclerView;
    private Toolbar mToolbar;
    private DrawerLayout mDrawer;
    private BooksAdapter mBooksAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        DaggerMainComponent.builder()
// Path: app/src/main/java/org/xdty/kindle/contract/MainContract.java
// public interface MainContract {
// 
//     interface View extends BaseView<Presenter> {
//         void refresh(List<Book> books);
//     }
// 
//     interface Presenter extends BasePresenter {
//         void loadBooks();
// 
//         void getBookNodes(Book book);
// 
//         void getReviews(String itemId);
// 
//         void setMode(Mode mode);
//     }
// }
// 
// Path: app/src/main/java/org/xdty/kindle/data/Mode.java
// public enum Mode {
//     DAILY_DEALS,
//     FREE_CN,
//     FREE_EN
// }
// 
// Path: app/src/main/java/org/xdty/kindle/di/modules/MainModule.java
// @Module
// public class MainModule {
// 
//     private MainContract.View mView;
// 
//     public MainModule(MainContract.View view) {
//         mView = view;
//     }
// 
//     @Provides
//     MainContract.View provideView() {
//         return mView;
//     }
// 
//     @Provides
//     MainContract.Presenter providePresenter() {
//         return new MainPresenter(mView);
//     }
// 
// }
// 
// Path: app/src/main/java/org/xdty/kindle/view/BooksAdapter.java
// public class BooksAdapter extends RecyclerView.Adapter<BooksAdapter.ViewHolder> {
// 
//     @Inject
//     RequestManager mGlideRequest;
//     private List<Book> mBooks = new ArrayList<>();
//     private ItemClickListener mItemClickListener;
// 
//     public BooksAdapter() {
//         Application.getAppComponent().inject(this);
//     }
// 
//     @Override
//     public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// 
//         View view = LayoutInflater.from(parent.getContext())
//                 .inflate(R.layout.item_book, parent, false);
// 
//         return new ViewHolder(view);
//     }
// 
//     @Override
//     public void onBindViewHolder(ViewHolder holder, int position) {
//         holder.bind(mBooks.get(position));
//     }
// 
//     @Override
//     public int getItemCount() {
//         return mBooks.size();
//     }
// 
//     public void refresh(List<Book> books) {
//         mBooks.clear();
//         mBooks.addAll(books);
//         notifyDataSetChanged();
//     }
// 
//     public void setItemClickListener(ItemClickListener itemClickListener) {
//         mItemClickListener = itemClickListener;
//     }
// 
//     public interface ItemClickListener {
//         void onItemClick(Book book);
//     }
// 
//     class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
// 
//         private Book mBook;
// 
//         private ImageView thumbnail;
//         private TextView title;
//         private TextView author;
//         private TextView pages;
//         private TextView price;
// 
//         ViewHolder(View view) {
//             super(view);
// 
//             thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
//             title = (TextView) view.findViewById(R.id.title);
//             author = (TextView) view.findViewById(R.id.author);
//             pages = (TextView) view.findViewById(R.id.pages);
//             price = (TextView) view.findViewById(R.id.price);
//             view.setOnClickListener(this);
//         }
// 
//         void bind(Book book) {
//             mBook = book;
//             title.setText(book.getTitle());
//             author.setText(book.getAuthor());
//             pages.setText(book.getPages());
//             price.setText(getString(R.string.price, book.getPrice()));
// 
//             mGlideRequest.load(book.getLargeImageUrl())
//                     .crossFade()
//                     .into(thumbnail);
//         }
// 
//         String getString(int resId, Object... formatArgs) {
//             return itemView.getContext().getString(resId, formatArgs);
//         }
// 
//         @Override
//         public void onClick(View view) {
//             if (mItemClickListener != null) {
//                 mItemClickListener.onItemClick(mBook);
//             }
//         }
//     }
// }


// Path: app/src/main/java/org/xdty/kindle/MainActivity.java
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import org.xdty.kindle.contract.MainContract;
import org.xdty.kindle.data.Mode;
import org.xdty.kindle.di.DaggerMainComponent;
import org.xdty.kindle.di.modules.MainModule;
import org.xdty.kindle.module.Book;
import org.xdty.kindle.view.BooksAdapter;
import java.util.List;
import javax.inject.Inject;

package org.xdty.kindle;





public class MainActivity extends AppCompatActivity
        implements MainContract.View, NavigationView.OnNavigationItemSelectedListener,
        BooksAdapter.ItemClickListener {

    private static final String TAG = MainActivity.class.getSimpleName();

    @Inject
    MainContract.Presenter mPresenter;

    private RecyclerView mRecyclerView;
    private Toolbar mToolbar;
    private DrawerLayout mDrawer;
    private BooksAdapter mBooksAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        DaggerMainComponent.builder()
                .mainModule(new MainModule(this))