Skip to content

Commit

Permalink
Swipe İşlemi
Browse files Browse the repository at this point in the history
  • Loading branch information
YunusCagliyan850 committed May 4, 2019
1 parent f3a67c7 commit cf6fad4
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected void onCreate(Bundle savedInstanceState) {
initialize();
setBackgroundImage();

//update recyclerView
//update recyclerView//
updateAdapter();
rVNoteList.isEmptyListInvisible(mToolbar);
rVNoteList.isEmptyListVisible(emptyList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class Divider extends RecyclerView.ItemDecoration {
public Divider(Context context,int orientation) {
mDivider =context.getDrawable(R.drawable.divider);
//mDivider= ContextCompat.getDrawable(context,R.drawable.divider);
//mDivider
if(orientation!=LinearLayoutManager.VERTICAL){
throw new IllegalArgumentException("this argument don't belong here");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
import com.yunuscagliyan.memorybook.R;
import com.yunuscagliyan.memorybook.data.Notes;
import com.yunuscagliyan.memorybook.listeners.AddListener;
import com.yunuscagliyan.memorybook.listeners.SwipeListener;

import java.util.List;


public class NoteListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
public class NoteListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements SwipeListener {
private static final int ITEM = 0;
public static final int FOOTER=1;
private Context mContext;
Expand Down Expand Up @@ -88,6 +89,11 @@ public int getItemViewType(int position) {

}

@Override
public void swipeItem(int position) {

}

class NoteViewHolder extends RecyclerView.ViewHolder{
TextView noteContent;
TextView noteDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.util.Collections;
import java.util.List;

//CustomRecyclerView
public class NotesRecyclerView extends RecyclerView {
List<View> isEmptyInvisible= Collections.EMPTY_LIST;
List<View> isEmptyVisible= Collections.EMPTY_LIST;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.yunuscagliyan.memorybook.adapter;

import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;

import com.yunuscagliyan.memorybook.listeners.SwipeListener;

public class SimpleTouchCallBack extends ItemTouchHelper.Callback {
SwipeListener mSwipeListener;

public SimpleTouchCallBack(SwipeListener mSwipeListener) {
this.mSwipeListener = mSwipeListener;
}

@Override
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
return makeMovementFlags(0,ItemTouchHelper.END);
}

@Override
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder viewHolder1) {
return false;
}

@Override
public boolean isLongPressDragEnabled() {
return false;
}

@Override
public boolean isItemViewSwipeEnabled() {
return true;
}

@Override
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
mSwipeListener.swipeItem(i);



}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ public Uri insert(@NonNull Uri uri, @Nullable ContentValues values) {

@Override
public int delete(@NonNull Uri uri, @Nullable String selection, @Nullable String[] selectionArgs) {
return 0;
int affectedRowCount=0;
switch (matcher.match(uri)){
case 1:
affectedRowCount=db.delete(TABLE_NAME,selection,selectionArgs);
}
return affectedRowCount;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.yunuscagliyan.memorybook.data;

//Data Model
public class Notes {
private int id;
private String noteContent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


import es.dmoral.toasty.Toasty;

//
public class DialogFragmentNewNote extends DialogFragment {
private static final Uri CONTENT_URI = NoteProvider.CONTENT_URI;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package com.yunuscagliyan.memorybook.listeners;

public interface AddListener {
void showAddDialog();
void showAddDialog();//Fragment-MainActivity Data Transporting
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.yunuscagliyan.memorybook.listeners;

public interface SwipeListener {
void swipeItem(int position);
}
10 changes: 10 additions & 0 deletions app/src/main/res/drawable-anydpi/ic_alarm_on.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="#030303">
<path
android:fillColor="#FF000000"
android:pathData="M22,5.72l-4.6,-3.86 -1.29,1.53 4.6,3.86L22,5.72zM7.88,3.39L6.6,1.86 2,5.71l1.29,1.53 4.59,-3.85zM12,4c-4.97,0 -9,4.03 -9,9s4.02,9 9,9c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,20c-3.87,0 -7,-3.13 -7,-7s3.13,-7 7,-7 7,3.13 7,7 -3.13,7 -7,7zM10.54,14.53L8.41,12.4l-1.06,1.06 3.18,3.18 6,-6 -1.06,-1.06 -4.93,4.95z"/>
</vector>
Binary file added app/src/main/res/drawable-hdpi/ic_alarm_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-mdpi/ic_alarm_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xhdpi/ic_alarm_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-xxhdpi/ic_alarm_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cf6fad4

Please sign in to comment.