Skip to content
This repository has been archived by the owner on Jun 20, 2021. It is now read-only.

Commit

Permalink
Merge branch 'working'
Browse files Browse the repository at this point in the history
  • Loading branch information
ratan12 committed Oct 23, 2016
2 parents 10cb190 + dc5b5bf commit 33fd7a5
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 213 deletions.
30 changes: 15 additions & 15 deletions Atarashii/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,34 +17,34 @@ apply plugin: 'io.fabric'
apply plugin: 'android-apt'

android {
compileSdkVersion 24
compileSdkVersion 25
buildToolsVersion '23.0.3'

defaultConfig {
minSdkVersion 14
targetSdkVersion 24
targetSdkVersion 25
}

productFlavors {
Production {
applicationId 'net.somethingdreadful.MAL'
versionCode 36
versionName '2.3.4'
versionCode 37
versionName '2.3.5'
}
FLOSSProduction {
applicationId 'net.somethingdreadful.MAL'
versionCode 36
versionName '2.3.4'
versionCode 37
versionName '2.3.5'
}
Beta {
applicationId 'net.somethingdreadful.MAL.beta'
versionCode 75
versionName '2.3.4'
versionCode 76
versionName '2.3.5'
}
FLOSSBeta {
applicationId 'net.somethingdreadful.MAL.beta'
versionCode 75
versionName '2.3.4'
versionCode 76
versionName '2.3.5'
}
}

Expand All @@ -68,11 +68,11 @@ repositories {
}

dependencies {
compile 'com.android.support:support-v4:24.+'
compile 'com.android.support:support-v13:24.+'
compile 'com.android.support:cardview-v7:24.+'
compile 'com.android.support:appcompat-v7:24.+'
compile 'com.android.support:design:24.+'
compile 'com.android.support:support-v4:25.+'
compile 'com.android.support:support-v13:25.+'
compile 'com.android.support:cardview-v7:25.+'
compile 'com.android.support:appcompat-v7:25.+'
compile 'com.android.support:design:25.+'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,6 @@ public void onGenresButton() {
activity.showDialog("storage", new GenreDialogFragment().setOnSendClickListener(this), bundle);
}

@Override
public void onSaveInstanceState(Bundle state) {
super.onSaveInstanceState(state);
}

@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public void onCreate(Bundle state) {
Theme.setActionBar(this, new IGFPagerAdapter(getFragmentManager()));
}

@Override
protected void onNewIntent(Intent intent) {
setIntent(intent);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,6 @@ public String getYoutubeUrl() {
@Getter
private int rewatchValue;

public void setAllDirty() {
addDirtyField("watchedStatus");
addDirtyField("watchedEpisodes");
addDirtyField("watchingStart");
addDirtyField("watchingEnd");
addDirtyField("storage");
addDirtyField("storageValue");
addDirtyField("epsDownloaded");
addDirtyField("rewatching");
addDirtyField("rewatchCount");
addDirtyField("rewatchValue");
}

public void setWatchedStatus(String watchedStatus) {
if (this.watchedStatus == null || !this.watchedStatus.equals(watchedStatus)) {
this.watchedStatus = watchedStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ public String getPersonalTagsString() {
}

public void setPersonalTags(ArrayList<String> personalTags) {
if (!fromCursor)
addDirtyField("personalTags");
this.personalTags = personalTags;
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public boolean addOrUpdateAnime(Anime anime) {
nameMap.put("watchingEnd", "end");
nameMap.put("priority", "priority");
nameMap.put("personalTags", "tags");
nameMap.put("personalComments", "comments");
nameMap.put("notes", "comments");
nameMap.put("fansubGroup", "fansubber");
nameMap.put("storage", "storage_type");
nameMap.put("storageValue", "storage_amt");
Expand Down Expand Up @@ -204,7 +204,7 @@ public boolean addOrUpdateManga(Manga manga) {
nameMap.put("personalTags", "tags");
nameMap.put("rereadValue", "reread_value");
nameMap.put("rereadCount", "reread_count");
nameMap.put("personalComments", "comments");
nameMap.put("notes", "comments");
HashMap<String, String> fieldMap = new HashMap<>();
for (String dirtyField : manga.getDirty()) {
if (nameMap.containsKey(dirtyField)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ public class GenericRecord implements Serializable {
@Getter
private ArrayList<String> tags;

/**
* The user's personal tags
*/
@Setter
@Getter
@SerializedName("personal_tags")
private ArrayList<String> personalTags;

/**
* A list of alternative versions of this record
*/
Expand Down Expand Up @@ -180,6 +188,7 @@ void createGeneralBaseModel(net.somethingdreadful.MAL.api.BaseModels.AnimeManga.
model.setScore(getScore());
model.setPriority(getPriority());
model.setNotes(getPersonalComments());
model.setPersonalTags(getPersonalTags());
}

private ArrayList<String> getTitleArray() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void onReceive(Context context, Intent intent) {
if (APIHelper.isNetworkAvailable(context) && AccountService.getAccount() != null) {
Intent notificationIntent = new Intent(context, Home.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 1, notificationIntent, PendingIntent.FLAG_CANCEL_CURRENT);
if (networkChange(intent) && !PrefManager.getAutosyncDone() || !networkChange(intent)) {
if (!networkChange(intent) || !PrefManager.getAutosyncDone()) {
ArrayList<String> args = new ArrayList<>();
args.add(ContentManager.listSortFromInt(0, MALApi.ListType.ANIME));
args.add(String.valueOf(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@ public class DatabaseHelper extends SQLiteOpenHelper {
private static DatabaseHelper instance;
private final Context context;

public static final String TABLE_ANIME = "anime";
public static final String TABLE_MANGA = "manga";
public static final String TABLE_PROFILE = "profile";
public static final String TABLE_FRIENDLIST = "friendlist";
public static final String TABLE_PRODUCER = "producer";
public static final String TABLE_ANIME_PRODUCER = "anime_producer";
public static final String TABLE_ANIME_OTHER_TITLES = "animeothertitles";
public static final String TABLE_MANGA_OTHER_TITLES = "mangaothertitles";
public static final String TABLE_SCHEDULE = "schedule";

public static final String TABLE_ANIME_ANIME_RELATIONS = "rel_anime_anime";
public static final String TABLE_ANIME_MANGA_RELATIONS = "rel_anime_manga";
public static final String TABLE_MANGA_MANGA_RELATIONS = "rel_manga_manga";
public static final String TABLE_MANGA_ANIME_RELATIONS = "rel_manga_anime";

public static final String RELATION_TYPE_ALTERNATIVE = "0";
public static final String RELATION_TYPE_CHARACTER = "1";
public static final String RELATION_TYPE_SIDE_STORY = "2";
public static final String RELATION_TYPE_SPINOFF = "3";
public static final String RELATION_TYPE_SUMMARY = "4";
public static final String RELATION_TYPE_ADAPTATION = "5";
public static final String RELATION_TYPE_RELATED = "6";
public static final String RELATION_TYPE_PREQUEL = "7";
public static final String RELATION_TYPE_SEQUEL = "8";
public static final String RELATION_TYPE_PARENT_STORY = "9";
public static final String RELATION_TYPE_OTHER = "10";
static final String TABLE_ANIME = "anime";
static final String TABLE_MANGA = "manga";
static final String TABLE_PROFILE = "profile";
static final String TABLE_FRIENDLIST = "friendlist";
static final String TABLE_PRODUCER = "producer";
static final String TABLE_ANIME_PRODUCER = "anime_producer";
static final String TABLE_ANIME_OTHER_TITLES = "animeothertitles";
static final String TABLE_MANGA_OTHER_TITLES = "mangaothertitles";
static final String TABLE_SCHEDULE = "schedule";

static final String TABLE_ANIME_ANIME_RELATIONS = "rel_anime_anime";
static final String TABLE_ANIME_MANGA_RELATIONS = "rel_anime_manga";
static final String TABLE_MANGA_MANGA_RELATIONS = "rel_manga_manga";
static final String TABLE_MANGA_ANIME_RELATIONS = "rel_manga_anime";

static final String RELATION_TYPE_ALTERNATIVE = "0";
static final String RELATION_TYPE_CHARACTER = "1";
static final String RELATION_TYPE_SIDE_STORY = "2";
static final String RELATION_TYPE_SPINOFF = "3";
static final String RELATION_TYPE_SUMMARY = "4";
static final String RELATION_TYPE_ADAPTATION = "5";
static final String RELATION_TYPE_RELATED = "6";
static final String RELATION_TYPE_PREQUEL = "7";
static final String RELATION_TYPE_SEQUEL = "8";
static final String RELATION_TYPE_PARENT_STORY = "9";
static final String RELATION_TYPE_OTHER = "10";

public static final String COLUMN_ID = "_id";

Expand Down Expand Up @@ -74,43 +74,43 @@ public class DatabaseHelper extends SQLiteOpenHelper {
* to avoid conversion in every query
*/

public static final String TABLE_GENRES = "genres";
static final String TABLE_GENRES = "genres";
private static final String CREATE_GENRES_TABLE = "CREATE TABLE "
+ TABLE_GENRES + "("
+ COLUMN_ID + " integer primary key autoincrement, "
+ "title varchar NOT NULL "
+ ");";
public static final String TABLE_ANIME_GENRES = "anime_genres";
static final String TABLE_ANIME_GENRES = "anime_genres";
private static final String CREATE_ANIME_GENRES_TABLE = "CREATE TABLE "
+ TABLE_ANIME_GENRES + "("
+ "anime_id integer NOT NULL REFERENCES " + TABLE_ANIME + "(" + COLUMN_ID + ") ON DELETE CASCADE, "
+ "genre_id integer NOT NULL REFERENCES " + TABLE_GENRES + "(" + COLUMN_ID + ") ON DELETE CASCADE, "
+ "PRIMARY KEY(anime_id, genre_id)"
+ ");";
public static final String TABLE_MANGA_GENRES = "manga_genres";
static final String TABLE_MANGA_GENRES = "manga_genres";
private static final String CREATE_MANGA_GENRES_TABLE = "CREATE TABLE "
+ TABLE_MANGA_GENRES + "("
+ "manga_id integer NOT NULL REFERENCES " + TABLE_MANGA + "(" + COLUMN_ID + ") ON DELETE CASCADE, "
+ "genre_id integer NOT NULL REFERENCES " + TABLE_GENRES + "(" + COLUMN_ID + ") ON DELETE CASCADE, "
+ "PRIMARY KEY(manga_id, genre_id)"
+ ");";

public static final String TABLE_TAGS = "tags";
static final String TABLE_TAGS = "tags";
private static final String CREATE_TAGS_TABLE = "CREATE TABLE "
+ TABLE_TAGS + "("
+ COLUMN_ID + " integer primary key autoincrement, "
+ "title varchar NOT NULL "
+ ");";
public static final String TABLE_ANIME_TAGS = "anime_tags";
public static final String TABLE_ANIME_PERSONALTAGS = "anime_personaltags";
public static final String TABLE_MANGA_TAGS = "manga_tags";
public static final String TABLE_MANGA_PERSONALTAGS = "manga_personaltags";
static final String TABLE_ANIME_TAGS = "anime_tags";
static final String TABLE_ANIME_PERSONALTAGS = "anime_personaltags";
static final String TABLE_MANGA_TAGS = "manga_tags";
static final String TABLE_MANGA_PERSONALTAGS = "manga_personaltags";
/* title types, working the same way as the relation types
*/
public static final int TITLE_TYPE_JAPANESE = 0;
public static final int TITLE_TYPE_ENGLISH = 1;
public static final int TITLE_TYPE_SYNONYM = 2;
public static final int TITLE_TYPE_ROMAJI = 3;
static final int TITLE_TYPE_JAPANESE = 0;
static final int TITLE_TYPE_ENGLISH = 1;
static final int TITLE_TYPE_SYNONYM = 2;
static final int TITLE_TYPE_ROMAJI = 3;

private DatabaseHelper(Context context) {
super(context, NAME, null, VERSION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public Anime getAnime(int id) {
result.setOther(Query.newQuery(db).getRelation(result.getId(), DatabaseHelper.TABLE_ANIME_ANIME_RELATIONS, DatabaseHelper.RELATION_TYPE_OTHER, true));
result.setGenres(Query.newQuery(db).getArrayList(result.getId(), DatabaseHelper.TABLE_GENRES, DatabaseHelper.TABLE_ANIME_GENRES, "genre_id", true));
result.setTags(Query.newQuery(db).getArrayList(result.getId(), DatabaseHelper.TABLE_TAGS, DatabaseHelper.TABLE_ANIME_TAGS, "tag_id", true));
result.setPersonalTags(Query.newQuery(db).getArrayList(result.getId(), DatabaseHelper.TABLE_TAGS, DatabaseHelper.TABLE_ANIME_PERSONALTAGS, "tag_id", true));
result.setProducers(Query.newQuery(db).getArrayList(result.getId(), DatabaseHelper.TABLE_PRODUCER, DatabaseHelper.TABLE_ANIME_PRODUCER, "producer_id", true));
}
cursor.close();
Expand Down Expand Up @@ -498,12 +499,7 @@ public void saveProfile(Profile profile) {
}
}

public void restoreLists(ArrayList<Anime> animeList, ArrayList<Manga> mangaList) {
saveAnimeList(animeList);
saveMangaList(mangaList);
}

public boolean deleteAnime(int id) {
public void deleteAnime(int id) {
boolean result = false;
try {
db.beginTransaction();
Expand All @@ -517,10 +513,9 @@ public boolean deleteAnime(int id) {
}
if (result)
cleanupAnimeTable();
return result;
}

public boolean deleteManga(int id) {
public void deleteManga(int id) {
boolean result = false;
try {
db.beginTransaction();
Expand All @@ -534,7 +529,6 @@ public boolean deleteManga(int id) {
}
if (result)
cleanupMangaTable();
return result;
}

public void saveSchedule(Schedule schedule) {
Expand Down
Loading

0 comments on commit 33fd7a5

Please sign in to comment.