Skip to content
This repository has been archived by the owner on May 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1 from LayoutXML/permissions
Browse files Browse the repository at this point in the history
Permissions
  • Loading branch information
LayoutXML committed Oct 20, 2018
2 parents 7c8609b + 98db084 commit f523677
Show file tree
Hide file tree
Showing 22 changed files with 395 additions and 153 deletions.
Binary file modified .idea/caches/build_file_checksums.ser
Binary file not shown.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
# Changelog for AppListManager (Android Library)

## Version 2.0.0
**NOTE**: This version introduces backwards incompatible changes. Follow the steps below on how to solve issues.

- Added ability to filter by application permissions:
- All `getSome...` methods now require two additional parameters - `String[]` (which contains permissions), and `Boolean` (which tells whether to look for applications that contain at least one of the given permissions or not).
- All listeners (except for `sortListener`) - `activityListener`, `appListener`, `newActivityListener`, `newAppListener`, `uninstalledActivityListener`, `uninstalledAppListener` - now receive two additional parameters (look the point above). If not applicable, then they are null and false.
- AppData object now holds application permissions (if you are working with activity lists, this field still contains application permissions) that can be accessed with `getPermissions()` and `setPermissions(...)`.
- `checkApplicationPermissions` method which allows checking whether a single AppData object contains (or does not contain) at least one of the given permissions.

For more information read [README.md](https://github.com/LayoutXML/AppListManager/blob/master/README.md).

## Version 1.1.0
- Added `BY_APPNAME_IGNORE_CASE` for sorting.
- Updated dependencies

## Version 1.0.0
-
- Initial release
87 changes: 50 additions & 37 deletions README.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
//implementation project(':applistmanagerlibrary')
implementation project(':applistmanagerlibrary')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.LayoutXML:AppListManager:1.1.0'
//implementation 'com.github.LayoutXML:AppListManager:1.1.0'
}
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.layoutxml.applistmanager">

<application
Expand All @@ -8,7 +9,8 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/layoutxml/applistmanager/ListActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ protected void onResume() {
}

@Override
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,uniqueIdentifier);
}

@Override
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,uniqueIdentifier);
}

Expand All @@ -131,30 +131,30 @@ else if (uniqueIdentifier==2 || uniqueIdentifier==3) {
}

@Override
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
if (!apps) {
appDataList.addAll(this.appDataList);
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,3);
}
}

@Override
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
if (apps) {
appDataList.addAll(this.appDataList);
AppList.sort(appDataList,AppList.BY_APPNAME_IGNORE_CASE,AppList.IN_ASCENDING,2);
}
}

@Override
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
if (this.appDataList!=null){
this.appDataList.removeAll(appDataList);
}
}

@Override
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
if (this.appDataList!=null){
this.appDataList.removeAll(appDataList);
}
Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/com/layoutxml/applistmanager/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void onClick(View view) {
getAllSystemButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
AppList.getSomeApps(getApplicationContext(), ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP, true, 3);
AppList.getSomeApps(getApplicationContext(), ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP, true, null,false,3);
}
});

Expand Down Expand Up @@ -157,7 +157,7 @@ public void onClick(View v) {
}

@Override
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
public void appListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
if (uniqueIdentifier==0) { //Could also be: if (filterFlags == null)
getAllText.setText("There are now " + appDataList.size() + " apps installed.");
AppList.sort(appDataList,AppList.BY_APPNAME,AppList.IN_ASCENDING,0);
Expand All @@ -169,7 +169,7 @@ else if (uniqueIdentifier==3) { //Could also be: else if (filterFlags == (Applic
}

@Override
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
public void newAppListener(List<AppData> appDataList, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
getNewText.setText(appDataList.size()+" new apps installed.");
if (AllAppsList != null) {
AllAppsList.addAll(appDataList);
Expand All @@ -178,7 +178,7 @@ public void newAppListener(List<AppData> appDataList, Integer applicationFlags,
}

@Override
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
public void uninstalledAppListener(List<AppData> appDataList, Boolean fromReceiver, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
getUninstalledText.setText(appDataList.size()+" apps uninstalled.");
if (AllAppsList!=null) {
AllAppsList.removeAll(appDataList);
Expand All @@ -192,15 +192,15 @@ public void sortListener(List<AppData> appDataList, Integer sortBy, Integer inOr
}

@Override
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Integer uniqueIdentifier) {
public void activityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
if (uniqueIdentifier==4) {
getActivitiesText.setText("There are now " + appDataList.size() + " activities");
AllActivitiesList = appDataList;
}
}

@Override
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
public void newActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
getNewActivitiesText.setText(appDataList.size()+" activities added");
if (AllActivitiesList!=null) {
AllActivitiesList.addAll(appDataList);
Expand All @@ -209,7 +209,7 @@ public void newActivityListener(List<AppData> appDataList, Intent intent, Intege
}

@Override
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, Integer uniqueIdentifier) {
public void uninstalledActivityListener(List<AppData> appDataList, Intent intent, Integer activityFlags, Integer applicationFlags, Boolean applicationFlagsMatch, Boolean fromReceiver, String[] permissions, Boolean matchPermissions, Integer uniqueIdentifier) {
getUninstalledActivitiesText.setText(appDataList.size()+" activities removed");
if (AllActivitiesList!=null){
AllActivitiesList.removeAll(appDataList);
Expand Down
Loading

0 comments on commit f523677

Please sign in to comment.