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
9b72634a
Commit
9b72634a
authored
Nov 20, 2018
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
APK抓包>从频道1开始依次抓取, 增加手动清理图片缓存
#BYLSERVER-1693
parent
9e69c7e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
3 deletions
+57
-3
MainActivity.kt
app/src/main/java/com/duolebo/blyrobot/MainActivity.kt
+4
-0
AppConfigListItem.kt
...rc/main/java/com/duolebo/blyrobot/ui/AppConfigListItem.kt
+1
-1
AppUtil.kt
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
+45
-2
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 @
9b72634a
...
...
@@ -88,6 +88,10 @@ class MainActivity : AppCompatActivity(), IAppBaseCallback {
this
.
appInfoAdapter
.
clear
()
requestAppList
()
}
clearBtn
.
setOnClickListener
{
AppUtil
.
clearCache
()
}
}
private
fun
start
()
{
...
...
app/src/main/java/com/duolebo/blyrobot/ui/AppConfigListItem.kt
View file @
9b72634a
...
...
@@ -22,7 +22,7 @@ class AppConfigListItem(context: Context?) : RelativeLayout(context) {
else
if
(!
apkInfo
.
monitoring
)
tips
=
"(监播未启用)"
this
.
appName
.
text
=
apkInfo
.
name
+
tips
this
.
packageName
.
text
=
apkInfo
.
packageName
this
.
packageName
.
text
=
"包名:${apkInfo.packageName}\t\t版本:"
+
AppUtil
.
getVersionName
(
context
,
apkInfo
.
packageName
)
}
fun
setIcon
(
drawable
:
Drawable
)
{
...
...
app/src/main/java/com/duolebo/blyrobot/util/AppUtil.kt
View file @
9b72634a
...
...
@@ -14,9 +14,13 @@ import android.os.Build
import
android.os.Environment
import
java.util.regex.Pattern
import
android.app.ActivityManager.RunningAppProcessInfo
import
java.net.HttpURLConnection
import
java.nio.file.Files.delete
import
java.net.HttpURLConnection.HTTP_OK
import
java.net.HttpURLConnection.setFollowRedirects
import
java.net.URL
import
android.R.attr.versionName
import
android.content.pm.PackageInfo
...
...
@@ -224,4 +228,43 @@ object AppUtil {
e
.
printStackTrace
()
}
}
fun
exists
(
url
:
String
):
Boolean
{
return
try
{
HttpURLConnection
.
setFollowRedirects
(
false
)
val
con
=
URL
(
url
).
openConnection
()
as
HttpURLConnection
con
.
requestMethod
=
"HEAD"
con
.
responseCode
==
HttpURLConnection
.
HTTP_OK
}
catch
(
e
:
Exception
)
{
e
.
printStackTrace
()
false
}
}
fun
getVersionName
(
context
:
Context
,
packageName
:
String
):
String
{
val
manager
=
context
.
packageManager
var
name
=
""
try
{
val
info
=
manager
.
getPackageInfo
(
packageName
,
0
)
name
=
info
.
versionName
}
catch
(
e
:
PackageManager
.
NameNotFoundException
)
{
e
.
printStackTrace
()
}
return
name
}
fun
clearCache
()
{
val
path
=
getAbsoluteSdcardPath
()
+
"/upload/"
val
dir
=
File
(
path
)
if
(
dir
.
exists
())
{
for
(
subDir
in
dir
.
listFiles
())
{
if
(
subDir
.
isDirectory
)
{
for
(
file
in
subDir
.
listFiles
())
{
file
.
delete
()
}
}
}
}
}
}
\ No newline at end of file
app/src/main/res/layout/activity_main.xml
View file @
9b72634a
...
...
@@ -40,6 +40,13 @@
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"10dp"
android:text=
"刷新应用列表"
/>
<Button
android:id=
"@+id/clearBtn"
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