Skip to content

Commit

Permalink
Merge pull request #40 from Arachnid-27/dev-1.4.x
Browse files Browse the repository at this point in the history
1.4.8
  • Loading branch information
Arachnid-27 authored May 27, 2017
2 parents 090b1da + dc45879 commit c738937
Show file tree
Hide file tree
Showing 145 changed files with 2,381 additions and 783 deletions.
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Online manga reader based on Android
- 卷纸阅读(Scroll Reader)
- 检查漫画更新(Check Manga For Update)
- 下载漫画(Download Manga)
- 本地漫画(Local Reader)
- 本地备份恢复(Local Backup)

# 支持网站
Expand Down Expand Up @@ -36,6 +37,7 @@ Online manga reader based on Android
- [RecyclerViewPager](https://github.com/lsjwzh/RecyclerViewPager)
- [PhotoDraweeView](https://github.com/ongakuer/PhotoDraweeView)
- [Rhino](https://github.com/mozilla/rhino)
- [BlazingChain](https://github.com/tommyettinger/BlazingChain)

# ToDo
- ~~综合搜索~~
Expand All @@ -46,15 +48,15 @@ Online manga reader based on Android
- ~~阅读状态自定义点击事件~~

# 应用截图
<img src="./screenshot/01.png" width="30%" height="30%">
<img src="./screenshot/02.png" width="30%" height="30%">
<img src="./screenshot/03.png" width="30%" height="30%">
<img src="./screenshot/04.png" width="30%" height="30%">
<img src="./screenshot/05.png" width="30%" height="30%">
<img src="./screenshot/06.png" width="30%" height="30%">
<img src="./screenshot/07.png" width="30%" height="30%">
<img src="./screenshot/08.png" width="30%" height="30%">
<img src="./screenshot/09.png" width="30%" height="30%">
<img src="./screenshot/01.png" width="250">
<img src="./screenshot/02.png" width="250">
<img src="./screenshot/03.png" width="250">
<img src="./screenshot/04.png" width="250">
<img src="./screenshot/05.png" width="250">
<img src="./screenshot/06.png" width="250">
<img src="./screenshot/07.png" width="250">
<img src="./screenshot/08.png" width="250">
<img src="./screenshot/09.png" width="250">

# 增加图源
- 继承 MangaParser 类,参照 Parser 接口的注释
Expand Down
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.4.7"
versionName "1.4.8"
resConfigs "en", "zh"
}
buildTypes {
Expand All @@ -24,7 +24,7 @@ android {
}

greendao {
schemaVersion 8
schemaVersion 9
}

dependencies {
Expand All @@ -33,11 +33,11 @@ dependencies {
compile "com.android.support:appcompat-v7:${SUPPORT_LIB_VERSION}"
compile "com.android.support:recyclerview-v7:${SUPPORT_LIB_VERSION}"
compile "com.android.support:design:${SUPPORT_LIB_VERSION}"
compile 'com.jakewharton:butterknife:8.5.1'
apt 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'org.greenrobot:greendao:3.2.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.facebook.fresco:fresco:1.2.0'
compile 'com.jakewharton:butterknife:8.6.0'
apt 'com.jakewharton:butterknife-compiler:8.6.0'
compile 'org.greenrobot:greendao:3.2.2'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile 'com.facebook.fresco:fresco:1.3.0'
compile 'org.jsoup:jsoup:1.10.2'
compile 'org.adw.library:discrete-seekbar:1.0.1'
compile 'io.reactivex:rxjava:1.2.4'
Expand Down
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# public *;
#}

-optimizationpasses 5
-optimizationpasses 0
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package="com.hiroshi.cimoc">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
Expand Down
22 changes: 21 additions & 1 deletion app/src/main/java/com/hiroshi/cimoc/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import android.app.Application;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.view.WindowManager;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.hiroshi.cimoc.component.AppGetter;
Expand All @@ -25,6 +27,12 @@
*/
public class App extends Application implements AppGetter {

public static int mWidthPixels;
public static int mHeightPixels;
public static int mCoverWidthPixels;
public static int mCoverHeightPixels;
public static int mLargePixels;

private static OkHttpClient mHttpClient;

private DocumentFile mDocumentFile;
Expand All @@ -40,13 +48,24 @@ public void onCreate() {
mOpenHelper = new DBOpenHelper(this, "cimoc.db");
UpdateHelper.update(getPreferenceManager(), getDaoSession());
Fresco.initialize(this);
initPixels();
}

@Override
public App getAppInstance() {
return this;
}

private void initPixels() {
DisplayMetrics metrics = new DisplayMetrics();
((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay().getMetrics(metrics);
mWidthPixels = metrics.widthPixels;
mHeightPixels = metrics.heightPixels;
mCoverWidthPixels = mWidthPixels / 3;
mCoverHeightPixels = mHeightPixels * mCoverWidthPixels / mWidthPixels;
mLargePixels = 2 * metrics.widthPixels * metrics.heightPixels;
}

public void initRootDocumentFile() {
String uri = mPreferenceManager.getString(PreferenceManager.PREF_OTHER_STORAGE);
mDocumentFile = Storage.initRoot(this, uri);
Expand Down Expand Up @@ -83,7 +102,8 @@ public RecyclerView.RecycledViewPool getGridRecycledPool() {

public ControllerBuilderProvider getBuilderProvider() {
if (mBuilderProvider == null) {
mBuilderProvider = new ControllerBuilderProvider(getApplicationContext(), SourceManager.getInstance(this).new HeaderGetter());
mBuilderProvider = new ControllerBuilderProvider(getApplicationContext(),
SourceManager.getInstance(this).new HeaderGetter(), true);
}
return mBuilderProvider;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public interface DialogCaller {
String EXTRA_DIALOG_TITLE = "cimoc.intent.extra.EXTRA_DIALOG_TITLE";
String EXTRA_DIALOG_ITEMS = "cimoc.intent.extra.EXTRA_DIALOG_ITEMS";
String EXTRA_DIALOG_CONTENT = "cimoc.intent.extra.EXTRA_DIALOG_CONTENT";
String EXTRA_DIALOG_CONTENT_TEXT = "cimoc.intent.extra.EXTRA_DIALOG_CONTENT_TEXT";
String EXTRA_DIALOG_NEGATIVE = "cimoc.intent.extra.EXTRA_DIALOG_NEGATIVE";
String EXTRA_DIALOG_CHOICE_ITEMS = "cimoc.intent.extra.EXTRA_DIALOG_CHOICE_ITEMS";

Expand Down
24 changes: 17 additions & 7 deletions app/src/main/java/com/hiroshi/cimoc/core/Backup.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import android.content.ContentResolver;

import com.hiroshi.cimoc.misc.Pair;
import com.hiroshi.cimoc.model.Comic;
import com.hiroshi.cimoc.model.Pair;
import com.hiroshi.cimoc.model.Tag;
import com.hiroshi.cimoc.saf.DocumentFile;
import com.hiroshi.cimoc.utils.DocumentUtils;
Expand Down Expand Up @@ -58,6 +58,7 @@ public class Backup {
private static final String JSON_KEY_COMIC_FINISH = "finish";
private static final String JSON_KEY_COMIC_LAST = "last";
private static final String JSON_KEY_COMIC_PAGE = "page";
private static final String JSON_KEY_COMIC_CHAPTER = "chapter";

public static Observable<String[]> loadFavorite(DocumentFile root) {
return load(root, SUFFIX_CIMOC, SUFFIX_CFBF);
Expand Down Expand Up @@ -155,6 +156,7 @@ private static JSONArray buildComicArray(List<Comic> list) throws JSONException
object.put(JSON_KEY_COMIC_FINISH, comic.getFinish());
object.put(JSON_KEY_COMIC_LAST, comic.getLast());
object.put(JSON_KEY_COMIC_PAGE, comic.getPage());
object.put(JSON_KEY_COMIC_CHAPTER, comic.getChapter());
array.put(object);
}
return array;
Expand Down Expand Up @@ -219,10 +221,14 @@ private static List<Comic> loadComicArray(JSONArray array, String suffix) throws
String title = object.getString(JSON_CIMOC_KEY_COMIC_TITLE);
String cover = object.getString(JSON_CIMOC_KEY_COMIC_COVER);
String update = object.optString(JSON_CIMOC_KEY_COMIC_UPDATE, null);
Boolean finish = object.has(JSON_CIMOC_KEY_COMIC_FINISH) ? object.getBoolean(JSON_CIMOC_KEY_COMIC_FINISH) : null;
Boolean finish = object.has(JSON_CIMOC_KEY_COMIC_FINISH) ?
object.getBoolean(JSON_CIMOC_KEY_COMIC_FINISH) : null;
String last = object.optString(JSON_CIMOC_KEY_COMIC_LAST, null);
Integer page = object.has(JSON_CIMOC_KEY_COMIC_PAGE) ? object.getInt(JSON_CIMOC_KEY_COMIC_PAGE) : null;
list.add(new Comic(null, source, cid, title, cover, false, update, finish, null, null, null, last, page));
Integer page = object.has(JSON_CIMOC_KEY_COMIC_PAGE) ?
object.getInt(JSON_CIMOC_KEY_COMIC_PAGE) : null;
String chapter = object.optString(JSON_CIMOC_KEY_COMIC_LAST, null);
list.add(new Comic(null, source, cid, title, cover, false, false, update,
finish, null, null, null, last, page, chapter));
}
break;
case SUFFIX_CFBF:
Expand All @@ -234,10 +240,14 @@ private static List<Comic> loadComicArray(JSONArray array, String suffix) throws
String title = object.getString(JSON_KEY_COMIC_TITLE);
String cover = object.getString(JSON_KEY_COMIC_COVER);
String update = object.optString(JSON_KEY_COMIC_UPDATE, null);
Boolean finish = object.has(JSON_KEY_COMIC_FINISH) ? object.getBoolean(JSON_KEY_COMIC_FINISH) : null;
Boolean finish = object.has(JSON_KEY_COMIC_FINISH) ?
object.getBoolean(JSON_KEY_COMIC_FINISH) : null;
String last = object.optString(JSON_KEY_COMIC_LAST, null);
Integer page = object.has(JSON_KEY_COMIC_PAGE) ? object.getInt(JSON_KEY_COMIC_PAGE) : null;
list.add(new Comic(null, source, cid, title, cover, false, update, finish, null, null, null, last, page));
Integer page = object.has(JSON_KEY_COMIC_PAGE) ?
object.getInt(JSON_KEY_COMIC_PAGE) : null;
String chapter = object.optString(JSON_CIMOC_KEY_COMIC_LAST, null);
list.add(new Comic(null, source, cid, title, cover, false, false, update,
finish, null, null, null, last, page, chapter));
}
break;
}
Expand Down
30 changes: 17 additions & 13 deletions app/src/main/java/com/hiroshi/cimoc/core/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import android.content.ContentResolver;

import com.hiroshi.cimoc.misc.Pair;
import com.hiroshi.cimoc.model.Chapter;
import com.hiroshi.cimoc.model.Comic;
import com.hiroshi.cimoc.model.ImageUrl;
import com.hiroshi.cimoc.model.Pair;
import com.hiroshi.cimoc.model.Task;
import com.hiroshi.cimoc.saf.DocumentFile;
import com.hiroshi.cimoc.utils.DecryptionUtils;
Expand All @@ -17,6 +17,7 @@

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;

Expand Down Expand Up @@ -232,22 +233,25 @@ public static Observable<List<ImageUrl>> images(final DocumentFile root, final C
@Override
public void call(Subscriber<? super List<ImageUrl>> subscriber) {
DocumentFile dir = getChapterDir(root, comic, chapter, title);
List<String> uris = DocumentUtils.listUrisWithoutSuffix(dir, "cdif");
if (uris.size() != 0) {
List<ImageUrl> list = new ArrayList<>(uris.size());
for (int i = 0; i < uris.size(); ++i) {
String uri = uris.get(i);
if (uri.startsWith("file")) { // content:// 解码会出错 file:// 中文路径如果不解码 Fresco 读取不了
uri = DecryptionUtils.urlDecrypt(uri);
}
ImageUrl image = new ImageUrl(i + 1, uri, false);
image.setChapter(chapter.getPath());
list.add(image);
List<DocumentFile> files = dir.listFiles(new DocumentFile.DocumentFileFilter() {
@Override
public boolean call(DocumentFile file) {
return !file.getName().endsWith("cdif");
}
}, new Comparator<DocumentFile>() {
@Override
public int compare(DocumentFile lhs, DocumentFile rhs) {
return lhs.getName().compareTo(rhs.getName());
}
});

List<ImageUrl> list = Storage.buildImageUrlFromDocumentFile(files, chapter.getPath(), chapter.getCount());
if (list.size() != 0) {
subscriber.onNext(list);
subscriber.onCompleted();
} else {
subscriber.onError(new Exception());
}
subscriber.onError(new Exception());
}
}).subscribeOn(Schedulers.io());
}
Expand Down
Loading

0 comments on commit c738937

Please sign in to comment.