Merge pull request #11611 from nextcloud/feature/noid/tagsPolishing

Tags polishing
This commit is contained in:
Andy Scherzinger 2023-05-12 17:03:44 +02:00 committed by GitHub
commit aa55dd6390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 10 deletions

View file

@ -367,7 +367,7 @@ dependencies {
// upon each update first test: new registration, receive push
gplayImplementation "com.google.firebase:firebase-messaging:23.1.2"
implementation 'com.github.nextcloud.android-common:ui:0.8.0'
implementation 'com.github.nextcloud.android-common:ui:0.10.0'
implementation "androidx.room:room-runtime:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"

View file

@ -25,6 +25,7 @@ import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup
import com.owncloud.android.ui.AvatarGroupLayout
@ -35,8 +36,8 @@ internal interface ListItemViewHolder : ListGridItemViewHolder {
val overflowMenu: ImageView
val sharedAvatars: AvatarGroupLayout
val tagsGroup: ChipGroup
val firstTag: TextView
val secondTag: TextView
val tagMore: TextView
val firstTag: Chip
val secondTag: Chip
val tagMore: Chip
val fileDetailGroup: LinearLayout
}

View file

@ -425,6 +425,7 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
} else {
holder.getTagsGroup().setVisibility(View.VISIBLE);
holder.getFileDetailGroup().setVisibility(View.GONE);
viewThemeUtils.material.themeChipSuggestion(holder.getFirstTag());
holder.getFirstTag().setVisibility(View.VISIBLE);
holder.getSecondTag().setVisibility(View.GONE);
holder.getTagMore().setVisibility(View.GONE);
@ -432,11 +433,13 @@ public class OCFileListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
holder.getFirstTag().setText(file.getTags().get(0));
if (file.getTags().size() > 1) {
viewThemeUtils.material.themeChipSuggestion(holder.getSecondTag());
holder.getSecondTag().setVisibility(View.VISIBLE);
holder.getSecondTag().setText(file.getTags().get(1));
}
if (file.getTags().size() > 2) {
viewThemeUtils.material.themeChipSuggestion(holder.getTagMore());
holder.getTagMore().setVisibility(View.VISIBLE);
holder.getTagMore().setText(String.format(activity.getString(R.string.tags_more),
(file.getTags().size() - 2)));

View file

@ -27,6 +27,7 @@ import android.widget.LinearLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.elyeproj.loaderviewlibrary.LoaderImageView
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup
import com.owncloud.android.databinding.ListItemBinding
import com.owncloud.android.ui.AvatarGroupLayout
@ -52,11 +53,11 @@ internal class OCFileListItemViewHolder(private var binding: ListItemBinding) :
get() = binding.thumbnailLayout.thumbnail
override val tagsGroup: ChipGroup
get() = binding.tagsGroup
override val firstTag: TextView
override val firstTag: Chip
get() = binding.firstTag
override val secondTag: TextView
override val secondTag: Chip
get() = binding.secondTag
override val tagMore: TextView
override val tagMore: Chip
get() = binding.tagMore
override val fileDetailGroup: LinearLayout
get() = binding.fileDetailGroup

View file

@ -242,8 +242,11 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
chip.setText(tag);
chip.setChipBackgroundColor(ColorStateList.valueOf(getResources().getColor(R.color.bg_default,
context.getTheme())));
chip.setTextColor(getResources().getColor(R.color.list_item_lastmod_and_filesize_text,
context.getTheme()));
chip.setShapeAppearanceModel(chip.getShapeAppearanceModel().toBuilder().setAllCornerSizes((100.0f))
.build());
chip.setEnsureMinTouchTargetSize(false);
chip.setClickable(false);
viewThemeUtils.material.themeChipSuggestion(chip);
binding.tagsGroup.addView(chip);
}
}

View file

@ -116,7 +116,8 @@
android:id="@+id/tagsGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
android:paddingTop="@dimen/standard_half_padding"
app:chipSpacingVertical="@dimen/standard_half_padding" />
</LinearLayout>