Skip to content

Commit

Permalink
Merge pull request #172 from Adventech/fix/text_selection_crash
Browse files Browse the repository at this point in the history
Fix class cast exception in ReadingViewModel
  • Loading branch information
TinasheMzondiwa authored Feb 25, 2021
2 parents 1d57c7d + 7b3e171 commit f38b4c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,8 @@ public Object instantiateItem(@NotNull ViewGroup collection, int position) {

final Handler handler = new Handler();
handler.postDelayed(() -> {
if (ssReadingView != null) {
ssReadingView.updateHighlights();
ssReadingView.updateComments();
}
ssReadingView.updateHighlights();
ssReadingView.updateComments();
}, 800);

layout.setTag("ssReadingView_" + position);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import android.text.InputType
import android.util.DisplayMetrics
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.core.widget.NestedScrollView
Expand Down Expand Up @@ -324,12 +323,11 @@ class SSReadingViewModel(

override fun onSelectionStarted(posX: Float, posY: Float) {
var y = posY
val view: LinearLayout = ssReadingActivityBinding.ssReadingViewPager
val scrollView: NestedScrollView = ssReadingActivityBinding.ssReadingViewPager
.findViewWithTag("ssReadingView_" + ssReadingActivityBinding.ssReadingViewPager.currentItem)
val scrollView: NestedScrollView = view.findViewById(R.id.ss_reading_view_scroll)
y = y - scrollView.scrollY + ssReadingActivityBinding.ssReadingViewPager.top
val metrics = DisplayMetrics()
(context as Activity?)!!.windowManager.defaultDisplay.getMetrics(metrics)
(context as? Activity)?.windowManager?.defaultDisplay?.getMetrics(metrics)
val params = ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.layoutParams as ViewGroup.MarginLayoutParams
val contextMenuWidth = ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.width
val contextMenuHeight = ssReadingActivityBinding.ssContextMenu.ssReadingContextMenu.height
Expand Down

0 comments on commit f38b4c9

Please sign in to comment.