Browse Source

UnreadFragment date/time fix & other minor fixes

pull/24/head
Ezerous 7 years ago
parent
commit
2725e08e03
  1. 2
      README.md
  2. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
  3. 7
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java

2
README.md

@ -29,4 +29,4 @@ Do not hesitate to contact us for any matter, either by sending an email to `thm
**Legal attribution: Google Play and the Google Play logo are trademarks of Google Inc.* **Legal attribution: Google Play and the Google Play logo are trademarks of Google Inc.*
[discord-server]: https://discord.gg/CVt3yrn [discord-server]: https://discord.gg/CVt3yrn
[trello-board]: https://trello.com/invite/b/4MVlkrkg/44a931707bd0b84a5e0bdfc42b9ae4f1/mthmmy [trello-board]: https://trello.com/b/4MVlkrkg/mthmmy

12
app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java

@ -64,7 +64,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
if (downloadsUrl != null && !Objects.equals(downloadsUrl, "")) { if (downloadsUrl != null && !Objects.equals(downloadsUrl, "")) {
ThmmyPage.PageCategory target = ThmmyPage.resolvePageCategory(Uri.parse(downloadsUrl)); ThmmyPage.PageCategory target = ThmmyPage.resolvePageCategory(Uri.parse(downloadsUrl));
if (!target.is(ThmmyPage.PageCategory.DOWNLOADS)) { if (!target.is(ThmmyPage.PageCategory.DOWNLOADS)) {
Timber.e("Bundle came with a non board url!\nUrl:\n%s" , downloadsUrl); Timber.e("Bundle came with a non downloads url!\nUrl:\n%s" , downloadsUrl);
Toast.makeText(this, "An error has occurred\nAborting.", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "An error has occurred\nAborting.", Toast.LENGTH_SHORT).show();
finish(); finish();
} }
@ -72,9 +72,10 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
//Initialize toolbar //Initialize toolbar
toolbar = findViewById(R.id.toolbar); toolbar = findViewById(R.id.toolbar);
if (downloadsTitle == null || Objects.equals(downloadsTitle, "")) if (downloadsTitle == null || downloadsTitle.equals(""))
toolbar.setTitle("Downloads"); toolbar.setTitle("Downloads");
toolbar.setTitle(downloadsTitle); else
toolbar.setTitle(downloadsTitle);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
if (getSupportActionBar() != null) { if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
@ -235,8 +236,9 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
@Override @Override
protected void postParsing(ResultCode result) { protected void postParsing(ResultCode result) {
if (downloadsTitle != null && !Objects.equals(downloadsTitle, "") && if (downloadsTitle != null && !downloadsTitle.equals("")
toolbar.getTitle() != downloadsTitle) && !downloadsTitle.equals("Αρχεία για λήψη")
&& toolbar.getTitle() != downloadsTitle)
toolbar.setTitle(downloadsTitle); toolbar.setTitle(downloadsTitle);
++pagesLoaded; ++pagesLoaded;

7
app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java

@ -174,7 +174,12 @@ public class UnreadFragment extends BaseFragment {
dateTime = dateTime.substring(0, dateTime.indexOf("<br>")); dateTime = dateTime.substring(0, dateTime.indexOf("<br>"));
dateTime = dateTime.replace("<b>", ""); dateTime = dateTime.replace("<b>", "");
dateTime = dateTime.replace("</b>", ""); dateTime = dateTime.replace("</b>", "");
dateTime = dateTime.replaceAll(":[0-5][0-9] ", " "); if (dateTime.contains(" am") || dateTime.contains(" pm") ||
dateTime.contains(" πμ") || dateTime.contains(" μμ")) {
dateTime = dateTime.replaceAll(":[0-5][0-9] ", " ");
} else {
dateTime=dateTime.substring(0,dateTime.lastIndexOf(":"));
}
if (!dateTime.contains(",")) { if (!dateTime.contains(",")) {
dateTime = dateTime.replaceAll(".+? ([0-9])", "$1"); dateTime = dateTime.replaceAll(".+? ([0-9])", "$1");
} }

Loading…
Cancel
Save