Skip to content

Commit f20e347

Browse files
AlvaroBreyAndyScherzinger
authored andcommitted
wip: Copy note actions to overflow menu on each note action
Signed-off-by: Álvaro Brey <[email protected]>
1 parent 6f091bb commit f20e347

15 files changed

+89
-11
lines changed

app/src/main/java/it/niedermann/owncloud/notes/AppendToNoteActivity.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,10 @@ public void onNoteClick(int position, View v) {
6565
}
6666
finish();
6767
}
68+
69+
@Override
70+
public void onNoteActionsClick(int position, View v) {
71+
// TODO
72+
Toast.makeText(v.getContext(), "Not implemented yet", Toast.LENGTH_SHORT).show();
73+
}
6874
}

app/src/main/java/it/niedermann/owncloud/notes/main/MainActivity.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import android.text.TextUtils;
2828
import android.util.Log;
2929
import android.view.View;
30+
import android.widget.Toast;
3031

3132
import androidx.annotation.ColorInt;
3233
import androidx.annotation.NonNull;
@@ -769,6 +770,12 @@ public void onNoteFavoriteClick(int position, View view) {
769770
toggleLiveData.observe(this, (next) -> toggleLiveData.removeObservers(this));
770771
}
771772

773+
@Override
774+
public void onNoteActionsClick(int position, View v) {
775+
// TODO
776+
Toast.makeText(v.getContext(), "Not implemented yet", Toast.LENGTH_SHORT).show();
777+
}
778+
772779
@Override
773780
public void onBackPressed() {
774781
if (activityBinding.searchToolbar.getVisibility() == VISIBLE) {

app/src/main/java/it/niedermann/owncloud/notes/main/items/NoteViewHolder.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import androidx.recyclerview.selection.ItemDetailsLookup;
2525
import androidx.recyclerview.widget.RecyclerView;
2626

27+
import com.google.android.material.button.MaterialButton;
2728
import com.google.android.material.chip.Chip;
2829
import com.nextcloud.android.common.ui.theme.utils.ColorRole;
2930

@@ -95,6 +96,13 @@ protected void bindSearchableContent(@NonNull Context context, @NonNull TextView
9596
}
9697
}
9798

99+
protected void bindActions(@NonNull MaterialButton actionsButton, int color) {
100+
final BrandingUtil util = BrandingUtil.of(color, actionsButton.getContext());
101+
util.material.colorMaterialButtonText(actionsButton);
102+
util.material.colorMaterialTextButton(actionsButton);
103+
actionsButton.setOnClickListener(view -> noteClickListener.onNoteActionsClick(getLayoutPosition(), view));
104+
}
105+
98106
public abstract void showSwipe(boolean left);
99107

100108
@Nullable
@@ -113,4 +121,4 @@ public Long getSelectionKey() {
113121
}
114122
};
115123
}
116-
}
124+
}

app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, @
5555
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color);
5656
bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt().replace(EXCERPT_LINE_SEPARATOR, "\n"), color);
5757
binding.noteExcerpt.setVisibility(TextUtils.isEmpty(note.getExcerpt()) ? GONE : VISIBLE);
58+
bindActions(binding.noteActions, color);
5859
}
5960

6061
@Nullable
6162
public View getNoteSwipeable() {
6263
return null;
6364
}
64-
}
65+
}

app/src/main/java/it/niedermann/owncloud/notes/main/items/grid/NoteViewGridHolderOnlyTitle.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, i
4444
bindStatus(binding.noteStatus, note.getStatus(), color);
4545
bindFavorite(binding.noteFavorite, note.getFavorite());
4646
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color);
47+
bindActions(binding.noteActions, color);
4748
}
4849

4950
@Nullable
5051
public View getNoteSwipeable() {
5152
return null;
5253
}
53-
}
54+
}

app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithExcerpt.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, @
4444

4545
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color);
4646
bindSearchableContent(context, binding.noteExcerpt, searchQuery, note.getExcerpt(), color);
47+
bindActions(binding.noteActions, color);
4748
}
4849

4950
@NonNull
5051
public View getNoteSwipeable() {
5152
return binding.noteSwipeable;
5253
}
53-
}
54+
}

app/src/main/java/it/niedermann/owncloud/notes/main/items/list/NoteViewHolderWithoutExcerpt.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ public void bind(boolean isSelected, @NonNull Note note, boolean showCategory, i
4242
bindStatus(binding.noteStatus, note.getStatus(), color);
4343
bindFavorite(binding.noteFavorite, note.getFavorite());
4444
bindSearchableContent(context, binding.noteTitle, searchQuery, note.getTitle(), color);
45+
bindActions(binding.noteActions, color);
4546
}
4647

4748
@NonNull
4849
public View getNoteSwipeable() {
4950
return binding.noteSwipeable;
5051
}
51-
}
52+
}

app/src/main/java/it/niedermann/owncloud/notes/shared/model/NoteClickListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ public interface NoteClickListener {
1212
void onNoteClick(int position, View v);
1313

1414
void onNoteFavoriteClick(int position, View v);
15-
}
15+
16+
void onNoteActionsClick(int position, View v);
17+
}

app/src/main/java/it/niedermann/owncloud/notes/widget/singlenote/SingleNoteWidgetConfigurationActivity.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
import android.view.View;
1616
import android.widget.Toast;
1717

18-
import androidx.appcompat.widget.Toolbar;
19-
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
20-
2118
import it.niedermann.owncloud.notes.NotesApplication;
2219
import it.niedermann.owncloud.notes.R;
2320
import it.niedermann.owncloud.notes.exception.ExceptionHandler;
@@ -79,4 +76,10 @@ public void onNoteClick(int position, View v) {
7976
}
8077
});
8178
}
79+
80+
@Override
81+
public void onNoteActionsClick(int position, View v) {
82+
// TODO
83+
Toast.makeText(v.getContext(), "Not implemented yet", Toast.LENGTH_SHORT).show();
84+
}
8285
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- drawable/dots_vertical.xml --><vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24"><path android:fillColor="#000000" android:pathData="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z" /></vector>

0 commit comments

Comments
 (0)