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
8c077a73
Commit
8c077a73
authored
Nov 20, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change search to async for smoother UI
parent
4e07b514
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
36 deletions
+62
-36
MagiskHideFragment.java
...rc/main/java/com/topjohnwu/magisk/MagiskHideFragment.java
+21
-8
ReposFragment.java
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
+41
-28
No files found.
app/src/main/java/com/topjohnwu/magisk/MagiskHideFragment.java
View file @
8c077a73
...
@@ -63,14 +63,7 @@ public class MagiskHideFragment extends Fragment {
...
@@ -63,14 +63,7 @@ public class MagiskHideFragment extends Fragment {
@Override
@Override
public
boolean
onQueryTextChange
(
String
newText
)
{
public
boolean
onQueryTextChange
(
String
newText
)
{
fListApps
.
clear
();
new
FilterApps
().
exec
(
newText
);
for
(
ApplicationInfo
info
:
listApps
)
{
if
(
info
.
loadLabel
(
packageManager
).
toString
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
info
.
packageName
.
toLowerCase
().
contains
(
newText
.
toLowerCase
()))
{
fListApps
.
add
(
info
);
}
}
appAdapter
.
notifyDataSetChanged
();
return
false
;
return
false
;
}
}
};
};
...
@@ -113,6 +106,26 @@ public class MagiskHideFragment extends Fragment {
...
@@ -113,6 +106,26 @@ public class MagiskHideFragment extends Fragment {
}
}
}
}
private
class
FilterApps
extends
Async
.
NormalTask
<
String
,
Void
,
Void
>
{
@Override
protected
Void
doInBackground
(
String
...
strings
)
{
String
newText
=
strings
[
0
];
fListApps
.
clear
();
for
(
ApplicationInfo
info
:
listApps
)
{
if
(
info
.
loadLabel
(
packageManager
).
toString
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
info
.
packageName
.
toLowerCase
().
contains
(
newText
.
toLowerCase
()))
{
fListApps
.
add
(
info
);
}
}
return
null
;
}
@Override
protected
void
onPostExecute
(
Void
v
)
{
appAdapter
.
notifyDataSetChanged
();
}
}
private
void
updateUI
()
{
private
void
updateUI
()
{
appAdapter
.
notifyDataSetChanged
();
appAdapter
.
notifyDataSetChanged
();
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
recyclerView
.
setVisibility
(
View
.
VISIBLE
);
...
...
app/src/main/java/com/topjohnwu/magisk/ReposFragment.java
View file @
8c077a73
...
@@ -94,34 +94,7 @@ public class ReposFragment extends Fragment {
...
@@ -94,34 +94,7 @@ public class ReposFragment extends Fragment {
@Override
@Override
public
boolean
onQueryTextChange
(
String
newText
)
{
public
boolean
onQueryTextChange
(
String
newText
)
{
fUpdateRepos
.
clear
();
new
FilterApps
().
exec
(
newText
);
fInstalledRepos
.
clear
();
fOthersRepos
.
clear
();
for
(
Repo
repo:
mUpdateRepos
)
{
if
(
repo
.
getName
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getAuthor
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getDescription
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
)
{
fUpdateRepos
.
add
(
repo
);
}
}
for
(
Repo
repo:
mInstalledRepos
)
{
if
(
repo
.
getName
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getAuthor
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getDescription
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
)
{
fInstalledRepos
.
add
(
repo
);
}
}
for
(
Repo
repo:
mOthersRepos
)
{
if
(
repo
.
getName
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getAuthor
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getDescription
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
)
{
fOthersRepos
.
add
(
repo
);
}
}
updateUI
();
return
false
;
return
false
;
}
}
};
};
...
@@ -182,4 +155,44 @@ public class ReposFragment extends Fragment {
...
@@ -182,4 +155,44 @@ public class ReposFragment extends Fragment {
mSwipeRefreshLayout
.
setRefreshing
(
false
);
mSwipeRefreshLayout
.
setRefreshing
(
false
);
}
}
private
class
FilterApps
extends
Async
.
NormalTask
<
String
,
Void
,
Void
>
{
@Override
protected
Void
doInBackground
(
String
...
strings
)
{
String
newText
=
strings
[
0
];
fUpdateRepos
.
clear
();
fInstalledRepos
.
clear
();
fOthersRepos
.
clear
();
for
(
Repo
repo:
mUpdateRepos
)
{
if
(
repo
.
getName
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getAuthor
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getDescription
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
)
{
fUpdateRepos
.
add
(
repo
);
}
}
for
(
Repo
repo:
mInstalledRepos
)
{
if
(
repo
.
getName
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getAuthor
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getDescription
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
)
{
fInstalledRepos
.
add
(
repo
);
}
}
for
(
Repo
repo:
mOthersRepos
)
{
if
(
repo
.
getName
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getAuthor
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
||
repo
.
getDescription
().
toLowerCase
().
contains
(
newText
.
toLowerCase
())
)
{
fOthersRepos
.
add
(
repo
);
}
}
return
null
;
}
@Override
protected
void
onPostExecute
(
Void
v
)
{
updateUI
();
}
}
}
}
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