Added system version to the details section for safetynet checks
This commit is contained in:
parent
f6061ba00e
commit
82eeefb544
@ -1,19 +1,10 @@
|
||||
package com.topjohnwu.magisk.redesign.safetynet
|
||||
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import android.view.ViewAnimationUtils
|
||||
import androidx.core.animation.doOnEnd
|
||||
import androidx.core.view.isInvisible
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.databinding.BindingAdapter
|
||||
import androidx.interpolator.view.animation.FastOutSlowInInterpolator
|
||||
import com.topjohnwu.magisk.R
|
||||
import com.topjohnwu.magisk.databinding.FragmentSafetynetMd2Binding
|
||||
import com.topjohnwu.magisk.redesign.compat.CompatFragment
|
||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||
import kotlin.math.hypot
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class SafetynetFragment : CompatFragment<SafetynetViewModel, FragmentSafetynetMd2Binding>() {
|
||||
|
||||
@ -22,37 +13,8 @@ class SafetynetFragment : CompatFragment<SafetynetViewModel, FragmentSafetynetMd
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
Build.VERSION.RELEASE
|
||||
activity.setTitle(R.string.safetyNet)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@BindingAdapter("revealSafetyNet")
|
||||
fun View.revealOnCenter(expand: Boolean) {
|
||||
val anim = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
isInvisible = expand
|
||||
return
|
||||
} else {
|
||||
val x = measuredWidth.toDouble()
|
||||
val y = measuredHeight.toDouble()
|
||||
val maxRadius = hypot(x, y).toFloat()
|
||||
val start = if (expand) 0f else maxRadius
|
||||
val end = if (expand) maxRadius else 0f
|
||||
|
||||
ViewAnimationUtils.createCircularReveal(
|
||||
this,
|
||||
(x / 2).roundToInt(),
|
||||
(y / 2).roundToInt(),
|
||||
start,
|
||||
end
|
||||
).apply {
|
||||
interpolator = FastOutSlowInInterpolator()
|
||||
doOnEnd { if (!expand) isVisible = false }
|
||||
}
|
||||
}
|
||||
|
||||
post {
|
||||
isVisible = true
|
||||
anim.start()
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
|
||||
<data>
|
||||
|
||||
<import type="android.os.Build" />
|
||||
<import type="com.topjohnwu.magisk.Info" />
|
||||
|
||||
<import type="com.topjohnwu.magisk.BuildConfig" />
|
||||
@ -92,7 +93,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/manager"
|
||||
android:textAppearance="?appearanceTextCaptionVariant"
|
||||
app:layout_constraintBottom_toTopOf="@+id/safetynet_attestation"
|
||||
app:layout_constraintBottom_toTopOf="@+id/safetynet_android_title"
|
||||
app:layout_constraintEnd_toStartOf="@+id/safetynet_manager_version"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@ -113,6 +114,33 @@
|
||||
app:layout_constraintTop_toTopOf="@+id/safetynet_manager_title"
|
||||
tools:text="10.0.0" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/safetynet_android_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/system"
|
||||
android:textAppearance="?appearanceTextCaptionVariant"
|
||||
app:layout_constraintBottom_toTopOf="@+id/safetynet_attestation"
|
||||
app:layout_constraintEnd_toStartOf="@+id/safetynet_android_version"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/safetynet_manager_title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/safetynet_android_version"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l_50"
|
||||
android:text="@{Build.VERSION.RELEASE}"
|
||||
android:textAppearance="?appearanceTextCaptionNormal"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/safetynet_android_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toEndOf="@+id/safetynet_android_title"
|
||||
app:layout_constraintTop_toTopOf="@+id/safetynet_android_title"
|
||||
tools:text="10" />
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/safetynet_attestation"
|
||||
style="?styleCardElevated"
|
||||
@ -126,7 +154,7 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/safetynet_manager_title"
|
||||
app:layout_constraintTop_toBottomOf="@+id/safetynet_android_title"
|
||||
app:layout_constraintWidth_max="300dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
<string name="manager">Manager</string>
|
||||
<string name="magisk">Magisk</string>
|
||||
<string name="system">System</string>
|
||||
|
||||
<string name="no_connection">No connection available</string>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user