Use databinding in place of all findViewById

This commit is contained in:
Schoumi 2018-04-11 15:27:05 +02:00
parent 9c619c2135
commit 357500df9a
9 changed files with 360 additions and 363 deletions

View File

@ -21,6 +21,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
}
dependencies {
@ -28,9 +31,9 @@ dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:recyclerview-v7:27.0.2'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
testCompile 'junit:junit:4.12'
}

View File

@ -20,11 +20,13 @@ package org.eu.exodus_privacy.exodusprivacy;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.databinding.DataBindingUtil;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import org.eu.exodus_privacy.exodusprivacy.adapters.ApplicationListAdapter;
import org.eu.exodus_privacy.exodusprivacy.databinding.MainBinding;
import org.eu.exodus_privacy.exodusprivacy.fragments.AppListFragment;
import org.eu.exodus_privacy.exodusprivacy.fragments.ReportFragment;
import org.eu.exodus_privacy.exodusprivacy.listener.NetworkListener;
@ -37,7 +39,7 @@ public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final MainBinding mainBinding = DataBindingUtil.setContentView(this,R.layout.main);
NetworkListener networkListener = new NetworkListener() {
@Override
@ -45,7 +47,7 @@ public class MainActivity extends AppCompatActivity {
runOnUiThread(() -> {
appList.updateComplete();
if(report != null)
report.updateComplete(null);
report.updateComplete();
});
}
@ -54,7 +56,7 @@ public class MainActivity extends AppCompatActivity {
public void onError(String error) {
runOnUiThread(() -> {
appList.updateComplete();
Snackbar bar = Snackbar.make(findViewById(R.id.fragment_container),error,Snackbar.LENGTH_LONG);
Snackbar bar = Snackbar.make(mainBinding.fragmentContainer,error,Snackbar.LENGTH_LONG);
bar.show();
});
}

View File

@ -18,8 +18,10 @@
package org.eu.exodus_privacy.exodusprivacy.adapters;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
@ -28,6 +30,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.eu.exodus_privacy.exodusprivacy.R;
import org.eu.exodus_privacy.exodusprivacy.databinding.AppItemBinding;
import org.eu.exodus_privacy.exodusprivacy.manager.DatabaseManager;
import org.eu.exodus_privacy.exodusprivacy.objects.Report;
import org.eu.exodus_privacy.exodusprivacy.objects.Tracker;
@ -44,7 +47,7 @@ public class ApplicationListAdapter extends android.support.v7.widget.RecyclerVi
private List<PackageInfo> packages;
private PackageManager packageManager;
private OnAppClickListener onAppClickListener;
private final String gStore = "com.android.vending";
private static final String gStore = "com.android.vending";
private Comparator<PackageInfo> alphaPackageComparator = new Comparator<PackageInfo>() {
@Override
@ -55,10 +58,9 @@ public class ApplicationListAdapter extends android.support.v7.widget.RecyclerVi
}
};
public ApplicationListAdapter(List<PackageInfo> installedPackages, PackageManager manager, OnAppClickListener listener) {
packageManager = manager;
public ApplicationListAdapter(PackageManager manager, OnAppClickListener listener) {
onAppClickListener = listener;
setInstalledPackages(installedPackages);
setPackageManager(manager);
}
private void setInstalledPackages(List<PackageInfo> installedPackages) {
@ -80,8 +82,8 @@ public class ApplicationListAdapter extends android.support.v7.widget.RecyclerVi
@Override
public ApplicationListViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.app_item,parent,false);
return new ApplicationListViewHolder(v);
AppItemBinding appItemBinding = DataBindingUtil.inflate(LayoutInflater.from(parent.getContext()),R.layout.app_item,parent,false);
return new ApplicationListViewHolder(appItemBinding);
}
@Override
@ -102,35 +104,31 @@ public class ApplicationListAdapter extends android.support.v7.widget.RecyclerVi
public void setPackageManager(PackageManager manager) {
packageManager = manager;
if(packageManager != null) {
List<PackageInfo> installedPackages = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS);
setInstalledPackages(installedPackages);
}
}
class ApplicationListViewHolder extends RecyclerView.ViewHolder {
ImageView app_logo;
TextView app_name;
TextView app_permission_nb;
TextView app_tracker_nb;
TextView tested;
TextView analysed;
PackageInfo packageInfo;
AppItemBinding appItemBinding;
ApplicationListViewHolder(View itemView) {
super(itemView);
app_logo = itemView.findViewById(R.id.app_logo);
app_name = itemView.findViewById(R.id.app_name);
app_permission_nb = itemView.findViewById(R.id.app_permission_nb);
app_tracker_nb = itemView.findViewById(R.id.app_tracker_nb);
tested = itemView.findViewById(R.id.other_version);
analysed = itemView.findViewById(R.id.analysed);
ApplicationListViewHolder(AppItemBinding binding) {
super(binding.getRoot());
appItemBinding = binding;
}
public void setData(PackageInfo data) {
packageInfo = data;
Context context = appItemBinding.getRoot().getContext();
//reinit view state
tested.setVisibility(View.GONE);
analysed.setVisibility(View.GONE);
app_tracker_nb.setVisibility(View.VISIBLE);
appItemBinding.otherVersion.setVisibility(View.GONE);
appItemBinding.analysed.setVisibility(View.GONE);
appItemBinding.appTrackerNb.setVisibility(View.VISIBLE);
String packageName = packageInfo.packageName;
@ -138,31 +136,31 @@ public class ApplicationListAdapter extends android.support.v7.widget.RecyclerVi
//get logo
try {
app_logo.setImageDrawable(packageManager.getApplicationIcon(packageName));
appItemBinding.appLogo.setImageDrawable(packageManager.getApplicationIcon(packageName));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
//get name
app_name.setText(packageManager.getApplicationLabel(packageInfo.applicationInfo));
appItemBinding.appName.setText(packageManager.getApplicationLabel(packageInfo.applicationInfo));
//get permissions
if(packageInfo.requestedPermissions != null) {
app_permission_nb.setText(app_name.getContext().getString(R.string.permissions) + " " + String.valueOf(data.requestedPermissions.length));
appItemBinding.appPermissionNb.setText(context.getString(R.string.permissions) + " " + String.valueOf(data.requestedPermissions.length));
} else {
app_permission_nb.setText(app_name.getContext().getString(R.string.permissions) + " " + String.valueOf(0));
appItemBinding.appPermissionNb.setText(context.getString(R.string.permissions) + " " + String.valueOf(0));
}
//get reports
Report report = DatabaseManager.getInstance(app_logo.getContext()).getReportFor(packageName, versionName);
Report report = DatabaseManager.getInstance(context).getReportFor(packageName, versionName);
if(report != null) {
Set<Tracker> trackers = DatabaseManager.getInstance(app_logo.getContext()).getTrackers(report.trackers);
app_tracker_nb.setText(app_name.getContext().getString(R.string.trackers) + " " + trackers.size());
Set<Tracker> trackers = DatabaseManager.getInstance(context).getTrackers(report.trackers);
appItemBinding.appTrackerNb.setText(context.getString(R.string.trackers) + " " + trackers.size());
if(!report.version.equals(data.versionName)) {
tested.setVisibility(View.VISIBLE);
appItemBinding.otherVersion.setVisibility(View.VISIBLE);
}
} else {
app_tracker_nb.setVisibility(View.GONE);
analysed.setVisibility(View.VISIBLE);
appItemBinding.appTrackerNb.setVisibility(View.GONE);
appItemBinding.analysed.setVisibility(View.VISIBLE);
}
}
}

View File

@ -23,6 +23,7 @@ import android.app.Fragment;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.widget.SwipeRefreshLayout;
@ -37,6 +38,7 @@ import android.widget.TextView;
import org.eu.exodus_privacy.exodusprivacy.R;
import org.eu.exodus_privacy.exodusprivacy.adapters.ApplicationListAdapter;
import org.eu.exodus_privacy.exodusprivacy.databinding.ApplistBinding;
import org.eu.exodus_privacy.exodusprivacy.listener.NetworkListener;
import org.eu.exodus_privacy.exodusprivacy.manager.NetworkManager;
@ -50,6 +52,7 @@ public class AppListFragment extends Fragment {
private NetworkListener networkListener;
private ApplicationListAdapter.OnAppClickListener onAppClickListener;
private boolean startupRefresh;
private ApplistBinding applistBinding;
public static AppListFragment newInstance(NetworkListener networkListener, ApplicationListAdapter.OnAppClickListener appClickListener) {
AppListFragment fragment = new AppListFragment();
@ -66,68 +69,58 @@ public class AppListFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.applist,container,false);
applistBinding = DataBindingUtil.inflate(inflater,R.layout.applist,container,false);
return applistBinding.getRoot();
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
View v = getView();
if(v == null)
if(applistBinding == null)
return;
RecyclerView app_list = v.findViewById(R.id.app_list);
SwipeRefreshLayout refresh = v.findViewById(R.id.swipe_refresh);
refresh.setOnRefreshListener(() -> startRefresh(getView()));
Context context = applistBinding.getRoot().getContext();
applistBinding.swipeRefresh.setOnRefreshListener(() -> startRefresh());
if (packageManager == null)
packageManager = v.getContext().getPackageManager();
packageManager = context.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);
applistBinding.appList.setLayoutManager(new LinearLayoutManager(context));
if (packageManager != null) {
if(startupRefresh) {
startRefresh(v);
startRefresh();
startupRefresh = false;
}
nopm.setVisibility(View.GONE);
noappfound.setVisibility(View.GONE);
ApplicationListAdapter adapter = new ApplicationListAdapter(packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS), packageManager, onAppClickListener);
applistBinding.noPackageManager.setVisibility(View.GONE);
applistBinding.noAppFound.setVisibility(View.GONE);
ApplicationListAdapter adapter = new ApplicationListAdapter(packageManager, onAppClickListener);
if(adapter.getItemCount() == 0) {
noappfound.setVisibility(View.VISIBLE);
applistBinding.noAppFound.setVisibility(View.VISIBLE);
} else {
app_list.setAdapter(adapter);
applistBinding.appList.setAdapter(adapter);
}
} else {
nopm.setVisibility(View.VISIBLE);
applistBinding.noPackageManager.setVisibility(View.VISIBLE);
}
}
public void startRefresh(View v){
if(v == null)
public void startRefresh(){
if(applistBinding == null)
return;
LinearLayout layout = v.findViewById(R.id.layout_progress);
layout.setVisibility(View.VISIBLE);
SwipeRefreshLayout refresh = v.findViewById(R.id.swipe_refresh);
refresh.setRefreshing(true);
applistBinding.layoutProgress.setVisibility(View.VISIBLE);
applistBinding.swipeRefresh.setRefreshing(true);
List<PackageInfo> packageInstalled = packageManager.getInstalledPackages(PackageManager.GET_PERMISSIONS);
ArrayList<String> packageList = new ArrayList<>();
for(PackageInfo pkgInfo : packageInstalled)
packageList.add(pkgInfo.packageName);
NetworkManager.getInstance().getReports(v.getContext(),networkListener,packageList);
NetworkManager.getInstance().getReports(applistBinding.getRoot().getContext(),networkListener,packageList);
}
public void updateComplete() {
View v = getView();
if(v != null) {
LinearLayout layout = v.findViewById(R.id.layout_progress);
layout.setVisibility(View.GONE);
SwipeRefreshLayout refresh = v.findViewById(R.id.swipe_refresh);
refresh.setRefreshing(false);
RecyclerView app_list = v.findViewById(R.id.app_list);
if(packageManager != null && app_list.getAdapter() != null) {
((ApplicationListAdapter) app_list.getAdapter()).setPackageManager(packageManager);
app_list.getAdapter().notifyDataSetChanged();
if(applistBinding != null) {
applistBinding.layoutProgress.setVisibility(View.GONE);
applistBinding.swipeRefresh.setRefreshing(false);
if(packageManager != null && applistBinding.appList.getAdapter() != null) {
((ApplicationListAdapter) applistBinding.appList.getAdapter()).setPackageManager(packageManager);
}
}
}
@ -155,17 +148,14 @@ public class AppListFragment extends Fragment {
if(activity == null)
return;
activity.runOnUiThread(() -> {
View v = getView();
if (v == null)
if (applistBinding == null)
return;
TextView status = v.findViewById(R.id.status_progress);
if(maxProgress > 0)
status.setText(getString(resourceId)+" "+progress+"/"+maxProgress);
applistBinding.statusProgress.setText(getString(resourceId)+" "+progress+"/"+maxProgress);
else
status.setText(getString(resourceId));
ProgressBar progressBar = v.findViewById(R.id.progress);
progressBar.setMax(maxProgress);
progressBar.setProgress(progress);
applistBinding.statusProgress.setText(getString(resourceId));
applistBinding.progress.setMax(maxProgress);
applistBinding.progress.setProgress(progress);
});
}

View File

@ -23,6 +23,7 @@ import android.app.Fragment;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -32,6 +33,7 @@ import android.widget.ImageView;
import android.widget.TextView;
import org.eu.exodus_privacy.exodusprivacy.R;
import org.eu.exodus_privacy.exodusprivacy.databinding.ReportBinding;
import org.eu.exodus_privacy.exodusprivacy.manager.DatabaseManager;
import org.eu.exodus_privacy.exodusprivacy.objects.Report;
import org.eu.exodus_privacy.exodusprivacy.objects.Tracker;
@ -45,6 +47,7 @@ public class ReportFragment extends Fragment {
private PackageManager packageManager;
private PackageInfo packageInfo;
private ReportBinding reportBinding;
public static ReportFragment newInstance(PackageManager packageManager, PackageInfo packageInfo) {
ReportFragment fragment = new ReportFragment();
@ -62,70 +65,57 @@ public class ReportFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.report, container, false);
updateComplete(v);
return v;
reportBinding = DataBindingUtil.inflate(inflater,R.layout.report,container,false);
updateComplete();
return reportBinding.getRoot();
}
public void updateComplete(View v) {
if(v == null) {
v = getView();
if (v == null)
return;
}
Context context = v.getContext();
public void updateComplete() {
Context context = reportBinding.getRoot().getContext();
String packageName = packageInfo.packageName;
String versionName = packageInfo.versionName;
//setup logo
ImageView app_logo = v.findViewById(R.id.logo);
try {
app_logo.setImageDrawable(packageManager.getApplicationIcon(packageName));
reportBinding.logo.setImageDrawable(packageManager.getApplicationIcon(packageName));
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
//setup name
TextView app_name = v.findViewById(R.id.name);
app_name.setText(packageManager.getApplicationLabel(packageInfo.applicationInfo));
reportBinding.name.setText(packageManager.getApplicationLabel(packageInfo.applicationInfo));
//setup permissions number
TextView permissions_title = v.findViewById(R.id.permissions_title);
String permissions_text;
if (packageInfo.requestedPermissions != null && packageInfo.requestedPermissions.length > 0)
permissions_text = context.getString(R.string.permissions) + " " + String.valueOf(packageInfo.requestedPermissions.length);
else
permissions_text = context.getString(R.string.permissions);
permissions_title.setText(permissions_text);
reportBinding.permissionsTitle.setText(permissions_text);
//setup permissions list
WebView permissionList = v.findViewById(R.id.permissions);
//Build html permissions list
if (packageInfo.requestedPermissions != null && packageInfo.requestedPermissions.length > 0) {
List<String> requestedPermissions = Arrays.asList(packageInfo.requestedPermissions);
String html = buildHtmlList(requestedPermissions);
permissionList.loadData(html,"text/html","UTF-8");
reportBinding.permissions.loadData(html,"text/html","UTF-8");
} else {
permissionList.loadData(getString(R.string.no_permissions),"text/plain", "UTF-8");
reportBinding.permissions.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);
reportBinding.analysed.setVisibility(View.GONE);
reportBinding.trackersTitle.setVisibility(View.VISIBLE);
reportBinding.trackers.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);
reportBinding.analysed.setVisibility(View.VISIBLE);
reportBinding.trackersTitle.setVisibility(View.GONE);
reportBinding.trackers.setVisibility(View.GONE);
}
//setup trackers report
String trackers_text;
@ -133,7 +123,7 @@ public class ReportFragment extends Fragment {
trackers_text = context.getString(R.string.trackers)+" "+String.valueOf(trackers.size());
else
trackers_text = context.getString(R.string.trackers);
trackers_title.setText(trackers_text);
reportBinding.trackersTitle.setText(trackers_text);
//setup trackers lists
//build html tracker list
@ -143,36 +133,33 @@ public class ReportFragment extends Fragment {
trackersName.add(tracker.name);
}
String html = buildHtmlList(trackersName);
trackersList.loadData(html,"text/html","UTF-8");
reportBinding.trackers.loadData(html,"text/html","UTF-8");
} else {
trackersList.loadData(getString(R.string.no_trackers),"text/plain","UTF-8");
reportBinding.trackers.loadData(getString(R.string.no_trackers),"text/plain","UTF-8");
}
//setup creator
TextView creators = v.findViewById(R.id.creator);
if(report != null)
creators.setText(DatabaseManager.getInstance(context).getCreator(report.appId));
reportBinding.creator.setText(DatabaseManager.getInstance(context).getCreator(report.appId));
else
creators.setVisibility(View.GONE);
reportBinding.creator.setVisibility(View.GONE);
//setup installed
TextView installed = v.findViewById(R.id.installed_version);
String installed_str = context.getString(R.string.installed) +" "+ versionName;
installed.setText(installed_str);
reportBinding.installedVersion.setText(installed_str);
//setup reportversion
TextView reportVersion = v.findViewById(R.id.report_version);
reportBinding.reportVersion.setVisibility(View.VISIBLE);
if(report != null && !report.version.equals(versionName)) {
String report_str = context.getString(R.string.report_version)+" "+report.version;
reportVersion.setText(report_str);
reportBinding.reportVersion.setText(report_str);
}
else
reportVersion.setVisibility(View.GONE);
reportBinding.reportVersion.setVisibility(View.GONE);
//setup report url
TextView url = v.findViewById(R.id.report_url);
if(report != null)
url.setText("https://reports.exodus-privacy.eu.org/reports/"+report.id+"/");
reportBinding.reportUrl.setText("https://reports.exodus-privacy.eu.org/reports/"+report.id+"/");
}
private String buildHtmlList(List<String> list) {

View File

@ -1,68 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:gravity="center">
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
>
<data/>
<RelativeLayout
android:id="@+id/base_info"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/app_logo"
android:contentDescription="@string/app_logo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"/>
<LinearLayout
android:id="@+id/layout_infos"
android:orientation="vertical"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/app_tracker_nb"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/app_permission_nb"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:gravity="center">
</LinearLayout>
<RelativeLayout
android:id="@+id/base_info"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/app_logo"
android:contentDescription="@string/app_logo"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginRight="5dp"
android:layout_marginEnd="5dp"/>
<LinearLayout
android:id="@+id/layout_infos"
android:orientation="vertical"
android:layout_centerInParent="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/app_tracker_nb"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/app_permission_nb"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:layout_centerInParent="true"
android:layout_toRightOf="@+id/app_logo"
android:layout_toEndOf="@+id/app_logo"
android:layout_toLeftOf="@+id/layout_infos"
android:layout_toStartOf="@+id/layout_infos"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:id="@+id/app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<TextView
android:layout_centerInParent="true"
android:layout_toRightOf="@+id/app_logo"
android:layout_toEndOf="@+id/app_logo"
android:layout_toLeftOf="@+id/layout_infos"
android:layout_toStartOf="@+id/layout_infos"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:id="@+id/app_name"
android:layout_below="@+id/base_info"
android:id="@+id/other_version"
android:text="@string/tested"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_below="@+id/other_version"
android:id="@+id/analysed"
android:text="@string/analysed"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_below="@+id/analysed"
android:layout_alignParentBottom="true"
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="10dp" />
</RelativeLayout>
<TextView
android:layout_below="@+id/base_info"
android:id="@+id/other_version"
android:text="@string/tested"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_below="@+id/other_version"
android:id="@+id/analysed"
android:text="@string/analysed"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_below="@+id/analysed"
android:layout_alignParentBottom="true"
style="?android:attr/listSeparatorTextViewStyle"
android:layout_width="match_parent"
android:layout_height="10dp" />
</RelativeLayout>
</layout>

View File

@ -1,71 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.eu.exodus_privacy.exodusprivacy.MainActivity">
<LinearLayout
android:visibility="gone"
android:id="@+id/layout_progress"
tools:context="org.eu.exodus_privacy.exodusprivacy.MainActivity"
>
<data/>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="10dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="match_parent"
>
<LinearLayout
android:visibility="gone"
android:id="@+id/layout_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="10dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_marginBottom="5dp"
android:id="@+id/status_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ProgressBar
android:id="@+id/progress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:progressDrawable="@drawable/progressbar"
android:layout_width="match_parent"
android:layout_height="5dp" />
</LinearLayout>
<TextView
android:layout_marginBottom="5dp"
android:id="@+id/status_progress"
android:id="@+id/no_package_manager"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/no_package_manager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ProgressBar
android:id="@+id/progress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:progressDrawable="@drawable/progressbar"
<TextView
android:id="@+id/no_app_found"
android:layout_width="match_parent"
android:layout_height="5dp" />
</LinearLayout>
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/no_app_found"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/no_package_manager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/no_package_manager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_progress"
>
<TextView
android:id="@+id/no_app_found"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/no_app_found"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.v7.widget.RecyclerView
android:id="@+id/app_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_progress"
>
<android.support.v7.widget.RecyclerView
android:id="@+id/app_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
</layout>

View File

@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="org.eu.exodus_privacy.exodusprivacy.MainActivity">
<FrameLayout
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
tools:context="org.eu.exodus_privacy.exodusprivacy.MainActivity"
>
<data/>
<FrameLayout
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</layout>

View File

@ -1,116 +1,122 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:id="@+id/base_info"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
<layout xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<data/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/logo"
android:layout_width="100dp"
android:layout_height="100dp"
/>
android:layout_height="match_parent">
<LinearLayout
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:orientation="vertical"
android:orientation="horizontal"
android:id="@+id/base_info"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/name"
android:text="test"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:text="Creator"
android:id="@+id/creator"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:text="installed version"
android:id="@+id/installed_version"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:text="Report version"
android:id="@+id/report_version"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/report_url"
android:autoLink="web"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/analysed"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/logo"
android:layout_width="100dp"
android:layout_height="100dp"
/>
<LinearLayout
android:layout_marginLeft="2dp"
android:layout_marginStart="2dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/analysed"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
>
<TextView
android:id="@+id/name"
android:text="test"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:text="Creator"
android:id="@+id/creator"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:text="installed version"
android:id="@+id/installed_version"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:text="Report version"
android:id="@+id/report_version"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/report_url"
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>
</LinearLayout>
<ScrollView
android:layout_below="@id/base_info"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
>
<RelativeLayout
<LinearLayout
android:layout_below="@id/base_info"
android:layout_alignParentBottom="true"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:background="@color/colorPrimary"
android:id="@+id/trackers_title"
android:text="@string/trackers"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
/>
android:layout_height="match_parent"
android:layout_weight="50"
android:orientation="vertical">
<WebView
android:id="@+id/trackers"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
<TextView
android:id="@+id/trackers_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
android:text="@string/trackers"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white" />
<WebView
android:id="@+id/trackers"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_weight="50"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/trackers_title"
/>
android:layout_height="match_parent">
<TextView
android:background="@color/colorPrimary"
android:id="@+id/permissions_title"
android:text="@string/permissions"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
/>
<TextView
android:background="@color/colorPrimary"
android:id="@+id/permissions_title"
android:text="@string/permissions"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/trackers"
android:textColor="@android:color/white"
/>
<WebView
android:id="@+id/permissions"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/permissions_title"
/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
<WebView
android:id="@+id/permissions"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</layout>