Followed hashtags view improvements (#4475)
Add click and longpress handler to the followed hashtags view #4459
This commit is contained in:
parent
b2d4092124
commit
f14a82325d
10 changed files with 58 additions and 42 deletions
|
|
@ -3,8 +3,12 @@
|
|||
package com.keylesspalace.tusky.util
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
import androidx.activity.ComponentActivity
|
||||
import androidx.annotation.AnimRes
|
||||
import androidx.lifecycle.Lifecycle
|
||||
|
|
@ -47,6 +51,14 @@ fun ComponentActivity.overrideActivityTransitionCompat(
|
|||
}
|
||||
}
|
||||
|
||||
fun Activity.copyToClipboard(text: CharSequence, popupText: CharSequence, clipboardLabel: CharSequence = "") {
|
||||
val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
|
||||
clipboard.setPrimaryClip(ClipData.newPlainText(clipboardLabel, text))
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.S_V2) {
|
||||
Toast.makeText(this, popupText, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
object ActivityConstants {
|
||||
const val OVERRIDE_TRANSITION_OPEN = 0
|
||||
const val OVERRIDE_TRANSITION_CLOSE = 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue