|
@ -104,27 +104,27 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa |
|
|
loadUrl(topicUrl); |
|
|
loadUrl(topicUrl); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void reloadPageThen(Runnable runnable) { |
|
|
|
|
|
if (topicUrl == null) throw new NullPointerException("No topic task has been requested yet!"); |
|
|
|
|
|
Timber.i("Reloading page"); |
|
|
|
|
|
stopLoading(); |
|
|
|
|
|
currentTopicTask = new TopicTask(topicTaskObserver, result -> { |
|
|
|
|
|
TopicViewModel.this.onTopicTaskCompleted(result); |
|
|
|
|
|
runnable.run(); |
|
|
|
|
|
}); |
|
|
|
|
|
currentTopicTask.execute(topicUrl); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* In contrast to {@link TopicViewModel#reloadPage()} this method gets rid of any arguments |
|
|
* In contrast to {@link TopicViewModel#reloadPage()} this method gets rid of any arguments |
|
|
* in the url before refreshing |
|
|
* in the url before refreshing |
|
|
*/ |
|
|
*/ |
|
|
public void resetPage() { |
|
|
public void resetPage() { |
|
|
if (topicUrl == null) throw new NullPointerException("No topic task has been requested yet!"); |
|
|
if (topicUrl == null) throw new NullPointerException("No topic task has been requested yet!"); |
|
|
Timber.i("Reseting page"); |
|
|
Timber.i("Resetting page"); |
|
|
loadUrl(ParseHelpers.getBaseURL(topicUrl) + "." + String.valueOf(currentPageIndex * 15)); |
|
|
loadUrl(ParseHelpers.getBaseURL(topicUrl) + "." + String.valueOf(currentPageIndex * 15)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void resetPageThen(Runnable runnable) { |
|
|
|
|
|
if (topicUrl == null) throw new NullPointerException("No topic task has been requested yet!"); |
|
|
|
|
|
Timber.i("Resetting page"); |
|
|
|
|
|
stopLoading(); |
|
|
|
|
|
currentTopicTask = new TopicTask(topicTaskObserver, result -> { |
|
|
|
|
|
TopicViewModel.this.onTopicTaskCompleted(result); |
|
|
|
|
|
runnable.run(); |
|
|
|
|
|
}); |
|
|
|
|
|
currentTopicTask.execute(ParseHelpers.getBaseURL(topicUrl) + "." + String.valueOf(currentPageIndex * 15)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void loadPageIndicated() { |
|
|
public void loadPageIndicated() { |
|
|
if (pageIndicatorIndex.getValue() == null) |
|
|
if (pageIndicatorIndex.getValue() == null) |
|
|
throw new NullPointerException("No page has been loaded yet!"); |
|
|
throw new NullPointerException("No page has been loaded yet!"); |
|
|