Implement share action

This commit is contained in:
Suphon Thanakornpakapong
2022-05-10 15:47:08 +07:00
parent 9a455966d4
commit fd595b9c25
2 changed files with 12 additions and 2 deletions
@@ -32,10 +32,11 @@ class LawnchairOverviewActionsView @JvmOverloads constructor(
container = ViewCompat.requireViewById(this, R.id.action_buttons)
clearAllAction = ViewCompat.requireViewById(this, R.id.action_clear_all)
shareAction = ViewCompat.requireViewById(this, R.id.action_share)
lensAction = ViewCompat.requireViewById(this, R.id.action_lens)
screenshotAction = ViewCompat.requireViewById(this, R.id.action_screenshot)
shareAction = ViewCompat.requireViewById(this, R.id.action_share)
shareAction.setOnClickListener { mCallbacks?.onShare() }
lensAction.setOnClickListener { mCallbacks?.onLens() }
prefs.recentsActionClearAll.subscribeChanges(this, ::updateVisibilities)
@@ -44,6 +44,14 @@ class TaskOverlayFactoryImpl(@Suppress("UNUSED_PARAMETER") context: Context) : T
task
), OverlayUICallbacks {
override fun onShare() {
if (mIsAllowedByPolicy) {
endLiveTileMode { mImageApi.startShareActivity(null) }
} else {
showBlockedByPolicyMessage()
}
}
override fun onLens() {
if (mIsAllowedByPolicy) {
endLiveTileMode { mImageApi.startLensActivity() }
@@ -55,6 +63,7 @@ class TaskOverlayFactoryImpl(@Suppress("UNUSED_PARAMETER") context: Context) : T
}
interface OverlayUICallbacks : TaskOverlayFactory.OverlayUICallbacks {
fun onShare()
fun onLens()
}
}