diff --git a/app/build.gradle b/app/build.gradle index 25b613ea5..b12712c05 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -118,8 +118,10 @@ dependencies { exclude group: 'org.ogce', module: 'xpp3' } + implementation("com.github.nextcloud.android-common:ui:$nextcloudAndroidCommonLib") + implementation("com.github.nextcloud.android-common:core:$nextcloudAndroidCommonLib") + // Nextcloud SSO - implementation 'com.github.nextcloud.android-common:ui:0.28.0' implementation("com.github.nextcloud:Android-SingleSignOn:$singleSignOnVersion") { version { strictly(singleSignOnVersion) @@ -173,6 +175,14 @@ dependencies { testImplementation 'org.robolectric:robolectric:4.16' } +configurations.configureEach { + resolutionStrategy.eachDependency { details -> + if (details.requested.group == "com.github.nextcloud.android-common") { + details.useVersion(nextcloudAndroidCommonLib) + } + } +} + // Run the compiler as a separate process tasks.withType(JavaCompile).configureEach { options.fork = true diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/ItemAdapter.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/ItemAdapter.java index c7466c312..48ceea073 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/ItemAdapter.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/ItemAdapter.java @@ -181,6 +181,7 @@ public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int ((ImageView) holder.itemView.findViewById(R.id.custom_checkbox)).setImageResource(R.drawable.ic_checkbox_blank_outline); } holder.itemView.findViewById(R.id.custom_checkbox).setVisibility(isMultiSelect ? View.VISIBLE : View.GONE); + holder.itemView.findViewById(R.id.noteFavorite).setVisibility(isMultiSelect ? View.GONE : View.VISIBLE); ((NoteViewHolder) holder).bind(isSelected, (Note) itemList.get(position), showCategory, color, searchQuery); } } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java index ec2ae21a6..54f0afdad 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java @@ -25,8 +25,11 @@ import androidx.recyclerview.widget.RecyclerView; import com.google.android.material.chip.Chip; +import com.nextcloud.android.common.core.utils.DateFormatter; import com.nextcloud.android.common.ui.theme.utils.ColorRole; +import java.util.Calendar; + import it.niedermann.owncloud.notes.R; import it.niedermann.owncloud.notes.branding.BrandingUtil; import it.niedermann.owncloud.notes.persistence.entity.Note; @@ -37,10 +40,14 @@ public abstract class NoteViewHolder extends RecyclerView.ViewHolder { @NonNull private final NoteClickListener noteClickListener; + @NonNull + private final DateFormatter dateFormatter; + public NoteViewHolder(@NonNull View v, @NonNull NoteClickListener noteClickListener) { super(v); this.noteClickListener = noteClickListener; this.setIsRecyclable(false); + this.dateFormatter = new DateFormatter(v.getContext()); } @CallSuper @@ -50,6 +57,15 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, @ itemView.setOnClickListener((view) -> noteClickListener.onNoteClick(getLayoutPosition(), view)); } + protected void bindModified(@NonNull TextView noteModified, @Nullable Calendar modified) { + if (modified != null && modified.getTimeInMillis() > 0) { + noteModified.setText(dateFormatter.getConditionallyRelativeFormattedTimeSpan(modified)); + noteModified.setVisibility(VISIBLE); + } else { + noteModified.setVisibility(INVISIBLE); + } + } + protected void bindStatus(AppCompatImageView noteStatus, DBStatus status, int color) { noteStatus.setVisibility(DBStatus.VOID.equals(status) ? INVISIBLE : VISIBLE); diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolder.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolder.java index 8e2cb5401..e9760a313 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolder.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolder.java @@ -52,6 +52,7 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, @ bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), color); bindStatus(binding.noteStatus, note.getStatus(), color); bindFavorite(binding.noteFavorite, note.getFavorite()); + bindModified(binding.noteModified, note.getModified()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color); bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt().replace(EXCERPT_LINE_SEPARATOR, "\n"), color); binding.noteExcerpt.setVisibility(TextUtils.isEmpty(note.getExcerpt()) ? GONE : VISIBLE); diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolderOnlyTitle.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolderOnlyTitle.java index b9fe26d59..49fd8a819 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolderOnlyTitle.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolderOnlyTitle.java @@ -41,8 +41,10 @@ public void showSwipe(boolean left) { public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, int color, @Nullable CharSequence searchQuery) { super.bind(isSelected, note, showCategory, color, searchQuery); @NonNull final Context context = itemView.getContext(); + bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), color); bindStatus(binding.noteStatus, note.getStatus(), color); bindFavorite(binding.noteFavorite, note.getFavorite()); + bindModified(binding.noteModified, note.getModified()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color); } diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithExcerpt.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithExcerpt.java index 0951d13f9..892ab456e 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithExcerpt.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithExcerpt.java @@ -41,6 +41,7 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, @ bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), color); bindStatus(binding.noteStatus, note.getStatus(), color); bindFavorite(binding.noteFavorite, note.getFavorite()); + bindModified(binding.noteModified, note.getModified()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color); bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt(), color); diff --git a/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithoutExcerpt.java b/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithoutExcerpt.java index 07ad5aaad..70a4da13b 100644 --- a/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithoutExcerpt.java +++ b/app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithoutExcerpt.java @@ -41,6 +41,7 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, i bindCategory(context, binding.noteCategory, showCategory, note.getCategory(), color); bindStatus(binding.noteStatus, note.getStatus(), color); bindFavorite(binding.noteFavorite, note.getFavorite()); + bindModified(binding.noteModified, note.getModified()); bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color); } diff --git a/app/src/main/res/layout/item_notes_list_note_item_grid.xml b/app/src/main/res/layout/item_notes_list_note_item_grid.xml index 46c953d6b..4f881bc77 100644 --- a/app/src/main/res/layout/item_notes_list_note_item_grid.xml +++ b/app/src/main/res/layout/item_notes_list_note_item_grid.xml @@ -49,8 +49,6 @@ + + - + android:layout_marginTop="@dimen/spacer_2x" + android:orientation="vertical"> - - + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_notes_list_note_item_grid_only_title.xml b/app/src/main/res/layout/item_notes_list_note_item_grid_only_title.xml index 0385484c8..6d33a561a 100644 --- a/app/src/main/res/layout/item_notes_list_note_item_grid_only_title.xml +++ b/app/src/main/res/layout/item_notes_list_note_item_grid_only_title.xml @@ -15,62 +15,110 @@ app:cardCornerRadius="@dimen/card_radius"> + android:layout_height="wrap_content" + android:layout_marginBottom="@dimen/spacer_2x" + android:orientation="vertical"> - + - + android:layout_marginHorizontal="@dimen/spacer_2x" + android:layout_marginTop="@dimen/spacer_2x" + android:hyphenationFrequency="full" + android:textAppearance="?attr/textAppearanceHeadline5" + android:textColor="@color/fg_default" + tools:maxLength="50" + tools:text="@tools:sample/lorem/random" /> + + - + + + + + + + + + + + - + android:layout_marginTop="@dimen/spacer_2x" + android:orientation="vertical"> - + - + + + + - \ No newline at end of file + + 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 1d1d17b7f..2bff2f604 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 @@ -9,11 +9,11 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/noteSwipeFrame" - android:clickable="true" - android:focusable="true" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/bg_attention"> + android:background="@color/bg_attention" + android:clickable="true" + android:focusable="true"> @@ -39,6 +39,7 @@ android:layout_height="wrap_content" android:background="@drawable/list_item_background_selector" android:baselineAligned="false" + android:gravity="center_vertical" android:paddingStart="@dimen/spacer_activity_sides" android:paddingEnd="@null"> @@ -48,13 +49,23 @@ + + - + + + @@ -115,8 +135,8 @@ android:layout_marginStart="@dimen/spacer_1x" android:background="@drawable/border" android:maxLines="1" - android:paddingVertical="1dp" android:paddingHorizontal="@dimen/spacer_1x" + android:paddingVertical="1dp" android:singleLine="true" android:textColor="?android:textColorPrimary" android:textSize="@dimen/secondary_font_size" @@ -125,17 +145,5 @@ - - 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 2eed4a816..a8ae9c73e 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 @@ -27,7 +27,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="end|center_vertical" - android:layout_marginEnd="@dimen/button_padding" + android:layout_marginEnd="@dimen/spacer_2x" android:contentDescription="@string/menu_delete" app:srcCompat="@drawable/ic_delete_white_24dp" /> @@ -47,13 +47,23 @@ + + - + android:orientation="horizontal" + android:paddingStart="@dimen/zero" + android:paddingEnd="@dimen/spacer_2x"> - + - - + + + + + diff --git a/app/src/main/res/layout/item_notes_list_section_item.xml b/app/src/main/res/layout/item_notes_list_section_item.xml index c2a434886..71f9935e8 100644 --- a/app/src/main/res/layout/item_notes_list_section_item.xml +++ b/app/src/main/res/layout/item_notes_list_section_item.xml @@ -19,4 +19,4 @@ android:padding="@dimen/spacer_1x" android:textColor="@color/fg_default_selection" android:textStyle="bold" - android:textSize="@dimen/secondary_font_size" /> \ No newline at end of file + android:textSize="@dimen/primary_font_size" /> diff --git a/build.gradle b/build.gradle index 39f36191d..688dfe7f6 100644 --- a/build.gradle +++ b/build.gradle @@ -6,9 +6,6 @@ * SPDX-FileCopyrightText: 2023 Álvaro Brey * SPDX-License-Identifier: GPL-3.0-or-later */ - -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { @@ -16,6 +13,7 @@ buildscript { kotlinVersion = '2.2.20' commonsVersion = '2.3.7' androidCommonsVersion = '1.1.0' + nextcloudAndroidCommonLib = "0.29.0" singleSignOnVersion = "17df25ce03d98b9d868249b41f7300bff6c54f3e" } repositories { diff --git a/gradle.properties b/gradle.properties index 5e2474b85..01a5d516e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,4 +11,5 @@ org.gradle.parallel=true org.gradle.configureondemand=true kapt.incremental.apt=true org.gradle.daemon=true -org.gradle.configuration-cache=true \ No newline at end of file +org.gradle.configuration-cache=true + diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 3849138c6..dce1ec5a7 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -174,6 +174,7 @@ + @@ -770,6 +771,16 @@ + + + + + + + + + + @@ -795,6 +806,11 @@ + + + + + @@ -835,6 +851,14 @@ + + + + + + + + @@ -860,6 +884,11 @@ + + + + + @@ -900,6 +929,14 @@ + + + + + + + + @@ -925,6 +962,11 @@ + + + + + @@ -965,6 +1007,14 @@ + + + + + + + + @@ -990,6 +1040,11 @@ + + + + + @@ -1030,6 +1085,14 @@ + + + + + + + + @@ -1081,6 +1144,11 @@ + + + + + @@ -1121,6 +1189,14 @@ + + + + + + + + @@ -1131,6 +1207,11 @@ + + + + + @@ -1172,6 +1253,11 @@ + + + + + @@ -1212,11 +1298,24 @@ + + + + + + + + + + + + + @@ -1225,6 +1324,14 @@ + + + + + + + + @@ -1250,6 +1357,11 @@ + + + + + @@ -1290,6 +1402,14 @@ + + + + + + + + @@ -1315,6 +1435,16 @@ + + + + + + + + + + @@ -1355,6 +1485,14 @@ + + + + + + + + @@ -1380,6 +1518,11 @@ + + + + + @@ -1420,6 +1563,14 @@ + + + + + + + + @@ -1445,6 +1596,16 @@ + + + + + + + + + + @@ -1485,6 +1646,14 @@ + + + + + + + + @@ -1510,6 +1679,11 @@ + + + + + @@ -1550,6 +1724,14 @@ + + + + + + + + @@ -1575,6 +1757,11 @@ + + + + + @@ -1615,6 +1802,14 @@ + + + + + + + + @@ -1640,6 +1835,11 @@ + + + + + @@ -1680,6 +1880,14 @@ + + + + + + + + @@ -1802,6 +2010,12 @@ + + + + + @@ -2494,6 +2708,14 @@ + + + + + + + + @@ -2526,6 +2748,14 @@ + + + + + + + + @@ -2558,6 +2788,14 @@ + + + + + + + + @@ -2645,6 +2883,9 @@ + + + @@ -2683,6 +2924,14 @@ + + + + + + + + @@ -2715,6 +2964,14 @@ + + + + + + + + @@ -2744,6 +3001,14 @@ + + + + + + + + @@ -2776,6 +3041,14 @@ + + + + + + + + @@ -2818,6 +3091,14 @@ + + + + + + + + @@ -2850,6 +3131,14 @@ + + + + + + + + @@ -2870,6 +3159,11 @@ + + + + + @@ -2902,6 +3196,14 @@ + + + + + + + + @@ -2934,6 +3236,14 @@ + + + + + + + + @@ -2966,6 +3276,14 @@ + + + + + + + + @@ -2998,6 +3316,14 @@ + + + + + + + + @@ -3057,6 +3383,17 @@ + + + + + + + + + + + @@ -3089,6 +3426,14 @@ + + + + + + + + @@ -3121,6 +3466,14 @@ + + + + + + + + @@ -3158,6 +3511,14 @@ + + + + + + + + @@ -3182,6 +3543,14 @@ + + + + + + + + @@ -3952,6 +4321,14 @@ + + + + + + + + @@ -10453,6 +10830,14 @@ + + + + + + + + @@ -10476,6 +10861,16 @@ + + + + + + + + @@ -10493,6 +10888,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10589,6 +11016,14 @@ + + + + + + + + @@ -10612,6 +11047,17 @@ + + + + + + + + @@ -10633,6 +11079,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -10729,6 +11207,14 @@ + + + + + + + + @@ -10752,6 +11238,16 @@ + + + + + + + + @@ -10769,6 +11265,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -11458,6 +11986,11 @@ + + + + + @@ -11596,6 +12129,14 @@ + + + + + + + + @@ -11666,6 +12207,11 @@ + + + + + @@ -11764,6 +12310,11 @@ + + + + + @@ -12447,6 +12998,14 @@ + + + + + + + + @@ -13052,8 +13611,12 @@ + + + + @@ -13144,6 +13707,14 @@ + + + + + + + + @@ -13168,6 +13739,14 @@ + + + + + + + + @@ -13183,6 +13762,11 @@ + + + + + @@ -13277,6 +13861,11 @@ + + + + + @@ -13335,6 +13924,11 @@ + + + + + @@ -13948,6 +14542,14 @@ + + + + + + + + @@ -14740,6 +15342,14 @@ + + + + + + + + @@ -15855,6 +16465,11 @@ + + + + + @@ -15908,6 +16523,14 @@ + + + + + + + +