From 407f0680c1a662f56c8dd7879d5fc73fe0411df9 Mon Sep 17 00:00:00 2001 From: stamatiap Date: Sun, 16 May 2021 10:00:16 +0300 Subject: [PATCH] make changes in dialog --- .../fragments/StoryViewerFragment.java | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java index 55497989..e40f445d 100644 --- a/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/StoryViewerFragment.java @@ -445,32 +445,11 @@ public class StoryViewerFragment extends Fragment { binding.swipeUp.setOnClickListener(v -> { final Object tag = v.getTag(); if (tag instanceof CharSequence) { - DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - switch (which){ - case DialogInterface.BUTTON_POSITIVE: - //Yes button clicked - Utils.openURL(context, tag.toString()); - break; - - case DialogInterface.BUTTON_NEGATIVE: - //No button clicked - dialog.dismiss(); - break; - - default: - dialog.dismiss(); - break; - } - } - }; - - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(R.string.swipe_up_confirmation); - builder.setMessage(tag.toString()).setPositiveButton("Yes", dialogClickListener) - .setNegativeButton("No", dialogClickListener).show(); - } + new AlertDialog.Builder(context) + .setTitle(R.string.swipe_up_confirmation) + .setMessage(tag.toString()).setPositiveButton(R.string.yes, (d, w) -> Utils.openURL(context, tag.toString())) + .setNegativeButton(R.string.no, (d, w) -> d.dismiss()).show(); + } }); binding.viewStoryPost.setOnClickListener(v -> { final Object tag = v.getTag();