Skip to content

Commit

Permalink
Mark episodes as watched after click, Customizable quick rewind,
Browse files Browse the repository at this point in the history
Documented AwerySettings,
Fix crash if media has no lists,
Enable Material You by default if it is supported on the device
  • Loading branch information
MrBoomDeveloper committed Mar 20, 2024
1 parent b2d9be0 commit d3c442f
Show file tree
Hide file tree
Showing 21 changed files with 479 additions and 116 deletions.
14 changes: 9 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ android {
}

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
Expand All @@ -74,17 +75,20 @@ android {
}

dependencies {
// Core
// Compatibility for new methods in old Api
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.0.4"
implementation "androidx.core:core-ktx:1.12.0"
implementation "androidx.work:work-runtime-ktx:2.9.0"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "androidx.browser:browser:1.8.0"
implementation "androidx.core:core-ktx:1.12.0"
implementation "androidx.webkit:webkit:1.10.0"
implementation "androidx.fragment:fragment-ktx:1.6.2"
implementation "androidx.work:work-runtime-ktx:2.9.0"
implementation "androidx.preference:preference-ktx:1.2.1"

// Kotlin shit
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.webkit:webkit:1.10.0"

// Glide
ext.glide_version = "4.16.0"
Expand Down
26 changes: 23 additions & 3 deletions app/schemas/com.mrboomdev.awery.data.db.AweryDB/2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"formatVersion": 1,
"database": {
"version": 2,
"identityHash": "6aaacfffb3e51c35cb67ef20833d4b33",
"identityHash": "8f75f6096ab783134a8453d60fc1ff8e",
"entities": [
{
"tableName": "media",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`global_id` TEXT NOT NULL, `titles` TEXT, `lists` TEXT, `trackers` TEXT, `title` TEXT, `banner` TEXT, `description` TEXT, `color` TEXT, `url` TEXT, `country` TEXT, `releaseDate` TEXT, `duration` TEXT, `type` TEXT, `id` INTEGER NOT NULL, `episodes_count` TEXT, `average_score` TEXT, `tags` TEXT, `genres` TEXT, `status` TEXT, `poster_extra_large` TEXT, `poster_large` TEXT, `poster_medium` TEXT, PRIMARY KEY(`global_id`))",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`global_id` TEXT NOT NULL, `titles` TEXT, `lists` TEXT, `trackers` TEXT, `title` TEXT, `banner` TEXT, `description` TEXT, `color` TEXT, `url` TEXT, `country` TEXT, `releaseDate` TEXT, `duration` TEXT, `type` TEXT, `id` INTEGER NOT NULL, `episodes_count` TEXT, `average_score` TEXT, `tags` TEXT, `genres` TEXT, `status` TEXT, `poster_extra_large` TEXT, `poster_large` TEXT, `poster_medium` TEXT, `last_source` TEXT, `last_episode` REAL NOT NULL DEFAULT -1, `last_episode_progress` REAL NOT NULL DEFAULT -1, PRIMARY KEY(`global_id`))",
"fields": [
{
"fieldPath": "globalId",
Expand Down Expand Up @@ -139,6 +139,26 @@
"columnName": "poster_medium",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "lastSource",
"columnName": "last_source",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "lastEpisode",
"columnName": "last_episode",
"affinity": "REAL",
"notNull": true,
"defaultValue": "-1"
},
{
"fieldPath": "lastEpisodeProgress",
"columnName": "last_episode_progress",
"affinity": "REAL",
"notNull": true,
"defaultValue": "-1"
}
],
"primaryKey": {
Expand Down Expand Up @@ -180,7 +200,7 @@
"views": [],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '6aaacfffb3e51c35cb67ef20833d4b33')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '8f75f6096ab783134a8453d60fc1ff8e')"
]
}
}
2 changes: 1 addition & 1 deletion app/src/main/assets/repos.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
{
"type": "AweryJS",
"title": "Awery - Official Repository",
"url": "https://github.com/MrBoomDeveloper/AweryRepo"
"url": "https://repo.mrboomdev.ru/cdn/repo.json"
}
]
12 changes: 12 additions & 0 deletions app/src/main/assets/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@
{ "key": "60", "title": "60s" },
{ "key": "120", "title": "120s" }
]
}, {
"key": "big_seek", "type": "select",
"title": "Quick Rewind ", "icon": "outline_fast_forward_24",
"items": [
{ "key": "0", "title": "Disabled" },
{ "key": "30", "title": "30s" },
{ "key": "60", "title": "1m" },
{ "key": "120", "title": "2m" },
{ "key": "180", "title": "3m" },
{ "key": "240", "title": "4m" },
{ "key": "300", "title": "5m" }
]
}, {
"key": "gestures", "type": "select", "string_value": "TODO: MAKE THIS VALUE AS DEFAULT",
"title": "Gestures mode",
Expand Down
138 changes: 136 additions & 2 deletions app/src/main/assets/tags.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,145 @@
{
"action": {
"title": "Action",
"variants": [ "action", "экшен" ],
"is_adult": false
},

"comedy": {
"title": "Comedy",
"variants": [ "comedy", "комедия" ],
"is_adult": false
},

"drama": {
"title": "Drama",
"variants": [ "drama", "драма" ],
"is_adult": false
},

"fantasy": {
"title": "Fantasy",
"variants": [ "fantasy", "фэнтези" ],
"is_adult": false
},

"horror": {
"title": "Horror",
"variants": [ "horror", "хоррор" ],
"is_adult": false
},

"mystery": {
"title": "Mystery",
"variants": [ "mystery", "мистика" ],
"is_adult": false
},

"romance": {
"title": "Romance",
"variants": [ "romance", "романтика" ],
"is_adult": false
},

"sci-fi": {
"title": "Sci-Fi",
"variants": [ "sci-fi", "фантастика" ],
"is_adult": false
},

"thriller": {
"title": "Thriller",
"variants": [ "thriller", "триллер" ],
"is_adult": false
},

"western": {
"title": "Western",
"variants": [ "western", "вестерн" ],
"is_adult": false
},

"adventure": {
"title": "Adventure",
"variants": [ "adventure", "приключения", "приключение" ],
"is_adult": false
},

"biography": {
"title": "Biography",
"variants": [ "biography", "биография" ],
"is_adult": false
},

"crime": {
"title": "Crime",
"variants": [ "crime", "криминал" ],
"is_adult": false
},

"documentary": {
"title": "Documentary",
"variants": [ "documentary", "документальное" ],
"is_adult": false
},

"history": {
"title": "History",
"variants": [ "history", "история" ],
"is_adult": false
},

"music": {
"title": "Music",
"variants": [ "music", "музыка" ],
"is_adult": false
},

"reality": {
"title": "Reality",
"variants": [ "reality", "реалити" ],
"is_adult": false
},

"war": {
"title": "War",
"variants": [ "war", "война" ],
"is_adult": false
},

"animation": {
"title": "Animation",
"variants": [ "animation", "anime", "анимация", "аниме" ],
"is_adult": false
},

"anime": {
"title": "Anime",
"variants": [ "anime", "аниме" ],
"is_adult": false
},

"cgi": {
"title": "CGI",
"variants": [ "cgi" ],
"is_adult": false
},

"gay": {
"title": "Gay",
"variants": [ "yaoi", "gay", "boys love" ]
"variants": [ "yaoi", "gay", "boys love", "сёнен-ай" ],
"is_adult": false
},

"lesbian": {
"title": "Lesbian",
"variants": [ "lesbian", "yuri" ]
"variants": [ "lesbian", "yuri", "сёдзе-ай" ],
"is_adult": false
},

"lgbt": {
"title": "LGBT",
"variants": [ "lgbt", "lesbian", "gay", "bisexual", "transgender", "lgbtq", "лгбт" ],
"is_adult": false
}
}
21 changes: 7 additions & 14 deletions app/src/main/java/com/mrboomdev/awery/AweryApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ public class AweryApp extends App implements Application.ActivityLifecycleCallba
private static final Map<Class<? extends Activity>, ActivityInfo> activities = new HashMap<>();
private static final Handler handler = new Handler(Looper.getMainLooper());
private static final List<Disposable> disposables = new ArrayList<>();
private static final String TAG = "AweryApp";
public static final boolean USE_KT_APP_INIT = true;
private static final String TAG = "AweryApp";
private static Thread mainThread;
private static AweryApp app;
private static AweryDB db;

Expand All @@ -94,12 +95,7 @@ public static Context getContext() {
}

public static void toast(Activity activity, String text, int duration) {
if(activity == null) {
Toast.makeText(app, text, duration).show();
return;
}

activity.runOnUiThread(() -> Toast.makeText(activity, text, duration).show());
runOnUiThread(() -> Toast.makeText(activity, text, duration).show());
}

public static void toast(String text, int duration) {
Expand Down Expand Up @@ -151,13 +147,8 @@ public static boolean isTv() {
}

public static void runOnUiThread(Runnable runnable) {
var activity = getAnyActivity();

if(activity != null) {
activity.runOnUiThread(runnable);
} else {
postRunnable(runnable);
}
if(Thread.currentThread() != mainThread) handler.post(runnable);
else runnable.run();
}

@Nullable
Expand All @@ -179,6 +170,8 @@ public void onCreate() {
setupCrashHandler();

app = this;
mainThread = Thread.currentThread();

super.onCreate();

if(AwerySettings.getInstance().getBoolean(AwerySettings.VERBOSE_NETWORK)) {
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/com/mrboomdev/awery/data/db/AweryDB.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.mrboomdev.awery.data.db;

import androidx.room.AutoMigration;
import androidx.room.Database;
import androidx.room.RoomDatabase;

import com.mrboomdev.awery.data.db.dao.CatalogListDao;
import com.mrboomdev.awery.data.db.dao.CatalogMediaDao;

@Database(
version = 1,
version = 2,

/*autoMigrations = {
autoMigrations = {
@AutoMigration(from = 1, to = 2)
},*/
},

entities = {
DBCatalogMedia.class,
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/java/com/mrboomdev/awery/data/db/DBCatalogMedia.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public class DBCatalogMedia {
public String largePoster;
@ColumnInfo(name = "poster_medium")
public String mediumPoster;
@ColumnInfo(name = "last_source")
public String lastSource;
@ColumnInfo(name = "last_episode", defaultValue = "-1")
public float lastEpisode;
@ColumnInfo(name = "last_episode_progress", defaultValue = "-1")
public float lastEpisodeProgress;

public DBCatalogMedia(@NonNull String globalId) {
this.globalId = globalId;
Expand All @@ -62,6 +68,10 @@ public static DBCatalogMedia fromCatalogMedia(@NonNull CatalogMedia media) {
dbMedia.id = media.id;
dbMedia.country = media.country;

dbMedia.lastEpisode = media.lastEpisode;
dbMedia.lastSource = media.lastSource;
dbMedia.lastEpisodeProgress = media.lastEpisodeProgress;

if(media.averageScore != null) {
dbMedia.averageScore = Float.toString(media.averageScore);
}
Expand Down Expand Up @@ -123,6 +133,10 @@ public CatalogMedia toCatalogMedia() {
media.color = color;
media.country = country;

media.lastSource = lastSource;
media.lastEpisode = lastEpisode;
media.lastEpisodeProgress = lastEpisodeProgress;

if(averageScore != null) {
media.averageScore = Float.parseFloat(averageScore);
}
Expand Down
Loading

0 comments on commit d3c442f

Please sign in to comment.