AdvancedAndroid_Shushme icon indicating copy to clipboard operation
AdvancedAndroid_Shushme copied to clipboard

Recycler view swipe to delete location

Open miki995 opened this issue 7 years ago • 5 comments

Hello, I wonder if there is a feature in app to swipe to delete place, or I'm missing something? Regards, Miroslav Maksimovic

miki995 avatar Feb 10 '18 16:02 miki995

i am also looking for the same but there is no option to delete the added location.

   `` RecycleClick.addTo(mRecyclerView).setOnItemClickListener(new RecycleClick.OnItemClickListener() {
        @Override
        public void onItemClicked(RecyclerView recyclerView, int position, View v) {
            SweetAlertDialog pDialog =new SweetAlertDialog(context, SweetAlertDialog.WARNING_TYPE);
            pDialog.setTitleText("Delete Location");
            pDialog.setContentText("Phone Will No Longer Change Profile Mode Automatically\nYes To Confirm No to Dismiss");
            pDialog.setConfirmButton("No", new SweetAlertDialog.OnSweetClickListener() {
                @Override
                public void onClick(SweetAlertDialog sDialog) {
                    sDialog.dismissWithAnimation();
                }
            });
            pDialog.setCancelButton("Yes", new SweetAlertDialog.OnSweetClickListener() {
                @Override
                public void onClick(SweetAlertDialog sDialog) {
                    sDialog.dismissWithAnimation();

                    Uri uri = PlaceContract.PlaceEntry.CONTENT_URI;
                    int data = getContentResolver().delete(uri,null, null);




                    Toast.makeText(getApplicationContext(), "Successfully Deleted This Location!",Toast.LENGTH_LONG).show();
                }
            });
            pDialog.setCancelable(true);
            pDialog.show();
        }
    });`

``

i added these lines but i am getting an error of invalid uri

codewithraqib avatar May 21 '18 10:05 codewithraqib

Yep, it's strange that they didn't included swipe to delete or something...

miki995 avatar May 21 '18 15:05 miki995

i had the same wish and i did use the method in the attached link to enable onClick WRT the recuclerView and i could enable it

https://www.littlerobots.nl/blog/Handle-Android-RecyclerView-Clicks/

moharidy avatar Oct 09 '18 19:10 moharidy

This works for you @moharidy ? So I can close the issue.

miki995 avatar Oct 10 '18 18:10 miki995

No it did not, yet , only the onclick part is solved but deleting the selected entry still not coded

moharidy avatar Oct 10 '18 21:10 moharidy