0
0
Fork 0
mirror of https://github.com/YTVanced/VancedManager synced 2024-11-26 21:13:01 +00:00

fixed uninstall button

This commit is contained in:
X1nto 2020-05-10 18:44:33 +04:00
parent 87b563b891
commit f4e7ac4f25
3 changed files with 64 additions and 40 deletions

View file

@ -66,7 +66,7 @@ open class Home : BaseFragment() {
} }
if (vancedStatus!!) { if (vancedStatus!!) {
microguninstallbtn.setOnClickListener { vanceduninstallbtn.setOnClickListener {
val uri = Uri.parse("package:com.vanced.android.youtube") val uri = Uri.parse("package:com.vanced.android.youtube")
val vanUninstall = Intent(Intent.ACTION_DELETE, uri) val vanUninstall = Intent(Intent.ACTION_DELETE, uri)
startActivity(vanUninstall) startActivity(vanUninstall)

View file

@ -8,6 +8,7 @@ import android.net.NetworkCapabilities
import android.net.NetworkRequest import android.net.NetworkRequest
import android.os.Bundle import android.os.Bundle
import android.view.* import android.view.*
import android.widget.LinearLayout
import androidx.core.animation.addListener import androidx.core.animation.addListener
import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.card.MaterialCardView import com.google.android.material.card.MaterialCardView
@ -65,18 +66,25 @@ class HomeFragment : Home() {
activity?.runOnUiThread { activity?.runOnUiThread {
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper) val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
val oa1 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", -1f, 0.3f) val mainLayout = view?.findViewById<LinearLayout>(R.id.home_main_wrapper)
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, 0f) val oa0 = ObjectAnimator.ofFloat(mainLayout, "yFraction", 0f, 0.3f)
val oa1 = ObjectAnimator.ofFloat(mainLayout, "yFraction", 0.3f, 0f)
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", -1f, 0.3f)
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, 0f)
oa1.apply { oa2.apply {
oa1.addListener(onStart = { oa2.addListener(onStart = {
networkErrorLayout?.visibility = View.VISIBLE networkErrorLayout?.visibility = View.VISIBLE
oa0.start()
} }
) )
oa2.addListener(onEnd = {
oa1.start()
})
start() start()
} }
oa2.start() oa3.start()
} }
@ -88,12 +96,20 @@ class HomeFragment : Home() {
activity?.runOnUiThread { activity?.runOnUiThread {
val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper) val networkErrorLayout = view?.findViewById<MaterialCardView>(R.id.home_network_wrapper)
val oa1 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f) val mainLayout = view?.findViewById<LinearLayout>(R.id.home_main_wrapper)
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f) val oa0 = ObjectAnimator.ofFloat(mainLayout, "yFraction", 0f, 0.3f)
val oa1 = ObjectAnimator.ofFloat(mainLayout, "yFraction", 0.3f, 0f)
val oa2 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0f, 0.3f)
val oa3 = ObjectAnimator.ofFloat(networkErrorLayout, "yFraction", 0.3f, -1f)
oa1.start() oa2.start()
oa2.apply { oa3.apply {
oa2.addListener(onEnd = { oa3.addListener(onStart = {
oa0.start()
})
oa3.addListener(onEnd = {
oa1.start()
networkErrorLayout?.visibility = View.GONE networkErrorLayout?.visibility = View.GONE
} }
) )

View file

@ -26,42 +26,50 @@
android:visibility="gone" android:visibility="gone"
tools:visibility="visible"/> tools:visibility="visible"/>
<include <LinearLayout
android:id="@+id/home_vanced_wrapper" android:id="@+id/home_main_wrapper"
layout="@layout/include_vanced"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginStart="@dimen/stdp" android:orientation="vertical">
android:layout_marginEnd="@dimen/stdp" />
<include <include
android:id="@+id/home_microg_wrapper" android:id="@+id/home_vanced_wrapper"
layout="@layout/include_microg" layout="@layout/include_vanced"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/stdp" android:layout_marginStart="@dimen/stdp"
android:layout_marginTop="@dimen/stdp" android:layout_marginEnd="@dimen/stdp" />
android:layout_marginEnd="@dimen/stdp" />
<include <include
android:id="@+id/home_changelog_wrapper" android:id="@+id/home_microg_wrapper"
layout="@layout/include_changelogs" layout="@layout/include_microg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/stdp" android:layout_marginStart="@dimen/stdp"
android:layout_marginTop="@dimen/stdp" android:layout_marginTop="@dimen/stdp"
android:layout_marginEnd="@dimen/stdp" /> android:layout_marginEnd="@dimen/stdp" />
<include
android:id="@+id/home_changelog_wrapper"
layout="@layout/include_changelogs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/stdp"
android:layout_marginTop="@dimen/stdp"
android:layout_marginEnd="@dimen/stdp" />
<include <include
android:id="@+id/home_useful_links_wrapper" android:id="@+id/home_useful_links_wrapper"
layout="@layout/include_useful_links" layout="@layout/include_useful_links"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/stdp" android:layout_marginStart="@dimen/stdp"
android:layout_marginTop="@dimen/stdp" android:layout_marginTop="@dimen/stdp"
android:layout_marginEnd="@dimen/stdp" /> android:layout_marginEnd="@dimen/stdp" />
</LinearLayout>
</LinearLayout> </LinearLayout>