From 3b475a48fddb299caf29f93ee0cbfc2be460c1ae Mon Sep 17 00:00:00 2001 From: alperozturk Date: Fri, 13 Dec 2024 16:13:55 +0100 Subject: [PATCH] make items square Signed-off-by: alperozturk --- .../ui/adapter/RecommendedFilesAdapter.kt | 17 ++++++++++- app/src/main/res/layout/list_header.xml | 4 +++ .../layout/recommended_files_list_item.xml | 30 ++++++++----------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/owncloud/android/ui/adapter/RecommendedFilesAdapter.kt b/app/src/main/java/com/owncloud/android/ui/adapter/RecommendedFilesAdapter.kt index 24a31dc701..571549c407 100644 --- a/app/src/main/java/com/owncloud/android/ui/adapter/RecommendedFilesAdapter.kt +++ b/app/src/main/java/com/owncloud/android/ui/adapter/RecommendedFilesAdapter.kt @@ -8,11 +8,13 @@ package com.owncloud.android.ui.adapter import android.content.Context +import android.content.res.ColorStateList import android.graphics.Bitmap import android.graphics.Color import android.graphics.drawable.ColorDrawable import android.view.LayoutInflater import android.view.ViewGroup +import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat import androidx.recyclerview.widget.RecyclerView import com.owncloud.android.R @@ -64,9 +66,22 @@ class RecommendedFilesAdapter( val item = recommendations[position] holder.binding.name.text = item.name - holder.binding.timestamp.text = DisplayUtils.getRelativeTimestamp(context, item.timestamp) + // holder.binding.timestamp.text = DisplayUtils.getRelativeTimestamp(context, item.timestamp) val thumbnail = getThumbnail(item) + + /* + val centerPixel = thumbnail.getPixel(thumbnail.width / 2, thumbnail.height / 2) + + val redValue = Color.red(centerPixel) + val blueValue = Color.blue(centerPixel) + val greenValue = Color.green(centerPixel) + + val centerColor = Color.argb(0.8f, redValue.toFloat(), greenValue.toFloat(), blueValue.toFloat()) + */ + + val containerColor = ContextCompat.getColor(context, R.color.primary) + holder.binding.container.backgroundTintList = ColorStateList.valueOf(containerColor) holder.binding.icon.setImageBitmap(thumbnail) } diff --git a/app/src/main/res/layout/list_header.xml b/app/src/main/res/layout/list_header.xml index 700e506c17..90d7a09e83 100644 --- a/app/src/main/res/layout/list_header.xml +++ b/app/src/main/res/layout/list_header.xml @@ -27,11 +27,15 @@ diff --git a/app/src/main/res/layout/recommended_files_list_item.xml b/app/src/main/res/layout/recommended_files_list_item.xml index 3b9b48cec6..906cfc1847 100644 --- a/app/src/main/res/layout/recommended_files_list_item.xml +++ b/app/src/main/res/layout/recommended_files_list_item.xml @@ -5,37 +5,33 @@ ~ SPDX-License-Identifier: AGPL-3.0-or-later --> - + android:gravity="center"> - -