Using bookmark icon for chapter bookmarking, heart for favoriting manga

This commit is contained in:
Jay 2020-04-12 20:19:07 -04:00
parent 3f31152968
commit cb6de21804
10 changed files with 35 additions and 8 deletions

View File

@ -93,7 +93,7 @@ open class MainActivity : BaseActivity(), DownloadServiceListener {
this.snackBar = snackBar this.snackBar = snackBar
canDismissSnackBar = false canDismissSnackBar = false
launchUI { launchUI {
delay(2000) delay(1000)
if (this@MainActivity.snackBar == snackBar) { if (this@MainActivity.snackBar == snackBar) {
canDismissSnackBar = true canDismissSnackBar = true
} }

View File

@ -142,8 +142,8 @@ class MangaHeaderHolder(
icon = ContextCompat.getDrawable( icon = ContextCompat.getDrawable(
itemView.context, when { itemView.context, when {
item.isLocked -> R.drawable.ic_lock_white_24dp item.isLocked -> R.drawable.ic_lock_white_24dp
manga.favorite -> R.drawable.ic_bookmark_white_24dp manga.favorite -> R.drawable.ic_heart_24dp
else -> R.drawable.ic_add_to_library_24dp else -> R.drawable.ic_heart_outline_24dp
} }
) )
text = itemView.resources.getString( text = itemView.resources.getString(

View File

@ -86,8 +86,8 @@ class ChapterHolder(
) )
bookmark.setImageDrawable( bookmark.setImageDrawable(
ContextCompat.getDrawable( ContextCompat.getDrawable(
read.context, if (item.bookmark) R.drawable.star_off read.context, if (item.bookmark) R.drawable.ic_bookmark_off_24dp
else R.drawable.star else R.drawable.ic_bookmark_24dp
) )
) )
} }

View File

@ -364,7 +364,8 @@ class RecentsController(bundle: Bundle? = null) : BaseController(bundle),
} }
override fun showSheet() { override fun showSheet() {
dl_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED if (dl_bottom_sheet.sheetBehavior?.isHideable == false || presenter.downloadManager.hasQueue())
dl_bottom_sheet.sheetBehavior?.state = BottomSheetBehavior.STATE_EXPANDED
} }
override fun toggleSheet() { override fun toggleSheet() {

View File

@ -30,7 +30,7 @@ import kotlin.math.abs
class RecentsPresenter( class RecentsPresenter(
val controller: RecentsController, val controller: RecentsController,
val preferences: PreferencesHelper = Injekt.get(), val preferences: PreferencesHelper = Injekt.get(),
private val downloadManager: DownloadManager = Injekt.get(), val downloadManager: DownloadManager = Injekt.get(),
private val db: DatabaseHelper = Injekt.get() private val db: DatabaseHelper = Injekt.get()
) : DownloadQueue.DownloadListener, LibraryServiceListener { ) : DownloadQueue.DownloadListener, LibraryServiceListener {

View File

@ -2,6 +2,7 @@
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:tint="#FFFFFF"
android:viewportHeight="24.0"> android:viewportHeight="24.0">
<path <path
android:fillColor="#FFFFFFFF" android:fillColor="#FFFFFFFF"

View File

@ -0,0 +1,8 @@
<!-- drawable/bookmark_off.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M20,20.72L18.73,22L16.78,20.05L12,18L5,21V8.27L2,5.27L3.28,4L20,20.72M19,17.16V5C19,3.89 18.1,3 17,3H7C6.41,3 5.89,3.27 5.5,3.68L19,17.16Z" />
</vector>

View File

@ -0,0 +1,9 @@
<!-- drawable/heart.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:tint="#FFFFFF"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M12,21.35L10.55,20.03C5.4,15.36 2,12.27 2,8.5C2,5.41 4.42,3 7.5,3C9.24,3 10.91,3.81 12,5.08C13.09,3.81 14.76,3 16.5,3C19.58,3 22,5.41 22,8.5C22,12.27 18.6,15.36 13.45,20.03L12,21.35Z" />
</vector>

View File

@ -0,0 +1,8 @@
<!-- drawable/heart_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path android:fillColor="#000" android:pathData="M12.1,18.55L12,18.65L11.89,18.55C7.14,14.24 4,11.39 4,8.5C4,6.5 5.5,5 7.5,5C9.04,5 10.54,6 11.07,7.36H12.93C13.46,6 14.96,5 16.5,5C18.5,5 20,6.5 20,8.5C20,11.39 16.86,14.24 12.1,18.55M16.5,3C14.76,3 13.09,3.81 12,5.08C10.91,3.81 9.24,3 7.5,3C4.42,3 2,5.41 2,8.5C2,12.27 5.4,15.36 10.55,20.03L12,21.35L13.45,20.03C18.6,15.36 22,12.27 22,8.5C22,5.41 19.58,3 16.5,3Z" />
</vector>

View File

@ -47,7 +47,7 @@
android:layout_gravity="start|center" android:layout_gravity="start|center"
android:layout_marginStart="21dp" android:layout_marginStart="21dp"
android:tint="@color/md_white_1000" android:tint="@color/md_white_1000"
android:src="@drawable/ic_bookmark_white_24dp" /> android:src="@drawable/ic_bookmark_24dp" />
</FrameLayout> </FrameLayout>
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout