Browse Source

Bookmarks refresh on activity resume, fixed quote, embedded video overlay image and recyclerView bugs. Made activities SingeInstance.

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
c79b1204f4
  1. 53
      app/src/main/AndroidManifest.xml
  2. BIN
      app/src/main/assets/YouTube_light_color_icon.png
  3. 8
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  4. 121
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java
  5. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  6. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  7. 30
      app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
  8. 2
      app/src/main/java/gr/thmmy/mthmmy/utils/ParseHelpers.java

53
app/src/main/AndroidManifest.xml

@ -3,10 +3,10 @@
package="gr.thmmy.mthmmy" package="gr.thmmy.mthmmy"
android:installLocation="auto"> android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application <application
android:name=".base.BaseApplication" android:name=".base.BaseApplication"
@ -23,33 +23,32 @@
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW"/> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.BROWSABLE" />
<data <data
android:host="thmmy.gr" android:host="thmmy.gr"
android:scheme="http"/> android:scheme="http" />
<data <data
android:host="www.thmmy.gr" android:host="www.thmmy.gr"
android:scheme="http"/> android:scheme="http" />
<data <data
android:host="www.thmmy.gr" android:host="www.thmmy.gr"
android:scheme="https"/> android:scheme="https" />
<data <data
android:host="thmmy.gr" android:host="thmmy.gr"
android:scheme="https"/> android:scheme="https" />
<data <data android:host="thmmy.gr" />
android:host="thmmy.gr"/>
</intent-filter> </intent-filter>
</activity> </activity>
<activity <activity
@ -58,14 +57,15 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" android:theme="@style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan"/> android:windowSoftInputMode="adjustPan" />
<activity <activity
android:name=".activities.AboutActivity" android:name=".activities.AboutActivity"
android:launchMode="singleInstance"
android:parentActivityName=".activities.main.MainActivity" android:parentActivityName=".activities.main.MainActivity"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity"/> android:value=".activities.main.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.topic.TopicActivity" android:name=".activities.topic.TopicActivity"
@ -74,11 +74,11 @@
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity"/> android:value=".activities.main.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.profile.ProfileActivity" android:name=".activities.profile.ProfileActivity"
android:theme="@style/AppTheme.NoActionBar"/> android:theme="@style/AppTheme.NoActionBar" />
<activity <activity
android:name=".activities.board.BoardActivity" android:name=".activities.board.BoardActivity"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
@ -86,15 +86,16 @@
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity"/> android:value=".activities.main.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.downloads.DownloadsActivity" android:name=".activities.downloads.DownloadsActivity"
android:launchMode="singleInstance"
android:parentActivityName=".activities.main.MainActivity" android:parentActivityName=".activities.main.MainActivity"
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity"/> android:value=".activities.main.MainActivity" />
</activity> </activity>
<activity <activity
android:name=".activities.BookmarkActivity" android:name=".activities.BookmarkActivity"
@ -102,7 +103,7 @@
android:theme="@style/AppTheme.NoActionBar"> android:theme="@style/AppTheme.NoActionBar">
<meta-data <meta-data
android:name="android.support.PARENT_ACTIVITY" android:name="android.support.PARENT_ACTIVITY"
android:value=".activities.main.MainActivity"/> android:value=".activities.main.MainActivity" />
</activity> </activity>
<provider <provider
@ -112,20 +113,20 @@
android:grantUriPermissions="true"> android:grantUriPermissions="true">
<meta-data <meta-data
android:name="android.support.FILE_PROVIDER_PATHS" android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/> android:resource="@xml/provider_paths" />
</provider> </provider>
<service <service
android:name=".services.DownloadService" android:name=".services.DownloadService"
android:exported="false"/> android:exported="false" />
<receiver <receiver
android:name=".receiver.Receiver" android:name=".receiver.Receiver"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false">
<intent-filter> <intent-filter>
<action android:name="android.media.action.ACTION_DOWNLOAD"/> <action android:name="android.media.action.ACTION_DOWNLOAD" />
<category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
</receiver> </receiver>
</application> </application>

BIN
app/src/main/assets/YouTube_light_color_icon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

8
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -8,6 +8,7 @@ import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ProgressBar; import android.widget.ProgressBar;
@ -161,6 +162,13 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
} }
} }
@Override
public void onResume() {
super.onResume();
Log.d("Boardaa", "onResume called!");
refreshBoardBookmark((ImageButton) findViewById(R.id.bookmark));
}
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();

121
app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java

@ -1,5 +1,7 @@
package gr.thmmy.mthmmy.activities.topic; package gr.thmmy.mthmmy.activities.topic;
import android.util.Log;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
@ -11,11 +13,52 @@ import java.util.regex.Matcher;
import okhttp3.Response; import okhttp3.Response;
import timber.log.Timber; import timber.log.Timber;
/**
* This is a utility class containing a collection of static methods to help with topic replying.
*/
class Posting { class Posting {
/**
* {@link REPLY_STATUS} enum defines the different possible outcomes of a topic reply request.
*/
enum REPLY_STATUS { enum REPLY_STATUS {
SUCCESSFUL, NO_SUBJECT, EMPTY_BODY, NEW_REPLY_WHILE_POSTING, NOT_FOUND, SESSION_ENDED, OTHER_ERROR /**
* The request was successful
*/
SUCCESSFUL,
/**
* Request was lacking a subject
*/
NO_SUBJECT,
/**
* Request had empty body
*/
EMPTY_BODY,
/**
* There were new topic replies while making the request
*/
NEW_REPLY_WHILE_POSTING,
/**
* Error 404, page was not found
*/
NOT_FOUND,
/**
* User session ended while posting the reply
*/
SESSION_ENDED,
/**
* Other undefined of unidentified error
*/
OTHER_ERROR
} }
/**
* This method can be used to check whether a topic post request was successful or not and if
* not maybe get the reason why.
*
* @param response {@link okhttp3.Response} of the request
* @return a {@link REPLY_STATUS} that describes the response status
* @throws IOException method relies to {@link org.jsoup.Jsoup#parse(String)}
*/
static REPLY_STATUS replyStatus(Response response) throws IOException { static REPLY_STATUS replyStatus(Response response) throws IOException {
if (response.code() == 404) return REPLY_STATUS.NOT_FOUND; if (response.code() == 404) return REPLY_STATUS.NOT_FOUND;
if (response.code() < 200 || response.code() >= 400) return REPLY_STATUS.OTHER_ERROR; if (response.code() < 200 || response.code() >= 400) return REPLY_STATUS.OTHER_ERROR;
@ -44,10 +87,19 @@ class Posting {
return REPLY_STATUS.SUCCESSFUL; return REPLY_STATUS.SUCCESSFUL;
} }
/**
* This is a fucked up method.. Just don't waste your time here unless you have suicidal
* tendencies.
*
* @param html the html string to be transformed to BBcode
* @return the BBcode string
*/
static String htmlToBBcode(String html) { static String htmlToBBcode(String html) {
Log.d("Cancer", html);
Map<String, String> bbMap = new HashMap<>(); Map<String, String> bbMap = new HashMap<>();
Map<String, String> smileysMap1 = new HashMap<>(); Map<String, String> smileysMap1 = new HashMap<>();
Map<String, String> smileysMap2 = new HashMap<>(); Map<String, String> smileysMap2 = new HashMap<>();
smileysMap1.put("Smiley", ":)"); smileysMap1.put("Smiley", ":)");
smileysMap1.put("Wink", ";)"); smileysMap1.put("Wink", ";)");
smileysMap1.put("Cheesy", ":D"); smileysMap1.put("Cheesy", ":D");
@ -170,64 +222,66 @@ class Posting {
//html stuff on the beginning //html stuff on the beginning
bbMap.put("<link rel=.+\">\n ", ""); bbMap.put("<link rel=.+\">\n ", "");
//quotes and code headers //quotes and code headers
bbMap.put("\n\\s+?<div class=\"quoteheader\">\n (.+?)\n </div>", ""); bbMap.put("\\s*?<div class=\"quoteheader\">(.*?(\\n))*?.*?<\\/div>", "");
bbMap.put("\n\\s+?<div class=\"codeheader\">\n (.+?)\n </div>", ""); bbMap.put("\\s*?<div class=\"codeheader\">(.*?(\\n))+?.*?<\\/div>", "");
bbMap.put("\n\\s+?<div class=\"quote\">\n (.+?)\n </div>", ""); bbMap.put("\\s*?<div class=\"quote\">(.*?(\\n))+?.*?<\\/div>", "");
bbMap.put("<br>", "\n"); bbMap.put("<br>", "\\\n");
//Non-breaking space
bbMap.put("&nbsp;", " ");
//bold //bold
bbMap.put("\n\\s+?<b>(.+?)</b>", "\\[b\\]$1\\[/b\\]"); bbMap.put("\\s*?<b>([\\S\\s]+?)<\\/b>", "\\[b\\]$1\\[/b\\]");
//italics //italics
bbMap.put("\n\\s+?<i>(.+?)</i>", "\\[i\\]$1\\[/i\\]"); bbMap.put("\\s*?<i>([\\S\\s]+?)<\\/i>", "\\[i\\]$1\\[/i\\]");
//underline //underline
bbMap.put("\n\\s+?<span style=\"text-decoration: underline;\">(.+?)</span>", "\\[u\\]$1\\[/u\\]"); bbMap.put("\\s*?<span style=\"text-decoration: underline;\">([\\S\\s]+?)<\\/span>", "\\[u\\]$1\\[/u\\]");
//deleted //deleted
bbMap.put("\n\\s+?<del>(.+?)</del>", "\\[s\\]$1\\[/s\\]"); bbMap.put("\\s*?<del>([\\S\\s]+?)<\\/del>", "\\[s\\]$1\\[/s\\]");
//text color //text color
bbMap.put("\n\\s+?<span style=\"color: (.+?);\">(.+?)</span>", "\\[color=$1\\]$2\\[/color\\]"); bbMap.put("\\s*?<span style=\"color: (.+?);\">([\\S\\s]+?)<\\/span>", "\\[color=$1\\]$2\\[/color\\]");
//glow //glow
bbMap.put("\n\\s+?<span style=\"background-color: (.+?);\">(.+?)</span>", "\\[glow=$1,2,300\\]$2\\[/glow\\]"); bbMap.put("\\s*?<span style=\"background-color: (.+?);\">([\\S\\s]+?)<\\/span>", "\\[glow=$1,2,300\\]$2\\[/glow\\]");
//shadow //shadow
bbMap.put("\n\\s+?<span style=\"text-shadow: (.+?) (.+?)\">(.+?)</span>", "\\[shadow=$1,$2\\]$3\\[/shadow\\]"); bbMap.put("\\s*?<span style=\"text-shadow: (.+?) (.+?)\">([\\S\\s]+?)<\\/span>", "\\[shadow=$1,$2\\]$3\\[/shadow\\]");
//running text //running text
bbMap.put("\\s+?<marquee>\n (.+?)\n </marquee>", "\\[move\\]$1\\[/move\\]"); bbMap.put("\\s*?<marquee>\n ([\\S\\s]+?)\n <\\/marquee>", "\\[move\\]$1\\[/move\\]");
//alignment //alignment
bbMap.put("\n\\s+?<div align=\"center\">\n (.+?)\n </div>", "\\[center\\]$1\\[/center\\]"); bbMap.put("\\s*?<div align=\"center\">\n ([\\S\\s]+?)\n <\\/div>", "\\[center\\]$1\\[/center\\]");
bbMap.put("\n\\s+?<div style=\"text-align: (.+?);\">\n (.+?)\n </div>", "\\[$1\\]$2\\[/$1\\]"); bbMap.put("\\s*?<div style=\"text-align: (.+?);\">\n ([\\S\\s]+?)\n <\\/div>", "\\[$1\\]$2\\[/$1\\]");
//preformated //preformated
bbMap.put("\n\\s+?<pre>(.+?)</pre>", "\\[pre\\]$1\\[/pre\\]"); bbMap.put("\\s*?<pre>([\\S\\s]+?)<\\/pre>", "\\[pre\\]$1\\[/pre\\]");
//horizontal rule //horizontal rule
bbMap.put("\n\\s+?<hr>", "\\[hr\\]"); bbMap.put("\\s*?<hr>", "\\[hr\\]");
//resize //resize
bbMap.put("\n\\s+?<span style=\"font-size: (.+?);(.+?)\">(.+?)</span>", "\\[size=$1\\]$3\\[/size\\]"); bbMap.put("\\s*?<span style=\"font-size: (.+?);(.+?)\">([\\S\\s]+?)<\\/span>", "\\[size=$1\\]$3\\[/size\\]");
//font //font
bbMap.put("\n\\s+?<span style=\"font-family: (.+?);\">(.+?)</span>", "\\[font=$1\\]$2\\[/font\\]"); bbMap.put("\\s*?<span style=\"font-family: (.+?);\">([\\S\\s]+?)<\\/span>", "\\[font=$1\\]$2\\[/font\\]");
//lists //lists
bbMap.put("\\s+<li>(.+?)</li>", "\\[li\\]$1\\[/li\\]"); bbMap.put("\\s+<li>(.+?)<\\/li>", "\\[li\\]$1\\[/li\\]");
bbMap.put("\n\\s+<ul style=\"margin-top: 0; margin-bottom: 0;\">([\\S\\s]+?)\n\\s+</ul>", bbMap.put("\n\\s+<ul style=\"margin-top: 0; margin-bottom: 0;\">([\\S\\s]+?)\n\\s+<\\/ul>",
"\\[list\\]\n$1\n\\[/list\\]"); "\\[list\\]\n$1\n\\[/list\\]");
//latex code //latex code
bbMap.put("\n\\s+?<img src=\".+?eq=(.+?)\" .+?\">", "\\[tex\\]$1\\[/tex\\]"); bbMap.put("\\s*?<img src=\".+?eq=([\\S\\s]+?)\" .+?\">", "\\[tex\\]$1\\[/tex\\]");
//code //code
bbMap.put("\n\\s+?<div class=\"code\">\n (.+?)\n </div>", "\\[code\\]$1\\[/code\\]"); bbMap.put("\\s*?<div class=\"code\">((.*?(\\n))+?.*?)<\\/div>", "\\[code\\]$1\\[/code\\]");
//teletype //teletype
bbMap.put("\n\\s+?<tt>(.+?)</tt>", "\\[tt\\]$1\\[/tt\\]"); bbMap.put("\\s*?<tt>([\\S\\s]+?)<\\/tt>", "\\[tt\\]$1\\[/tt\\]");
//superscript/subscript //superscript/subscript
bbMap.put("\n\\s+?<sub>(.+?)</sub>", "\\[sub\\]$1\\[/sub\\]"); bbMap.put("\\s*?<sub>([\\S\\s]+?)<\\/sub>", "\\[sub\\]$1\\[/sub\\]");
bbMap.put("\n\\s+?<sup>(.+?)</sup>", "\\[sup\\]$1\\[/sup\\]"); bbMap.put("\\s*?<sup>([\\S\\s]+?)<\\/sup>", "\\[sup\\]$1\\[/sup\\]");
//tables //tables
bbMap.put("\\s+?<td.+?>([\\S\\s]+?)</td>", "\\[td\\]$1\\[/td\\]"); bbMap.put("\\s*?<td.+?>([\\S\\s]+?)<\\/td>", "\\[td\\]$1\\[/td\\]");
bbMap.put("<tr>([\\S\\s]+?)\n </tr>", "\\[tr\\]$1\\[/tr\\]"); bbMap.put("<tr>([\\S\\s]+?)\n <\\/tr>", "\\[tr\\]$1\\[/tr\\]");
bbMap.put("\n\\s+?<table style=\"(.+?)\">\n <tbody>\n ([\\S\\s]+?)\n </tbody>\n </table>" bbMap.put("\\s*?<table style=\"(.+?)\">\n <tbody>\n ([\\S\\s]+?)\n <\\/tbody>\n <\\/table>"
, "\\[table\\]$2\\[/table\\]"); , "\\[table\\]$2\\[/table\\]");
//videos //videos
bbMap.put("\n\\s+?<div class=\"yt\"><a href=\".+?watch\\?v=(.+?)\"((.|\\n)*?)\\/div>\n", bbMap.put("\\s*?<div class=\"yt\">.+?watch\\?v=(.+?)\"((.|\\n)*?)/div>\n",
"[youtube]https://www.youtube.com/watch?v=$1[/youtube]"); "[youtube]https://www.youtube.com/watch?v=$1[/youtube]");
//ftp //ftp
bbMap.put("<a href=\"ftp:(.+?)\" .+?>([\\S\\s]+?)</a>", "\\[fpt=ftp:$1\\]$2\\[/ftp\\]"); bbMap.put("<a href=\"ftp:(.+?)\" .+?>([\\S\\s]+?)<\\/a>", "\\[fpt=ftp:$1\\]$2\\[/ftp\\]");
//mailto //mailto
bbMap.put("\n\\s+?<a href=\"mailto:(.+?)\">([\\S\\s]+?)</a>", "\\[email\\]$2\\[/email\\]"); bbMap.put("\\s*?<a href=\"mailto:(.+?)\">([\\S\\s]+?)<\\/a>", "\\[email\\]$2\\[/email\\]");
//links //links
bbMap.put("\n\\s+?<a href=\"(.+?)\" .+?>([\\S\\s]+?)</a>", "\\[url=$1\\]$2\\[/url\\]"); bbMap.put("\\s*?<a href=\"(.+?)\" .+?>([\\S\\s]+?)</a>", "\\[url=$1\\]$2\\[/url\\]");
//smileys //smileys
for (Map.Entry entry : smileysMap1.entrySet()) { for (Map.Entry entry : smileysMap1.entrySet()) {
bbMap.put("\n <img src=\"(.+?)//www.thmmy.gr/smf/Smileys/default_dither/(.+?) alt=\"" bbMap.put("\n <img src=\"(.+?)//www.thmmy.gr/smf/Smileys/default_dither/(.+?) alt=\""
@ -257,6 +311,7 @@ class Posting {
html = html.replaceAll("\\s+<img src=\"(.+?)\" .+? height=\"(.+?)\" .+?>", "\\[img height=$2\\]$1\\[/img\\]"); html = html.replaceAll("\\s+<img src=\"(.+?)\" .+? height=\"(.+?)\" .+?>", "\\[img height=$2\\]$1\\[/img\\]");
html = html.replaceAll("\\s+<img src=\"(.+?)\".+?>", "\\[img\\]$1\\[/img\\]"); html = html.replaceAll("\\s+<img src=\"(.+?)\".+?>", "\\[img\\]$1\\[/img\\]");
Log.d("Cancer", html);
return html; return html;
} }
} }

4
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -226,6 +226,7 @@ public class TopicActivity extends BaseActivity {
// Inflates the menu; this adds items to the action bar if it is present. // Inflates the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.topic_menu, menu); getMenuInflater().inflate(R.menu.topic_menu, menu);
setTopicBookmark(menu.getItem(0)); setTopicBookmark(menu.getItem(0));
super.onCreateOptionsMenu(menu);
return true; return true;
} }
@ -269,8 +270,9 @@ public class TopicActivity extends BaseActivity {
@Override @Override
protected void onResume() { protected void onResume() {
drawer.setSelection(-1);
super.onResume(); super.onResume();
refreshTopicBookmark();
drawer.setSelection(-1);
} }
@Override @Override

1
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -181,6 +181,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
//Post's WebView parameters //Post's WebView parameters
holder.post.setClickable(true); holder.post.setClickable(true);
holder.post.setWebViewClient(new LinkLauncher()); holder.post.setWebViewClient(new LinkLauncher());
holder.post.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
//Avoids errors about layout having 0 width/height //Avoids errors about layout having 0 width/height
holder.thumbnail.setMinimumWidth(1); holder.thumbnail.setMinimumWidth(1);

30
app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java

@ -337,7 +337,7 @@ public abstract class BaseActivity extends AppCompatActivity {
drawer = drawerBuilder.build(); drawer = drawerBuilder.build();
if(!(BaseActivity.this instanceof MainActivity)) if (!(BaseActivity.this instanceof MainActivity))
drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false); drawer.getActionBarDrawerToggle().setDrawerIndicatorEnabled(false);
drawer.setOnDrawerNavigationListener(new Drawer.OnDrawerNavigationListener() { drawer.setOnDrawerNavigationListener(new Drawer.OnDrawerNavigationListener() {
@ -396,7 +396,7 @@ public abstract class BaseActivity extends AppCompatActivity {
protected void onPostExecute(Integer result) { protected void onPostExecute(Integer result) {
Toast.makeText(getBaseContext(), "Logged out successfully!", Toast.LENGTH_LONG).show(); Toast.makeText(getBaseContext(), "Logged out successfully!", Toast.LENGTH_LONG).show();
updateDrawer(); updateDrawer();
if(mainActivity!=null) if (mainActivity != null)
mainActivity.updateTabs(); mainActivity.updateTabs();
progressDialog.dismiss(); progressDialog.dismiss();
} }
@ -422,6 +422,18 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
} }
protected void refreshTopicBookmark() {
if (thisPageBookmarkMenuButton == null) {
return;
}
loadSavedBookmarks();
if (thisPageBookmark.matchExists(topicsBookmarked)) {
thisPageBookmarkMenuButton.setIcon(bookmarked);
} else {
thisPageBookmarkMenuButton.setIcon(notBookmarked);
}
}
protected void topicMenuBookmarkClick() { protected void topicMenuBookmarkClick() {
if (thisPageBookmark.matchExists(topicsBookmarked)) { if (thisPageBookmark.matchExists(topicsBookmarked)) {
thisPageBookmarkMenuButton.setIcon(notBookmarked); thisPageBookmarkMenuButton.setIcon(notBookmarked);
@ -455,6 +467,17 @@ public abstract class BaseActivity extends AppCompatActivity {
}); });
} }
protected void refreshBoardBookmark(final ImageButton thisPageBookmarkImageButton) {
if (thisPageBookmarkImageButton == null)
return;
loadSavedBookmarks();
if (thisPageBookmark.matchExists(boardsBookmarked)) {
thisPageBookmarkImageButton.setImageDrawable(bookmarked);
} else {
thisPageBookmarkImageButton.setImageDrawable(notBookmarked);
}
}
private void loadSavedBookmarks() { private void loadSavedBookmarks() {
String tmpString = bookmarksFile.getString(BOOKMARKED_TOPICS_KEY, null); String tmpString = bookmarksFile.getString(BOOKMARKED_TOPICS_KEY, null);
if (tmpString != null) if (tmpString != null)
@ -568,8 +591,7 @@ public abstract class BaseActivity extends AppCompatActivity {
} }
//----------------------------------MISC---------------------- //----------------------------------MISC----------------------
protected void setMainActivity(MainActivity mainActivity) protected void setMainActivity(MainActivity mainActivity) {
{
this.mainActivity = mainActivity; this.mainActivity = mainActivity;
} }

2
app/src/main/java/gr/thmmy/mthmmy/utils/ParseHelpers.java

@ -156,7 +156,7 @@ public class ParseHelpers {
+ "<a href=\"https://www.youtube.com/watch?v=" + "<a href=\"https://www.youtube.com/watch?v="
+ embededVideosUrls.get(tmp_counter) + "\" target=\"_blank\">" + embededVideosUrls.get(tmp_counter) + "\" target=\"_blank\">"
+ "<img class=\"embedded-video-play\" " + "<img class=\"embedded-video-play\" "
+ "src=\"http://www.youtube.com/yt/brand/media/image/YouTube_light_color_icon.png\">" + "src=\"YouTube_light_color_icon.png\">"
+ "</a>" + "</a>"
+ "<img src=\"https://img.youtube.com/vi/" + "<img src=\"https://img.youtube.com/vi/"
+ embededVideosUrls.get(tmp_counter) + embededVideosUrls.get(tmp_counter)

Loading…
Cancel
Save