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
e69b99f0
Commit
e69b99f0
authored
May 19, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update status UI
parent
55b8079e
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
99 additions
and
123 deletions
+99
-123
build.gradle
app/build.gradle
+1
-1
proguard-rules.pro
app/proguard-rules.pro
+0
-5
InstallFragment.java
app/src/main/java/com/topjohnwu/magisk/InstallFragment.java
+0
-1
MagiskManager.java
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
+0
-1
SplashActivity.java
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
+0
-1
StatusFragment.java
app/src/main/java/com/topjohnwu/magisk/StatusFragment.java
+39
-50
ProcessMagiskZip.java
...in/java/com/topjohnwu/magisk/asyncs/ProcessMagiskZip.java
+0
-5
zipadjust.c
app/src/main/jni/zipadjust.c
+0
-1
fragment_status.xml
app/src/main/res/layout/fragment_status.xml
+58
-57
build.gradle
build.gradle
+1
-1
No files found.
app/build.gradle
View file @
e69b99f0
...
...
@@ -20,6 +20,7 @@ android {
buildTypes
{
release
{
minifyEnabled
true
shrinkResources
true
proguardFiles
getDefaultProguardFile
(
'proguard-android.txt'
),
'proguard-rules.pro'
}
}
...
...
@@ -51,7 +52,6 @@ repositories {
dependencies
{
compile
fileTree
(
include:
[
'*.jar'
],
dir:
'libs'
)
compile
'com.android.support:recyclerview-v7:25.3.1'
compile
'com.android.support:cardview-v7:25.3.1'
compile
'com.android.support:design:25.3.1'
...
...
app/proguard-rules.pro
View file @
e69b99f0
...
...
@@ -16,11 +16,6 @@
# public *;
#}
-
keep
class
android
.
support
.
v7
.
internal
.
**
{
*
;
}
-
keep
interface
android
.
support
.
v7
.
internal
.
**
{
*
;
}
-
keep
class
android
.
support
.
v7
.
**
{
*
;
}
-
keep
interface
android
.
support
.
v7
.
**
{
*
;
}
# SpongyCastle
-
keep
class
org
.
spongycastle
.
**
{
*
;
}
-
dontwarn
javax
.
naming
.
**
...
...
app/src/main/java/com/topjohnwu/magisk/InstallFragment.java
View file @
e69b99f0
...
...
@@ -32,7 +32,6 @@ import java.io.IOException;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Locale
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
...
...
app/src/main/java/com/topjohnwu/magisk/MagiskManager.java
View file @
e69b99f0
...
...
@@ -13,7 +13,6 @@ import com.topjohnwu.magisk.module.Module;
import
com.topjohnwu.magisk.module.Repo
;
import
com.topjohnwu.magisk.superuser.Policy
;
import
com.topjohnwu.magisk.utils.CallbackEvent
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.ValueSortedMap
;
...
...
app/src/main/java/com/topjohnwu/magisk/SplashActivity.java
View file @
e69b99f0
...
...
@@ -12,7 +12,6 @@ import com.topjohnwu.magisk.asyncs.GetBootBlocks;
import
com.topjohnwu.magisk.asyncs.LoadApps
;
import
com.topjohnwu.magisk.asyncs.LoadModules
;
import
com.topjohnwu.magisk.asyncs.LoadRepos
;
import
com.topjohnwu.magisk.asyncs.MagiskHide
;
import
com.topjohnwu.magisk.components.Activity
;
import
com.topjohnwu.magisk.services.UpdateCheckService
;
...
...
app/src/main/java/com/topjohnwu/magisk/StatusFragment.java
View file @
e69b99f0
...
...
@@ -31,16 +31,15 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
private
Unbinder
unbinder
;
@BindView
(
R
.
id
.
swipeRefreshLayout
)
SwipeRefreshLayout
mSwipeRefreshLayout
;
@BindView
(
R
.
id
.
magisk_status_container
)
View
magiskStatusContainer
;
@BindView
(
R
.
id
.
magisk_status_icon
)
ImageView
magiskStatusIcon
;
@BindView
(
R
.
id
.
magisk_version
)
TextView
magiskVersionText
;
@BindView
(
R
.
id
.
magisk_update_icon
)
ImageView
magiskUpdateIcon
;
@BindView
(
R
.
id
.
magisk_update_status
)
TextView
magiskUpdateText
;
@BindView
(
R
.
id
.
magisk_check_updates_progress
)
ProgressBar
magiskCheckUpdatesProgress
;
@BindView
(
R
.
id
.
root_status_container
)
View
rootStatusContainer
;
@BindView
(
R
.
id
.
magisk_status_icon
)
ImageView
magiskStatusIcon
;
@BindView
(
R
.
id
.
magisk_version
)
TextView
magiskVersionText
;
@BindView
(
R
.
id
.
root_status_icon
)
ImageView
rootStatusIcon
;
@BindView
(
R
.
id
.
root_status
)
TextView
rootStatusText
;
@BindView
(
R
.
id
.
root_info
)
TextView
rootInfoText
;
@BindView
(
R
.
id
.
safetyNet_container
)
View
safetyNetContainer
;
@BindView
(
R
.
id
.
safetyNet_icon
)
ImageView
safetyNetIcon
;
...
...
@@ -60,32 +59,31 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
safetyNetContainer
.
setBackgroundColor
(
trans
);
safetyNetIcon
.
setImageResource
(
0
);
safetyNetStatusText
.
setText
(
R
.
string
.
checking_safetyNet_status
);
Utils
.
checkSafetyNet
(
getApplication
()
);
Utils
.
checkSafetyNet
(
magiskManager
);
}
@OnClick
(
R
.
id
.
magisk_status_container
)
public
void
gotoInstall
()
{
if
(
getApplication
()
.
remoteMagiskVersionCode
>
0
)
{
if
(
magiskManager
.
remoteMagiskVersionCode
>
0
)
{
((
MainActivity
)
getActivity
()).
navigate
(
R
.
id
.
install
);
}
}
private
int
defaultColor
;
private
MagiskManager
magiskManager
;
@Nullable
@Override
public
View
onCreateView
(
LayoutInflater
inflater
,
@Nullable
ViewGroup
container
,
@Nullable
Bundle
savedInstanceState
)
{
View
v
=
inflater
.
inflate
(
R
.
layout
.
fragment_status
,
container
,
false
);
unbinder
=
ButterKnife
.
bind
(
this
,
v
);
magiskManager
=
getApplication
();
defaultColor
=
magiskUpdateText
.
getCurrentTextColor
();
mSwipeRefreshLayout
.
setOnRefreshListener
(()
->
{
magiskStatusContainer
.
setBackgroundColor
(
trans
);
magiskStatusIcon
.
setImageResource
(
0
);
magiskUpdateText
.
setText
(
R
.
string
.
checking_for_updates
);
magiskCheckUpdatesProgress
.
setVisibility
(
View
.
VISIBLE
);
magiskUpdate
Text
.
setTextColor
(
defaultColor
);
magiskUpdate
Icon
.
setVisibility
(
View
.
GONE
);
safetyNetProgress
.
setVisibility
(
View
.
GONE
);
safetyNetContainer
.
setBackgroundColor
(
colorNeutral
);
...
...
@@ -93,14 +91,14 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
safetyNetStatusText
.
setText
(
R
.
string
.
safetyNet_check_text
);
safetyNetStatusText
.
setTextColor
(
defaultColor
);
getApplication
()
.
safetyNetDone
.
isTriggered
=
false
;
magiskManager
.
safetyNetDone
.
isTriggered
=
false
;
noDialog
=
false
;
updateUI
();
new
CheckUpdates
(
getActivity
()).
exec
();
});
if
(
getApplication
()
.
magiskVersionCode
<
0
&&
Shell
.
rootAccess
()
&&
!
noDialog
)
{
if
(
magiskManager
.
magiskVersionCode
<
0
&&
Shell
.
rootAccess
()
&&
!
noDialog
)
{
noDialog
=
true
;
new
AlertDialogBuilder
(
getActivity
())
.
setTitle
(
R
.
string
.
no_magisk_title
)
...
...
@@ -113,9 +111,9 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
updateUI
();
if
(
getApplication
()
.
updateCheckDone
.
isTriggered
)
if
(
magiskManager
.
updateCheckDone
.
isTriggered
)
updateCheckUI
();
if
(
getApplication
()
.
safetyNetDone
.
isTriggered
)
if
(
magiskManager
.
safetyNetDone
.
isTriggered
)
updateSafetyNetUI
();
return
v
;
...
...
@@ -123,10 +121,10 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
@Override
public
void
onTrigger
(
CallbackEvent
<
Void
>
event
)
{
if
(
event
==
getApplication
()
.
updateCheckDone
)
{
if
(
event
==
magiskManager
.
updateCheckDone
)
{
Logger
.
dev
(
"StatusFragment: Update Check UI refresh triggered"
);
updateCheckUI
();
}
else
if
(
event
==
getApplication
()
.
safetyNetDone
)
{
}
else
if
(
event
==
magiskManager
.
safetyNetDone
)
{
Logger
.
dev
(
"StatusFragment: SafetyNet UI refresh triggered"
);
updateSafetyNetUI
();
}
...
...
@@ -135,15 +133,15 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
@Override
public
void
onStart
()
{
super
.
onStart
();
getApplication
()
.
updateCheckDone
.
register
(
this
);
getApplication
()
.
safetyNetDone
.
register
(
this
);
magiskManager
.
updateCheckDone
.
register
(
this
);
magiskManager
.
safetyNetDone
.
register
(
this
);
getActivity
().
setTitle
(
R
.
string
.
status
);
}
@Override
public
void
onStop
()
{
getApplication
()
.
updateCheckDone
.
unRegister
(
this
);
getApplication
()
.
safetyNetDone
.
unRegister
(
this
);
magiskManager
.
updateCheckDone
.
unRegister
(
this
);
magiskManager
.
safetyNetDone
.
unRegister
(
this
);
super
.
onStop
();
}
...
...
@@ -156,29 +154,32 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
private
void
updateUI
()
{
int
image
,
color
;
getApplication
()
.
updateMagiskInfo
();
magiskManager
.
updateMagiskInfo
();
if
(
getApplication
().
magiskVersionCode
<
0
)
{
if
(
magiskManager
.
magiskVersionCode
<
0
)
{
color
=
colorBad
;
image
=
R
.
drawable
.
ic_cancel
;
magiskVersionText
.
setText
(
R
.
string
.
magisk_version_error
);
}
else
if
(
getApplication
().
disabled
)
{
magiskVersionText
.
setText
(
getString
(
R
.
string
.
magisk_version_core_only
,
getApplication
().
magiskVersionString
));
}
else
{
magiskVersionText
.
setText
(
getString
(
R
.
string
.
magisk_version
,
getApplication
().
magiskVersionString
));
color
=
colorOK
;
image
=
R
.
drawable
.
ic_check_circle
;
magiskVersionText
.
setText
(
getString
(
R
.
string
.
current_magisk_title
,
"v"
+
magiskManager
.
magiskVersionString
));
}
magiskStatusIcon
.
setImageResource
(
image
);
magiskStatusIcon
.
setColorFilter
(
color
);
switch
(
Shell
.
rootStatus
)
{
case
0
:
color
=
colorBad
;
image
=
R
.
drawable
.
ic_cancel
;
rootStatusText
.
setText
(
R
.
string
.
not_rooted
);
rootInfoText
.
setText
(
R
.
string
.
root_info_warning
);
break
;
case
1
:
if
(
getApplication
()
.
suVersion
!=
null
)
{
if
(
magiskManager
.
suVersion
!=
null
)
{
color
=
colorOK
;
image
=
R
.
drawable
.
ic_check_circle
;
rootStatusText
.
setText
(
R
.
string
.
proper_root
);
rootInfoText
.
setText
(
getApplication
().
suVersion
);
rootStatusText
.
setText
(
magiskManager
.
suVersion
);
break
;
}
case
-
1
:
...
...
@@ -186,40 +187,28 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
color
=
colorNeutral
;
image
=
R
.
drawable
.
ic_help
;
rootStatusText
.
setText
(
R
.
string
.
root_error
);
rootInfoText
.
setText
(
R
.
string
.
root_info_warning
);
}
rootStatusContainer
.
setBackgroundColor
(
color
);
rootStatusText
.
setTextColor
(
color
);
rootInfoText
.
setTextColor
(
color
);
rootStatusIcon
.
setImageResource
(
image
);
rootStatusIcon
.
setColorFilter
(
color
);
}
private
void
updateCheckUI
()
{
int
image
,
color
;
if
(
getApplication
()
.
remoteMagiskVersionCode
<
0
)
{
if
(
magiskManager
.
remoteMagiskVersionCode
<
0
)
{
color
=
colorNeutral
;
image
=
R
.
drawable
.
ic_help
;
magiskUpdateText
.
setText
(
R
.
string
.
cannot_check_updates
);
}
else
if
(
getApplication
().
remoteMagiskVersionCode
>
getApplication
().
magiskVersionCode
)
{
color
=
colorInfo
;
image
=
R
.
drawable
.
ic_update
;
magiskUpdateText
.
setText
(
getString
(
R
.
string
.
magisk_update_available
,
getApplication
().
remoteMagiskVersionString
));
}
else
{
color
=
colorOK
;
image
=
R
.
drawable
.
ic_check_circle
;
magiskUpdateText
.
setText
(
getString
(
R
.
string
.
up_to_date
,
getString
(
R
.
string
.
magisk
)));
}
if
(
getApplication
().
magiskVersionCode
<
0
)
{
color
=
colorBad
;
image
=
R
.
drawable
.
ic_cancel
;
magiskUpdateText
.
setText
(
getString
(
R
.
string
.
install_magisk_title
,
"v"
+
magiskManager
.
remoteMagiskVersionString
));
}
magiskStatusContainer
.
setBackgroundColor
(
color
);
magiskVersionText
.
setTextColor
(
color
);
magiskUpdateText
.
setTextColor
(
color
);
magiskStatusIcon
.
setImageResource
(
image
);
magiskUpdateIcon
.
setImageResource
(
image
);
magiskUpdateIcon
.
setColorFilter
(
color
);
magiskUpdateIcon
.
setVisibility
(
View
.
VISIBLE
);
magiskCheckUpdatesProgress
.
setVisibility
(
View
.
GONE
);
mSwipeRefreshLayout
.
setRefreshing
(
false
);
...
...
@@ -228,7 +217,7 @@ public class StatusFragment extends Fragment implements CallbackEvent.Listener<V
private
void
updateSafetyNetUI
()
{
int
image
,
color
;
safetyNetProgress
.
setVisibility
(
View
.
GONE
);
switch
(
getApplication
()
.
SNCheckResult
)
{
switch
(
magiskManager
.
SNCheckResult
)
{
case
-
3
:
color
=
colorNeutral
;
image
=
R
.
drawable
.
ic_help
;
...
...
app/src/main/java/com/topjohnwu/magisk/asyncs/ProcessMagiskZip.java
View file @
e69b99f0
...
...
@@ -4,14 +4,9 @@ import android.app.Activity;
import
android.app.ProgressDialog
;
import
android.net.Uri
;
import
com.topjohnwu.magisk.MagiskManager
;
import
com.topjohnwu.magisk.R
;
import
com.topjohnwu.magisk.utils.Logger
;
import
com.topjohnwu.magisk.utils.Shell
;
import
com.topjohnwu.magisk.utils.Utils
;
import
com.topjohnwu.magisk.utils.ZipUtils
;
import
java.io.File
;
public
class
ProcessMagiskZip
extends
ParallelTask
<
Void
,
Void
,
Boolean
>
{
...
...
app/src/main/jni/zipadjust.c
View file @
e69b99f0
#include <stdlib.h>
#include <stdio.h>
#include <zlib.h>
#include <string.h>
#include "zipadjust.h"
size_t
insize
=
0
,
outsize
=
0
,
alloc
=
0
;
...
...
app/src/main/res/layout/fragment_status.xml
View file @
e69b99f0
...
...
@@ -21,7 +21,6 @@
android:orientation=
"vertical"
>
<android.support.v7.widget.CardView
android:id=
"@+id/magiskStatusView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"4dp"
...
...
@@ -33,44 +32,28 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/magisk_version"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:gravity=
"center"
android:padding=
"6dp"
android:textStyle=
"bold"
/>
<FrameLayout
android:id=
"@+id/magisk_status_container"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
android:background=
"?android:attr/selectableItemBackground"
android:foregroundGravity=
"center"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/magisk_status_icon"
android:layout_width=
"84dp"
android:layout_height=
"84dp"
android:layout_gravity=
"center"
/>
<ProgressBar
android:id=
"@+id/magisk_check_updates_progress"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
/>
</FrameLayout>
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<ProgressBar
android:id=
"@+id/magisk_check_updates_progress"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:layout_margin=
"15dp"
/>
<ImageView
android:id=
"@+id/magisk_update_icon"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:layout_margin=
"15dp"
android:visibility=
"gone"
/>
<TextView
android:id=
"@+id/magisk_update_status"
android:layout_width=
"
match_par
ent"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:minWidth=
"225dp"
android:layout_gravity=
"center"
android:gravity=
"center"
android:padding=
"6dp"
...
...
@@ -82,7 +65,6 @@
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:id=
"@+id/rootStatusView"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"4dp"
...
...
@@ -94,42 +76,61 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/magisk_status_icon"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:layout_margin=
"15dp"
/>
<TextView
android:id=
"@+id/
root_status
"
android:layout_width=
"
match_par
ent"
android:id=
"@+id/
magisk_version
"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:minWidth=
"225dp"
android:layout_gravity=
"center"
android:gravity=
"center"
android:padding=
"6dp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
<FrameLayout
android:id=
"@+id/root_status_container"
android:layout_width=
"match_parent"
android:layout_height=
"100dp"
android:background=
"?android:attr/selectableItemBackground"
android:foregroundGravity=
"center"
android:orientation=
"vertical"
>
</LinearLayout>
<ImageView
android:id=
"@+id/root_status_icon"
android:layout_width=
"84dp"
android:layout_height=
"84dp"
android:layout_gravity=
"center"
/>
</android.support.v7.widget.CardView>
</FrameLayout>
<android.support.v7.widget.CardView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"4dp"
android:layout_marginLeft=
"5dip"
android:layout_marginRight=
"5dip"
android:layout_marginTop=
"6dp"
style=
"?attr/cardStyle"
app:cardUseCompatPadding=
"true"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/root_status_icon"
android:layout_width=
"25dp"
android:layout_height=
"25dp"
android:layout_margin=
"15dp"
/>
<TextView
android:id=
"@+id/root_
info
"
android:layout_width=
"
match_par
ent"
android:id=
"@+id/root_
status
"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:minWidth=
"225dp"
android:layout_gravity=
"center"
android:gravity=
"center"
android:padding=
"6dp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
/>
</LinearLayout>
...
...
build.gradle
View file @
e69b99f0
...
...
@@ -6,7 +6,7 @@ buildscript {
mavenCentral
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:2.3.
1
'
classpath
'com.android.tools.build:gradle:2.3.
2
'
classpath
'me.tatarka:gradle-retrolambda:3.6.0'
// NOTE: Do not place your application dependencies here; they belong
...
...
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