|
@ -81,10 +81,6 @@ public class TopicActivity extends BaseActivity { |
|
|
* The key to use when putting topic's title String to {@link TopicActivity}'s Bundle. |
|
|
* The key to use when putting topic's title String to {@link TopicActivity}'s Bundle. |
|
|
*/ |
|
|
*/ |
|
|
public static final String BUNDLE_TOPIC_TITLE = "TOPIC_TITLE"; |
|
|
public static final String BUNDLE_TOPIC_TITLE = "TOPIC_TITLE"; |
|
|
/** |
|
|
|
|
|
* The key to use when activity should scroll to bottom, for example when coming from recent. |
|
|
|
|
|
*/ |
|
|
|
|
|
public static final String BUNDLE_FOCUS_TO_LAST_POST = "BUNDLE_FOCUS_TO_LAST_POST"; |
|
|
|
|
|
private static TopicTask topicTask; |
|
|
private static TopicTask topicTask; |
|
|
private MaterialProgressBar progressBar; |
|
|
private MaterialProgressBar progressBar; |
|
|
private TextView toolbarTitle; |
|
|
private TextView toolbarTitle; |
|
@ -107,7 +103,6 @@ public class TopicActivity extends BaseActivity { |
|
|
* bundle one and gets rendered in the toolbar. |
|
|
* bundle one and gets rendered in the toolbar. |
|
|
*/ |
|
|
*/ |
|
|
private String parsedTitle; |
|
|
private String parsedTitle; |
|
|
private Boolean focusToLastPost; |
|
|
|
|
|
private RecyclerView recyclerView; |
|
|
private RecyclerView recyclerView; |
|
|
/** |
|
|
/** |
|
|
* Holds the url of this page |
|
|
* Holds the url of this page |
|
@ -208,7 +203,6 @@ public class TopicActivity extends BaseActivity { |
|
|
Toast.makeText(this, "An error has occurred\n Aborting.", Toast.LENGTH_SHORT).show(); |
|
|
Toast.makeText(this, "An error has occurred\n Aborting.", Toast.LENGTH_SHORT).show(); |
|
|
finish(); |
|
|
finish(); |
|
|
} |
|
|
} |
|
|
focusToLastPost = extras.getBoolean(BUNDLE_FOCUS_TO_LAST_POST); |
|
|
|
|
|
|
|
|
|
|
|
thisPageBookmark = new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl)); |
|
|
thisPageBookmark = new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl)); |
|
|
|
|
|
|
|
@ -649,10 +643,6 @@ public class TopicActivity extends BaseActivity { |
|
|
pageIndicator.setText(String.valueOf(thisPage) + "/" + String.valueOf(numberOfPages)); |
|
|
pageIndicator.setText(String.valueOf(thisPage) + "/" + String.valueOf(numberOfPages)); |
|
|
pageRequestValue = thisPage; |
|
|
pageRequestValue = thisPage; |
|
|
|
|
|
|
|
|
if (focusToLastPost) { |
|
|
|
|
|
recyclerView.scrollToPosition(postsList.size() - 1); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
paginationEnabled(true); |
|
|
paginationEnabled(true); |
|
|
break; |
|
|
break; |
|
|
case NETWORK_ERROR: |
|
|
case NETWORK_ERROR: |
|
@ -820,17 +810,8 @@ public class TopicActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
Response response = client.newCall(request).execute(); |
|
|
Response response = client.newCall(request).execute(); |
|
|
document = Jsoup.parse(response.body().string()); |
|
|
String body = response.body().string(); |
|
|
String html = document.outerHtml(); |
|
|
buildedQuotes += body.substring(body.indexOf("<quote>") + 7, body.indexOf("</quote>")); |
|
|
if (Build.VERSION.SDK_INT >= 24) { |
|
|
|
|
|
buildedQuotes += Html.fromHtml( |
|
|
|
|
|
html.substring(html.indexOf("<quote>"), html.indexOf("</quote>")), |
|
|
|
|
|
Html.FROM_HTML_MODE_LEGACY).toString(); |
|
|
|
|
|
} else { |
|
|
|
|
|
buildedQuotes += Html.fromHtml( |
|
|
|
|
|
html.substring(html.indexOf("<quote>"), html.indexOf("</quote>"))) |
|
|
|
|
|
.toString(); |
|
|
|
|
|
} |
|
|
|
|
|
buildedQuotes += "\n\n"; |
|
|
buildedQuotes += "\n\n"; |
|
|
} catch (IOException | Selector.SelectorParseException e) { |
|
|
} catch (IOException | Selector.SelectorParseException e) { |
|
|
Timber.e(e, "Quote building failed."); |
|
|
Timber.e(e, "Quote building failed."); |
|
|