|
@@ -5,15 +5,22 @@ import android.app.Fragment;
|
|
import android.view.LayoutInflater;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.ViewGroup;
|
|
-import android.widget.ArrayAdapter;
|
|
|
|
|
|
+import android.widget.GridView;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
+import butterknife.Bind;
|
|
|
|
+import butterknife.ButterKnife;
|
|
import eu.kanade.mangafeed.R;
|
|
import eu.kanade.mangafeed.R;
|
|
|
|
+import eu.kanade.mangafeed.data.entities.Manga;
|
|
import eu.kanade.mangafeed.ui.activity.BaseActivity;
|
|
import eu.kanade.mangafeed.ui.activity.BaseActivity;
|
|
|
|
+import eu.kanade.mangafeed.ui.adapter.LibraryAdapter;
|
|
|
|
|
|
public class LibraryFragment extends Fragment {
|
|
public class LibraryFragment extends Fragment {
|
|
|
|
|
|
|
|
+ @Bind(R.id.gridView)
|
|
|
|
+ GridView grid;
|
|
|
|
+
|
|
public static LibraryFragment newInstance() {
|
|
public static LibraryFragment newInstance() {
|
|
LibraryFragment fragment = new LibraryFragment();
|
|
LibraryFragment fragment = new LibraryFragment();
|
|
Bundle args = new Bundle();
|
|
Bundle args = new Bundle();
|
|
@@ -21,35 +28,26 @@ public class LibraryFragment extends Fragment {
|
|
return fragment;
|
|
return fragment;
|
|
}
|
|
}
|
|
|
|
|
|
- public LibraryFragment() {
|
|
|
|
- // Required empty public constructor
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void onCreate(Bundle savedInstanceState) {
|
|
|
|
- super.onCreate(savedInstanceState);
|
|
|
|
- ((BaseActivity) getActivity()).getSupportActionBar().setTitle(R.string.library_title);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
Bundle savedInstanceState) {
|
|
Bundle savedInstanceState) {
|
|
// Inflate the layout for this fragment
|
|
// Inflate the layout for this fragment
|
|
-
|
|
|
|
View view = inflater.inflate(R.layout.fragment_library, container, false);
|
|
View view = inflater.inflate(R.layout.fragment_library, container, false);
|
|
- return view;
|
|
|
|
- }
|
|
|
|
|
|
+ ((BaseActivity) getActivity()).getSupportActionBar().setTitle(R.string.library_title);
|
|
|
|
|
|
|
|
+ ButterKnife.bind(this, view);
|
|
|
|
|
|
- public class LocalManga {
|
|
|
|
- public String name;
|
|
|
|
- public String url;
|
|
|
|
|
|
+ ArrayList<Manga> mangas = new ArrayList<>();
|
|
|
|
+ mangas.add(new Manga("One Piece"));
|
|
|
|
+ mangas.add(new Manga("Berserk"));
|
|
|
|
+ mangas.add(new Manga("Fate/stay night: Unlimited Blade Works"));
|
|
|
|
|
|
- public LocalManga(String name, String url) {
|
|
|
|
- this.name = name;
|
|
|
|
- this.url = url;
|
|
|
|
- }
|
|
|
|
|
|
+ LibraryAdapter adapter = new LibraryAdapter(getActivity(),
|
|
|
|
+ R.layout.item_library, mangas);
|
|
|
|
+
|
|
|
|
+ grid.setAdapter(adapter);
|
|
|
|
+
|
|
|
|
+ return view;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|