Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
R
RatelVirtualLocation
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
open-source
RatelVirtualLocation
Commits
6dcb33ce
Commit
6dcb33ce
authored
Aug 26, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sort
parent
9d78c49e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
12 deletions
+14
-12
AppsActivity.java
...top/littlerich/virtuallocation/activity/AppsActivity.java
+1
-0
MyAppInfo.java
.../java/top/littlerich/virtuallocation/model/MyAppInfo.java
+1
-8
ApkTool.java
...ain/java/top/littlerich/virtuallocation/util/ApkTool.java
+10
-2
item_app_info.xml
app/src/main/res/layout/item_app_info.xml
+2
-2
No files found.
app/src/main/java/top/littlerich/virtuallocation/activity/AppsActivity.java
View file @
6dcb33ce
...
...
@@ -82,6 +82,7 @@ public class AppsActivity extends AppCompatActivity {
super
.
run
();
//扫描得到APP列表
final
List
<
MyAppInfo
>
appInfos
=
ApkTool
.
scanLocalInstallAppList
(
AppsActivity
.
this
.
getPackageManager
(),
isFilter
);
mHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
app/src/main/java/top/littlerich/virtuallocation/model/MyAppInfo.java
View file @
6dcb33ce
package
top
.
littlerich
.
virtuallocation
.
model
;
import
android.graphics.drawable.Drawable
;
/**
* Created by xuqingfu on 17/4/24.
*/
...
...
@@ -9,14 +10,6 @@ public class MyAppInfo {
private
String
appName
;
private
String
pkgName
;
public
MyAppInfo
(
Drawable
image
,
String
appName
,
String
pkgName
)
{
this
.
image
=
image
;
this
.
appName
=
appName
;
this
.
pkgName
=
pkgName
;
}
public
MyAppInfo
()
{
}
public
Drawable
getImage
()
{
return
image
;
...
...
app/src/main/java/top/littlerich/virtuallocation/util/ApkTool.java
View file @
6dcb33ce
...
...
@@ -6,6 +6,8 @@ import android.content.pm.PackageManager;
import
android.util.Log
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
...
...
@@ -32,9 +34,9 @@ public class ApkTool {
continue
;
}
MyAppInfo
myAppInfo
=
new
MyAppInfo
();
myAppInfo
.
setPkgName
(
packageInfo
.
applicationInfo
.
loadLabel
(
packageManager
).
toString
()
);
myAppInfo
.
setPkgName
(
packageInfo
.
packageName
);
myAppInfo
.
setAppName
(
packageInfo
.
packageName
);
myAppInfo
.
setAppName
(
packageInfo
.
applicationInfo
.
loadLabel
(
packageManager
).
toString
()
);
if
(
packageInfo
.
applicationInfo
.
loadIcon
(
packageManager
)
==
null
)
{
continue
;
}
...
...
@@ -52,6 +54,12 @@ public class ApkTool {
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"===============获取应用包信息失败"
);
}
Collections
.
sort
(
myAppInfos
,
new
Comparator
<
MyAppInfo
>()
{
@Override
public
int
compare
(
MyAppInfo
o1
,
MyAppInfo
o2
)
{
return
o1
.
getAppName
().
compareTo
(
o2
.
getAppName
());
}
});
return
myAppInfos
;
}
...
...
app/src/main/res/layout/item_app_info.xml
View file @
6dcb33ce
...
...
@@ -35,7 +35,7 @@
>
<TextView
android:id=
"@+id/tv_app_
pkg
"
android:id=
"@+id/tv_app_
name
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"5dp"
...
...
@@ -44,7 +44,7 @@
/>
<TextView
android:id=
"@+id/tv_app_
name
"
android:id=
"@+id/tv_app_
pkg
"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"5dp"
...
...
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