Merge pull request #829 from Bnyro/master

minor fixes
This commit is contained in:
Bnyro 2022-07-20 13:50:33 +02:00 committed by GitHub
commit 97e3cfd283
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 12 deletions

View File

@ -404,10 +404,10 @@ class PlayerFragment : Fragment() {
// show the advanced player options // show the advanced player options
playerBinding.toggleOptions.setOnClickListener { playerBinding.toggleOptions.setOnClickListener {
if (playerBinding.advancedOptions.isVisible) { if (playerBinding.advancedOptions.isVisible) {
playerBinding.toggleOptions.animate().rotationX(0F).setDuration(200).start() playerBinding.toggleOptions.animate().rotation(0F).setDuration(250).start()
playerBinding.advancedOptions.visibility = View.GONE playerBinding.advancedOptions.visibility = View.GONE
} else { } else {
playerBinding.toggleOptions.animate().rotationX(180F).setDuration(200).start() playerBinding.toggleOptions.animate().rotation(180F).setDuration(250).start()
playerBinding.advancedOptions.visibility = View.VISIBLE playerBinding.advancedOptions.visibility = View.VISIBLE
} }
} }
@ -613,9 +613,15 @@ class PlayerFragment : Fragment() {
} }
private fun toggleDescription() { private fun toggleDescription() {
binding.playerDescriptionArrow.animate().rotationBy(180F).setDuration(250).start() if (binding.descLinLayout.isVisible) {
binding.descLinLayout.visibility = // hide the description and chapters
if (binding.descLinLayout.isVisible) View.GONE else View.VISIBLE binding.playerDescriptionArrow.animate().rotation(0F).setDuration(250).start()
binding.descLinLayout.visibility = View.GONE
} else {
// show the description and chapters
binding.playerDescriptionArrow.animate().rotation(180F).setDuration(250).start()
binding.descLinLayout.visibility = View.VISIBLE
}
} }
private fun toggleComments() { private fun toggleComments() {

View File

@ -102,14 +102,16 @@ object ThemeHelper {
val nManager = context val nManager = context
.getSystemService(AppCompatActivity.NOTIFICATION_SERVICE) as NotificationManager .getSystemService(AppCompatActivity.NOTIFICATION_SERVICE) as NotificationManager
nManager.cancelAll() nManager.cancelAll()
// restart to MainActivity // start a new Intent of the app
val pm: PackageManager = context.packageManager val pm: PackageManager = context.packageManager
val intent = pm.getLaunchIntentForPackage(context.packageName) val intent = pm.getLaunchIntentForPackage(context.packageName)
intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
context.startActivity(intent) context.startActivity(intent)
// kill the old application
android.os.Process.killProcess(android.os.Process.myPid())
} }
fun getThemeColor(context: Context, colorCode: Int): Int { private fun getThemeColor(context: Context, colorCode: Int): Int {
val value = TypedValue() val value = TypedValue()
context.theme.resolveAttribute(colorCode, value, true) context.theme.resolveAttribute(colorCode, value, true)
return value.data return value.data

View File

@ -19,7 +19,7 @@ internal class CustomExoPlayerView(
init { init {
setControllerVisibilityListener { setControllerVisibilityListener {
// hide the advanced options // hide the advanced options
binding.toggleOptions.animate().rotationX(0F).setDuration(0).start() binding.toggleOptions.animate().rotation(0F).setDuration(250).start()
binding.advancedOptions.visibility = View.GONE binding.advancedOptions.visibility = View.GONE
} }
} }

View File

@ -62,10 +62,10 @@
style="@style/Widget.Material3.CardView.Elevated" style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="8dp"
android:layout_marginTop="16dp" android:layout_marginTop="5dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="12dp"
android:visibility="gone" android:visibility="gone"
app:cardCornerRadius="18dp" app:cardCornerRadius="18dp"
app:cardElevation="20dp"> app:cardElevation="20dp">