mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-24 18:08:24 +01:00
Use constraints, delete chapters when deleting a Manga
This commit is contained in:
parent
53f86c4f4b
commit
b2a1ba777d
@ -27,4 +27,10 @@ public class DbOpenHelper extends SQLiteOpenHelper {
|
|||||||
public void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
// no impl
|
// no impl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConfigure(SQLiteDatabase db){
|
||||||
|
db.setForeignKeyConstraintsEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -37,7 +37,8 @@ public class ChaptersTable {
|
|||||||
+ COLUMN_NAME + " TEXT NOT NULL, "
|
+ COLUMN_NAME + " TEXT NOT NULL, "
|
||||||
+ COLUMN_READ + " BOOLEAN NOT NULL, "
|
+ COLUMN_READ + " BOOLEAN NOT NULL, "
|
||||||
+ COLUMN_DATE_FETCH + " LONG NOT NULL, "
|
+ COLUMN_DATE_FETCH + " LONG NOT NULL, "
|
||||||
+ "FOREIGN KEY(" + COLUMN_MANGA_ID + ") REFERENCES " + MangasTable.TABLE + "(" + MangasTable.COLUMN_ID + ")"
|
+ "FOREIGN KEY(" + COLUMN_MANGA_ID + ") REFERENCES " + MangasTable.TABLE + "(" + MangasTable.COLUMN_ID + ") "
|
||||||
|
+ "ON DELETE CASCADE"
|
||||||
+ ");";
|
+ ");";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@ public class MangaLibraryHolder extends ItemViewHolder<Manga> {
|
|||||||
mUnreadText.setVisibility(View.VISIBLE);
|
mUnreadText.setVisibility(View.VISIBLE);
|
||||||
mUnreadText.setText(Integer.toString(manga.unread));
|
mUnreadText.setText(Integer.toString(manga.unread));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
mUnreadText.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
Glide.with(getContext())
|
Glide.with(getContext())
|
||||||
.load("http://img1.wikia.nocookie.net/__cb20090524204255/starwars/images/thumb/1/1a/R2d2.jpg/400px-R2d2.jpg")
|
.load("http://img1.wikia.nocookie.net/__cb20090524204255/starwars/images/thumb/1/1a/R2d2.jpg/400px-R2d2.jpg")
|
||||||
.centerCrop()
|
.centerCrop()
|
||||||
|
Loading…
Reference in New Issue
Block a user