Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
82eeefb5
Commit
82eeefb5
authored
Oct 24, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added system version to the details section for safetynet checks
parent
f6061ba0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
41 deletions
+32
-41
SafetynetFragment.kt
.../topjohnwu/magisk/redesign/safetynet/SafetynetFragment.kt
+1
-39
fragment_safetynet_md2.xml
app/src/main/res/layout/fragment_safetynet_md2.xml
+30
-2
strings_md2.xml
app/src/main/res/values/strings_md2.xml
+1
-0
No files found.
app/src/main/java/com/topjohnwu/magisk/redesign/safetynet/SafetynetFragment.kt
View file @
82eeefb5
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
)
}
}
\ No newline at end of file
@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
()
}
}
\ No newline at end of file
app/src/main/res/layout/fragment_safetynet_md2.xml
View file @
82eeefb5
...
...
@@ -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_a
ttestation
"
app:layout_constraintBottom_toTopOf=
"@+id/safetynet_a
ndroid_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
...
...
app/src/main/res/values/strings_md2.xml
View file @
82eeefb5
...
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment