Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #21] Delete unused/obsolete code related to the app icons. #1357

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
*/
public class LogRecyclerViewAdapter extends RecyclerView.Adapter<LogRecyclerViewAdapter.ViewHolder> {


private final List<LogData> logData;
private final Context context;
private LogData data;
Expand All @@ -58,55 +57,11 @@ public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder(mView);
}

/*private Bitmap getAppIcon(PackageManager mPackageManager, ApplicationInfo applicationInfo) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
return getAppIcon26(mPackageManager, applicationInfo);
}
try {
Drawable drawable = mPackageManager.getApplicationIcon(applicationInfo);
return ((BitmapDrawable) drawable).getBitmap();
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
}
return null;
}

@RequiresApi(api = Build.VERSION_CODES.O)
private Bitmap getAppIcon26(PackageManager mPackageManager, ApplicationInfo applicationInfo) {
Drawable drawable = mPackageManager.getApplicationIcon(applicationInfo);
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable) drawable).getBitmap();
} else if (drawable instanceof AdaptiveIconDrawable) {
Drawable backgroundDr = ((AdaptiveIconDrawable) drawable).getBackground();
Drawable foregroundDr = ((AdaptiveIconDrawable) drawable).getForeground();

Drawable[] drr = new Drawable[2];
drr[0] = backgroundDr;
drr[1] = foregroundDr;

LayerDrawable layerDrawable = new LayerDrawable(drr);

int width = layerDrawable.getIntrinsicWidth();
int height = layerDrawable.getIntrinsicHeight();

Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

Canvas canvas = new Canvas(bitmap);

layerDrawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
layerDrawable.draw(canvas);

return bitmap;
}

return null;
}*/

@Override
public void onBindViewHolder(ViewHolder holder, int position) {
data = logData.get(position);
PackageManager manager = context.getPackageManager();
holder.bind(logData.get(position),recyclerItemClickListener);
holder.bind(logData.get(position), recyclerItemClickListener);
try {
Drawable applicationIcon = Api.getApplicationIcon(context, data.getUid());
holder.icon.setBackground(applicationIcon);
Expand Down Expand Up @@ -149,7 +104,6 @@ public int getItemCount() {
return logData.size();
}


public static class ViewHolder extends RecyclerView.ViewHolder {

final ImageView icon;
Expand Down
56 changes: 0 additions & 56 deletions app/src/main/java/dev/ukanth/ufirewall/util/AppIconHelperV26.java

This file was deleted.

Loading