diff --git a/README.md b/README.md index a0ad9196..c308848d 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,13 @@ Translations: Please note that you agree to the license below by contributing, including the copyright. +Attribution +----------- + +NetGuard uses: + +* [Picasso](http://square.github.io/picasso/) +* [Android Support Library](https://developer.android.com/tools/support-library/index.html) License ------- diff --git a/app/app.iml b/app/app.iml index 3ddd50b4..3aa6d96f 100644 --- a/app/app.iml +++ b/app/app.iml @@ -94,6 +94,7 @@ + \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 2d93e53b..7da8d62a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,4 +37,5 @@ dependencies { testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.0' compile 'com.android.support:recyclerview-v7:23.1.0' + compile 'com.squareup.picasso:picasso:2.5.2' } diff --git a/app/src/main/java/eu/faircode/netguard/Rule.java b/app/src/main/java/eu/faircode/netguard/Rule.java index a28ebb5b..831408a6 100644 --- a/app/src/main/java/eu/faircode/netguard/Rule.java +++ b/app/src/main/java/eu/faircode/netguard/Rule.java @@ -69,10 +69,6 @@ public class Rule implements Comparable { return listRules; } - public Drawable getIcon(Context context) { - return info.applicationInfo.loadIcon(context.getPackageManager()); - } - @Override public int compareTo(Rule other) { if ((changed || unused) == (other.changed || other.unused)) { diff --git a/app/src/main/java/eu/faircode/netguard/RuleAdapter.java b/app/src/main/java/eu/faircode/netguard/RuleAdapter.java index 3d81d386..6405124e 100644 --- a/app/src/main/java/eu/faircode/netguard/RuleAdapter.java +++ b/app/src/main/java/eu/faircode/netguard/RuleAdapter.java @@ -4,6 +4,8 @@ import android.content.Context; import android.content.SharedPreferences; import android.content.res.TypedArray; import android.graphics.Color; +import android.net.Uri; +import android.os.AsyncTask; import android.preference.PreferenceManager; import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; @@ -20,6 +22,8 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import com.squareup.picasso.Picasso; + import java.util.ArrayList; import java.util.List; @@ -134,7 +138,13 @@ public class RuleAdapter extends RecyclerView.Adapter im if (rule.disabled) color = Color.argb(100, Color.red(color), Color.green(color), Color.blue(color)); - holder.ivIcon.setImageDrawable(rule.getIcon(context)); + if (rule.info.applicationInfo.icon == 0) + Picasso.with(context).load(android.R.drawable.sym_def_app_icon).into(holder.ivIcon); + else { + Uri uri = Uri.parse("android.resource://" + rule.info.packageName + "/" + rule.info.applicationInfo.icon); + Picasso.with(context).load(uri).into(holder.ivIcon); + } + holder.ivExpander.setImageResource(rule.attributes ? android.R.drawable.arrow_up_float : android.R.drawable.arrow_down_float); holder.llApplication.setOnClickListener(llListener); holder.tvName.setText(rule.name);