From 382acab118dfd251bf7989822efa8d756b6e6544 Mon Sep 17 00:00:00 2001 From: inorichi Date: Mon, 30 Nov 2015 21:08:06 +0100 Subject: [PATCH 1/3] Add a query to get the next unread chapter --- .../mangafeed/data/database/DatabaseHelper.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java b/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java index 49e579af8e..b75af7fb9a 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/database/DatabaseHelper.java @@ -226,6 +226,21 @@ public class DatabaseHelper { .prepare(); } + public PreparedGetListOfObjects getNextUnreadChapter(Manga manga) { + return db.get() + .listOfObjects(Chapter.class) + .withQuery(Query.builder() + .table(ChapterTable.TABLE) + .where(ChapterTable.COLUMN_MANGA_ID + "=? AND " + + ChapterTable.COLUMN_READ + "=? AND " + + ChapterTable.COLUMN_CHAPTER_NUMBER + ">=?") + .whereArgs(manga.id, 0, 0) + .orderBy(ChapterTable.COLUMN_CHAPTER_NUMBER) + .limit(1) + .build()) + .prepare(); + } + public PreparedPutObject insertChapter(Chapter chapter) { return db.put() .object(chapter) From 8288e98a13aa382f206383abaa84b3c3cc0956a1 Mon Sep 17 00:00:00 2001 From: inorichi Date: Mon, 30 Nov 2015 21:43:29 +0100 Subject: [PATCH 2/3] Make title a bit smaller and remove unneeded padding --- app/src/main/res/layout/item_chapter.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/res/layout/item_chapter.xml b/app/src/main/res/layout/item_chapter.xml index c325e78834..9ea7672838 100644 --- a/app/src/main/res/layout/item_chapter.xml +++ b/app/src/main/res/layout/item_chapter.xml @@ -55,7 +55,7 @@ android:layout_height="wrap_content" android:layout_alignWithParentIfMissing="true" android:gravity="center_vertical" - android:textSize="18dp" + android:textSize="17sp" android:ellipsize="end" android:maxLines="1" tools:text="Title" @@ -64,8 +64,7 @@ android:layout_above="@+id/relativeLayout" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" - android:layout_alignParentTop="true" - android:paddingRight="30dp"/> + android:layout_alignParentTop="true"/> Date: Mon, 30 Nov 2015 23:51:17 +0100 Subject: [PATCH 3/3] Complete Kissmanga --- .../data/source/online/english/Kissmanga.java | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java b/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java index f59161aec3..6ddd43b8c5 100644 --- a/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java +++ b/app/src/main/java/eu/kanade/mangafeed/data/source/online/english/Kissmanga.java @@ -36,6 +36,7 @@ public class Kissmanga extends Source { public static final String IP = "93.174.95.110"; public static final String BASE_URL = "http://" + IP; public static final String POPULAR_MANGAS_URL = BASE_URL + "/MangaList/MostPopular?page=%s"; + public static final String SEARCH_URL = BASE_URL + "/AdvanceSearch"; public Kissmanga(Context context) { super(context); @@ -75,7 +76,7 @@ public class Kissmanga extends Source { @Override protected String getInitialSearchUrl(String query) { - return null; + return SEARCH_URL; } @Override @@ -111,12 +112,31 @@ public class Kissmanga extends Source { if (next == null) return null; - return String.format(POPULAR_MANGAS_URL, next.attr("href")); + return BASE_URL + next.attr("href"); + } + + public Observable searchMangasFromNetwork(MangasPage page, String query) { + if (page.page == 1) + page.url = getInitialSearchUrl(query); + + FormEncodingBuilder form = new FormEncodingBuilder(); + form.add("authorArtist", ""); + form.add("mangaName", query); + form.add("status", ""); + form.add("genres", ""); + + return networkService + .postData(page.url, form.build(), requestHeaders) + .flatMap(networkService::mapResponseToString) + .map(Jsoup::parse) + .doOnNext(doc -> page.mangas = parseSearchFromHtml(doc)) + .doOnNext(doc -> page.nextPageUrl = parseNextSearchUrl(doc, page, query)) + .map(response -> page); } @Override protected List parseSearchFromHtml(Document parsedHtml) { - return null; + return parsePopularMangasFromHtml(parsedHtml); } @Override