mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 14:20:30 +05:30
Merge pull request #5719 from Isira-Seneviratne/TooltipCompat
feature: Display tooltips on Android versions below 8.0
This commit is contained in:
commit
85d9cb3a46
@ -1,15 +0,0 @@
|
|||||||
package com.github.libretube.ui.extensions
|
|
||||||
|
|
||||||
import android.os.Build
|
|
||||||
import android.widget.ImageView
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attempts to set the tooltip for the ImageView.
|
|
||||||
* If the OS does not support tooltips, this function will have no effect.
|
|
||||||
* @param tooltip The tooltip of the image
|
|
||||||
*/
|
|
||||||
fun ImageView.trySetTooltip(tooltip: String) {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
||||||
tooltipText = tooltip
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,6 +17,7 @@ import android.view.Window
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import androidx.appcompat.widget.TooltipCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.os.postDelayed
|
import androidx.core.os.postDelayed
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
@ -52,7 +53,6 @@ import com.github.libretube.helpers.WindowHelper
|
|||||||
import com.github.libretube.obj.BottomSheetItem
|
import com.github.libretube.obj.BottomSheetItem
|
||||||
import com.github.libretube.ui.base.BaseActivity
|
import com.github.libretube.ui.base.BaseActivity
|
||||||
import com.github.libretube.ui.extensions.toggleSystemBars
|
import com.github.libretube.ui.extensions.toggleSystemBars
|
||||||
import com.github.libretube.ui.extensions.trySetTooltip
|
|
||||||
import com.github.libretube.ui.fragments.PlayerFragment
|
import com.github.libretube.ui.fragments.PlayerFragment
|
||||||
import com.github.libretube.ui.interfaces.PlayerGestureOptions
|
import com.github.libretube.ui.interfaces.PlayerGestureOptions
|
||||||
import com.github.libretube.ui.interfaces.PlayerOptions
|
import com.github.libretube.ui.interfaces.PlayerOptions
|
||||||
@ -141,7 +141,7 @@ open class CustomExoPlayerView(
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.lockPlayer.setImageResource(icon)
|
binding.lockPlayer.setImageResource(icon)
|
||||||
binding.lockPlayer.trySetTooltip(context.getString(tooltip))
|
TooltipCompat.setTooltipText(binding.lockPlayer, context.getString(tooltip))
|
||||||
|
|
||||||
// show/hide all the controls
|
// show/hide all the controls
|
||||||
lockPlayer(isPlayerLocked)
|
lockPlayer(isPlayerLocked)
|
||||||
|
Loading…
Reference in New Issue
Block a user