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
9ebe372a
Commit
9ebe372a
authored
Oct 16, 2017
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify flash log screen
parent
e6e04cc5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
80 deletions
+33
-80
FlashActivity.java
app/src/main/java/com/topjohnwu/magisk/FlashActivity.java
+11
-46
MagiskLogFragment.java
...src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java
+3
-3
AdaptiveList.java
...ain/java/com/topjohnwu/magisk/container/AdaptiveList.java
+3
-13
activity_flash.xml
app/src/main/res/layout/activity_flash.xml
+16
-9
list_item_flashlog.xml
app/src/main/res/layout/list_item_flashlog.xml
+0
-9
No files found.
app/src/main/java/com/topjohnwu/magisk/FlashActivity.java
View file @
9ebe372a
...
...
@@ -4,13 +4,12 @@ import android.content.Intent;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.support.v7.app.ActionBar
;
import
android.support.v7.widget.RecyclerView
;
import
android.support.v7.widget.Toolbar
;
import
android.
view.LayoutInflater
;
import
android.
text.TextUtils
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
android.widget.LinearLayout
;
import
android.widget.ScrollView
;
import
android.widget.TextView
;
import
com.topjohnwu.magisk.asyncs.FlashZip
;
...
...
@@ -19,8 +18,6 @@ import com.topjohnwu.magisk.components.Activity;
import
com.topjohnwu.magisk.container.AdaptiveList
;
import
com.topjohnwu.magisk.utils.Shell
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.ButterKnife
;
import
butterknife.OnClick
;
...
...
@@ -37,9 +34,10 @@ public class FlashActivity extends Activity {
public
static
final
String
FLASH_MAGISK
=
"magisk"
;
@BindView
(
R
.
id
.
toolbar
)
Toolbar
toolbar
;
@BindView
(
R
.
id
.
flash_logs
)
Recycler
View
flashLogs
;
@BindView
(
R
.
id
.
txtLog
)
Text
View
flashLogs
;
@BindView
(
R
.
id
.
button_panel
)
LinearLayout
buttonPanel
;
@BindView
(
R
.
id
.
reboot
)
Button
reboot
;
@BindView
(
R
.
id
.
scrollView
)
ScrollView
sv
;
@OnClick
(
R
.
id
.
no_thanks
)
public
void
dismiss
()
{
...
...
@@ -56,7 +54,13 @@ public class FlashActivity extends Activity {
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_flash
);
ButterKnife
.
bind
(
this
);
AdaptiveList
<
String
>
rootShellOutput
=
new
AdaptiveList
<>(
flashLogs
);
AdaptiveList
<
String
>
rootShellOutput
=
new
AdaptiveList
<
String
>()
{
@Override
public
synchronized
void
updateView
()
{
flashLogs
.
setText
(
TextUtils
.
join
(
"\n"
,
this
));
sv
.
postDelayed
(()
->
sv
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
),
10
);
}
};
setSupportActionBar
(
toolbar
);
ActionBar
ab
=
getSupportActionBar
();
if
(
ab
!=
null
)
{
...
...
@@ -67,8 +71,6 @@ public class FlashActivity extends Activity {
if
(!
Shell
.
rootAccess
())
reboot
.
setVisibility
(
View
.
GONE
);
flashLogs
.
setAdapter
(
new
FlashLogAdapter
(
rootShellOutput
));
// We must receive a Uri of the target zip
Intent
intent
=
getIntent
();
Uri
uri
=
intent
.
getData
();
...
...
@@ -113,41 +115,4 @@ public class FlashActivity extends Activity {
public
void
onBackPressed
()
{
// Prevent user accidentally press back button
}
private
static
class
FlashLogAdapter
extends
RecyclerView
.
Adapter
<
ViewHolder
>
{
private
List
<
String
>
mList
;
FlashLogAdapter
(
List
<
String
>
list
)
{
mList
=
list
;
}
@Override
public
ViewHolder
onCreateViewHolder
(
ViewGroup
parent
,
int
viewType
)
{
View
view
=
LayoutInflater
.
from
(
parent
.
getContext
())
.
inflate
(
R
.
layout
.
list_item_flashlog
,
parent
,
false
);
return
new
ViewHolder
(
view
);
}
@Override
public
void
onBindViewHolder
(
ViewHolder
holder
,
int
position
)
{
holder
.
text
.
setText
(
mList
.
get
(
position
));
}
@Override
public
int
getItemCount
()
{
return
mList
.
size
();
}
}
public
static
class
ViewHolder
extends
RecyclerView
.
ViewHolder
{
@BindView
(
R
.
id
.
textView
)
TextView
text
;
public
ViewHolder
(
View
itemView
)
{
super
(
itemView
);
ButterKnife
.
bind
(
this
,
itemView
);
}
}
}
app/src/main/java/com/topjohnwu/magisk/MagiskLogFragment.java
View file @
9ebe372a
...
...
@@ -117,7 +117,7 @@ public class MagiskLogFragment extends Fragment {
switch
(
mode
)
{
case
0
:
StringBuildingList
logList
=
new
StringBuildingList
();
Shell
.
su
(
logList
,
"cat "
+
MAGISK_LOG
);
Shell
.
su
(
logList
,
"cat "
+
MAGISK_LOG
+
" | tail -n 1000"
);
return
logList
.
toString
();
case
1
:
...
...
@@ -164,8 +164,8 @@ public class MagiskLogFragment extends Fragment {
txtLog
.
setText
(
R
.
string
.
log_is_empty
);
else
txtLog
.
setText
(
llog
);
svLog
.
post
(()
->
svLog
.
scrollTo
(
0
,
txtLog
.
getHeight
())
);
hsvLog
.
post
(()
->
hsvLog
.
scrollTo
(
0
,
0
)
);
svLog
.
post
Delayed
(()
->
svLog
.
fullScroll
(
ScrollView
.
FOCUS_DOWN
),
100
);
hsvLog
.
post
Delayed
(()
->
hsvLog
.
fullScroll
(
ScrollView
.
FOCUS_LEFT
),
100
);
break
;
case
2
:
boolean
bool
=
(
boolean
)
o
;
...
...
app/src/main/java/com/topjohnwu/magisk/container/AdaptiveList.java
View file @
9ebe372a
package
com
.
topjohnwu
.
magisk
.
container
;
import
android.support.v7.widget.RecyclerView
;
import
java.util.ArrayList
;
public
class
AdaptiveList
<
E
>
extends
ArrayList
<
E
>
{
public
abstract
class
AdaptiveList
<
E
>
extends
ArrayList
<
E
>
{
private
Runnable
callback
;
private
RecyclerView
mView
;
public
AdaptiveList
(
RecyclerView
v
)
{
mView
=
v
;
}
public
void
updateView
()
{
mView
.
getAdapter
().
notifyDataSetChanged
();
mView
.
scrollToPosition
(
mView
.
getAdapter
().
getItemCount
()
-
1
);
}
public
abstract
void
updateView
();
public
void
setCallback
(
Runnable
cb
)
{
callback
=
cb
;
}
public
boolean
add
(
E
e
)
{
public
synchronized
boolean
add
(
E
e
)
{
boolean
ret
=
super
.
add
(
e
);
if
(
ret
)
{
if
(
callback
==
null
)
{
...
...
app/src/main/res/layout/activity_flash.xml
View file @
9ebe372a
...
...
@@ -3,27 +3,34 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:background=
"@android:color/black"
tools:context=
"com.topjohnwu.magisk.FlashActivity"
>
<include
layout=
"@layout/toolbar"
/>
<HorizontalScrollView
<ScrollView
android:id=
"@+id/scrollView"
android:layout_weight=
"1"
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
>
<android.support.v7.widget.RecyclerView
android:id=
"@+id/flash_logs"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
app:layoutManager=
"android.support.v7.widget.LinearLayoutManager"
>
<HorizontalScrollView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
</android.support.v7.widget.RecyclerView>
<TextView
android:id=
"@+id/txtLog"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"monospace"
android:padding=
"8dp"
android:textColor=
"@android:color/white"
android:textSize=
"10sp"
/>
</HorizontalScrollView>
</HorizontalScrollView>
</ScrollView>
<LinearLayout
android:id=
"@+id/button_panel"
...
...
app/src/main/res/layout/list_item_flashlog.xml
deleted
100644 → 0
View file @
e6e04cc5
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:id=
"@+id/textView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:fontFamily=
"monospace"
android:textColor=
"@android:color/white"
android:textSize=
"10sp"
/>
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