|
@ -397,10 +397,10 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb |
|
|
public void run() { |
|
|
public void run() { |
|
|
long REPEAT_DELAY = 250; |
|
|
long REPEAT_DELAY = 250; |
|
|
if (autoIncrement) { |
|
|
if (autoIncrement) { |
|
|
viewModel.incrementPageRequestValue(step); |
|
|
viewModel.incrementPageRequestValue(step, false); |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), REPEAT_DELAY); |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), REPEAT_DELAY); |
|
|
} else if (autoDecrement) { |
|
|
} else if (autoDecrement) { |
|
|
viewModel.decrementPageRequestValue(step); |
|
|
viewModel.decrementPageRequestValue(step, false); |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), REPEAT_DELAY); |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), REPEAT_DELAY); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -440,11 +440,9 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb |
|
|
// Increment once for a click
|
|
|
// Increment once for a click
|
|
|
increment.setOnClickListener(v -> { |
|
|
increment.setOnClickListener(v -> { |
|
|
if (!autoIncrement && step == LARGE_STEP) { |
|
|
if (!autoIncrement && step == LARGE_STEP) { |
|
|
viewModel.incrementPageRequestValue(viewModel.getPageCount()); |
|
|
viewModel.setPageIndicatorIndex(viewModel.getPageCount(), true); |
|
|
viewModel.changePage(viewModel.getPageCount() - 1); |
|
|
|
|
|
} else if (!autoIncrement) { |
|
|
} else if (!autoIncrement) { |
|
|
viewModel.incrementPageRequestValue(step); |
|
|
viewModel.incrementPageRequestValue(step, true); |
|
|
viewModel.changePage(viewModel.getPageIndicatorIndex().getValue() - 1); |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -468,12 +466,11 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb |
|
|
} else if (rect != null && event.getAction() == MotionEvent.ACTION_UP && autoIncrement) { |
|
|
} else if (rect != null && event.getAction() == MotionEvent.ACTION_UP && autoIncrement) { |
|
|
autoIncrement = false; |
|
|
autoIncrement = false; |
|
|
paginationEnabled(true); |
|
|
paginationEnabled(true); |
|
|
viewModel.changePage(viewModel.getPageIndicatorIndex().getValue() - 1); |
|
|
viewModel.performPageChange(); |
|
|
} else if (rect != null && event.getAction() == MotionEvent.ACTION_MOVE) { |
|
|
} else if (rect != null && event.getAction() == MotionEvent.ACTION_MOVE) { |
|
|
if (!rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) { |
|
|
if (!rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) { |
|
|
autoIncrement = false; |
|
|
autoIncrement = false; |
|
|
viewModel.decrementPageRequestValue(viewModel.getPageIndicatorIndex().getValue() |
|
|
viewModel.setPageIndicatorIndex(viewModel.getCurrentPageIndex(), false); |
|
|
- viewModel.getCurrentPageIndex()); |
|
|
|
|
|
paginationEnabled(true); |
|
|
paginationEnabled(true); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -487,11 +484,9 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb |
|
|
// Decrement once for a click
|
|
|
// Decrement once for a click
|
|
|
decrement.setOnClickListener(v -> { |
|
|
decrement.setOnClickListener(v -> { |
|
|
if (!autoDecrement && step == LARGE_STEP) { |
|
|
if (!autoDecrement && step == LARGE_STEP) { |
|
|
viewModel.decrementPageRequestValue(viewModel.getPageCount()); |
|
|
viewModel.setPageIndicatorIndex(1, true); |
|
|
viewModel.changePage(0); |
|
|
|
|
|
} else if (!autoDecrement) { |
|
|
} else if (!autoDecrement) { |
|
|
viewModel.decrementPageRequestValue(step); |
|
|
viewModel.decrementPageRequestValue(step, true); |
|
|
viewModel.changePage(viewModel.getPageIndicatorIndex().getValue() - 1); |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -515,13 +510,12 @@ public class TopicActivity extends BaseActivity implements TopicTask.TopicTaskOb |
|
|
} else if (event.getAction() == MotionEvent.ACTION_UP && autoDecrement) { |
|
|
} else if (event.getAction() == MotionEvent.ACTION_UP && autoDecrement) { |
|
|
autoDecrement = false; |
|
|
autoDecrement = false; |
|
|
paginationEnabled(true); |
|
|
paginationEnabled(true); |
|
|
viewModel.changePage(viewModel.getPageIndicatorIndex().getValue() - 1); |
|
|
viewModel.performPageChange(); |
|
|
} else if (event.getAction() == MotionEvent.ACTION_MOVE) { |
|
|
} else if (event.getAction() == MotionEvent.ACTION_MOVE) { |
|
|
if (rect != null && |
|
|
if (rect != null && |
|
|
!rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) { |
|
|
!rect.contains(v.getLeft() + (int) event.getX(), v.getTop() + (int) event.getY())) { |
|
|
autoIncrement = false; |
|
|
autoIncrement = false; |
|
|
viewModel.incrementPageRequestValue(viewModel.getCurrentPageIndex() |
|
|
viewModel.setPageIndicatorIndex(viewModel.getCurrentPageIndex(), false); |
|
|
- viewModel.getPageIndicatorIndex().getValue()); |
|
|
|
|
|
paginationEnabled(true); |
|
|
paginationEnabled(true); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|