Loading app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java +2 −5 Original line number Diff line number Diff line package it.niedermann.owncloud.notes.android.activity; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.SearchManager; import android.content.Intent; import android.content.SharedPreferences; Loading Loading @@ -404,7 +402,6 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap case ItemTouchHelper.RIGHT: { final DBNote dbNote = (DBNote) adapter.getItem(viewHolder.getAdapterPosition()); db.toggleFavorite(dbNote, null); adapter.notifyItemChanged(viewHolder.getAdapterPosition()); refreshLists(); break; } Loading @@ -414,8 +411,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { ItemAdapter.NoteViewHolder noteViewHolder = (ItemAdapter.NoteViewHolder) viewHolder; // show delete icon on the right side noteViewHolder.showSwipeDelete(dX>0); // show swipe icon on the side noteViewHolder.showSwipe(dX>0); // move only swipeable part of item (not leave-behind) getDefaultUIUtil().onDraw(c, recyclerView, noteViewHolder.noteSwipeable, dX, dY, actionState, isCurrentlyActive); } Loading app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java +4 −1 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class NoteViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener { public View noteSwipeable; View noteSwipeFrame; ImageView noteFavoriteLeft, noteDeleteRight; TextView noteTitle; TextView noteCategory; Loading @@ -173,6 +174,7 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private NoteViewHolder(View v) { super(v); this.noteSwipeFrame = v.findViewById(R.id.noteSwipeFrame); this.noteSwipeable = v.findViewById(R.id.noteSwipeable); this.noteFavoriteLeft = v.findViewById(R.id.noteFavoriteLeft); this.noteDeleteRight = v.findViewById(R.id.noteDeleteRight); Loading @@ -195,9 +197,10 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { return noteClickListener.onNoteLongClick(getAdapterPosition(), v); } public void showSwipeDelete(boolean left) { public void showSwipe(boolean left) { noteFavoriteLeft.setVisibility(left ? View.VISIBLE : View.INVISIBLE); noteDeleteRight.setVisibility(left ? View.INVISIBLE : View.VISIBLE); noteSwipeFrame.setBackgroundResource(left ? R.color.bg_warning : R.color.bg_attention); } } Loading app/src/main/res/layout/fragment_notes_list_note_item.xml +1 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/noteSwipeFrame" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/bg_attention"> Loading app/src/main/res/values/colors.xml +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ <color name="bg_highlighted">#f3f3f3</color> <color name="bg_normal">#ffffff</color> <color name="bg_attention">#662020</color> <color name="bg_warning">#999920</color> <color name="fg_default">#000000</color> <color name="fg_default_selection">#333333</color> <color name="fg_default_low">#666666</color> Loading Loading
app/src/main/java/it/niedermann/owncloud/notes/android/activity/NotesListViewActivity.java +2 −5 Original line number Diff line number Diff line package it.niedermann.owncloud.notes.android.activity; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.SearchManager; import android.content.Intent; import android.content.SharedPreferences; Loading Loading @@ -404,7 +402,6 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap case ItemTouchHelper.RIGHT: { final DBNote dbNote = (DBNote) adapter.getItem(viewHolder.getAdapterPosition()); db.toggleFavorite(dbNote, null); adapter.notifyItemChanged(viewHolder.getAdapterPosition()); refreshLists(); break; } Loading @@ -414,8 +411,8 @@ public class NotesListViewActivity extends AppCompatActivity implements ItemAdap @Override public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { ItemAdapter.NoteViewHolder noteViewHolder = (ItemAdapter.NoteViewHolder) viewHolder; // show delete icon on the right side noteViewHolder.showSwipeDelete(dX>0); // show swipe icon on the side noteViewHolder.showSwipe(dX>0); // move only swipeable part of item (not leave-behind) getDefaultUIUtil().onDraw(c, recyclerView, noteViewHolder.noteSwipeable, dX, dY, actionState, isCurrentlyActive); } Loading
app/src/main/java/it/niedermann/owncloud/notes/model/ItemAdapter.java +4 −1 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { public class NoteViewHolder extends RecyclerView.ViewHolder implements View.OnLongClickListener, View.OnClickListener { public View noteSwipeable; View noteSwipeFrame; ImageView noteFavoriteLeft, noteDeleteRight; TextView noteTitle; TextView noteCategory; Loading @@ -173,6 +174,7 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private NoteViewHolder(View v) { super(v); this.noteSwipeFrame = v.findViewById(R.id.noteSwipeFrame); this.noteSwipeable = v.findViewById(R.id.noteSwipeable); this.noteFavoriteLeft = v.findViewById(R.id.noteFavoriteLeft); this.noteDeleteRight = v.findViewById(R.id.noteDeleteRight); Loading @@ -195,9 +197,10 @@ public class ItemAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { return noteClickListener.onNoteLongClick(getAdapterPosition(), v); } public void showSwipeDelete(boolean left) { public void showSwipe(boolean left) { noteFavoriteLeft.setVisibility(left ? View.VISIBLE : View.INVISIBLE); noteDeleteRight.setVisibility(left ? View.INVISIBLE : View.VISIBLE); noteSwipeFrame.setBackgroundResource(left ? R.color.bg_warning : R.color.bg_attention); } } Loading
app/src/main/res/layout/fragment_notes_list_note_item.xml +1 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/noteSwipeFrame" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/bg_attention"> Loading
app/src/main/res/values/colors.xml +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ <color name="bg_highlighted">#f3f3f3</color> <color name="bg_normal">#ffffff</color> <color name="bg_attention">#662020</color> <color name="bg_warning">#999920</color> <color name="fg_default">#000000</color> <color name="fg_default_selection">#333333</color> <color name="fg_default_low">#666666</color> Loading