Allow the refresh for tracking list

This commit is contained in:
Thomas 2020-12-15 18:21:10 +01:00
parent 9d330bf07f
commit 20f2e8412f
25 changed files with 146 additions and 16 deletions

View File

@ -34,12 +34,18 @@ android {
amal {
applicationId "app.fedilab.amal"
}
fedilab {
applicationId "app.fedilab.exodusprivacy"
}
}
sourceSets {
exodus {
res.srcDirs = ['src/main/res', 'src/exodus/res']
}
fedilab {
res.srcDirs = ['src/main/res', 'src/fedilab/res']
}
amal {
res.srcDirs = ['src/main/res', 'src/amal/res']
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,27 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group
android:scaleX="1.48"
android:scaleY="1.48"
android:translateX="14.04"
android:translateY="14.04">
<path
android:fillAlpha="1"
android:fillColor="#1976D2"
android:pathData="M2.1737,27a24.8263,24.5976 0,1 0,49.6526 0a24.8263,24.5976 0,1 0,-49.6526 0z"
android:strokeWidth="0.0297731"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#ffffff"
android:pathData="m22.6353,26.1025c-4.3263,-1.5231 -6.4894,-3.8295 -6.4894,-6.9192 -0,-2.4369 1.1474,-4.3843 3.4423,-5.8421 2.2949,-1.4578 5.1443,-2.1867 8.5482,-2.1867 3.0964,0 5.556,0.5059 7.3788,1.5176 1.8227,1.0118 2.7341,2.2248 2.7341,3.6391 -0,0.7398 -0.2855,1.3871 -0.8565,1.9419 -0.571,0.5549 -1.2298,0.8323 -1.9765,0.8323 -1.2298,0 -2.24,-0.8486 -3.0306,-2.5457 -1.098,-2.3499 -2.7451,-3.5248 -4.9412,-3.5249 -1.7349,0 -3.1624,0.5657 -4.2823,1.6972 -1.12,1.1315 -1.68,2.7089 -1.68,4.7325 -0,3.9818 2.0753,5.9727 6.2259,5.9727 0.4392,0 0.9443,-0.0435 1.5153,-0.1305 0.9882,-0.1305 1.7568,-0.1958 2.3059,-0.1958 1.3396,0 2.0094,0.3808 2.0094,1.1423 -0,0.8486 -0.6808,1.2729 -2.0424,1.2729 -0.4832,0 -1.2079,-0.0761 -2.1741,-0.2285 -0.7247,-0.1305 -1.2847,-0.1958 -1.68,-0.1958 -4.3922,0 -6.5882,2.2194 -6.5882,6.6581 -0,2.1541 0.5819,3.8893 1.7459,5.2057 1.1639,1.3164 2.789,1.9746 4.8753,1.9746 2.6133,0 4.3482,-1.3381 5.2047,-4.0144 0.4392,-1.4143 0.9278,-2.3934 1.4659,-2.9374 0.538,-0.544 1.2572,-0.8159 2.1576,-0.8159 0.7466,0 1.4219,0.2665 2.0259,0.7996 0.6039,0.5331 0.9059,1.213 0.9059,2.0399 -0,1.98 -1.12,3.6173 -3.36,4.912 -2.24,1.2946 -4.9522,1.9419 -8.1365,1.9419 -3.4918,0 -6.5937,-0.8268 -9.3059,-2.4805 -2.7122,-1.6536 -4.0682,-3.8621 -4.0682,-6.6254 -0,-3.4596 2.6902,-6.0053 8.0706,-7.6372z"
android:strokeWidth="0.03275258"
android:strokeAlpha="1"
android:strokeColor="#00000000"
android:strokeLineCap="butt"
android:strokeLineJoin="miter" />
</group>
</vector>

View File

@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="100dp"
android:viewportWidth="54"
android:viewportHeight="54">
<path
android:fillAlpha="1"
android:fillColor="#1976D2"
android:pathData="M2.1737,27a24.8263,24.5976 0,1 0,49.6526 0a24.8263,24.5976 0,1 0,-49.6526 0z"
android:strokeWidth="0.0297731"
android:strokeColor="#00000000" />
<path
android:fillAlpha="1"
android:fillColor="#ffffff"
android:pathData="m22.6353,26.1025c-4.3263,-1.5231 -6.4894,-3.8295 -6.4894,-6.9192 -0,-2.4369 1.1474,-4.3843 3.4423,-5.8421 2.2949,-1.4578 5.1443,-2.1867 8.5482,-2.1867 3.0964,0 5.556,0.5059 7.3788,1.5176 1.8227,1.0118 2.7341,2.2248 2.7341,3.6391 -0,0.7398 -0.2855,1.3871 -0.8565,1.9419 -0.571,0.5549 -1.2298,0.8323 -1.9765,0.8323 -1.2298,0 -2.24,-0.8486 -3.0306,-2.5457 -1.098,-2.3499 -2.7451,-3.5248 -4.9412,-3.5249 -1.7349,0 -3.1624,0.5657 -4.2823,1.6972 -1.12,1.1315 -1.68,2.7089 -1.68,4.7325 -0,3.9818 2.0753,5.9727 6.2259,5.9727 0.4392,0 0.9443,-0.0435 1.5153,-0.1305 0.9882,-0.1305 1.7568,-0.1958 2.3059,-0.1958 1.3396,0 2.0094,0.3808 2.0094,1.1423 -0,0.8486 -0.6808,1.2729 -2.0424,1.2729 -0.4832,0 -1.2079,-0.0761 -2.1741,-0.2285 -0.7247,-0.1305 -1.2847,-0.1958 -1.68,-0.1958 -4.3922,0 -6.5882,2.2194 -6.5882,6.6581 -0,2.1541 0.5819,3.8893 1.7459,5.2057 1.1639,1.3164 2.789,1.9746 4.8753,1.9746 2.6133,0 4.3482,-1.3381 5.2047,-4.0144 0.4392,-1.4143 0.9278,-2.3934 1.4659,-2.9374 0.538,-0.544 1.2572,-0.8159 2.1576,-0.8159 0.7466,0 1.4219,0.2665 2.0259,0.7996 0.6039,0.5331 0.9059,1.213 0.9059,2.0399 -0,1.98 -1.12,3.6173 -3.36,4.912 -2.24,1.2946 -4.9522,1.9419 -8.1365,1.9419 -3.4918,0 -6.5937,-0.8268 -9.3059,-2.4805 -2.7122,-1.6536 -4.0682,-3.8621 -4.0682,-6.6254 -0,-3.4596 2.6902,-6.0053 8.0706,-7.6372z"
android:strokeWidth="0.03275258"
android:strokeAlpha="1"
android:strokeColor="#00000000"
android:strokeLineCap="butt"
android:strokeLineJoin="miter" />
</vector>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#1976D2</color>
<color name="colorPrimaryDark">#0D47A1</color>
<color name="colorAccent">#64B5F6</color>
<color name="percent">#771976D2</color>
<color name="colorGreen">#6fc384</color>
<color name="colorLightRed">#e46772</color>
<color name="colorLightYellow">#ffdb66</color>
<color name="colorLightBlue">#17a2b8</color>
<color name="colorYellow">#ffc70f</color>
<color name="colorDarkOrange">#ff8c00</color>
<color name="colorRed">#e61718</color>
<color name="colorPurple">#684971</color>
<color name="textColorDark">#343A40</color>
<color name="textColorDarkLight">#6C757D</color>
<color name="textColorWhite">#FFFFFF</color>
<color name="textDetection">#E83E8C</color>
</resources>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="exodus">9c6106a229bc5f34b5802e5861bcb87d1626617d</string>
<string name="app_title">εxodus</string>
<string name="app_name">Exodus (test)</string>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#1976D2</color>
</resources>

View File

@ -112,10 +112,10 @@ public class CheckAppActivity extends AppCompatActivity implements NetworkListen
ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText(getString(R.string.app_name), app_id);
clipboard.setPrimaryClip(clip);
if (BuildConfig.FLAVOR.equals("exodus")) {
uri = Uri.parse("https://reports.exodus-privacy.eu.org/analysis/submit/");
} else {
if (BuildConfig.FLAVOR.equals("amal")) {
uri = Uri.parse("https://exodus.phm.education.gouv.fr/analysis/submit/");
} else {
uri = Uri.parse("https://reports.exodus-privacy.eu.org/analysis/submit/");
}
Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(browserIntent);

View File

@ -32,7 +32,7 @@ public class Utils {
public static final String LAST_REFRESH = "last_refresh";
public static String getDomain() {
return BuildConfig.FLAVOR.compareTo("exodus") == 0 ? "reports.exodus-privacy.eu.org" : "exodus.phm.education.gouv.fr";
return BuildConfig.FLAVOR.compareTo("amal") == 0 ? "exodus.phm.education.gouv.fr" : "reports.exodus-privacy.eu.org";
}
@SuppressLint("PackageManagerGetSignatures")

View File

@ -71,9 +71,17 @@ public class MyTrackersFragment extends Fragment implements MyTrackersListAdapte
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
Context context = trackerBinding.getRoot().getContext();
trackerBinding.loader.setVisibility(View.VISIBLE);
trackerBinding.trackers.setVisibility(View.GONE);
trackerBinding.swipeRefresh.setOnRefreshListener(this::refresh);
trackerBinding.refresh.setOnClickListener(v -> refresh());
refresh();
}
private void refresh() {
new Thread(() -> {
DatabaseManager databaseManager = DatabaseManager.getInstance(getActivity());
PackageManager packageManager = context.getPackageManager();
@ -118,18 +126,25 @@ public class MyTrackersFragment extends Fragment implements MyTrackersListAdapte
Handler mainHandler = new Handler(Looper.getMainLooper());
int finalMaxValue = maxValue;
Runnable myRunnable = () -> {
Collections.sort(myTrackers, (obj1, obj2) -> Integer.compare(obj2.number, obj1.number));
MyTrackersListAdapter myTrackersListAdapter = new MyTrackersListAdapter(myTrackers, MyTrackersFragment.this, finalMaxValue, appInstalled);
trackerBinding.trackers.setAdapter(myTrackersListAdapter);
trackerBinding.trackers.setLayoutManager(new LinearLayoutManager(context));
trackerBinding.trackers.setVisibility(View.VISIBLE);
trackerBinding.loader.setVisibility(View.GONE);
if (myTrackers.size() > 0) {
Collections.sort(myTrackers, (obj1, obj2) -> Integer.compare(obj2.number, obj1.number));
MyTrackersListAdapter myTrackersListAdapter = new MyTrackersListAdapter(myTrackers, MyTrackersFragment.this, finalMaxValue, appInstalled);
trackerBinding.trackers.setAdapter(myTrackersListAdapter);
trackerBinding.trackers.setLayoutManager(new LinearLayoutManager(context));
trackerBinding.trackers.setVisibility(View.VISIBLE);
trackerBinding.loader.setVisibility(View.GONE);
trackerBinding.refresh.setVisibility(View.GONE);
} else {
trackerBinding.refresh.setVisibility(View.VISIBLE);
trackerBinding.trackers.setVisibility(View.GONE);
trackerBinding.loader.setVisibility(View.GONE);
}
trackerBinding.swipeRefresh.setRefreshing(false);
};
mainHandler.post(myRunnable);
}).start();
}
@Override

View File

@ -166,6 +166,7 @@ public class ReportFragment extends Fragment implements Updatable {
public void onPrepareOptionsMenu(Menu menu) {
menu.findItem(R.id.action_filter).setVisible(false);
menu.findItem(R.id.action_filter_options).setVisible(false);
menu.findItem(R.id.action_settings).setVisible(true);
}
public ApplicationViewModel getModel() {

View File

@ -6,15 +6,32 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/trackers"
android:layout_width="match_parent"
android:layout_height="match_parent"
<TextView
android:id="@+id/refresh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/nothing_here"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/trackers"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<RelativeLayout
android:id="@+id/loader"
android:layout_width="match_parent"

View File

@ -66,6 +66,7 @@
<string name="title_trackers">Trackers</string>
<string name="list_of_apps">See the list of apps</string>
<string name="apps">%1$s apps</string>
<string name="nothing_here">Nothing to display currently. You can pull to refresh!</string>
</resources>