From 15c66ea41aba3184869f1aaae6b243502103b7fc Mon Sep 17 00:00:00 2001 From: porvil Date: Tue, 27 Oct 2020 01:37:11 +0530 Subject: [PATCH] fixed background playback when info button pressed --- .../algorithms/sorting/merge/MergeSortActivity.java | 6 +++++- .../algorithms/sorting/quick/QuickSortActivity.java | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/merge/MergeSortActivity.java b/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/merge/MergeSortActivity.java index 799d09b..d9930a6 100644 --- a/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/merge/MergeSortActivity.java +++ b/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/merge/MergeSortActivity.java @@ -276,8 +276,12 @@ public void onClick(View v) { ImageButton btn_close = view.findViewById(R.id.btn_close); String comparisons = "-"; - if(mergeSort != null) + if(mergeSort != null) { + isAutoPlay = false; + btn_play.setImageDrawable(UtilUI.getDrawable(context, AppSettings.PLAY_BUTTON)); + timer.cancel(); comparisons = String.valueOf(mergeSort.comparisons); + } tv_name.setText(MergeSortStats.name); tv_avg.setText(MergeSortStats.avg); diff --git a/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/quick/QuickSortActivity.java b/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/quick/QuickSortActivity.java index 12f5445..3368921 100644 --- a/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/quick/QuickSortActivity.java +++ b/app/src/main/java/com/iiitd/dsavisualizer/algorithms/sorting/quick/QuickSortActivity.java @@ -277,8 +277,12 @@ public void onClick(View v) { ImageButton btn_close = view.findViewById(R.id.btn_close); String comparisons = "-"; - if(quickSort != null) + if(quickSort != null) { + isAutoPlay = false; + btn_play.setImageDrawable(UtilUI.getDrawable(context, AppSettings.PLAY_BUTTON)); + timer.cancel(); comparisons = String.valueOf(quickSort.comparisons); + } tv_name.setText(QuickSortStats.name); tv_avg.setText(QuickSortStats.avg);