diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java index cd5eb4067b..54284aa557 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java +++ b/app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java @@ -16,6 +16,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.content.ContentValues; import android.content.res.Resources; +import android.graphics.Bitmap; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; @@ -32,8 +33,10 @@ import android.widget.LinearLayout; import com.elyeproj.loaderviewlibrary.LoaderImageView; import com.nextcloud.android.common.ui.theme.utils.ColorRole; import com.nextcloud.client.account.User; +import com.nextcloud.client.database.entity.OfflineOperationEntity; import com.nextcloud.client.jobs.upload.FileUploadHelper; import com.nextcloud.client.preferences.AppPreferences; +import com.nextcloud.model.OfflineOperationType; import com.nextcloud.model.OCFileFilterType; import com.nextcloud.utils.extensions.ViewExtensionsKt; import com.owncloud.android.MainApp; @@ -67,6 +70,7 @@ import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.fragment.SearchType; import com.owncloud.android.ui.interfaces.OCFileListFragmentInterface; import com.owncloud.android.ui.preview.PreviewTextFragment; +import com.owncloud.android.utils.BitmapUtils; import com.owncloud.android.utils.DisplayUtils; import com.owncloud.android.utils.FileSortOrder; import com.owncloud.android.utils.FileStorageUtils; @@ -164,7 +168,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter private constructor } + public static Bitmap addColorFilter(Bitmap originalBitmap, int filterColor, int opacity) { + int width = originalBitmap.getWidth(); + int height = originalBitmap.getHeight(); + + Bitmap resultBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); + Canvas canvas = new Canvas(resultBitmap); + + canvas.drawBitmap(originalBitmap, 0, 0, null); + + Paint paint = new Paint(); + paint.setColor(filterColor); + + paint.setAlpha(opacity); + + paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_ATOP)); + canvas.drawRect(0, 0, width, height, paint); + + return resultBitmap; + } + /** * Decodes a bitmap from a file containing it minimizing the memory use, known that the bitmap will be drawn in a * surface of reqWidth x reqHeight