Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BYLAppRobot
Project
Project
Details
Activity
Releases
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
liuyang
BYLAppRobot
Commits
eb964c2f
Commit
eb964c2f
authored
Oct 24, 2018
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加刷新应用列表
parent
162ec3eb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
MainActivity.kt
app/src/main/java/com/duolebo/blyrobot/MainActivity.kt
+13
-6
activity_main.xml
app/src/main/res/layout/activity_main.xml
+7
-0
No files found.
app/src/main/java/com/duolebo/blyrobot/MainActivity.kt
View file @
eb964c2f
...
...
@@ -37,6 +37,7 @@ class MainActivity : AppCompatActivity(), IAppBaseCallback {
private
lateinit
var
dataHandler
:
AppBaseHandler
private
lateinit
var
appInfoAdapter
:
AppConfigAdapter
private
lateinit
var
refreshTimer
:
Timer
private
lateinit
var
appInfoData
:
AppInfoData
private
var
apkPackageInfo
:
List
<
ApkPackageInfo
>?
=
null
...
...
@@ -74,6 +75,10 @@ class MainActivity : AppCompatActivity(), IAppBaseCallback {
requestAppList
()
refreshBtn
.
setOnClickListener
{
requestAppList
()
}
}
private
fun
requestAppList
()
{
...
...
@@ -134,10 +139,11 @@ class MainActivity : AppCompatActivity(), IAppBaseCallback {
override
fun
onProtocolSucceed
(
protocol
:
IProtocol
?)
{
if
(
protocol
is
GetAppInfoProtocol
)
{
val
appInfoData
=
protocol
.
data
as
AppInfoD
ata
this
.
appInfoData
=
protocol
.
d
ata
this
.
appInfoAdapter
.
setData
(
appInfoData
.
apkInfos
)
this
.
appInfoAdapter
.
notifyDataSetChanged
()
if
(!
TaskManager
.
instance
.
isRunning
)
{
for
(
apkInfo
in
appInfoData
.
apkInfos
)
{
if
(
apkInfo
.
monitoring
&&
AppUtil
.
isAppInstalled
(
this
,
apkInfo
.
packageName
))
{
val
task
=
Task
(
this
.
applicationContext
)
...
...
@@ -147,6 +153,7 @@ class MainActivity : AppCompatActivity(), IAppBaseCallback {
}
}
}
}
fun
getAppIcon
(
packageName
:
String
):
Drawable
?
{
var
drawable
:
Drawable
?=
null
...
...
app/src/main/res/layout/activity_main.xml
View file @
eb964c2f
...
...
@@ -33,6 +33,13 @@
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:text=
"停止"
/>
<Button
android:id=
"@+id/refreshBtn"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:text=
"刷新应用列表"
/>
</LinearLayout>
<ListView
...
...
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