Download button
|
@ -18,4 +18,12 @@ public class PreferencesHelper {
|
||||||
mPref.edit().clear().apply();
|
mPref.edit().clear().apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFirstRun() {
|
||||||
|
return mPref.getBoolean("firstrun", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNotFirstRun() {
|
||||||
|
mPref.edit().putBoolean("firstrun", false).commit();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,8 +44,6 @@ public class MangaManager extends BaseManager {
|
||||||
m.thumbnail_url="http://example.com/pic.png";
|
m.thumbnail_url="http://example.com/pic.png";
|
||||||
m.title="One Piece";
|
m.title="One Piece";
|
||||||
insert(m).subscribe();
|
insert(m).subscribe();
|
||||||
m.title="Berserk";
|
|
||||||
insert(m).subscribe();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import javax.inject.Inject;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.App;
|
import eu.kanade.mangafeed.App;
|
||||||
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
||||||
|
import eu.kanade.mangafeed.data.helpers.PreferencesHelper;
|
||||||
import eu.kanade.mangafeed.data.models.Manga;
|
import eu.kanade.mangafeed.data.models.Manga;
|
||||||
import eu.kanade.mangafeed.ui.activity.MangaDetailActivity;
|
import eu.kanade.mangafeed.ui.activity.MangaDetailActivity;
|
||||||
import eu.kanade.mangafeed.view.LibraryView;
|
import eu.kanade.mangafeed.view.LibraryView;
|
||||||
|
@ -18,11 +19,22 @@ public class LibraryPresenter {
|
||||||
private LibraryView view;
|
private LibraryView view;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DatabaseHelper db;
|
DatabaseHelper db;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
PreferencesHelper prefs;
|
||||||
|
|
||||||
public LibraryPresenter(LibraryView view) {
|
public LibraryPresenter(LibraryView view) {
|
||||||
this.view = view;
|
this.view = view;
|
||||||
App.getComponent(view.getActivity()).inject(this);
|
App.getComponent(view.getActivity()).inject(this);
|
||||||
|
|
||||||
|
//TODO remove, only for testing
|
||||||
|
if (prefs.isFirstRun()) {
|
||||||
|
db.manga.createDummyManga();
|
||||||
|
db.chapter.createDummyChapters();
|
||||||
|
prefs.setNotFirstRun();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onMangaClick(EasyAdapter<Manga> adapter, int position) {
|
public void onMangaClick(EasyAdapter<Manga> adapter, int position) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.kanade.mangafeed.ui.adapter;
|
package eu.kanade.mangafeed.ui.adapter;
|
||||||
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import eu.kanade.mangafeed.R;
|
import eu.kanade.mangafeed.R;
|
||||||
|
@ -16,11 +17,15 @@ public class ChapterListHolder extends ItemViewHolder<Chapter> {
|
||||||
@ViewId(R.id.chapter_title)
|
@ViewId(R.id.chapter_title)
|
||||||
TextView title;
|
TextView title;
|
||||||
|
|
||||||
|
@ViewId(R.id.chapter_download_image)
|
||||||
|
ImageView download_icon;
|
||||||
|
|
||||||
public ChapterListHolder(View view) {
|
public ChapterListHolder(View view) {
|
||||||
super(view);
|
super(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSetValues(Chapter chapter, PositionInfo positionInfo) {
|
public void onSetValues(Chapter chapter, PositionInfo positionInfo) {
|
||||||
title.setText(chapter.name);
|
title.setText(chapter.name);
|
||||||
|
download_icon.setImageResource(R.drawable.ic_file_download_black_48dp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
app/src/main/res/drawable-hdpi/ic_file_download_black_24dp.png
Normal file
After Width: | Height: | Size: 148 B |
BIN
app/src/main/res/drawable-hdpi/ic_file_download_black_48dp.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
app/src/main/res/drawable-mdpi/ic_file_download_black_24dp.png
Normal file
After Width: | Height: | Size: 114 B |
BIN
app/src/main/res/drawable-mdpi/ic_file_download_black_48dp.png
Normal file
After Width: | Height: | Size: 144 B |
BIN
app/src/main/res/drawable-xhdpi/ic_file_download_black_24dp.png
Normal file
After Width: | Height: | Size: 144 B |
BIN
app/src/main/res/drawable-xhdpi/ic_file_download_black_48dp.png
Normal file
After Width: | Height: | Size: 209 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_file_download_black_24dp.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
app/src/main/res/drawable-xxhdpi/ic_file_download_black_48dp.png
Normal file
After Width: | Height: | Size: 264 B |
After Width: | Height: | Size: 209 B |
After Width: | Height: | Size: 305 B |
|
@ -1,18 +1,19 @@
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
tools:context="eu.kanade.mangafeed.ui.activity.MangaDetailActivity">
|
tools:context="eu.kanade.mangafeed.ui.activity.MangaDetailActivity"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
layout="@layout/toolbar"/>
|
layout="@layout/toolbar"/>
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:id="@+id/manga_chapters_list"
|
android:id="@+id/manga_chapters_list"
|
||||||
tools:listitem="@layout/item_chapter"
|
tools:listitem="@layout/item_chapter"
|
||||||
android:height="?android:listPreferredItemHeight"/>
|
android:height="?android:listPreferredItemHeight"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
|
|