Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce008f5576 | ||
|
|
25f7e8b35c | ||
|
|
109398d955 | ||
|
|
4a8551087b | ||
|
|
34febe3545 |
No files matched your search
+1
-1
@@ -33,7 +33,7 @@ android {
|
||||
minSdkVersion 28
|
||||
targetSdkVersion 33
|
||||
versionCode 180030
|
||||
versionName "1.8.5.3-alpha01"
|
||||
versionName "1.8.5.3-alpha02"
|
||||
resConfigs 'zh', 'zh-rCN', 'zh-rHK', 'zh-rTW', 'es', 'ja', 'ko', 'fr', 'de', 'th'
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
*/
|
||||
package com.hippo.ehviewer.client.data
|
||||
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize // This is wrong Parcelize usage, TODO: use delegate and move galleryinfo to primary constructor
|
||||
// This is wrong Parcelize usage, TODO: use delegate and move galleryinfo to primary constructor
|
||||
class GalleryDetail(
|
||||
@JvmField
|
||||
var apiUid: Long = -1L,
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.hippo.ehviewer.UrlOpener
|
||||
import com.hippo.ehviewer.client.EhUrl
|
||||
import com.hippo.ehviewer.client.EhUtils
|
||||
import com.hippo.ehviewer.client.data.GalleryDetail
|
||||
import com.hippo.util.tellClipboard
|
||||
import com.hippo.util.tellClipboardWithToast
|
||||
|
||||
class GalleryInfoBottomSheet(detail: GalleryDetail) : BottomSheetDialogFragment() {
|
||||
private var mKeys: ArrayList<String> = arrayListOf()
|
||||
@@ -117,7 +117,7 @@ class GalleryInfoBottomSheet(detail: GalleryDetail) : BottomSheetDialogFragment(
|
||||
if (position == INDEX_PARENT) {
|
||||
UrlOpener.openUrl(context, mValues[position], true)
|
||||
} else {
|
||||
requireActivity() tellClipboard mValues[position]
|
||||
requireActivity() tellClipboardWithToast mValues[position]
|
||||
if (position == INDEX_URL) {
|
||||
// Save it to avoid detect the gallery
|
||||
Settings.putClipboardTextHashCode(mValues[position].hashCode())
|
||||
|
||||
@@ -516,15 +516,17 @@ class MainActivity : StageActivity(), NavigationView.OnNavigationItemSelectedLis
|
||||
}
|
||||
}
|
||||
|
||||
fun showTip(@StringRes id: Int, length: Int) {
|
||||
showTip(getString(id), length)
|
||||
@JvmOverloads
|
||||
fun showTip(@StringRes id: Int, length: Int, useToast: Boolean = false) {
|
||||
showTip(getString(id), length, useToast)
|
||||
}
|
||||
|
||||
/**
|
||||
* If activity is running, show snack bar, otherwise show toast
|
||||
*/
|
||||
fun showTip(message: CharSequence, length: Int) {
|
||||
findViewById<View>(R.id.snackbar)?.apply {
|
||||
@JvmOverloads
|
||||
fun showTip(message: CharSequence, length: Int, useToast: Boolean = false) {
|
||||
findViewById<View>(R.id.snackbar)?.takeUnless { useToast }?.apply {
|
||||
Snackbar.make(
|
||||
this, message,
|
||||
if (length == BaseScene.LENGTH_LONG) Snackbar.LENGTH_LONG else Snackbar.LENGTH_SHORT
|
||||
|
||||
@@ -1155,7 +1155,9 @@ public class DownloadsScene extends BaseToolbarScene
|
||||
return;
|
||||
}
|
||||
DownloadInfo info = mList.get(position);
|
||||
holder.thumb.load(EhCacheKeyFactory.getThumbKey(info.gid), info.thumb);
|
||||
if (info.thumb != null) {
|
||||
holder.thumb.load(EhCacheKeyFactory.getThumbKey(info.gid), info.thumb);
|
||||
}
|
||||
holder.title.setText(EhUtils.getSuitableTitle(info));
|
||||
holder.uploader.setText(info.uploader);
|
||||
holder.rating.setRating(info.rating);
|
||||
|
||||
@@ -403,7 +403,7 @@ class HistoryScene : BaseToolbarScene() {
|
||||
override fun onBindViewHolder(holder: HistoryHolder, position: Int) {
|
||||
val gi: GalleryInfo? = getItem(position)
|
||||
gi ?: return
|
||||
holder.thumb.load(EhCacheKeyFactory.getThumbKey(gi.gid), gi.thumb!!)
|
||||
gi.thumb?.let { holder.thumb.load(EhCacheKeyFactory.getThumbKey(gi.gid), it) }
|
||||
holder.title.text = EhUtils.getSuitableTitle(gi)
|
||||
holder.uploader.text = gi.uploader
|
||||
holder.rating.rating = gi.rating
|
||||
|
||||
@@ -38,7 +38,12 @@ infix fun Context.tellClipboard(text: String?) {
|
||||
addTextToClipboard(text, false)
|
||||
}
|
||||
|
||||
fun Context.addTextToClipboard(text: String?, isSensitive: Boolean) {
|
||||
infix fun Context.tellClipboardWithToast(text: String?) {
|
||||
addTextToClipboard(text, false, true)
|
||||
}
|
||||
|
||||
@JvmOverloads
|
||||
fun Context.addTextToClipboard(text: String?, isSensitive: Boolean, useToast: Boolean = false) {
|
||||
getClipboardManager().apply {
|
||||
setPrimaryClip(ClipData.newPlainText(null, text).apply {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU && isSensitive)
|
||||
@@ -50,7 +55,7 @@ fun Context.addTextToClipboard(text: String?, isSensitive: Boolean) {
|
||||
// Avoid double notify user since system have done that on Tiramisu above
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU)
|
||||
if (this is MainActivity) {
|
||||
showTip(R.string.copied_to_clipboard, BaseScene.LENGTH_SHORT)
|
||||
showTip(R.string.copied_to_clipboard, BaseScene.LENGTH_SHORT, useToast)
|
||||
} else if (this is SettingsActivity) {
|
||||
showTip(R.string.copied_to_clipboard, BaseScene.LENGTH_SHORT)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user