Add Updated navigation section
This commit is contained in:
@@ -17,12 +17,13 @@ enum class NavItem(
|
||||
EXPLORE(R.id.nav_explore, R.string.explore, R.drawable.ic_explore_selector),
|
||||
SUGGESTIONS(R.id.nav_suggestions, R.string.suggestions, R.drawable.ic_suggestion_selector),
|
||||
FEED(R.id.nav_feed, R.string.feed, R.drawable.ic_feed_selector),
|
||||
UPDATED(R.id.nav_updated, R.string.updated, R.drawable.ic_updated_selector),
|
||||
BOOKMARKS(R.id.nav_bookmarks, R.string.bookmarks, R.drawable.ic_bookmark_selector),
|
||||
;
|
||||
|
||||
fun isAvailable(settings: AppSettings): Boolean = when (this) {
|
||||
SUGGESTIONS -> settings.isSuggestionsEnabled
|
||||
FEED -> settings.isTrackerEnabled
|
||||
UPDATED, FEED -> settings.isTrackerEnabled
|
||||
else -> true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.koitharu.kotatsu.history.ui.HistoryListFragment
|
||||
import org.koitharu.kotatsu.local.ui.LocalListFragment
|
||||
import org.koitharu.kotatsu.suggestions.ui.SuggestionsFragment
|
||||
import org.koitharu.kotatsu.tracker.ui.feed.FeedFragment
|
||||
import org.koitharu.kotatsu.tracker.ui.updates.UpdatesFragment
|
||||
import java.util.LinkedList
|
||||
import com.google.android.material.R as materialR
|
||||
|
||||
@@ -144,6 +145,7 @@ class MainNavigationDelegate(
|
||||
R.id.nav_local -> LocalListFragment::class.java
|
||||
R.id.nav_suggestions -> SuggestionsFragment::class.java
|
||||
R.id.nav_bookmarks -> BookmarksFragment::class.java
|
||||
R.id.nav_updated -> UpdatesFragment::class.java
|
||||
else -> return false
|
||||
},
|
||||
)
|
||||
@@ -157,6 +159,7 @@ class MainNavigationDelegate(
|
||||
is LocalListFragment -> R.id.nav_local
|
||||
is SuggestionsFragment -> R.id.nav_suggestions
|
||||
is BookmarksFragment -> R.id.nav_bookmarks
|
||||
is UpdatesFragment -> R.id.nav_updated
|
||||
else -> 0
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,11 @@ abstract class TracksDao {
|
||||
abstract fun observeNewChapters(mangaId: Long): Flow<Int?>
|
||||
|
||||
@Transaction
|
||||
@Query("SELECT manga.* FROM tracks LEFT JOIN manga ON manga.manga_id = tracks.manga_id WHERE chapters_new > 0 ORDER BY chapters_new DESC")
|
||||
@Query("SELECT manga.* FROM tracks LEFT JOIN manga ON manga.manga_id = tracks.manga_id WHERE chapters_new > 0 ORDER BY last_chapter_date DESC")
|
||||
abstract fun observeUpdatedManga(): Flow<List<MangaWithTags>>
|
||||
|
||||
@Transaction
|
||||
@Query("SELECT manga.* FROM tracks LEFT JOIN manga ON manga.manga_id = tracks.manga_id WHERE chapters_new > 0 ORDER BY chapters_new DESC LIMIT :limit")
|
||||
@Query("SELECT manga.* FROM tracks LEFT JOIN manga ON manga.manga_id = tracks.manga_id WHERE chapters_new > 0 ORDER BY last_chapter_date DESC LIMIT :limit")
|
||||
abstract fun observeUpdatedManga(limit: Int): Flow<List<MangaWithTags>>
|
||||
|
||||
@Query("DELETE FROM tracks")
|
||||
|
||||
11
app/src/main/res/drawable/ic_updated.xml
Normal file
11
app/src/main/res/drawable/ic_updated.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M12 20C12.4 20 12.7 20 13.1 19.9C13.2 20.6 13.4 21.3 13.7 21.8C13.2 21.9 12.6 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2C17.5 2 22 6.5 22 12C22 12.5 21.92 12.97 21.84 13.5L21.8 13.7C21.2 13.4 20.6 13.2 19.9 13.1C20 12.7 20 12.4 20 12C20 7.6 16.4 4 12 4C7.6 4 4 7.6 4 12C4 16.4 7.6 20 12 20M12.5 12.3L15.6 14.1C15.2 14.4 14.8 14.7 14.5 15.1L11 13V7H12.5V12.3M17.74 17.75L19 15L20.25 17.75L23 19L20.25 20.26L19 23L17.74 20.26L15 19L17.74 17.75Z" />
|
||||
</vector>
|
||||
11
app/src/main/res/drawable/ic_updated_checked.xml
Normal file
11
app/src/main/res/drawable/ic_updated_checked.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M14.4 15.1C13.5 16.2 13 17.5 13 19C13 20 13.3 21 13.7 21.8C13.2 21.9 12.6 22 12 22C6.5 22 2 17.5 2 12C2 6.5 6.5 2 12 2C17.5 2 22 6.5 22 12C22 12.5 21.92 12.97 21.84 13.5L21.8 13.7C21 13.3 20 13 19 13C17.7 13 16.6 13.4 15.6 14.1L12.5 12.2V7H11V13L14.4 15.1M17.74 17.75L19 15L20.25 17.75L23 19L20.25 20.26L19 23L17.74 20.26L15 19L17.74 17.75Z" />
|
||||
</vector>
|
||||
20
app/src/main/res/drawable/ic_updated_selector.xml
Normal file
20
app/src/main/res/drawable/ic_updated_selector.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animated-selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/normal"
|
||||
android:drawable="@drawable/ic_updated"
|
||||
android:state_checked="false" />
|
||||
|
||||
<item
|
||||
android:id="@+id/checked"
|
||||
android:drawable="@drawable/ic_updated_checked"
|
||||
android:state_checked="true" />
|
||||
|
||||
<!--<transition
|
||||
android:drawable="@drawable/TODO"
|
||||
android:fromId="@id/normal"
|
||||
android:toId="@id/checked" />-->
|
||||
|
||||
</animated-selector>
|
||||
@@ -14,6 +14,7 @@
|
||||
<item name="nav_local" type="id" />
|
||||
<item name="nav_explore" type="id" />
|
||||
<item name="nav_feed" type="id" />
|
||||
<item name="nav_updated" type="id" />
|
||||
<item name="nav_suggestions" type="id" />
|
||||
<item name="nav_bookmarks" type="id" />
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user