Restore OCFileListGridImageViewHolder

Changed in #10079. Not sure why it was changed this way but it causes crashes.

Signed-off-by: Álvaro Brey <alvaro.brey@nextcloud.com>
This commit is contained in:
Álvaro Brey 2022-10-19 15:51:56 +02:00
parent 9b3c8510a1
commit dea4c2f530
No known key found for this signature in database
GPG key ID: 2585783189A62105
4 changed files with 115 additions and 42 deletions

View file

@ -1,33 +0,0 @@
/*
*
* Nextcloud Android client application
*
* @author Tobias Kaminsky
* Copyright (C) 2022 Tobias Kaminsky
* Copyright (C) 2022 Nextcloud GmbH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.owncloud.android.ui.adapter
import android.widget.ImageView
import com.afollestad.sectionedrecyclerview.SectionedViewHolder
import com.owncloud.android.databinding.GridImageBinding
class GalleryItemViewHolder(val binding: GridImageBinding) :
SectionedViewHolder(binding.root) {
val thumbnail: ImageView
get() = binding.thumbnail
}

View file

@ -21,14 +21,40 @@
*/
package com.owncloud.android.ui.adapter
import android.view.View
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.elyeproj.loaderviewlibrary.LoaderImageView
import com.owncloud.android.databinding.GridImageBinding
internal class OCFileListGridImageViewHolder(var binding: GridImageBinding) :
RecyclerView.ViewHolder(
binding.root
) {
val thumbnail: ImageView
),
ListGridImageViewHolder {
override val thumbnail: ImageView
get() = binding.thumbnail
override fun showVideoOverlay() {
// noop
}
override val shimmerThumbnail: LoaderImageView
get() = binding.thumbnailShimmer
override val favorite: ImageView
get() = binding.favoriteAction
override val localFileIndicator: ImageView
get() = binding.localFileIndicator
override val shared: ImageView
get() = binding.sharedIcon
override val checkbox: ImageView
get() = binding.customCheckbox
override val itemLayout: View
get() = binding.ListItemLayout
override val unreadComments: ImageView
get() = binding.unreadComments
init {
binding.favoriteAction.drawable.mutate()
}
}

View file

@ -15,12 +15,87 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/thumbnail"
android:layout_width="wrap_content"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ListItemLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:contentDescription="@null"
android:scaleType="centerCrop"
android:src="@drawable/file_image" />
android:layout_gravity="center_horizontal"
android:foreground="?android:attr/selectableItemBackground"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.elyeproj.loaderviewlibrary.LoaderImageView
android:id="@+id/thumbnail_shimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="@dimen/grid_image_icon_margin"
android:contentDescription="@null"
android:visibility="gone"
app:corners="6"
app:height_weight="0.6"
app:width_weight="0.4" />
<com.owncloud.android.ui.SquareImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:padding="@dimen/grid_image_icon_padding"
android:scaleType="centerCrop"
android:src="@drawable/file_image" />
<ImageView
android:id="@+id/favorite_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_margin="@dimen/standard_quarter_margin"
android:contentDescription="@string/favorite_icon"
android:visibility="gone"
android:src="@drawable/favorite" />
<ImageView
android:id="@+id/sharedIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:contentDescription="@string/shared_icon_shared_via_link"
android:src="@drawable/shared_via_link" />
<ImageView
android:id="@+id/unreadComments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|end"
android:layout_marginTop="@dimen/grid_image_shared_icon_layout_top_margin"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:clickable="true"
android:contentDescription="@string/unread_comments"
android:focusable="true"
android:src="@drawable/ic_comment_grid"
android:visibility="gone" />
<ImageView
android:id="@+id/localFileIndicator"
android:layout_width="@dimen/grid_image_local_file_indicator_layout_width"
android:layout_height="@dimen/grid_image_local_file_indicator_layout_height"
android:layout_gravity="bottom|end"
android:layout_marginTop="@dimen/standard_quarter_margin"
android:layout_marginEnd="@dimen/standard_quarter_margin"
android:layout_marginBottom="@dimen/standard_quarter_margin"
android:contentDescription="@string/synced_icon"
android:src="@drawable/ic_synced" />
<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|top"
android:layout_marginLeft="@dimen/standard_quarter_margin"
android:layout_marginRight="@dimen/standard_quarter_margin"
android:contentDescription="@string/checkbox"
android:src="@android:drawable/checkbox_off_background" />
</FrameLayout>

View file

@ -106,6 +106,11 @@
<dimen name="contactlist_item_icon_layout_height">40dp</dimen>
<dimen name="empty_list_icon_layout_width">72dp</dimen>
<dimen name="empty_list_icon_layout_height">72dp</dimen>
<dimen name="grid_image_shared_icon_layout_top_margin">24dp</dimen>
<dimen name="grid_image_local_file_indicator_layout_width">16dp</dimen>
<dimen name="grid_image_local_file_indicator_layout_height">16dp</dimen>
<dimen name="grid_image_icon_margin">14dp</dimen>
<dimen name="grid_image_icon_padding">14dp</dimen>
<dimen name="grid_item_shared_icon_layout_top_margin">24dp</dimen>
<dimen name="grid_item_local_file_indicator_layout_width">16dp</dimen>
<dimen name="grid_item_local_file_indicator_layout_height">16dp</dimen>