Merge branch 'master' of https://github.com/stom79/exodus-android-app
This commit is contained in:
commit
6b5631bb43
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||||
|
<queries>
|
||||||
|
<intent>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
</intent>
|
||||||
|
</queries>
|
||||||
<application
|
<application
|
||||||
android:allowBackup="false"
|
android:allowBackup="false"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
@ -14,6 +19,7 @@
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
tools:ignore="GoogleAppIndexingWarning"
|
tools:ignore="GoogleAppIndexingWarning"
|
||||||
android:largeHeap="true">
|
android:largeHeap="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize">
|
android:configChanges="keyboardHidden|orientation|screenSize">
|
||||||
|
|
|
@ -16,7 +16,7 @@ import java.util.Map;
|
||||||
public class ComputeAppList {
|
public class ComputeAppList {
|
||||||
|
|
||||||
private static final String gStore = "com.android.vending";
|
private static final String gStore = "com.android.vending";
|
||||||
private static final String fdroid = "ord.fdroid.fdroid";
|
private static final String fdroid = "org.fdroid.fdroid";
|
||||||
|
|
||||||
|
|
||||||
public static List<ApplicationViewModel> compute(PackageManager packageManager,
|
public static List<ApplicationViewModel> compute(PackageManager packageManager,
|
||||||
|
@ -32,7 +32,7 @@ public class ComputeAppList {
|
||||||
if (userOrderChoice == null) {
|
if (userOrderChoice == null) {
|
||||||
userOrderChoice = order.DEFAULT;
|
userOrderChoice = order.DEFAULT;
|
||||||
}
|
}
|
||||||
vms = order(vms, userOrderChoice);
|
order(vms, userOrderChoice);
|
||||||
return vms;
|
return vms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,9 +41,8 @@ public class ComputeAppList {
|
||||||
*
|
*
|
||||||
* @param vms List<ApplicationViewModel>
|
* @param vms List<ApplicationViewModel>
|
||||||
* @param orderChoice order
|
* @param orderChoice order
|
||||||
* @return List<ApplicationViewModel>
|
|
||||||
*/
|
*/
|
||||||
private static List<ApplicationViewModel> order(List<ApplicationViewModel> vms, order orderChoice) {
|
private static void order(List<ApplicationViewModel> vms, order orderChoice) {
|
||||||
if (orderChoice == order.LESS_TRACKERS) {
|
if (orderChoice == order.LESS_TRACKERS) {
|
||||||
Collections.sort(vms, (obj1, obj2) -> Integer.compare(obj1.requestedPermissions != null ? obj1.requestedPermissions.length : 0, obj2.requestedPermissions != null ? obj2.requestedPermissions.length : 0));
|
Collections.sort(vms, (obj1, obj2) -> Integer.compare(obj1.requestedPermissions != null ? obj1.requestedPermissions.length : 0, obj2.requestedPermissions != null ? obj2.requestedPermissions.length : 0));
|
||||||
Collections.sort(vms, (obj1, obj2) -> Integer.compare(obj1.trackers != null ? obj1.trackers.size() : 0, obj2.trackers != null ? obj2.trackers.size() : 0));
|
Collections.sort(vms, (obj1, obj2) -> Integer.compare(obj1.trackers != null ? obj1.trackers.size() : 0, obj2.trackers != null ? obj2.trackers.size() : 0));
|
||||||
|
@ -59,7 +58,6 @@ public class ComputeAppList {
|
||||||
} else {
|
} else {
|
||||||
Collections.sort(vms, (obj1, obj2) -> String.valueOf(obj1.label).compareToIgnoreCase(String.valueOf(obj2.label)));
|
Collections.sort(vms, (obj1, obj2) -> String.valueOf(obj1.label).compareToIgnoreCase(String.valueOf(obj2.label)));
|
||||||
}
|
}
|
||||||
return vms;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void convertPackagesToViewModels(List<ApplicationViewModel> appsToBuild,
|
private static void convertPackagesToViewModels(List<ApplicationViewModel> appsToBuild,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.eu.exodus_privacy.exodusprivacy.fragments;
|
package org.eu.exodus_privacy.exodusprivacy.fragments;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -71,7 +72,7 @@ public class HomeFragment extends Fragment implements ComputeAppList.Listener, U
|
||||||
packageManager = context.getPackageManager();
|
packageManager = context.getPackageManager();
|
||||||
homeBinding.swipeRefresh.setOnRefreshListener(this::startRefresh);
|
homeBinding.swipeRefresh.setOnRefreshListener(this::startRefresh);
|
||||||
|
|
||||||
SharedPreferences sharedPreferences = getContext().getSharedPreferences(Utils.APP_PREFS, MODE_PRIVATE);
|
SharedPreferences sharedPreferences = context.getSharedPreferences(Utils.APP_PREFS, MODE_PRIVATE);
|
||||||
last_refresh = sharedPreferences.getString(Utils.LAST_REFRESH, null);
|
last_refresh = sharedPreferences.getString(Utils.LAST_REFRESH, null);
|
||||||
|
|
||||||
if (packageManager != null) {
|
if (packageManager != null) {
|
||||||
|
@ -94,12 +95,13 @@ public class HomeFragment extends Fragment implements ComputeAppList.Listener, U
|
||||||
return homeBinding.getRoot();
|
return homeBinding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void startRefresh() {
|
public void startRefresh() {
|
||||||
if (packageManager != null) {
|
if (packageManager != null) {
|
||||||
refreshInProgress = true;
|
refreshInProgress = true;
|
||||||
homeBinding.layoutProgress.setVisibility(View.VISIBLE);
|
homeBinding.layoutProgress.setVisibility(View.VISIBLE);
|
||||||
homeBinding.swipeRefresh.setRefreshing(true);
|
homeBinding.swipeRefresh.setRefreshing(true);
|
||||||
List<PackageInfo> packageInstalled = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS);
|
@SuppressLint("QueryPermissionsNeeded") List<PackageInfo> packageInstalled = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS);
|
||||||
ArrayList<String> packageList = new ArrayList<>();
|
ArrayList<String> packageList = new ArrayList<>();
|
||||||
for (PackageInfo pkgInfo : packageInstalled)
|
for (PackageInfo pkgInfo : packageInstalled)
|
||||||
packageList.add(pkgInfo.packageName);
|
packageList.add(pkgInfo.packageName);
|
||||||
|
@ -114,6 +116,9 @@ public class HomeFragment extends Fragment implements ComputeAppList.Listener, U
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
if (!refreshInProgress && homeBinding.layoutProgress.getVisibility() == View.VISIBLE) {
|
||||||
|
onUpdateComplete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -353,8 +353,8 @@ public class NetworkManager {
|
||||||
JSONObject object = makeDataRequest(mes.context, mes.listener, url);
|
JSONObject object = makeDataRequest(mes.context, mes.listener, url);
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
try {
|
try {
|
||||||
JSONObject application = object.getJSONObject(handle);
|
|
||||||
if (handle != null) {
|
if (handle != null) {
|
||||||
|
JSONObject application = object.getJSONObject(handle);
|
||||||
return parseApplication(application, handle);
|
return parseApplication(application, handle);
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
@ -400,7 +400,7 @@ public class NetworkManager {
|
||||||
|
|
||||||
report.creationDate = Calendar.getInstance();
|
report.creationDate = Calendar.getInstance();
|
||||||
report.creationDate.setTimeZone(TimeZone.getTimeZone("UTC"));
|
report.creationDate.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||||
report.creationDate.setTime(date);
|
report.creationDate.setTime(date!=null?date:new Date());
|
||||||
date = dateFormat.parse(object.getString("creation_date"));
|
date = dateFormat.parse(object.getString("creation_date"));
|
||||||
if (date != null) {
|
if (date != null) {
|
||||||
report.creationDate.setTime(date);
|
report.creationDate.setTime(date);
|
||||||
|
|
Loading…
Reference in New Issue