diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-06-09 23:40:51 +0300 |
---|---|---|
committer | Niedermann IT-Dienstleistungen <stefan-niedermann@users.noreply.github.com> | 2020-06-09 23:43:05 +0300 |
commit | c8930e90ef317827a0612d78ec28189962d415c5 (patch) | |
tree | 428c0299b31b71b99d733a668e0cf14d848333ed /app/src/main | |
parent | db517049b09ff86ffbdfe9394c5cde060c73b037 (diff) |
Fix #374 Title and category should be centered if no excerpt is given
Diffstat (limited to 'app/src/main')
3 files changed, 19 insertions, 20 deletions
diff --git a/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java b/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java index 239dc146..21eece55 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java @@ -81,10 +81,10 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> i return new SectionViewHolder(ItemNotesListSectionItemBinding.inflate(LayoutInflater.from(parent.getContext()))); } case TYPE_NOTE_WITH_EXCERPT: { - return new NoteViewHolderWithExcerpt(ItemNotesListNoteItemWithExcerptBinding.inflate(LayoutInflater.from(parent.getContext())), noteClickListener); + return new NoteViewHolderWithExcerpt(ItemNotesListNoteItemWithExcerptBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false), noteClickListener); } case TYPE_NOTE_WITHOUT_EXCERPT: { - return new NoteViewHolderWithoutExcerpt(inflate(LayoutInflater.from(parent.getContext())), noteClickListener); + return new NoteViewHolderWithoutExcerpt(inflate(LayoutInflater.from(parent.getContext()), parent, false), noteClickListener); } default: { throw new IllegalArgumentException("Not supported viewType: " + viewType); diff --git a/app/src/main/res/layout/item_notes_list_note_item_with_excerpt.xml b/app/src/main/res/layout/item_notes_list_note_item_with_excerpt.xml index ba88af2a..fe4d8b0b 100644 --- a/app/src/main/res/layout/item_notes_list_note_item_with_excerpt.xml +++ b/app/src/main/res/layout/item_notes_list_note_item_with_excerpt.xml @@ -27,16 +27,16 @@ android:contentDescription="@string/menu_delete" app:srcCompat="@drawable/ic_delete_white_32dp" /> - <androidx.appcompat.widget.LinearLayoutCompat + <LinearLayout android:id="@+id/noteSwipeable" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/list_item_background_selector"> + android:background="@drawable/list_item_background_selector" + android:baselineAligned="false"> <FrameLayout android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_centerVertical="true"> + android:layout_height="match_parent"> <ImageView android:id="@+id/noteFavorite" @@ -60,8 +60,8 @@ </FrameLayout> - <androidx.appcompat.widget.LinearLayoutCompat - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" @@ -72,13 +72,13 @@ android:paddingRight="@dimen/spacer_2x" android:paddingBottom="@dimen/spacer_2x"> - <androidx.appcompat.widget.LinearLayoutCompat + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/noteTitle" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:ellipsize="end" @@ -86,19 +86,17 @@ android:textColor="?android:textColorPrimary" android:textSize="@dimen/primary_font_size" tools:text="@tools:sample/lorem/random" /> - </androidx.appcompat.widget.LinearLayoutCompat> + </LinearLayout> - <androidx.appcompat.widget.LinearLayoutCompat + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/noteExcerpt" - android:layout_width="wrap_content" + android:layout_width="0dp" android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:layout_alignParentLeft="true" android:layout_weight="1" android:ellipsize="end" android:maxLines="1" @@ -111,8 +109,6 @@ android:id="@+id/noteCategory" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:layout_alignParentRight="true" android:layout_marginStart="@dimen/spacer_1x" android:layout_marginLeft="@dimen/spacer_1x" android:background="@drawable/border" @@ -126,8 +122,8 @@ android:textSize="@dimen/secondary_font_size" tools:maxLength="15" tools:text="@tools:sample/lorem/random" /> - </androidx.appcompat.widget.LinearLayoutCompat> - </androidx.appcompat.widget.LinearLayoutCompat> - </androidx.appcompat.widget.LinearLayoutCompat> + </LinearLayout> + </LinearLayout> + </LinearLayout> </FrameLayout> diff --git a/app/src/main/res/layout/item_notes_list_note_item_without_excerpt.xml b/app/src/main/res/layout/item_notes_list_note_item_without_excerpt.xml index 6645dc2e..cf61752d 100644 --- a/app/src/main/res/layout/item_notes_list_note_item_without_excerpt.xml +++ b/app/src/main/res/layout/item_notes_list_note_item_without_excerpt.xml @@ -64,6 +64,8 @@ android:id="@+id/noteTitle" android:layout_width="0dp" android:layout_height="wrap_content" + android:layout_marginTop="10sp" + android:layout_marginBottom="10sp" android:layout_weight="1" android:ellipsize="end" android:maxLines="1" @@ -79,6 +81,7 @@ android:layout_height="wrap_content" android:layout_marginStart="@dimen/spacer_1x" android:layout_marginLeft="@dimen/spacer_1x" + android:layout_marginTop="1dp" android:layout_marginEnd="@dimen/spacer_2x" android:layout_marginRight="@dimen/spacer_2x" android:background="@drawable/border" |