mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-14 06:10:31 +05:30
arrows animation
This commit is contained in:
parent
4e37e5b29a
commit
6f4101ba57
@ -19,6 +19,9 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.animation.Animation
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
|
import android.view.animation.RotateAnimation
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.constraintlayout.motion.widget.MotionLayout
|
import androidx.constraintlayout.motion.widget.MotionLayout
|
||||||
@ -203,8 +206,27 @@ class PlayerFragment : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
view.findViewById<RelativeLayout>(R.id.player_title_layout).setOnClickListener {
|
view.findViewById<RelativeLayout>(R.id.player_title_layout).setOnClickListener {
|
||||||
playerDescription.visibility =
|
if (playerDescription.isVisible){
|
||||||
if (playerDescription.isVisible) View.GONE else View.VISIBLE
|
val image = view.findViewById<ImageView>(R.id.player_description_arrow)
|
||||||
|
image.clearAnimation()
|
||||||
|
playerDescription.visibility = View.GONE
|
||||||
|
} else {
|
||||||
|
//toggle button
|
||||||
|
val rotate = RotateAnimation(
|
||||||
|
0F,
|
||||||
|
180F,
|
||||||
|
Animation.RELATIVE_TO_SELF,
|
||||||
|
0.5f,
|
||||||
|
Animation.RELATIVE_TO_SELF,
|
||||||
|
0.5f
|
||||||
|
)
|
||||||
|
rotate.duration = 100
|
||||||
|
rotate.interpolator = LinearInterpolator()
|
||||||
|
rotate.fillAfter = true
|
||||||
|
val image = view.findViewById<ImageView>(R.id.player_description_arrow)
|
||||||
|
image.startAnimation(rotate)
|
||||||
|
playerDescription.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view.findViewById<com.google.android.material.card.MaterialCardView>(R.id.comments_toggle).setOnClickListener {
|
view.findViewById<com.google.android.material.card.MaterialCardView>(R.id.comments_toggle).setOnClickListener {
|
||||||
|
@ -6,6 +6,9 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.animation.Animation
|
||||||
|
import android.view.animation.LinearInterpolator
|
||||||
|
import android.view.animation.RotateAnimation
|
||||||
import android.widget.*
|
import android.widget.*
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
@ -16,9 +19,9 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||||
import com.github.libretube.adapters.SubscriptionAdapter
|
import com.github.libretube.adapters.SubscriptionAdapter
|
||||||
import com.github.libretube.adapters.SubscriptionChannelAdapter
|
import com.github.libretube.adapters.SubscriptionChannelAdapter
|
||||||
import java.io.IOException
|
|
||||||
import org.chromium.base.ThreadUtils.runOnUiThread
|
|
||||||
import retrofit2.HttpException
|
import retrofit2.HttpException
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
|
||||||
class Subscriptions : Fragment() {
|
class Subscriptions : Fragment() {
|
||||||
val TAG = "SubFragment"
|
val TAG = "SubFragment"
|
||||||
@ -78,9 +81,29 @@ class Subscriptions : Fragment() {
|
|||||||
}
|
}
|
||||||
channelRecView.visibility = View.VISIBLE
|
channelRecView.visibility = View.VISIBLE
|
||||||
feedRecView.visibility = View.GONE
|
feedRecView.visibility = View.GONE
|
||||||
|
|
||||||
|
//toggle button
|
||||||
|
val rotate = RotateAnimation(
|
||||||
|
0F,
|
||||||
|
180F,
|
||||||
|
Animation.RELATIVE_TO_SELF,
|
||||||
|
0.5f,
|
||||||
|
Animation.RELATIVE_TO_SELF,
|
||||||
|
0.5f
|
||||||
|
)
|
||||||
|
rotate.duration = 100
|
||||||
|
rotate.interpolator = LinearInterpolator()
|
||||||
|
rotate.fillAfter = true
|
||||||
|
val image = view.findViewById<ImageView>(R.id.toggle)
|
||||||
|
image.startAnimation(rotate)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
channelRecView.visibility = View.GONE
|
channelRecView.visibility = View.GONE
|
||||||
feedRecView.visibility = View.VISIBLE
|
feedRecView.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
//toggle button
|
||||||
|
val image = view.findViewById<ImageView>(R.id.toggle)
|
||||||
|
image.clearAnimation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true"
|
||||||
android:layout_marginEnd="10dp"
|
android:layout_marginStart="8dp"
|
||||||
android:paddingLeft="16dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:src="@drawable/ic_arrow_down" />
|
android:src="@drawable/ic_arrow_down" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@ -147,8 +147,8 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="@string/download" />
|
android:text="@string/download"
|
||||||
>
|
android:maxLines="1"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
android:id="@+id/toggle"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
Loading…
Reference in New Issue
Block a user