Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
42 changes: 25 additions & 17 deletions app/src/main/res/layout/item_notes_list_note_item_grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal">

<FrameLayout
Expand All @@ -66,6 +64,17 @@
android:padding="@dimen/spacer_2x"
tools:src="@drawable/ic_star_yellow_24dp" />

<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="top"
android:clickable="false"
android:contentDescription="@null"
android:focusable="false"
android:padding="@dimen/spacer_2x"
android:src="@drawable/ic_checkbox_blank_outline" />

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/noteStatus"
android:layout_width="wrap_content"
Expand All @@ -77,10 +86,11 @@
app:srcCompat="@drawable/ic_sync_blue_18dp" />
</FrameLayout>

<FrameLayout
android:layout_width="0dp"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
android:layout_marginTop="@dimen/spacer_2x"
android:orientation="vertical">

<com.google.android.material.chip.Chip
android:id="@+id/noteCategory"
Expand All @@ -104,19 +114,17 @@
app:textStartPadding="0dp"
tools:maxLength="50"
tools:text="@tools:sample/lorem/random" />
</FrameLayout>

<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="top"
android:clickable="false"
android:contentDescription="@null"
android:focusable="false"
android:paddingStart="@dimen/spacer_1x"
android:paddingEnd="@dimen/spacer_1x"
android:src="@drawable/ic_checkbox_blank_outline" />
<TextView
android:id="@+id/noteModified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:paddingStart="@dimen/spacer_1hx"
android:paddingEnd="@dimen/spacer_2x"
tools:text="27.11." />

</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
146 changes: 97 additions & 49 deletions app/src/main/res/layout/item_notes_list_note_item_grid_only_title.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,110 @@
app:cardCornerRadius="@dimen/card_radius">

<LinearLayout
android:id="@+id/wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingBottom="@dimen/spacer_1x">
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/spacer_2x"
android:orientation="vertical">

<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacer_1qx">
<LinearLayout
android:id="@+id/wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ImageView
android:id="@+id/noteFavorite"
android:layout_width="wrap_content"
<TextView
android:id="@+id/noteTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/menu_favorite"
android:padding="@dimen/spacer_2x"
tools:src="@drawable/ic_star_yellow_24dp" />
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" />

</LinearLayout>

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/noteStatus"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<ImageView
android:id="@+id/noteFavorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/menu_favorite"
android:padding="@dimen/spacer_2x"
tools:src="@drawable/ic_star_yellow_24dp" />

<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="false"
android:contentDescription="@null"
android:focusable="false"
android:padding="@dimen/spacer_2x"
android:src="@drawable/ic_checkbox_blank_outline" />

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/noteStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="12dp"
android:layout_marginEnd="4dp"
android:baseline="14dp"
app:srcCompat="@drawable/ic_sync_blue_18dp" />
</FrameLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginTop="12dp"
android:layout_marginEnd="4dp"
android:baseline="14dp"
app:srcCompat="@drawable/ic_sync_blue_18dp" />
</FrameLayout>
android:layout_marginTop="@dimen/spacer_2x"
android:orientation="vertical">

<TextView
android:id="@+id/noteTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="0dp"
android:layout_marginTop="@dimen/spacer_2x"
android:layout_marginEnd="@dimen/spacer_2x"
android:layout_marginBottom="@dimen/spacer_1x"
android:layout_weight="1"
android:hyphenationFrequency="full"
android:textAppearance="?attr/textAppearanceHeadline5"
android:textColor="@color/fg_default"
tools:maxLength="50"
tools:text="@tools:sample/lorem/random" />
<com.google.android.material.chip.Chip
android:id="@+id/noteCategory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="0dp"
android:layout_marginEnd="@dimen/spacer_2x"
android:ellipsize="middle"
android:padding="@dimen/spacer_1hx"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/secondary_font_size"
app:chipBackgroundColor="@color/defaultBrand"
app:chipEndPadding="@dimen/spacer_1x"
app:chipMinHeight="0dp"
app:chipStartPadding="@dimen/spacer_1x"
app:chipStrokeColor="@android:color/transparent"
app:chipStrokeWidth="1dp"
app:ensureMinTouchTargetSize="false"
app:textEndPadding="0dp"
app:textStartPadding="0dp"
tools:maxLength="50"
tools:text="@tools:sample/lorem/random" />

<ImageView
android:id="@+id/custom_checkbox"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="top"
android:clickable="false"
android:contentDescription="@null"
android:focusable="false"
android:paddingStart="@dimen/spacer_1x"
android:paddingEnd="@dimen/spacer_1x"
android:src="@drawable/ic_checkbox_blank_outline" />
<TextView
android:id="@+id/noteModified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:paddingStart="@dimen/spacer_1hx"
android:paddingEnd="@dimen/spacer_2x"
tools:text="27.11." />

</LinearLayout>
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>

</com.google.android.material.card.MaterialCardView>
Loading
Loading