Allow to refresh data from MAL and show total chapters. Create nomedia file for default downloads folder on new installations.
This commit is contained in:
@@ -43,4 +43,11 @@ public class MangaSync implements Serializable {
|
||||
mangasync.sync_id = service.getId();
|
||||
return mangasync;
|
||||
}
|
||||
|
||||
public void copyPersonalFrom(MangaSync other) {
|
||||
last_chapter_read = other.last_chapter_read;
|
||||
score = other.score;
|
||||
status = other.status;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ public class MyAnimeList extends MangaSyncService {
|
||||
private static final String SCORE_TAG = "score";
|
||||
private static final String STATUS_TAG = "status";
|
||||
|
||||
public static final int NOT_IN_LIST = 0;
|
||||
public static final int READING = 1;
|
||||
public static final int COMPLETED = 2;
|
||||
public static final int ON_HOLD = 3;
|
||||
@@ -125,7 +124,7 @@ public class MyAnimeList extends MangaSyncService {
|
||||
.toString();
|
||||
}
|
||||
|
||||
public Observable<List<MangaSync>> getList(String username) {
|
||||
public Observable<List<MangaSync>> getList() {
|
||||
// TODO cache this list for a few minutes
|
||||
return networkService.getStringResponse(getListUrl(username), headers, null)
|
||||
.map(Jsoup::parse)
|
||||
@@ -215,15 +214,13 @@ public class MyAnimeList extends MangaSyncService {
|
||||
}
|
||||
|
||||
public Observable<Response> bind(MangaSync manga) {
|
||||
return getList(username)
|
||||
return getList()
|
||||
.flatMap(list -> {
|
||||
manga.sync_id = getId();
|
||||
for (MangaSync remoteManga : list) {
|
||||
if (remoteManga.remote_id == manga.remote_id) {
|
||||
// Manga is already in the list
|
||||
manga.score = remoteManga.score;
|
||||
manga.status = remoteManga.status;
|
||||
manga.last_chapter_read = remoteManga.last_chapter_read;
|
||||
manga.copyPersonalFrom(remoteManga);
|
||||
return update(manga);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.f2prateek.rx.preferences.Preference;
|
||||
import com.f2prateek.rx.preferences.RxSharedPreferences;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import eu.kanade.mangafeed.R;
|
||||
import eu.kanade.mangafeed.data.mangasync.base.MangaSyncService;
|
||||
@@ -38,8 +39,13 @@ public class PreferencesHelper {
|
||||
File.separator + context.getString(R.string.app_name), "downloads");
|
||||
|
||||
// Create default directory
|
||||
if (getDownloadsDirectory().equals(defaultDownloadsDir.getAbsolutePath()))
|
||||
if (getDownloadsDirectory().equals(defaultDownloadsDir.getAbsolutePath()) &&
|
||||
!defaultDownloadsDir.exists()) {
|
||||
defaultDownloadsDir.mkdirs();
|
||||
try {
|
||||
new File(defaultDownloadsDir, ".nomedia").createNewFile();
|
||||
} catch (IOException e) { /* Ignore */ }
|
||||
}
|
||||
}
|
||||
|
||||
private String getKey(int keyResource) {
|
||||
|
||||
Reference in New Issue
Block a user