Skip to content

Commit

Permalink
#25 完成5.0以下修改存储路径
Browse files Browse the repository at this point in the history
  • Loading branch information
Arachnid-27 committed Dec 6, 2016
1 parent 8493477 commit 8b9b442
Show file tree
Hide file tree
Showing 39 changed files with 526 additions and 614 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ build/

# Intellij
*.iml
.idea
.idea/

# Local configuration file (sdk path, etc)
local.properties
Expand Down
22 changes: 0 additions & 22 deletions .idea/compiler.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/copyright/profiles_settings.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

19 changes: 0 additions & 19 deletions .idea/gradle.xml

This file was deleted.

67 changes: 0 additions & 67 deletions .idea/markdown-navigator.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/markdown-navigator/profiles_settings.xml

This file was deleted.

46 changes: 0 additions & 46 deletions .idea/misc.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@
android:name=".ui.activity.PartFavoriteActivity"
android:screenOrientation="portrait"/>

<activity android:name=".ui.activity.DirPickerActivity"
android:screenOrientation="portrait"/>

<activity
android:name=".ui.activity.settings.EventSettingsActivity"
android:configChanges="orientation|screenSize"/>
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/java/com/hiroshi/cimoc/CimocApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public void initRootDocumentFile() {
File file = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "Cimoc");
if (file.exists() || file.mkdirs()) {
mDocumentFile = DocumentFile.fromFile(file);
} else {
mDocumentFile = null;
}
mDocumentFile = DocumentFile.fromFile(new File(Environment.getExternalStorageDirectory().getAbsolutePath()));
} else if (uri.startsWith("content")) {
mDocumentFile = DocumentFile.fromTreeUri(this, Uri.parse(uri));
} else {
Expand Down
34 changes: 16 additions & 18 deletions app/src/main/java/com/hiroshi/cimoc/core/Download.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,22 @@ private static DocumentFile createComicIndex(DocumentFile root, Comic comic) {
return null;
}

public static Observable<Void> updateComicIndex(final List<Chapter> list, final Comic comic) {
return Observable.create(new Observable.OnSubscribe<Void>() {
@Override
public void call(Subscriber<? super Void> subscriber) {
ContentResolver resolver = CimocApplication.getResolver();
DocumentFile root = CimocApplication.getDocumentFile();
try {
createNoMedia(root);
String jsonString = getJsonFromComic(list, comic);
DocumentFile file = createComicIndex(root, comic);
DocumentUtils.writeStringToFile(resolver, file, "cimoc".concat(jsonString));
subscriber.onNext(null);
subscriber.onCompleted();
} catch (Exception e) {
subscriber.onError(e);
}
}
}).observeOn(Schedulers.io());
/**
* 写漫画索引,不关心是否成功,若没有索引文件,则不能排序章节及扫描恢复漫画,但不影响下载及观看
* @param list
* @param comic
*/
public static void updateComicIndex(List<Chapter> list, Comic comic) {
ContentResolver resolver = CimocApplication.getResolver();
DocumentFile root = CimocApplication.getDocumentFile();
try {
createNoMedia(root);
String jsonString = getJsonFromComic(list, comic);
DocumentFile file = createComicIndex(root, comic);
DocumentUtils.writeStringToFile(resolver, file, "cimoc".concat(jsonString));
} catch (Exception e) {
e.printStackTrace();
}
}

private static String getJsonFromComic(List<Chapter> list, Comic comic) throws JSONException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ public Observable<List<Task>> listInRx() {
.list();
}

public long insert(Task task) {
return mTaskDao.insert(task);
public void insert(Task task) {
long id = mTaskDao.insert(task);
task.setId(id);
}

public void update(Task task) {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/hiroshi/cimoc/global/FastClick.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class FastClick {

public static boolean isClickValid() {
long cur = System.currentTimeMillis();
boolean valid = cur - last > 800;
boolean valid = cur - last > 600;
if (valid) {
last = cur;
}
Expand Down

This file was deleted.

Loading

0 comments on commit 8b9b442

Please sign in to comment.