mirror of
https://github.com/nextcloud/android.git
synced 2024-11-22 21:25:35 +03:00
show two tags
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
eaf8462fe1
commit
c72354bd3e
4 changed files with 48 additions and 21 deletions
|
@ -23,6 +23,7 @@ package com.owncloud.android.ui.adapter
|
|||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import com.owncloud.android.ui.AvatarGroupLayout
|
||||
|
||||
|
@ -32,6 +33,8 @@ internal interface ListItemViewHolder : ListGridItemViewHolder {
|
|||
val lastModification: TextView
|
||||
val overflowMenu: ImageView
|
||||
val sharedAvatars: AvatarGroupLayout
|
||||
val tag: TextView
|
||||
val firstTag: TextView
|
||||
val secondTag: TextView
|
||||
val tagMore: TextView
|
||||
val fileDetailGroup: LinearLayout
|
||||
}
|
||||
|
|
|
@ -417,19 +417,27 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
|||
|
||||
// tags
|
||||
if (file.getTags().isEmpty()) {
|
||||
holder.getTag().setVisibility(View.GONE);
|
||||
holder.getFirstTag().setVisibility(View.GONE);
|
||||
holder.getSecondTag().setVisibility(View.GONE);
|
||||
holder.getTagMore().setVisibility(View.GONE);
|
||||
holder.getFileDetailGroup().setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
holder.getTag().setVisibility(View.VISIBLE);
|
||||
|
||||
holder.getTag().setText(file.getTags().get(0));
|
||||
holder.getFileDetailGroup().setVisibility(View.GONE);
|
||||
holder.getSecondTag().setVisibility(View.GONE);
|
||||
holder.getTagMore().setVisibility(View.GONE);
|
||||
holder.getFirstTag().setVisibility(View.VISIBLE);
|
||||
|
||||
holder.getFirstTag().setText(file.getTags().get(0));
|
||||
|
||||
if (file.getTags().size() > 1) {
|
||||
holder.getSecondTag().setVisibility(View.VISIBLE);
|
||||
holder.getSecondTag().setText(file.getTags().get(1));
|
||||
}
|
||||
|
||||
if (file.getTags().size() > 2) {
|
||||
holder.getTagMore().setVisibility(View.VISIBLE);
|
||||
holder.getTagMore().setText(String.format(activity.getString(R.string.tags_more),
|
||||
(file.getTags().size() - 1)));
|
||||
} else {
|
||||
holder.getTagMore().setVisibility(View.GONE);
|
||||
(file.getTags().size() - 2)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ package com.owncloud.android.ui.adapter
|
|||
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.elyeproj.loaderviewlibrary.LoaderImageView
|
||||
|
@ -48,10 +49,14 @@ internal class OCFileListItemViewHolder(private var binding: ListItemBinding) :
|
|||
get() = binding.Filename
|
||||
override val thumbnail: ImageView
|
||||
get() = binding.thumbnailLayout.thumbnail
|
||||
override val tag: TextView
|
||||
get() = binding.tag
|
||||
override val firstTag: TextView
|
||||
get() = binding.firstTag
|
||||
override val secondTag: TextView
|
||||
get() = binding.secondTag
|
||||
override val tagMore: TextView
|
||||
get() = binding.tagMore
|
||||
override val fileDetailGroup: LinearLayout
|
||||
get() = binding.fileDetailGroup
|
||||
|
||||
override fun showVideoOverlay() {
|
||||
binding.thumbnailLayout.videoOverlay.visibility = View.VISIBLE
|
||||
|
|
|
@ -96,36 +96,47 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/tag"
|
||||
android:id="@+id/firstTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/standard_eighth_margin"
|
||||
android:checkable="false"
|
||||
android:ellipsize="middle"
|
||||
android:textColor="@color/list_item_lastmod_and_filesize_text"
|
||||
android:textSize="@dimen/two_line_secondary_text_size"
|
||||
app:chipStartPadding="@dimen/standard_eighth_margin"
|
||||
app:chipEndPadding="@dimen/standard_eighth_margin"
|
||||
app:chipBackgroundColor="@color/bg_default"
|
||||
app:chipEndPadding="@dimen/standard_eighth_margin"
|
||||
app:chipStartPadding="@dimen/standard_eighth_margin" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/secondTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/standard_eighth_margin"
|
||||
android:checkable="false"
|
||||
android:ellipsize="middle" />
|
||||
android:ellipsize="middle"
|
||||
android:textColor="@color/list_item_lastmod_and_filesize_text"
|
||||
android:textSize="@dimen/two_line_secondary_text_size"
|
||||
app:chipBackgroundColor="@color/bg_default"
|
||||
app:chipEndPadding="@dimen/standard_eighth_margin"
|
||||
app:chipStartPadding="@dimen/standard_eighth_margin" />
|
||||
|
||||
<com.google.android.material.chip.Chip
|
||||
android:id="@+id/tag_more"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/standard_eighth_margin"
|
||||
android:layout_marginEnd="@dimen/standard_eighth_margin"
|
||||
android:checkable="false"
|
||||
android:textColor="@color/list_item_lastmod_and_filesize_text"
|
||||
android:textSize="@dimen/two_line_secondary_text_size"
|
||||
app:chipStartPadding="@dimen/standard_eighth_margin"
|
||||
app:chipEndPadding="@dimen/standard_eighth_margin"
|
||||
app:chipBackgroundColor="@color/bg_default"
|
||||
android:layout_weight="1" />
|
||||
app:chipEndPadding="@dimen/standard_eighth_margin"
|
||||
app:chipStartPadding="@dimen/standard_eighth_margin" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/file_detail_group"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:layout_weight="1">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/file_size"
|
||||
|
|
Loading…
Reference in a new issue