|  | @ -21,6 +21,7 @@ import gr.thmmy.mthmmy.activities.topic.tasks.TopicTaskResult; | 
			
		
	
		
		
			
				
					|  |  | import gr.thmmy.mthmmy.base.BaseActivity; |  |  | import gr.thmmy.mthmmy.base.BaseActivity; | 
			
		
	
		
		
			
				
					|  |  | import gr.thmmy.mthmmy.model.Post; |  |  | import gr.thmmy.mthmmy.model.Post; | 
			
		
	
		
		
			
				
					|  |  | import gr.thmmy.mthmmy.session.SessionManager; |  |  | import gr.thmmy.mthmmy.session.SessionManager; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import gr.thmmy.mthmmy.utils.parsing.ParseHelpers; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTaskCompleted, |  |  | public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTaskCompleted, | 
			
		
	
		
		
			
				
					|  |  |         PrepareForReply.OnPrepareForReplyFinished, PrepareForEditTask.OnPrepareEditFinished { |  |  |         PrepareForReply.OnPrepareForReplyFinished, PrepareForEditTask.OnPrepareEditFinished { | 
			
		
	
	
		
		
			
				
					|  | @ -59,47 +60,53 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa | 
			
		
	
		
		
			
				
					|  |  |      * navigation bar occurs, aka the value that the page indicator shows |  |  |      * navigation bar occurs, aka the value that the page indicator shows | 
			
		
	
		
		
			
				
					|  |  |      */ |  |  |      */ | 
			
		
	
		
		
			
				
					|  |  |     private MutableLiveData<Integer> pageIndicatorIndex = new MutableLiveData<>(); |  |  |     private MutableLiveData<Integer> pageIndicatorIndex = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |     private MutableLiveData<TopicTaskResult> topicTaskResult = new MutableLiveData<>(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     private MutableLiveData<PrepareForReplyResult> prepareForReplyResult = new MutableLiveData<>(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     private MutableLiveData<PrepareForEditResult> prepareForEditResult = new MutableLiveData<>(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |     private String firstTopicUrl; |  |  |     private MutableLiveData<String> replyPageUrl = new MutableLiveData<>(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  |     private MutableLiveData<Integer> pageTopicId = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private MutableLiveData<String> topicTitle = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private MutableLiveData<ArrayList<Post>> postsList = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private MutableLiveData<Integer> focusedPostIndex = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private MutableLiveData<TopicTask.ResultCode> topicTaskResultCode = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private MutableLiveData<String> topicTreeAndMods = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private MutableLiveData<String> topicViewers = new MutableLiveData<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private String topicUrl; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private int currentPageIndex; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     private int pageCount; | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |     public void initialLoad(String pageUrl) { |  |  |     private MutableLiveData<PrepareForReplyResult> prepareForReplyResult = new MutableLiveData<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |         firstTopicUrl = pageUrl; |  |  |     private MutableLiveData<PrepareForEditResult> prepareForEditResult = new MutableLiveData<>(); | 
			
				
				
			
		
	
		
		
			
				
					|  |  |         currentTopicTask = new TopicTask(topicTaskObserver, this); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         currentTopicTask.execute(pageUrl); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public void loadUrl(String pageUrl) { |  |  |     public void loadUrl(String pageUrl) { | 
			
		
	
		
		
			
				
					|  |  |         stopLoading(); |  |  |         stopLoading(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         topicUrl = pageUrl; | 
			
		
	
		
		
			
				
					|  |  |         currentTopicTask = new TopicTask(topicTaskObserver, this); |  |  |         currentTopicTask = new TopicTask(topicTaskObserver, this); | 
			
		
	
		
		
			
				
					|  |  |         currentTopicTask.execute(pageUrl); |  |  |         currentTopicTask.execute(pageUrl); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public void reloadPage() { |  |  |     public void reloadPage() { | 
			
		
	
		
		
			
				
					
					|  |  |         if (topicTaskResult.getValue() == null) |  |  |         if (topicUrl == null) throw new NullPointerException("No topic task has finished yet!"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             throw new NullPointerException("No topic task has finished yet!"); |  |  |         loadUrl(topicUrl); | 
			
				
				
			
		
	
		
		
			
				
					|  |  |         loadUrl(topicTaskResult.getValue().getLastPageLoadAttemptedUrl()); |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public void performPageChange() { |  |  |     public void performPageChange() { | 
			
		
	
		
		
			
				
					
					|  |  |         if (topicTaskResult.getValue() == null || 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!"); | 
			
		
	
		
		
			
				
					|  |  |         int pageRequested = pageIndicatorIndex.getValue() - 1; |  |  |         int pageRequested = pageIndicatorIndex.getValue() - 1; | 
			
		
	
		
		
			
				
					
					|  |  |         if (pageRequested != topicTaskResult.getValue().getCurrentPageIndex() - 1) { |  |  |         if (pageRequested != currentPageIndex - 1) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             loadUrl(topicTaskResult.getValue().getPagesUrls().get(pageRequested)); |  |  |             loadUrl(ParseHelpers.getBaseURL(topicUrl) + "." + String.valueOf(pageRequested * 15)); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |             pageIndicatorIndex.setValue(pageRequested + 1); |  |  |             pageIndicatorIndex.setValue(pageRequested + 1); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         } else { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             stopLoading(); | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public void prepareForReply() { |  |  |     public void prepareForReply() { | 
			
		
	
		
		
			
				
					
					|  |  |         if (topicTaskResult.getValue() == null) |  |  |         if (replyPageUrl.getValue() == null) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             throw new NullPointerException("Topic task has not finished yet!"); |  |  |             throw new NullPointerException("Topic task has not finished yet!"); | 
			
		
	
		
		
			
				
					|  |  |         stopLoading(); |  |  |         stopLoading(); | 
			
		
	
		
		
			
				
					|  |  |         setPageIndicatorIndex(getPageCount(), true); |  |  |         setPageIndicatorIndex(getPageCount(), true); | 
			
		
	
		
		
			
				
					|  |  |         currentPrepareForReplyTask = new PrepareForReply(prepareForReplyCallbacks, this, |  |  |         currentPrepareForReplyTask = new PrepareForReply(prepareForReplyCallbacks, this, | 
			
		
	
		
		
			
				
					
					|  |  |                 topicTaskResult.getValue().getReplyPageUrl()); |  |  |                 replyPageUrl.getValue()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         currentPrepareForReplyTask.execute(toQuoteList.toArray(new Integer[0])); |  |  |         currentPrepareForReplyTask.execute(toQuoteList.toArray(new Integer[0])); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -124,11 +131,11 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public void prepareForEdit(int position, String postEditURL) { |  |  |     public void prepareForEdit(int position, String postEditURL) { | 
			
		
	
		
		
			
				
					
					|  |  |         if (topicTaskResult.getValue() == null) |  |  |         if (replyPageUrl.getValue() == null) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |             throw new NullPointerException("Topic task has not finished yet!"); |  |  |             throw new NullPointerException("Topic task has not finished yet!"); | 
			
		
	
		
		
			
				
					|  |  |         stopLoading(); |  |  |         stopLoading(); | 
			
		
	
		
		
			
				
					|  |  |         currentPrepareForEditTask = new PrepareForEditTask(prepareForEditCallbacks, this, position, |  |  |         currentPrepareForEditTask = new PrepareForEditTask(prepareForEditCallbacks, this, position, | 
			
		
	
		
		
			
				
					
					|  |  |                 topicTaskResult.getValue().getReplyPageUrl()); |  |  |                 replyPageUrl.getValue()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |         currentPrepareForEditTask.execute(postEditURL); |  |  |         currentPrepareForEditTask.execute(postEditURL); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  | @ -166,14 +173,23 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa | 
			
		
	
		
		
			
				
					|  |  |     // callbacks for viewmodel
 |  |  |     // callbacks for viewmodel
 | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
		
		
			
				
					|  |  |     public void onTopicTaskCompleted(TopicTaskResult result) { |  |  |     public void onTopicTaskCompleted(TopicTaskResult result) { | 
			
		
	
		
		
			
				
					|  |  |         topicTaskResult.setValue(result); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         if (result.getResultCode() == TopicTask.ResultCode.SUCCESS) { |  |  |         if (result.getResultCode() == TopicTask.ResultCode.SUCCESS) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             currentPageIndex = result.getCurrentPageIndex(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             pageCount = result.getPageCount(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             topicTreeAndMods.setValue(result.getTopicTreeAndMods()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             topicViewers.setValue(result.getTopicViewers()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             pageTopicId.setValue(result.getLoadedPageTopicId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             replyPageUrl.setValue(result.getReplyPageUrl()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             topicTitle.setValue(result.getTopicTitle()); | 
			
		
	
		
		
			
				
					|  |  |             pageIndicatorIndex.setValue(result.getCurrentPageIndex()); |  |  |             pageIndicatorIndex.setValue(result.getCurrentPageIndex()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             postsList.setValue(result.getNewPostsList()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  |             focusedPostIndex.setValue(result.getFocusedPostIndex()); | 
			
		
	
		
		
			
				
					|  |  |             isUserExtraInfoVisibile.clear(); |  |  |             isUserExtraInfoVisibile.clear(); | 
			
		
	
		
		
			
				
					|  |  |             for (int i = 0; i < result.getNewPostsList().size(); i++) { |  |  |             for (int i = 0; i < result.getNewPostsList().size(); i++) { | 
			
		
	
		
		
			
				
					|  |  |                 isUserExtraInfoVisibile.add(false); |  |  |                 isUserExtraInfoVisibile.add(false); | 
			
		
	
		
		
			
				
					|  |  |             } |  |  |             } | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |         } | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         topicTaskResultCode.setValue(result.getResultCode()); | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     @Override |  |  |     @Override | 
			
		
	
	
		
		
			
				
					|  | @ -216,6 +232,41 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     // <-------------Just getters, setters and helper methods below here---------------->
 |  |  |     // <-------------Just getters, setters and helper methods below here---------------->
 | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<String> getTopicViewers() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return topicViewers; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<String> getTopicTreeAndMods() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return topicTreeAndMods; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<TopicTask.ResultCode> getTopicTaskResultCode() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return topicTaskResultCode; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<Integer> getFocusedPostIndex() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return focusedPostIndex; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<ArrayList<Post>> getPostsList() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return postsList; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<String> getReplyPageUrl() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return replyPageUrl; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<Integer> getPageTopicId() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return pageTopicId; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public MutableLiveData<String> getTopicTitle() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return topicTitle; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     public String getTopicUrl() { | 
			
		
	
		
		
			
				
					|  |  |  |  |  |         return topicUrl; | 
			
		
	
		
		
			
				
					|  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public MutableLiveData<Integer> getPageIndicatorIndex() { |  |  |     public MutableLiveData<Integer> getPageIndicatorIndex() { | 
			
		
	
		
		
			
				
					|  |  |         return pageIndicatorIndex; |  |  |         return pageIndicatorIndex; | 
			
		
	
	
		
		
			
				
					|  | @ -268,10 +319,6 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa | 
			
		
	
		
		
			
				
					|  |  |         this.prepareForReplyCallbacks = prepareForReplyCallbacks; |  |  |         this.prepareForReplyCallbacks = prepareForReplyCallbacks; | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public MutableLiveData<TopicTaskResult> getTopicTaskResult() { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         return topicTaskResult; |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     public MutableLiveData<PrepareForReplyResult> getPrepareForReplyResult() { |  |  |     public MutableLiveData<PrepareForReplyResult> getPrepareForReplyResult() { | 
			
		
	
		
		
			
				
					|  |  |         return prepareForReplyResult; |  |  |         return prepareForReplyResult; | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
	
		
		
			
				
					|  | @ -293,7 +340,7 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public boolean canReply() { |  |  |     public boolean canReply() { | 
			
		
	
		
		
			
				
					
					|  |  |         return topicTaskResult.getValue() != null && topicTaskResult.getValue().getReplyPageUrl() != null; |  |  |         return replyPageUrl.getValue() != null; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public boolean isWritingReply() { |  |  |     public boolean isWritingReply() { | 
			
		
	
	
		
		
			
				
					|  | @ -304,40 +351,14 @@ public class TopicViewModel extends BaseViewModel implements TopicTask.OnTopicTa | 
			
		
	
		
		
			
				
					|  |  |         this.writingReply = writingReply; |  |  |         this.writingReply = writingReply; | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public String getBaseUrl() { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         if (topicTaskResult.getValue() != null) { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             return topicTaskResult.getValue().getBaseUrl(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         } else { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             return ""; |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     public String getTopicUrl() { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         if (topicTaskResult.getValue() != null) { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             return topicTaskResult.getValue().getLastPageLoadAttemptedUrl(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         } else { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             // topic task has not finished yet (log? disable menu button until load is finished?)
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             return firstTopicUrl; |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         } |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     public String getTopicTitle() { |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         if (topicTaskResult.getValue() == null) |  |  |  | 
			
		
	
		
		
			
				
					|  |  |             throw new NullPointerException("Topic task has not finished yet!"); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         return topicTaskResult.getValue().getTopicTitle(); |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     } |  |  |  | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |     public int getCurrentPageIndex() { |  |  |     public int getCurrentPageIndex() { | 
			
		
	
		
		
			
				
					
					|  |  |         if (topicTaskResult.getValue() == null) |  |  |         if (currentPageIndex == 0) throw  new NullPointerException("No page has been loaded yet!"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             throw new NullPointerException("No page has been loaded yet!"); |  |  |         return currentPageIndex; | 
			
				
				
			
		
	
		
		
			
				
					|  |  |         return topicTaskResult.getValue().getCurrentPageIndex(); |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public int getPageCount() { |  |  |     public int getPageCount() { | 
			
		
	
		
		
			
				
					
					|  |  |         if (topicTaskResult.getValue() == null) |  |  |         if (pageCount == 0) throw  new NullPointerException("No page has been loaded yet!"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |             throw new NullPointerException("No page has been loaded yet!"); |  |  |         return pageCount; | 
			
				
				
			
		
	
		
		
			
				
					|  |  | 
 |  |  |  | 
			
		
	
		
		
			
				
					|  |  |         return topicTaskResult.getValue().getPageCount(); |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |     } |  |  |     } | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |     public String getPostBeingEditedText() { |  |  |     public String getPostBeingEditedText() { | 
			
		
	
	
		
		
			
				
					|  | 
 |