Fixes to android lollipop
Notification icons now has color Coping title or other text in manga info is now a snackbar, shows the type of text copied
This commit is contained in:
parent
d263f03cc7
commit
6da8c368fa
7 changed files with 26 additions and 18 deletions
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.download
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.download.model.Download
|
import eu.kanade.tachiyomi.data.download.model.Download
|
||||||
import eu.kanade.tachiyomi.data.download.model.DownloadQueue
|
import eu.kanade.tachiyomi.data.download.model.DownloadQueue
|
||||||
|
@ -219,7 +220,7 @@ internal class DownloadNotifier(private val context: Context) {
|
||||||
clearActions()
|
clearActions()
|
||||||
setAutoCancel(true)
|
setAutoCancel(true)
|
||||||
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
|
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
|
||||||
color = context.getResourceColor(R.attr.colorAccent)
|
color = ContextCompat.getColor(context, R.color.colorAccentLight)
|
||||||
setProgress(0, 0, false)
|
setProgress(0, 0, false)
|
||||||
}
|
}
|
||||||
notification.show(Notifications.ID_DOWNLOAD_CHAPTER_ERROR)
|
notification.show(Notifications.ID_DOWNLOAD_CHAPTER_ERROR)
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.os.Build
|
||||||
import android.os.IBinder
|
import android.os.IBinder
|
||||||
import android.os.PowerManager
|
import android.os.PowerManager
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||||
import eu.kanade.tachiyomi.data.database.models.Category
|
import eu.kanade.tachiyomi.data.database.models.Category
|
||||||
|
@ -90,7 +91,7 @@ class LibraryUpdateService(
|
||||||
.setLargeIcon(notificationBitmap)
|
.setLargeIcon(notificationBitmap)
|
||||||
.setOngoing(true)
|
.setOngoing(true)
|
||||||
.setOnlyAlertOnce(true)
|
.setOnlyAlertOnce(true)
|
||||||
.setColor(getResourceColor(R.attr.colorAccent))
|
.setColor(ContextCompat.getColor(this, R.color.colorAccentLight))
|
||||||
.addAction(R.drawable.ic_clear_grey_24dp_img, getString(android.R.string.cancel), cancelIntent)
|
.addAction(R.drawable.ic_clear_grey_24dp_img, getString(android.R.string.cancel), cancelIntent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +464,7 @@ class LibraryUpdateService(
|
||||||
setSmallIcon(R.drawable.ic_book_white_24dp)
|
setSmallIcon(R.drawable.ic_book_white_24dp)
|
||||||
setLargeIcon(notificationBitmap)
|
setLargeIcon(notificationBitmap)
|
||||||
setContentTitle(getString(R.string.notification_new_chapters))
|
setContentTitle(getString(R.string.notification_new_chapters))
|
||||||
color = getResourceColor(R.attr.colorAccent)
|
color = ContextCompat.getColor(applicationContext, R.color.colorAccentLight)
|
||||||
if (newUpdates.size > 1) {
|
if (newUpdates.size > 1) {
|
||||||
setContentText(getString(R.string.notification_new_chapters_text, newUpdates.size))
|
setContentText(getString(R.string.notification_new_chapters_text, newUpdates.size))
|
||||||
setStyle(NotificationCompat.BigTextStyle().bigText(newUpdates.joinToString("\n")))
|
setStyle(NotificationCompat.BigTextStyle().bigText(newUpdates.joinToString("\n")))
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.updater
|
||||||
import android.app.PendingIntent
|
import android.app.PendingIntent
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import com.evernote.android.job.Job
|
import com.evernote.android.job.Job
|
||||||
import com.evernote.android.job.JobManager
|
import com.evernote.android.job.JobManager
|
||||||
import com.evernote.android.job.JobRequest
|
import com.evernote.android.job.JobRequest
|
||||||
|
@ -28,7 +29,7 @@ class UpdaterJob : Job() {
|
||||||
setContentTitle(context.getString(R.string.app_name))
|
setContentTitle(context.getString(R.string.app_name))
|
||||||
setContentText(context.getString(R.string.update_check_notification_update_available))
|
setContentText(context.getString(R.string.update_check_notification_update_available))
|
||||||
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
setSmallIcon(android.R.drawable.stat_sys_download_done)
|
||||||
color = context.getResourceColor(R.attr.colorAccent)
|
color = ContextCompat.getColor(context, R.color.colorAccentLight)
|
||||||
// Download action
|
// Download action
|
||||||
addAction(android.R.drawable.stat_sys_download_done,
|
addAction(android.R.drawable.stat_sys_download_done,
|
||||||
context.getString(R.string.action_download),
|
context.getString(R.string.action_download),
|
||||||
|
|
|
@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.updater
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.notification.NotificationHandler
|
import eu.kanade.tachiyomi.data.notification.NotificationHandler
|
||||||
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
|
||||||
|
@ -96,7 +97,7 @@ internal class UpdaterNotifier(private val context: Context) {
|
||||||
setSmallIcon(android.R.drawable.stat_sys_warning)
|
setSmallIcon(android.R.drawable.stat_sys_warning)
|
||||||
setOnlyAlertOnce(false)
|
setOnlyAlertOnce(false)
|
||||||
setProgress(0, 0, false)
|
setProgress(0, 0, false)
|
||||||
color = context.getResourceColor(R.attr.colorAccent)
|
color = ContextCompat.getColor(context, R.color.colorAccentLight)
|
||||||
// Retry action
|
// Retry action
|
||||||
addAction(R.drawable.ic_refresh_grey_24dp_img,
|
addAction(R.drawable.ic_refresh_grey_24dp_img,
|
||||||
context.getString(R.string.action_retry),
|
context.getString(R.string.action_retry),
|
||||||
|
|
|
@ -101,7 +101,8 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
swipe_refresh.refreshes().subscribeUntilDestroy { fetchMangaFromSource() }
|
swipe_refresh.refreshes().subscribeUntilDestroy { fetchMangaFromSource() }
|
||||||
|
|
||||||
manga_full_title.longClicks().subscribeUntilDestroy {
|
manga_full_title.longClicks().subscribeUntilDestroy {
|
||||||
copyToClipboard(view.context.getString(R.string.title), manga_full_title.text.toString())
|
copyToClipboard(view.context.getString(R.string.title), manga_full_title.text
|
||||||
|
.toString(), R.string.manga_info_full_title_label)
|
||||||
}
|
}
|
||||||
|
|
||||||
manga_full_title.clicks().subscribeUntilDestroy {
|
manga_full_title.clicks().subscribeUntilDestroy {
|
||||||
|
@ -109,7 +110,8 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
}
|
}
|
||||||
|
|
||||||
manga_artist.longClicks().subscribeUntilDestroy {
|
manga_artist.longClicks().subscribeUntilDestroy {
|
||||||
copyToClipboard(manga_artist_label.text.toString(), manga_artist.text.toString())
|
copyToClipboard(manga_artist_label.text.toString(), manga_artist.text.toString(), R
|
||||||
|
.string.manga_info_artist_label)
|
||||||
}
|
}
|
||||||
|
|
||||||
manga_artist.clicks().subscribeUntilDestroy {
|
manga_artist.clicks().subscribeUntilDestroy {
|
||||||
|
@ -117,7 +119,8 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
}
|
}
|
||||||
|
|
||||||
manga_author.longClicks().subscribeUntilDestroy {
|
manga_author.longClicks().subscribeUntilDestroy {
|
||||||
copyToClipboard(manga_author.text.toString(), manga_author.text.toString())
|
copyToClipboard(manga_author.text.toString(), manga_author.text.toString(), R.string
|
||||||
|
.manga_info_author_label)
|
||||||
}
|
}
|
||||||
|
|
||||||
manga_author.clicks().subscribeUntilDestroy {
|
manga_author.clicks().subscribeUntilDestroy {
|
||||||
|
@ -125,13 +128,14 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
}
|
}
|
||||||
|
|
||||||
manga_summary.longClicks().subscribeUntilDestroy {
|
manga_summary.longClicks().subscribeUntilDestroy {
|
||||||
copyToClipboard(view.context.getString(R.string.description), manga_summary.text.toString())
|
copyToClipboard(view.context.getString(R.string.description), manga_summary.text
|
||||||
|
.toString(), R.string.description)
|
||||||
}
|
}
|
||||||
|
|
||||||
//manga_genres_tags.setOnTagClickListener { tag -> performGlobalSearch(tag) }
|
//manga_genres_tags.setOnTagClickListener { tag -> performGlobalSearch(tag) }
|
||||||
|
|
||||||
manga_cover.longClicks().subscribeUntilDestroy {
|
manga_cover.longClicks().subscribeUntilDestroy {
|
||||||
copyToClipboard(view.context.getString(R.string.title), presenter.manga.title)
|
copyToClipboard(view.context.getString(R.string.title), presenter.manga.title, R.string.manga_info_full_title_label)
|
||||||
}
|
}
|
||||||
container = (view as ViewGroup).findViewById(R.id.manga_info_layout) as? View
|
container = (view as ViewGroup).findViewById(R.id.manga_info_layout) as? View
|
||||||
val bottomM = manga_genres_tags.marginBottom
|
val bottomM = manga_genres_tags.marginBottom
|
||||||
|
@ -569,7 +573,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
* @param label Label to show to the user describing the content
|
* @param label Label to show to the user describing the content
|
||||||
* @param content the actual text to copy to the board
|
* @param content the actual text to copy to the board
|
||||||
*/
|
*/
|
||||||
private fun copyToClipboard(label: String, content: String) {
|
private fun copyToClipboard(label: String, content: String, resId: Int) {
|
||||||
if (content.isBlank()) return
|
if (content.isBlank()) return
|
||||||
|
|
||||||
val activity = activity ?: return
|
val activity = activity ?: return
|
||||||
|
@ -578,8 +582,8 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
|
||||||
val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
val clipboard = activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||||
clipboard.setPrimaryClip(ClipData.newPlainText(label, content))
|
clipboard.setPrimaryClip(ClipData.newPlainText(label, content))
|
||||||
|
|
||||||
activity.toast(view.context.getString(R.string.copied_to_clipboard, content.truncateCenter(20)),
|
snack = container?.snack(view.context.getString(R.string.copied_to_clipboard, view.context
|
||||||
Toast.LENGTH_SHORT)
|
.getString(resId)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,10 +55,10 @@ Unit)? = null): Snackbar {
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
snack.f()
|
snack.f()
|
||||||
}
|
}
|
||||||
snack.view.doOnApplyWindowInsets { v, insets, padding ->
|
if (Build.VERSION.SDK_INT < 23) {
|
||||||
//v.setPadding(padding.left, 0, padding.right, 0)
|
val view = if (this !is CoordinatorLayout) this else snack.view
|
||||||
v.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
view.doOnApplyWindowInsets { _, insets, _ ->
|
||||||
if (Build.VERSION.SDK_INT < 23) {
|
snack.view.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
bottomMargin = 12 + insets.systemWindowInsetBottom
|
bottomMargin = 12 + insets.systemWindowInsetBottom
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<item name="icon_color">@color/iconColorLight</item>
|
<item name="icon_color">@color/iconColorLight</item>
|
||||||
|
|
||||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||||
<item name="android:navigationBarColor">@color/colorPrimary</item>
|
<item name="android:navigationBarColor">#B3000000</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Theme.Tachiyomi" parent="Theme.Base"/>
|
<style name="Theme.Tachiyomi" parent="Theme.Base"/>
|
||||||
|
|
Reference in a new issue