Add in report view that app hasn't been analysed if no report is found

for.
This commit is contained in:
Schoumi 2018-03-08 14:25:16 +01:00
parent aed4b6d6c9
commit 3fceca295e
3 changed files with 22 additions and 6 deletions

View File

@ -75,19 +75,20 @@ public class AppListFragment extends Fragment {
View v = getView();
if(v == null)
return;
if(startupRefresh) {
startRefresh(v);
startupRefresh = false;
}
RecyclerView app_list = v.findViewById(R.id.app_list);
SwipeRefreshLayout refresh = v.findViewById(R.id.swipe_refresh);
refresh.setOnRefreshListener(() -> startRefresh(getView()));
if (packageManager == null)
packageManager = v.getContext().getPackageManager();
app_list.setLayoutManager(new LinearLayoutManager(v.getContext()));
TextView nopm = v.findViewById(R.id.no_package_manager);
TextView noappfound = v.findViewById(R.id.no_app_found);
if (packageManager != null) {
if(startupRefresh) {
startRefresh(v);
startupRefresh = false;
}
nopm.setVisibility(View.GONE);
noappfound.setVisibility(View.GONE);
ApplicationListAdapter adapter = new ApplicationListAdapter(packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS), packageManager, onAppClickListener);

View File

@ -111,14 +111,23 @@ public class ReportFragment extends Fragment {
permissionList.loadData(getString(R.string.no_permissions),"text/plain", "UTF-8");
}
TextView analysed = v.findViewById(R.id.analysed);
TextView trackers_title = v.findViewById(R.id.trackers_title);
WebView trackersList = v.findViewById(R.id.trackers);
analysed.setVisibility(View.GONE);
trackers_title.setVisibility(View.VISIBLE);
trackersList.setVisibility(View.VISIBLE);
//get trackers
Report report = DatabaseManager.getInstance(context).getReportFor(packageName,versionName);
Set<Tracker> trackers = null;
if(report != null) {
trackers = DatabaseManager.getInstance(context).getTrackers(report.trackers);
} else {
analysed.setVisibility(View.VISIBLE);
trackers_title.setVisibility(View.GONE);
trackersList.setVisibility(View.GONE);
}
//setup trackers report
TextView trackers_title = v.findViewById(R.id.trackers_title);
String trackers_text;
if(trackers != null && trackers.size() > 0)
trackers_text = context.getString(R.string.trackers)+" "+String.valueOf(trackers.size());
@ -127,7 +136,6 @@ public class ReportFragment extends Fragment {
trackers_title.setText(trackers_text);
//setup trackers lists
WebView trackersList = v.findViewById(R.id.trackers);
//build html tracker list
if(trackers != null && trackers.size() > 0) {
List<String> trackersName = new ArrayList<>();

View File

@ -50,6 +50,13 @@
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/analysed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/analysed"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
</LinearLayout>
</LinearLayout>
<ScrollView