From 9b45c1286eb8e01173b8d130072064bd2ea9e76f Mon Sep 17 00:00:00 2001
From: Ezerous
Date: Mon, 23 Jan 2017 17:23:35 +0200
Subject: [PATCH 01/18] Small doc changes
---
CONTRIBUTING.md | 1 -
README.md | 11 ++++++++---
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e28d7593..44be1c74 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -45,4 +45,3 @@ follow the workflow below to make a merge request:
[trello-board]: https://trello.com/invite/b/4MVlkrkg/44a931707bd0b84a5e0bdfc42b9ae4f1/mthmmy
[discord-server]: https://discord.gg/CVt3yrn
-[gitlab-contributing-guide]: https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md
diff --git a/README.md b/README.md
index 69c60e28..89f8a134 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,11 @@
[![build status](https://gitlab.com/ThmmyNoLife/mTHMMY/badges/develop/build.svg)](https://gitlab.com/ThmmyNoLife/mTHMMY/commits/develop)
[![API](https://img.shields.io/badge/API-19%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=19)
-[![Discord Channel](https://img.shields.io/badge/discord-public@mTHMMY-738bd7.svg?style=flat)](https://discord.gg/CVt3yrn)
+[![Discord Channel](https://img.shields.io/badge/discord-public@mTHMMY-738bd7.svg?style=flat)][discord-server]
+[![Trello Board](https://img.shields.io/badge/trello-mTHMMY-red.svg?style=flat)][trello-board]
-mTHMMY is a mobile app for thmmy.gr
+
+mTHMMY is a mobile app for the [thmmy.gr](https://www.thmmy.gr) community.
## Requirements
@@ -16,4 +18,7 @@ Please refer to [CONTRIBUTING.md](/CONTRIBUTING.md) for details.
## Contact
-Do not hesitate to contact us for any matter at `thmmynolife@gmail.com`.
+Do not hesitate to contact us for any matter, either by sending an email to `thmmynolife@gmail.com`, or by joining our [Discord server][discord-server].
+
+[discord-server]: https://discord.gg/CVt3yrn
+[trello-board]: https://trello.com/invite/b/4MVlkrkg/44a931707bd0b84a5e0bdfc42b9ae4f1/mthmmy
From fd3539a1f600ca1acead1f05e9d58cbb59d1f650 Mon Sep 17 00:00:00 2001
From: Ezerous
Date: Tue, 24 Jan 2017 19:44:38 +0000
Subject: [PATCH 02/18] Update forum_post.txt
---
doc/forum_post.txt | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/doc/forum_post.txt b/doc/forum_post.txt
index f51905fa..1957af12 100644
--- a/doc/forum_post.txt
+++ b/doc/forum_post.txt
@@ -1,34 +1,35 @@
[center][size=25pt][b]Introduction[/b][/size][/center]
- [url=https://www.thmmy.gr/smf/index.php?topic=67629.0][/url], project Android .
+Από τη συζήτηση [url=https://www.thmmy.gr/smf/index.php?topic=67629.0]εδώ[/url], ξεκίνησε ένα project με στόχο τη δημιουργία εφαρμογής για Android κινητά που θα συγκεντρώνει και θα κάνει πιο εύκολη τη πρόσβαση σε μερικές από τις βασικές σελίδες και υπηρεσίες που αφορούν τη σχολή και χρησιμοποιούμε καθημερινά.
- 2+ 9000 [size=9pt](.java, .xml )[/size], ( closed alpha phase) Google Play Store!
+Μετά από 2+ μήνες δουλειάς και πάνω από 9000 γραμμές κώδικα (.java, .xml και άλλα), σήμερα (16/1/2017) ανεβάσαμε για πρώτη φορά την εφαρμογή (σε closed alpha phase) στο Google Play Store!
- forum. , ethmmy , instant chat .., , .
+Προς το παρόν η εφαρμογή υποστηρίζει κάποιες από τις βασικές λειτουργίες του forum. Σταδιακά θα ενσωματώνονται όλο και περισσότερες λειτουργίες, για παράδειγμα ενός συστήματος ειδοποιήσεων για νέες ανακοινώσεις του ethmmy και της σελίδας της γραμματείας, instant chat κ.ά., ανάλογα πάντα με τις ιδέες, τη διάθεση και την ενέργεια όσων θα συμμετέχουν.
- project L, iason1907 [url=https://www.thmmy.gr/smf/index.php?topic=67565.msg1163192#msg1163192]nohponex[/url].
+Αυτή τη στιγμή με το project ασχολούμαστε εγώ και ο L, ενώ έχουν βοηθήσει ο iason1907 και ο [url=https://www.thmmy.gr/smf/index.php?topic=67565.msg1163192#msg1163192]nohponex[/url].
[hr]
-[center][size=25pt][b] contributors[/b][/size]
+[center][size=25pt][b]Κάλεσμα για contributors[/b][/size]
-[img height=400]https://tctechcrunch2011.files.wordpress.com/2015/04/uncle-sam-we-want-you1-kopie_1.png[/img][/center]
+[img height=200]https://tctechcrunch2011.files.wordpress.com/2015/04/uncle-sam-we-want-you1-kopie_1.png[/img][/center]
- project :
+Αν ενδιαφέρεσαι κι [b]ΕΣΥ[/b] να ασχοληθείς με το project μπορείς να το κάνεις με πολλούς τρόπους:
[list]
-[li] repository. [i][/i] developers , , javadocs documentation , white-box testing, backend server . , , forks merge requests - .
-[/li]
+
[li]
- bugs, , [url=https://discord.gg/PVRVjth]Discord server[/url], Issue Tracker .
+Να αναφέρεις bugs, να προτείνεις βελτιώσεις και να συμμετέχεις σε συζητήσεις στον [url=https://discord.gg/PVRVjth]Discord server[/url] μας και στον Issue Tracker στο [url=trello.com]Trello[/url] (το link του είναι pinned στο #feedback στο Discord).
[/li]
[li]
- alpha [url=https://play.google.com/apps/testing/gr.thmmy.mthmmy][/url] gmail .
+Να κατεβάσεις και να δοκιμάσεις την alpha έκδοση της εφαρμογής από [url=https://play.google.com/apps/testing/gr.thmmy.mthmmy]εδώ[/url], [b]αφού [/b]πρώτα μας στείλεις το Gmail που έχεις στο Google Play για να αποκτήσεις πρόσβαση.
[/li]
[li]
- Discord email thmmynolife@gmail.com.
+Να έρθεις σε άμεση επικοινωνία με την ομάδα μέσω του [url=https://discord.gg/PVRVjth]Discord[/url] ή στέλνοντας email στο thmmynolife@gmail.com.
+[/li]
+[li]Αν ξέρεις προγραμματισμό μπορείς αρχικά να ζητήσεις πρόσβαση στο repository και να συνεισφέρεις κώδικα με fork και merge requests στους ρυθμούς σου. Χρειάζονται [i]άμεσα[/i] νέοι developers για υλοποιήση καινούργιων χαρακτηριστικών, διόρθωση εντόμων, σύνταξη των javadocs και του documentation γενικότερα, white-box testing, υλοποίηση του backend στο server που στήθηκε πρόσφατα και πολλών άλλων.
[/li][/list]
[hr]
-[center][size=25pt][b] [/b][/size][/center]
+[center][size=25pt][b]Η εφαρμογή[/b][/size][/center]
-[center][url=https://s6.postimg.org/4mupem3jl/image.png][img width=200]https://s6.postimg.org/4mupem3jl/image.png[/img][/url] [url=https://s6.postimg.org/ovdhmldgx/image.png][img width=200]https://s6.postimg.org/ovdhmldgx/image.png[/img][/url] [url=https://s6.postimg.org/a9mgycgoh/image.png][img width=200]https://s6.postimg.org/a9mgycgoh/image.png[/img][/url] [url=https://s6.postimg.org/5jwj9qpo1/image.png][img width=200]https://s6.postimg.org/5jwj9qpo1/image.png[/img][/url] [url=https://s6.postimg.org/fjrfpn0xd/image.png][img width=200]https://s6.postimg.org/fjrfpn0xd/image.png[/img][/url] [url=https://s6.postimg.org/z0c5c5w1d/image.png][img width=200]https://s6.postimg.org/z0c5c5w1d/image.png[/img][/url][/center]
+[center][url=https://s6.postimg.org/v9mseb7n5/image.png][img width=200]https://s6.postimg.org/v9mseb7n5/image.png[/img][/url] [url=https://s6.postimg.org/3nk0tmoa9/image2.png][img width=200]https://s6.postimg.org/3nk0tmoa9/image2.png[/img][/url] [url=https://s6.postimg.org/i813ogj8x/image3.png][img width=200]https://s6.postimg.org/i813ogj8x/image3.png[/img][/url] [url=https://s6.postimg.org/4to0sfckx/image4.png][img width=200]https://s6.postimg.org/4to0sfckx/image4.png[/img][/url] [url=https://s6.postimg.org/69zjakfht/image5.png][img width=200]https://s6.postimg.org/69zjakfht/image5.png[/img][/url] [url=https://s6.postimg.org/rkx3etxm9/image6.png][img width=200]https://s6.postimg.org/rkx3etxm9/image6.png[/img][/url][/center]
- login logout, "", boards, topics user profiles post.
\ No newline at end of file
+Αυτή τη στιγμή στην εφαρμογή μπορείς να κάνεις login και logout, να δεις τα "Πρόσφατα", να περιηγηθείς στα boards, topics και user profiles, να κατεβάσεις αρχεία από τα downloads και από συνημμένα σε post.
\ No newline at end of file
From d74331b05dc94c9c259290815efc30a4247bd2f4 Mon Sep 17 00:00:00 2001
From: Apostolof
Date: Wed, 22 Feb 2017 19:40:46 +0200
Subject: [PATCH 03/18] Fix for embedded videos and reversed order in user
stats.
---
.../activities/board/BoardActivity.java | 2 +-
.../downloads/DownloadsActivity.java | 2 +-
.../profile/stats/StatsFragment.java | 3 +++
.../gr/thmmy/mthmmy/base/BaseActivity.java | 1 +
.../gr/thmmy/mthmmy/base/BaseApplication.java | 25 ++++++++++++++++++-
.../thmmy/mthmmy/session/SessionManager.java | 2 +-
.../gr/thmmy/mthmmy/utils/ParseHelpers.java | 7 ++++--
7 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
index c3587b1b..77d2165d 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
@@ -201,7 +201,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
.url(boardUrl[0])
.build();
try {
- Response response = BaseActivity.getClient().newCall(request).execute();
+ Response response = client.newCall(request).execute();
parseBoard(Jsoup.parse(response.body().string()));
} catch (SSLHandshakeException e) {
Report.w(TAG, "Certificate problem (please switch to unsafe connection).");
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
index 2343f78d..ea02b7b8 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsActivity.java
@@ -192,7 +192,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
.url(downloadsUrl[0])
.build();
try {
- Response response = BaseActivity.getClient().newCall(request).execute();
+ Response response = client.newCall(request).execute();
parseDownloads(Jsoup.parse(response.body().string()));
} catch (SSLHandshakeException e) {
Report.w(TAG, "Certificate problem (please switch to unsafe connection).");
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
index d99f7d65..2e102c0e 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
@@ -33,6 +33,7 @@ import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import javax.net.ssl.SSLHandshakeException;
@@ -206,6 +207,7 @@ public class StatsFragment extends Fragment {
Integer.parseInt(dataCols.last().text())));
mostPopularBoardsByPostsLabels.add(dataCols.first().text());
}
+ Collections.reverse(mostPopularBoardsByPostsLabels);
}
{
Elements mostPopularBoardsByActivityRows = statsRows.last().select(">td").last()
@@ -218,6 +220,7 @@ public class StatsFragment extends Fragment {
Float.parseFloat(tmp.substring(0, tmp.indexOf("%")))));
mostPopularBoardsByActivityLabels.add(dataCols.first().text());
}
+ Collections.reverse(mostPopularBoardsByActivityLabels);
}
}
return true;
diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
index 501e2452..2147a1d3 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseActivity.java
@@ -79,6 +79,7 @@ public abstract class BaseActivity extends AppCompatActivity {
super.onCreate(savedInstanceState);
if (client == null)
client = BaseApplication.getInstance().getClient(); //must check every time - e.g.
+
// they become null when app restarts after crash
if (sessionManager == null)
sessionManager = BaseApplication.getInstance().getSessionManager();
diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
index 1e5ffdd6..b119dabe 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
@@ -19,11 +19,17 @@ import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader;
import com.mikepenz.materialdrawer.util.DrawerImageLoader;
import com.squareup.picasso.Picasso;
+import java.io.IOException;
+import java.util.Objects;
import java.util.concurrent.TimeUnit;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.session.SessionManager;
+import okhttp3.HttpUrl;
+import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import okhttp3.Response;
public class BaseApplication extends Application {
@@ -40,7 +46,7 @@ public class BaseApplication extends Application {
//Display Metrics
private static float dpHeight, dpWidth;
- public static BaseApplication getInstance(){
+ public static BaseApplication getInstance() {
return baseApplication;
}
@@ -54,6 +60,22 @@ public class BaseApplication extends Application {
PersistentCookieJar cookieJar = new PersistentCookieJar(new SetCookieCache(), sharedPrefsCookiePersistor);
client = new OkHttpClient.Builder()
.cookieJar(cookieJar)
+ .addInterceptor(new Interceptor() {
+ @Override
+ public Response intercept(Chain chain) throws IOException {
+ Request request = chain.request();
+ HttpUrl oldUrl = chain.request().url();
+ if (Objects.equals(chain.request().url().host(), "www.thmmy.gr")) {
+ if (!oldUrl.toString().contains("theme=4")) {
+ //Probably works but needs more testing:
+ HttpUrl newUrl = oldUrl.newBuilder().addQueryParameter("theme", "4").build();
+ request = request.newBuilder().url(newUrl).build();
+ }
+ }
+ return chain.proceed(request);
+
+ }
+ })
.connectTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
@@ -71,6 +93,7 @@ public class BaseApplication extends Application {
public void set(ImageView imageView, Uri uri, Drawable placeholder) {
Picasso.with(imageView.getContext()).load(uri).placeholder(placeholder).into(imageView);
}
+
@Override
public void cancel(ImageView imageView) {
Picasso.with(imageView.getContext()).cancelRequest(imageView);
diff --git a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
index 2321b88a..c6bbd713 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
@@ -332,7 +332,7 @@ public class SessionManager {
if (!avatar.isEmpty())
return avatar.first().attr("src");
- Report.e(TAG, "Extracting avatar's link failed!");
+ Report.i(TAG, "Extracting avatar's link failed!");
return null;
}
diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/ParseHelpers.java b/app/src/main/java/gr/thmmy/mthmmy/utils/ParseHelpers.java
index 2520cc89..2e8867f5 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/utils/ParseHelpers.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/utils/ParseHelpers.java
@@ -1,5 +1,7 @@
package gr.thmmy.mthmmy.utils;
+import android.util.Log;
+
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
@@ -153,15 +155,16 @@ public class ParseHelpers {
fixed = fixed.replace(
fixed.substring(fixed.indexOf("
*/
class ParseDownloadPageTask extends AsyncTask {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- private static final String TAG = "ParseDownloadPageTask"; //Separate tag for AsyncTask
private String thisPageUrl;
@Override
@@ -195,9 +187,9 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
Response response = client.newCall(request).execute();
parseDownloads(Jsoup.parse(response.body().string()));
} catch (SSLHandshakeException e) {
- Report.w(TAG, "Certificate problem (please switch to unsafe connection).");
+ Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Report.e("TAG", "ERROR", e);
+ Timber.e("ERROR", e);
}
return null;
}
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java
index a46dfeea..0253359b 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/downloads/DownloadsAdapter.java
@@ -29,11 +29,6 @@ import static gr.thmmy.mthmmy.activities.downloads.DownloadsActivity.BUNDLE_DOWN
import static gr.thmmy.mthmmy.activities.downloads.DownloadsActivity.BUNDLE_DOWNLOADS_URL;
class DownloadsAdapter extends RecyclerView.Adapter {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "DownloadsAdapter";
private final int VIEW_TYPE_DOWNLOAD = 0;
private final int VIEW_TYPE_LOADING = 1;
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
index 5e701d6e..d3d38870 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
@@ -38,7 +38,6 @@ import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL;
public class MainActivity extends BaseActivity implements RecentFragment.RecentFragmentInteractionListener, ForumFragment.ForumFragmentInteractionListener {
//----------------------------------------CLASS VARIABLES-----------------------------------------
- private static final String TAG = "MainActivity";
private static final int TIME_INTERVAL = 2000;
private long mBackPressed;
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java
index d9777cf7..8bcecc25 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumFragment.java
@@ -30,10 +30,11 @@ import gr.thmmy.mthmmy.model.Board;
import gr.thmmy.mthmmy.model.Category;
import gr.thmmy.mthmmy.session.SessionManager;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
-import mthmmy.utils.Report;
+
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.Response;
+import timber.log.Timber;
/**
* A {@link BaseFragment} subclass.
@@ -87,7 +88,7 @@ public class ForumFragment extends BaseFragment
forumTask.execute();
}
- Report.d(TAG, "onActivityCreated");
+ Timber.d("onActivityCreated");
}
@Override
@@ -151,8 +152,7 @@ public class ForumFragment extends BaseFragment
//---------------------------------------ASYNC TASK-----------------------------------
- public class ForumTask extends AsyncTask {
- private static final String TAG = "ForumTask";
+ private class ForumTask extends AsyncTask {
private HttpUrl forumUrl = SessionManager.forumUrl; //may change upon collapse/expand
private Document document;
@@ -179,10 +179,10 @@ public class ForumFragment extends BaseFragment
fetchedCategories.clear();
return 0;
} catch (IOException e) {
- Report.d(TAG, "Network Error", e);
+ Timber.d("Network Error", e);
return 1;
} catch (Exception e) {
- Report.d(TAG, "Exception", e);
+ Timber.d("Exception", e);
return 2;
}
@@ -225,7 +225,7 @@ public class ForumFragment extends BaseFragment
}
}
else
- Report.e(TAG, "Parsing failed!");
+ Timber.e("Parsing failed!");
}
public void setUrl(String string)
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
index 7cd9ef63..d9e92599 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
@@ -29,10 +29,11 @@ import gr.thmmy.mthmmy.session.SessionManager;
import gr.thmmy.mthmmy.utils.CustomRecyclerView;
import gr.thmmy.mthmmy.utils.exceptions.ParseException;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
-import mthmmy.utils.Report;
+
import okhttp3.HttpUrl;
import okhttp3.Request;
import okhttp3.Response;
+import timber.log.Timber;
/**
* A {@link BaseFragment} subclass.
@@ -86,7 +87,7 @@ public class RecentFragment extends BaseFragment {
recentTask.execute();
}
- Report.d(TAG, "onActivityCreated");
+ Timber.d("onActivityCreated");
}
@@ -141,8 +142,7 @@ public class RecentFragment extends BaseFragment {
//---------------------------------------ASYNC TASK-----------------------------------
- public class RecentTask extends AsyncTask {
- private static final String TAG = "RecentTask";
+ private class RecentTask extends AsyncTask {
private final HttpUrl thmmyUrl = SessionManager.indexUrl;
private Document document;
@@ -161,13 +161,13 @@ public class RecentFragment extends BaseFragment {
parse(document);
return 0;
} catch (ParseException e) {
- Report.e(TAG, "ParseException", e);
+ Timber.e("ParseException", e);
return 1;
} catch (IOException e) {
- Report.i(TAG, "Network Error", e);
+ Timber.i("Network Error", e);
return 2;
} catch (Exception e) {
- Report.e(TAG, "Exception", e);
+ Timber.e("Exception", e);
return 3;
}
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
index 2444bf95..08495dd9 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/ProfileActivity.java
@@ -19,7 +19,7 @@ import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.text.style.RelativeSizeSpan;
-import android.util.Log;
+
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
@@ -50,9 +50,10 @@ import gr.thmmy.mthmmy.model.ThmmyPage;
import gr.thmmy.mthmmy.utils.CenterVerticalSpan;
import gr.thmmy.mthmmy.utils.CircleTransform;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
-import mthmmy.utils.Report;
+
import okhttp3.Request;
import okhttp3.Response;
+import timber.log.Timber;
import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_TITLE;
import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL;
@@ -64,11 +65,6 @@ import static gr.thmmy.mthmmy.activities.topic.TopicActivity.BUNDLE_TOPIC_URL;
* the username using the key {@link #BUNDLE_PROFILE_USERNAME}.
*/
public class ProfileActivity extends BaseActivity implements LatestPostsFragment.LatestPostsFragmentInteractionListener {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "ProfileActivity";
/**
* The key to use when putting profile's url String to {@link ProfileActivity}'s Bundle.
*/
@@ -179,7 +175,7 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
ThmmyPage.PageCategory target = ThmmyPage.resolvePageCategory(Uri.parse(profileUrl));
if (!target.is(ThmmyPage.PageCategory.PROFILE)) {
- Report.e(TAG, "Bundle came with a non profile url!\nUrl:\n" + profileUrl);
+ Timber.e("Bundle came with a non profile url!\nUrl:\n%s" , profileUrl);
Toast.makeText(this, "An error has occurred\n Aborting.", Toast.LENGTH_SHORT).show();
finish();
}
@@ -222,11 +218,6 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
*/
public class ProfileTask extends AsyncTask {
//Class variables
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "ProfileTask"; //Separate tag for AsyncTask
Document profilePage;
Spannable usernameSpan;
@@ -262,7 +253,7 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
} else {
//Should never get here!
//Something is wrong.
- Report.e(TAG, "An error occurred while trying to find profile's personal text.");
+ Timber.e("An error occurred while trying to find profile's personal text.");
personalText = null;
}
}
@@ -283,16 +274,16 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
}
return true;
} catch (SSLHandshakeException e) {
- Report.w(TAG, "Certificate problem (please switch to unsafe connection).");
+ Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Report.e("TAG", "ERROR", e);
+ Timber.e("ERROR", e);
}
return false;
}
protected void onPostExecute(Boolean result) {
- if (!result) { //Parse failed!
- Report.d(TAG, "Parse failed!");
+ if (!result) { //Parse failed! //TODO report as ParseException?
+ Timber.d("Parse failed!");
Toast.makeText(getBaseContext(), "Fatal error!\n Aborting..."
, Toast.LENGTH_LONG).show();
finish();
@@ -344,7 +335,7 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
viewPager.setAdapter(adapter);
}
- class ViewPagerAdapter extends FragmentPagerAdapter {
+ private class ViewPagerAdapter extends FragmentPagerAdapter {
private final List mFragmentList = new ArrayList<>();
private final List mFragmentTitleList = new ArrayList<>();
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java
index 5f0f77d2..13319607 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java
@@ -21,11 +21,6 @@ import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
* specified {@link LatestPostsFragment.LatestPostsFragmentInteractionListener}.
*/
class LatestPostsAdapter extends RecyclerView.Adapter {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "LatestPostsAdapter";
private final int VIEW_TYPE_ITEM = 0;
private final int VIEW_TYPE_LOADING = 1;
final private LatestPostsFragment.LatestPostsFragmentInteractionListener interactionListener;
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java
index ccdb5593..5c3f8d40 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java
@@ -26,19 +26,15 @@ import gr.thmmy.mthmmy.base.BaseFragment;
import gr.thmmy.mthmmy.model.PostSummary;
import gr.thmmy.mthmmy.utils.ParseHelpers;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
-import mthmmy.utils.Report;
+
import okhttp3.Request;
import okhttp3.Response;
+import timber.log.Timber;
/**
* Use the {@link LatestPostsFragment#newInstance} factory method to create an instance of this fragment.
*/
public class LatestPostsFragment extends BaseFragment implements LatestPostsAdapter.OnLoadMoreListener{
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "LatestPostsFragment";
/**
* The key to use when putting profile's url String to {@link LatestPostsFragment}'s Bundle.
*/
@@ -136,7 +132,7 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap
profileLatestPostsTask.execute(profileUrl + ";sa=showPosts");
pagesLoaded = 1;
}
- Report.d(TAG, "onActivityCreated");
+ Timber.d("onActivityCreated");
}
@Override
@@ -156,14 +152,7 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap
*
LatestPostsTask's {@link AsyncTask#execute execute} method needs a profile's url as String
* parameter!
*/
- public class LatestPostsTask extends AsyncTask {
- //Class variables
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "LatestPostsTask"; //Separate tag for AsyncTask
-
+ private class LatestPostsTask extends AsyncTask {
protected void onPreExecute() {
if (!isLoadingMore) progressBar.setVisibility(ProgressBar.VISIBLE);
}
@@ -176,16 +165,16 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap
Response response = BaseActivity.getClient().newCall(request).execute();
return parseLatestPosts(Jsoup.parse(response.body().string()));
} catch (SSLHandshakeException e) {
- Report.w(TAG, "Certificate problem (please switch to unsafe connection).");
+ Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Report.e("TAG", "ERROR", e);
+ Timber.e("ERROR", e);
}
return false;
}
protected void onPostExecute(Boolean result) {
if (!result) { //Parse failed!
- Report.d(TAG, "Parse failed!");
+ Timber.d("Parse failed!");
Toast.makeText(getContext()
, "Fatal error!\n Aborting...", Toast.LENGTH_LONG).show();
getActivity().finish();
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
index 2e102c0e..f573f3db 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java
@@ -41,16 +41,12 @@ import javax.net.ssl.SSLHandshakeException;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.base.BaseActivity;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
-import mthmmy.utils.Report;
+
import okhttp3.Request;
import okhttp3.Response;
+import timber.log.Timber;
public class StatsFragment extends Fragment {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "StatsFragment";
/**
* The key to use when putting profile's url String to {@link StatsFragment}'s Bundle.
*/
@@ -109,7 +105,7 @@ public class StatsFragment extends Fragment {
profileStatsTask = new ProfileStatsTask();
profileStatsTask.execute(profileUrl + ";sa=statPanel");
}
- Report.d(TAG, "onActivityCreated");
+ Timber.d("onActivityCreated");
}
@Override
@@ -127,14 +123,7 @@ public class StatsFragment extends Fragment {
*
Calling SummaryTask's {@link AsyncTask#execute execute} method needs to have profile's url
* as String parameter!
*/
- public class ProfileStatsTask extends AsyncTask {
- //Class variables
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "ProfileStatsTask"; //Separate tag for AsyncTask
-
+ private class ProfileStatsTask extends AsyncTask {
@Override
protected void onPreExecute() {
progressBar.setVisibility(ProgressBar.VISIBLE);
@@ -150,9 +139,9 @@ public class StatsFragment extends Fragment {
Response response = BaseActivity.getClient().newCall(request).execute();
return parseStats(Jsoup.parse(response.body().string()));
} catch (SSLHandshakeException e) {
- Report.w(TAG, "Certificate problem (please switch to unsafe connection).");
+ Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Report.e("TAG", "ERROR", e);
+ Timber.e("ERROR", e);
}
return false;
}
@@ -160,7 +149,7 @@ public class StatsFragment extends Fragment {
@Override
protected void onPostExecute(Boolean result) {
if (!result) { //Parse failed!
- Report.d(TAG, "Parse failed!");
+ Timber.d("Parse failed!");
Toast.makeText(getContext()
, "Fatal error!\n Aborting...", Toast.LENGTH_LONG).show();
getActivity().finish();
@@ -348,7 +337,7 @@ public class StatsFragment extends Fragment {
mostPopularBoardsByActivityChart.invalidate();
}
- class MyXAxisValueFormatter implements IAxisValueFormatter {
+ private class MyXAxisValueFormatter implements IAxisValueFormatter {
private final ArrayList mValues;
MyXAxisValueFormatter(ArrayList values) {
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java
index f876b6ff..70644bf4 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java
@@ -7,7 +7,7 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.Html;
import android.text.method.LinkMovementMethod;
-import android.util.Log;
+
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -25,18 +25,14 @@ import java.util.Objects;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.utils.ParseHelpers;
-import mthmmy.utils.Report;
+
+import timber.log.Timber;
/**
* Use the {@link SummaryFragment#newInstance} factory method to create an instance of this fragment.
*/
public class SummaryFragment extends Fragment {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "SummaryFragment";
/**
* The key to use when putting profile's source code String to {@link SummaryFragment}'s Bundle.
*/
@@ -96,7 +92,7 @@ public class SummaryFragment extends Fragment {
summaryTask = new SummaryTask();
summaryTask.execute(profileSummaryDocument);
}
- Report.d(TAG, "onActivityCreated");
+ Timber.d("onActivityCreated");
}
@Override
@@ -114,14 +110,7 @@ public class SummaryFragment extends Fragment {
*
Calling SummaryTask's {@link AsyncTask#execute execute} method needs to have profile's url
* as String parameter!
*/
- public class SummaryTask extends AsyncTask {
- //Class variables
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "SummaryTask"; //Separate tag for AsyncTask
-
+ private class SummaryTask extends AsyncTask {
protected Void doInBackground(Document... profileSummaryPage) {
parsedProfileSummaryData = parseProfileSummary(profileSummaryPage[0]);
return null;
@@ -193,8 +182,8 @@ public class SummaryFragment extends Fragment {
if (profileSummaryRow.contains("@") &&
(profileSummaryRow.contains("Email") || profileSummaryRow.contains("E-mail"))) {
- Log.d(TAG, "mpika");
- Log.d(TAG, profileSummaryRow);
+ Timber.d("mpika");
+ Timber.d(profileSummaryRow);
String email = profileSummaryRow.substring(profileSummaryRow.indexOf(": ") + 6);
profileSummaryRow = profileSummaryRow.replace(email,
"" + email + "");
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/ReplyParser.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/ReplyParser.java
index 4950478b..ca47585a 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/ReplyParser.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/ReplyParser.java
@@ -10,12 +10,6 @@ import java.io.IOException;
import okhttp3.Response;
class ReplyParser {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "ReplyParser";
-
enum REPLY_STATUS {
SUCCESSFUL, NO_SUBJECT, EMPTY_BODY, NEW_REPLY_WHILE_POSTING, NOT_FOUND, SESSION_ENDED, OTHER_ERROR
}
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
index 710170fa..942dd50c 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
@@ -47,11 +47,12 @@ import gr.thmmy.mthmmy.model.Post;
import gr.thmmy.mthmmy.model.ThmmyPage;
import gr.thmmy.mthmmy.utils.ParseHelpers;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
-import mthmmy.utils.Report;
+
import okhttp3.MultipartBody;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
+import timber.log.Timber;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_TITLE;
@@ -69,11 +70,6 @@ import static gr.thmmy.mthmmy.activities.topic.ReplyParser.replyStatus;
@SuppressWarnings("unchecked")
public class TopicActivity extends BaseActivity {
//Class variables
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "TopicActivity";
/**
* The key to use when putting topic's url String to {@link TopicActivity}'s Bundle.
*/
@@ -134,7 +130,7 @@ public class TopicActivity extends BaseActivity {
ThmmyPage.PageCategory target = ThmmyPage.resolvePageCategory(
Uri.parse(topicPageUrl));
if (!target.is(ThmmyPage.PageCategory.TOPIC)) {
- Report.e(TAG, "Bundle came with a non topic url!\nUrl:\n" + topicPageUrl);
+ Timber.e("Bundle came with a non topic url!\nUrl:\n" + topicPageUrl);
Toast.makeText(this, "An error has occurred\n Aborting.", Toast.LENGTH_SHORT).show();
finish();
}
@@ -455,11 +451,6 @@ public class TopicActivity extends BaseActivity {
* as String parameter!
*/
class TopicTask extends AsyncTask {
- //Class variables
- /**
- * Debug Tag for logging debug output to LogCat
- */
- private static final String TAG = "TopicTask"; //Separate tag for AsyncTask
private static final int SUCCESS = 0;
private static final int NETWORK_ERROR = 1;
private static final int OTHER_ERROR = 2;
@@ -518,10 +509,10 @@ public class TopicActivity extends BaseActivity {
parse(document);
return SUCCESS;
} catch (IOException e) {
- Report.i(TAG, "IO Exception", e);
+ Timber.i("IO Exception", e);
return NETWORK_ERROR;
} catch (Exception e) {
- Report.e(TAG, "Exception", e);
+ Timber.e("Exception", e);
return OTHER_ERROR;
}
}
@@ -570,7 +561,7 @@ public class TopicActivity extends BaseActivity {
break;
default:
//Parse failed - should never happen
- Report.d(TAG, "Parse failed!");
+ Timber.d("Parse failed!"); //TODO report ParseException?
Toast.makeText(getBaseContext(), "Fatal Error", Toast.LENGTH_SHORT).show();
finish();
break;
@@ -609,7 +600,7 @@ public class TopicActivity extends BaseActivity {
} else {
parsedTitle = parsedTitle.substring(parsedTitle.indexOf("Θέμα:") + 6
, parsedTitle.indexOf("(Αναγνώστηκε") - 2);
- Report.d(TAG, parsedTitle);
+ Timber.d(parsedTitle);
}
}
@@ -700,10 +691,10 @@ public class TopicActivity extends BaseActivity {
subject = document.select("input[name=subject]").first().attr("value");
topic = document.select("input[name=topic]").first().attr("value");
} catch (IOException e) {
- Report.e(TAG, "Post failed.", e);
+ Timber.e("Post failed.", e);
return false;
} catch (Selector.SelectorParseException e) {
- Report.e(TAG, "Post failed.", e);
+ Timber.e("Post failed.", e);
return false;
}
@@ -733,11 +724,11 @@ public class TopicActivity extends BaseActivity {
//TODO this...
return true;
default:
- Report.e(TAG, "Malformed post. Request string:\n" + post.toString());
+ Timber.e("Malformed post. Request string:\n" + post.toString());
return true;
}
} catch (IOException e) {
- Report.e(TAG, "Post failed.", e);
+ Timber.e("Post failed.", e);
return false;
}
}
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
index 59c529af..3f5154fb 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
@@ -18,7 +18,7 @@ import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
-import android.util.Log;
+
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -54,7 +54,8 @@ import gr.thmmy.mthmmy.model.Post;
import gr.thmmy.mthmmy.model.ThmmyFile;
import gr.thmmy.mthmmy.model.ThmmyPage;
import gr.thmmy.mthmmy.utils.CircleTransform;
-import mthmmy.utils.Report;
+
+import timber.log.Timber;
import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_TITLE;
@@ -68,10 +69,6 @@ import static gr.thmmy.mthmmy.base.BaseActivity.getSessionManager;
* Custom {@link android.support.v7.widget.RecyclerView.Adapter} used for topics.
*/
class TopicAdapter extends RecyclerView.Adapter {
- /**
- * Debug Tag for logging debug output to LogCat
- */
- private static final String TAG = "TopicAdapter";
/**
* Int that holds thumbnail's size defined in R.dimen
*/
@@ -415,7 +412,7 @@ class TopicAdapter extends RecyclerView.Adapter {
if (toQuoteList.contains(postsList.indexOf(currentPost))) {
toQuoteList.remove(toQuoteList.indexOf(postsList.indexOf(currentPost)));
} else
- Report.i(TAG, "An error occurred while trying to exclude post from" +
+ Timber.i("An error occurred while trying to exclude post from" +
"toQuoteList, post wasn't there!");
holder.quoteToggle.setImageResource(R.drawable.ic_format_quote_unchecked);
} else {
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java
index 9229c6b9..7d21196a 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java
@@ -17,7 +17,8 @@ import java.util.Objects;
import gr.thmmy.mthmmy.model.Post;
import gr.thmmy.mthmmy.model.ThmmyFile;
import gr.thmmy.mthmmy.utils.ParseHelpers;
-import mthmmy.utils.Report;
+import timber.log.Timber;
+
/**
* Singleton used for parsing a topic.
@@ -36,12 +37,6 @@ class TopicParser {
static final int USER_COLOR_PINK = Color.parseColor("#FF4081");
private static final int USER_COLOR_YELLOW = Color.parseColor("#FFEB3B");
- /**
- * Debug Tag for logging debug output to LogCat
- */
- @SuppressWarnings("unused")
- private static final String TAG = "TopicParser";
-
/**
* Returns users currently viewing this topic.
*
@@ -257,7 +252,7 @@ class TopicParser {
try {
attachedUrl = new URL(tmpAttachedFileUrlAndName.attr("href"));
} catch (MalformedURLException e) {
- Report.e(TAG, "Attached file malformed url", e);
+ Timber.e("Attached file malformed url", e);
break;
}
String attachedFileName = tmpAttachedFileUrlAndName.text().substring(1);
@@ -317,7 +312,7 @@ class TopicParser {
try {
attachedUrl = new URL(tmpAttachedFileUrlAndName.attr("href"));
} catch (MalformedURLException e) {
- Report.e(TAG, "Attached file malformed url", e);
+ Timber.e("Attached file malformed url", e);
break;
}
String attachedFileName = tmpAttachedFileUrlAndName.text().substring(1);
diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
index b119dabe..3030cce0 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseApplication.java
@@ -23,13 +23,16 @@ import java.io.IOException;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
+import gr.thmmy.mthmmy.BuildConfig;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.session.SessionManager;
+import gr.thmmy.mthmmy.utils.CrashReportingTree;
import okhttp3.HttpUrl;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
+import timber.log.Timber;
public class BaseApplication extends Application {
@@ -55,6 +58,12 @@ public class BaseApplication extends Application {
super.onCreate();
baseApplication = this; //init singleton
+ if (BuildConfig.DEBUG) {
+ Timber.plant(new Timber.DebugTree());
+ } else {
+ Timber.plant(new CrashReportingTree());
+ }
+
SharedPreferences sharedPrefs = getSharedPreferences(SHARED_PREFS_NAME, MODE_PRIVATE);
SharedPrefsCookiePersistor sharedPrefsCookiePersistor = new SharedPrefsCookiePersistor(getApplicationContext());
PersistentCookieJar cookieJar = new PersistentCookieJar(new SetCookieCache(), sharedPrefsCookiePersistor);
diff --git a/app/src/main/java/gr/thmmy/mthmmy/base/BaseFragment.java b/app/src/main/java/gr/thmmy/mthmmy/base/BaseFragment.java
index c7b3d477..c33ffdf6 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/base/BaseFragment.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/base/BaseFragment.java
@@ -5,8 +5,8 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
-import mthmmy.utils.Report;
import okhttp3.OkHttpClient;
+import timber.log.Timber;
public abstract class BaseFragment extends Fragment {
protected static final String ARG_SECTION_NUMBER = "SectionNumber";
@@ -26,31 +26,31 @@ public abstract class BaseFragment extends Fragment {
if(client==null)
client = BaseApplication.getInstance().getClient(); //must check every time - e.g.
// becomes null when app restarts after crash
- Report.d(TAG, "onCreate");
+ Timber.d("onCreate");
}
@Override
public void onStart() {
super.onStart();
- Report.d(TAG, "onStart");
+ Timber.d("onStart");
}
@Override
public void onResume() {
super.onResume();
- Report.d(TAG, "onResume");
+ Timber.d("onResume");
}
@Override
public void onPause() {
super.onPause();
- Report.d(TAG, "onPause");
+ Timber.d("onPause");
}
@Override
public void onStop() {
super.onStop();
- Report.d(TAG, "onStop");
+ Timber.d("onStop");
}
@Override
diff --git a/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java b/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java
index cc9a1781..38f95867 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java
@@ -4,7 +4,7 @@ import android.net.Uri;
import java.util.Objects;
-import mthmmy.utils.Report;
+import timber.log.Timber;
/**
* This class consists exclusively of static classes (enums) and methods (excluding methods of inner
@@ -162,7 +162,7 @@ public class ThmmyPage {
|| Objects.equals(uriString, "https://www.thmmy.gr")
|| Objects.equals(uriString, "https://www.thmmy.gr/smf/index.php"))
return PageCategory.INDEX;
- Report.v(TAG, "Unknown thmmy link found, link: " + uriString);
+ Timber.v("Unknown thmmy link found, link: " + uriString);
return PageCategory.UNKNOWN_THMMY;
}
return PageCategory.NOT_THMMY;
diff --git a/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java b/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java
index 3e811134..d93f4272 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/receiver/Receiver.java
@@ -14,7 +14,8 @@ import android.webkit.MimeTypeMap;
import java.io.File;
import gr.thmmy.mthmmy.R;
-import mthmmy.utils.Report;
+
+import timber.log.Timber;
import static gr.thmmy.mthmmy.services.DownloadService.ACTION_DOWNLOAD;
import static gr.thmmy.mthmmy.services.DownloadService.COMPLETED;
@@ -28,7 +29,6 @@ import static gr.thmmy.mthmmy.services.DownloadService.SAVE_DIR;
import static gr.thmmy.mthmmy.services.DownloadService.STARTED;
public class Receiver extends BroadcastReceiver {
- private static final String TAG = "BroadcastReceiver";
public Receiver() {
}
@@ -72,7 +72,7 @@ public class Receiver extends BroadcastReceiver {
builder.setContentIntent(pendingIntent);
} else
- Report.w(TAG, "File doesn't exist.");
+ Timber.w("File doesn't exist.");
}
Notification notification = builder.build();
notificationManager.notify(id, notification);
diff --git a/app/src/main/java/gr/thmmy/mthmmy/services/DownloadService.java b/app/src/main/java/gr/thmmy/mthmmy/services/DownloadService.java
index 7339fa73..cd878b25 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/services/DownloadService.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/services/DownloadService.java
@@ -13,12 +13,13 @@ import java.io.IOException;
import gr.thmmy.mthmmy.base.BaseApplication;
import gr.thmmy.mthmmy.receiver.Receiver;
-import mthmmy.utils.Report;
+
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okio.BufferedSink;
import okio.Okio;
+import timber.log.Timber;
/**
* An {@link IntentService} subclass for handling asynchronous task requests in
@@ -116,9 +117,9 @@ public class DownloadService extends IntentService {
if(!dirPath.isDirectory())
{
if(dirPath.mkdirs())
- Report.i(TAG, "mTHMMY's directory created successfully!");
+ Timber.i("mTHMMY's directory created successfully!");
else
- Report.e(TAG, "Couldn't create mTHMMY's directory...");
+ Timber.e("Couldn't create mTHMMY's directory...");
}
@@ -127,7 +128,7 @@ public class DownloadService extends IntentService {
if(tokens.length!=2)
{
- Report.w(TAG, "Couldn't get file extension...");
+ Timber.w("Couldn't get file extension...");
nameFormat = fileName + "(%d)";
}
else
@@ -148,26 +149,26 @@ public class DownloadService extends IntentService {
fileName = file.getName();
- Report.v(TAG, "Started saving file " + fileName);
+ Timber.v("Started saving file " + fileName);
sendNotification(downloadId, STARTED, fileName);
sink = Okio.buffer(Okio.sink(file));
sink.writeAll(response.body().source());
sink.flush();
- Report.i(TAG, "Download OK!");
+ Timber.i("Download OK!");
sendNotification(downloadId, COMPLETED, fileName);
}
else
- Report.e(TAG, "Response not a binary file!");
+ Timber.e("Response not a binary file!");
}
catch (FileNotFoundException e){
- Report.i(TAG, "Download failed...");
- Report.e(TAG, "FileNotFound", e);
+ Timber.i("Download failed...");
+ Timber.e("FileNotFound", e);
sendNotification(downloadId, FAILED, fileName);
}
catch (IOException e){
- Report.i(TAG, "Download failed...");
- Report.e(TAG, "IOException", e);
+ Timber.i("Download failed...");
+ Timber.e("IOException", e);
sendNotification(downloadId, FAILED, fileName);
} finally {
if (sink!= null) {
@@ -203,7 +204,7 @@ public class DownloadService extends IntentService {
break;
}
default:{
- Report.wtf(TAG, "Invalid notification case!");
+ Timber.e("Invalid notification case!");
return;
}
}
diff --git a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
index c6bbd713..ce0f9228 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
@@ -18,7 +18,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import gr.thmmy.mthmmy.utils.exceptions.ParseException;
-import mthmmy.utils.Report;
import okhttp3.Cookie;
import okhttp3.FormBody;
import okhttp3.HttpUrl;
@@ -26,15 +25,13 @@ import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
+import timber.log.Timber;
/**
* This class handles all session related operations (e.g. login, logout)
* and stores data to SharedPreferences (session information and cookies).
*/
public class SessionManager {
- //Class TAG
- private static final String TAG = "SessionManager";
-
//Generic constants
public static final HttpUrl indexUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?theme=4");
public static final HttpUrl forumUrl = HttpUrl.parse("https://www.thmmy.gr/smf/index.php?action=forum;theme=4");
@@ -80,7 +77,7 @@ public class SessionManager {
* Always call it in a separate thread.
*/
public int login(String... strings) {
- Report.i(TAG, "Logging in...");
+ Timber.i("Logging in...");
//Build the login request for each case
Request request;
@@ -114,7 +111,7 @@ public class SessionManager {
if (unreadRepliesLinks.size()>=2) //Normally it's just == 2, but who knows what can be posted by users
{
- Report.i(TAG, "Login successful!");
+ Timber.i("Login successful!");
setPersistentCookieSession(); //Store cookies
//Edit SharedPreferences, save session's data
@@ -133,18 +130,18 @@ public class SessionManager {
return SUCCESS;
} else {
- Report.i(TAG, "Login failed.");
+ Timber.i("Login failed.");
//Investigate login failure
Elements error = document.select("b:contains(That username does not exist.)");
if (error.size() == 1) { //Wrong username
- Report.i(TAG, "Wrong Username");
+ Timber.i("Wrong Username");
return WRONG_USER;
}
error = document.select("body:contains(Password incorrect)");
if (error.size() == 1) { //Wrong password
- Report.i(TAG, "Wrong Password");
+ Timber.i("Wrong Password");
return WRONG_PASSWORD;
}
@@ -154,13 +151,13 @@ public class SessionManager {
}
//Handle exception
} catch (InterruptedIOException e) {
- Report.i(TAG, "Login InterruptedIOException"); //users cancels LoginTask
+ Timber.i("Login InterruptedIOException"); //users cancels LoginTask
return CANCELLED;
} catch (IOException e) {
- Report.w(TAG, "Login IOException", e);
+ Timber.w("Login IOException", e);
return CONNECTION_ERROR;
} catch (Exception e) {
- Report.w(TAG, "Login Exception (other)", e);
+ Timber.w("Login Exception (other)", e);
return EXCEPTION;
}
}
@@ -175,7 +172,7 @@ public class SessionManager {
* fragments' data are retrieved).
*/
public void validateSession() {
- Report.i(TAG, "Validating session...");
+ Timber.i("Validating session...");
if (isLoggedIn()) {
int loginResult = login();
@@ -192,7 +189,7 @@ public class SessionManager {
* Call this function when user explicitly chooses to continue as a guest (UI thread).
*/
public void guestLogin() {
- Report.i("TAG", "Continuing as a guest, as chosen by the user.");
+ Timber.i("Continuing as a guest, as chosen by the user.");
clearSessionData();
sharedPrefs.edit().putBoolean(LOGIN_SCREEN_AS_DEFAULT, false).apply();
}
@@ -202,7 +199,7 @@ public class SessionManager {
* Logout function. Always call it in a separate thread.
*/
public int logout() {
- Report.i(TAG, "Logging out...");
+ Timber.i("Logging out...");
Request request = new Request.Builder()
.url(sharedPrefs.getString(LOGOUT_LINK, "LogoutLink"))
@@ -216,17 +213,17 @@ public class SessionManager {
Elements loginButton = document.select("[value=Login]"); //Attempt to find login button
if (!loginButton.isEmpty()) //If login button exists, logout was successful
{
- Report.i(TAG, "Logout successful!");
+ Timber.i("Logout successful!");
return SUCCESS;
} else {
- Report.i(TAG, "Logout failed.");
+ Timber.i("Logout failed.");
return FAILURE;
}
} catch (IOException e) {
- Report.w(TAG, "Logout IOException", e);
+ Timber.w("Logout IOException", e);
return CONNECTION_ERROR;
} catch (Exception e) {
- Report.w(TAG, "Logout Exception", e);
+ Timber.w("Logout Exception", e);
return EXCEPTION;
} finally {
//All data should always be cleared from device regardless the result of logout
@@ -288,7 +285,7 @@ public class SessionManager {
sharedPrefs.edit().clear().apply(); //Clear session data
sharedPrefs.edit().putString(USERNAME, guestName).apply();
sharedPrefs.edit().putBoolean(LOGGED_IN, false).apply(); //User logs out
- Report.i(TAG, "Session data cleared.");
+ Timber.i("Session data cleared.");
}
@NonNull
@@ -321,7 +318,7 @@ public class SessionManager {
if(userName != null && !userName.isEmpty())
return userName;
- Report.e(TAG, "ParseException", new ParseException("Parsing failed(username extraction)"));
+ Timber.e("ParseException", new ParseException("Parsing failed(username extraction)"));
return "User"; //return a default username
}
@@ -332,7 +329,7 @@ public class SessionManager {
if (!avatar.isEmpty())
return avatar.first().attr("src");
- Report.i(TAG, "Extracting avatar's link failed!");
+ Timber.i("Extracting avatar's link failed!");
return null;
}
@@ -346,7 +343,7 @@ public class SessionManager {
if(link != null && !link.isEmpty())
return link;
}
- Report.e(TAG, "ParseException", new ParseException("Parsing failed(logoutLink extraction)"));
+ Timber.e("ParseException", new ParseException("Parsing failed(logoutLink extraction)"));
return "https://www.thmmy.gr/smf/index.php?action=logout"; //return a default link
}
//----------------------------------OTHER FUNCTIONS END-----------------------------------------
diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReportingTree.java b/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReportingTree.java
new file mode 100644
index 00000000..2aeca9a2
--- /dev/null
+++ b/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReportingTree.java
@@ -0,0 +1,34 @@
+package gr.thmmy.mthmmy.utils;
+
+import android.util.Log;
+
+import com.google.firebase.crash.FirebaseCrash;
+
+import gr.thmmy.mthmmy.utils.exceptions.UnknownException;
+import timber.log.Timber;
+
+public class CrashReportingTree extends Timber.Tree {
+ @Override
+ protected void log(int priority, String tag, String message, Throwable t) {
+ if (priority == Log.VERBOSE || priority == Log.DEBUG) {
+ return;
+ }
+
+ String level="A";
+
+ if (priority == Log.INFO)
+ level = "I";
+ else if (priority == Log.WARN)
+ level = "W";
+ else if(priority == Log.ERROR)
+ level = "E";
+
+ FirebaseCrash.log(level + "/" + tag + ": " + message);
+
+ if(t==null)
+ t = new UnknownException("UnknownException");
+
+ if ((priority == Log.ERROR))
+ FirebaseCrash.report(t);
+ }
+}
diff --git a/app/src/release/java/mthmmy.utils/Report.java b/app/src/release/java/mthmmy.utils/Report.java
deleted file mode 100644
index 4a6a46b8..00000000
--- a/app/src/release/java/mthmmy.utils/Report.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package mthmmy.utils;
-
-import com.google.firebase.crash.FirebaseCrash;
-
-import gr.thmmy.mthmmy.utils.exceptions.UnknownException;
-
-public class Report
-{
-
- public static void v (String TAG, String message)
- {
- log("V", TAG, message);
- }
-
- public static void v (String TAG, String message, Throwable tr)
- {
- exception("V", TAG, message, tr);
- }
-
- public static void d (String TAG, String message)
- {
- log("D", TAG, message);
- }
-
- public static void d (String TAG, String message, Throwable tr)
- {
- exception("D", TAG, message, tr);
- }
-
- public static void i (String TAG, String message)
- {
- log("I", TAG, message);
- }
-
- public static void i (String TAG, String message, Throwable tr)
- {
- exception("I", TAG, message, tr);
- }
-
- public static void w (String TAG, String message)
- {
- log("W", TAG, message);
- }
-
- public static void w (String TAG, String message, Throwable tr)
- {
- exception("W", TAG, message, tr);
- }
-
- public static void e (String TAG, String message)
- {
- log("E", TAG, message);
- }
-
- public static void e (String TAG, String message, Throwable tr)
- {
- exception("E", TAG, message, tr);
- }
-
- public static void wtf (String TAG, String message)
- {
- log("WTF", TAG, message);
- }
-
- public static void wtf (String TAG, String message, Throwable tr)
- {
- exception("WTF", TAG, message, tr);
- }
-
- private static void log(String level, String TAG, String message)
- {
- if(!level.equals("V")&&!level.equals("D")) //don't log V and D levels
- {
- FirebaseCrash.log(level + "/" + TAG + ": " + message);
- if(level.equals("E")||level.equals("WTF")) //report only serious exceptions
- FirebaseCrash.report(new UnknownException("UnknownException"));
- }
- }
-
- private static void exception(String level, String TAG, String message, Throwable tr)
- {
- if(!level.equals("V")&&!level.equals("D")) //don't log V and D levels
- {
- FirebaseCrash.log(level + "/" + TAG + ": " + message + ": " + tr.getMessage());
- if(level.equals("E")||level.equals("WTF")) //report only serious exceptions
- FirebaseCrash.report(tr);
- }
- }
-
- /**
- * Does nothing in release.
- */
- public static void longMessage(String TAG, String level, String message) {return;}
-
-
-}
diff --git a/build.gradle b/build.gradle
index 25e7e862..a40a0e30 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,7 +6,7 @@ buildscript {
maven { url "https://jitpack.io" }
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.3'
+ classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 04e285f3..8b6dacea 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Mon Dec 28 10:00:20 PST 2015
+#Wed Mar 08 11:25:21 EET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
From be889af3d7a286a9cc98fbec9401e45257b461e2 Mon Sep 17 00:00:00 2001
From: Ezerous
Date: Tue, 14 Mar 2017 12:32:32 +0200
Subject: [PATCH 12/18] yml file update
---
.gitlab-ci.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d02a2bf6..bf367524 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,8 +2,8 @@ image: openjdk:8-jdk
variables:
ANDROID_TARGET_SDK: "25"
- ANDROID_BUILD_TOOLS: "25.0.1"
- ANDROID_SDK_TOOLS: "25.2.5"
+ ANDROID_BUILD_TOOLS: "25.0.2"
+ ANDROID_SDK_TOOLS: "25.3.0"
before_script:
- apt-get --quiet update --yes
From fd2f289aee0c484fdba54a25e3609d8dd65a7119 Mon Sep 17 00:00:00 2001
From: Ezerous
Date: Tue, 14 Mar 2017 12:40:08 +0200
Subject: [PATCH 13/18] yml update 2
---
.gitlab-ci.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bf367524..cd22f77e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,7 +3,7 @@ image: openjdk:8-jdk
variables:
ANDROID_TARGET_SDK: "25"
ANDROID_BUILD_TOOLS: "25.0.2"
- ANDROID_SDK_TOOLS: "25.3.0"
+ ANDROID_SDK_TOOLS: "25.2.5"
before_script:
- apt-get --quiet update --yes
From 34cd86e98c2c20fdb37eb69fe29f1c83d0641dde Mon Sep 17 00:00:00 2001
From: Apostolof
Date: Sun, 19 Mar 2017 01:30:30 +0200
Subject: [PATCH 14/18] Html to BBcode init
---
app/build.gradle | 13 +-
.../mthmmy/activities/topic/TopicAdapter.java | 221 +++++++++++++++++-
2 files changed, 227 insertions(+), 7 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index 522c3627..c7dc1920 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -20,7 +20,8 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
- def date = new Date().format('ddMMyy_HHmm');
+ //def date = new Date().format('ddMMyy_HHmm');
+ def date = 1;
archivesBaseName = archivesBaseName + "-$date"
}
}
@@ -28,11 +29,11 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- compile 'com.android.support:appcompat-v7:25.2.0'
- compile 'com.android.support:design:25.2.0'
- compile 'com.android.support:support-v4:25.2.0'
- compile 'com.android.support:cardview-v7:25.2.0'
- compile 'com.android.support:recyclerview-v7:25.2.0'
+ compile 'com.android.support:appcompat-v7:25.3.0'
+ compile 'com.android.support:design:25.3.0'
+ compile 'com.android.support:support-v4:25.3.0'
+ compile 'com.android.support:cardview-v7:25.3.0'
+ compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.picasso:picasso:2.5.2'
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
index 3f5154fb..6f1d438c 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
@@ -42,9 +42,12 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.Objects;
+import java.util.regex.Matcher;
import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.board.BoardActivity;
@@ -149,7 +152,7 @@ class TopicAdapter extends RecyclerView.Adapter {
quotes += buildQuote(quotePosition);
}
if (!Objects.equals(quotes, ""))
- replyDataHolder[replyText] = quotes;
+ replyDataHolder[replyText] = htmlToBBcode(quotes);
return new QuickReplyViewHolder(view, new CustomEditTextListener(replySubject),
new CustomEditTextListener(replyText));
}
@@ -779,6 +782,222 @@ class TopicAdapter extends RecyclerView.Adapter {
return null;
}
+ private String htmlToBBcode(String html) {
+ Map bbMap = new HashMap<>();
+ Map smileysMap1 = new HashMap<>();
+ Map smileysMap2 = new HashMap<>();
+ smileysMap1.put("Smiley", ":)");
+ smileysMap1.put("Wink", ";)");
+ smileysMap1.put("Cheesy", ":D");
+ smileysMap1.put("Grin", ";D");
+ smileysMap1.put("Angry", ">:(");
+ smileysMap1.put("Sad", ":(");
+ smileysMap1.put("Shocked", ":o");
+ smileysMap1.put("Cool", "8))");
+ smileysMap1.put("Huh", ":???:");
+ smileysMap1.put("Roll Eyes", "::)");
+ smileysMap1.put("Tongue", ":P");
+ smileysMap1.put("Embarrassed", ":-[");
+ smileysMap1.put("Lips Sealed", ":-X");
+ smileysMap1.put("Kiss", ":-*");
+ smileysMap1.put("Cry", ":'(");
+ smileysMap1.put("heart", "<3");
+ smileysMap1.put("kleidaria", "^locked^");
+ smileysMap1.put("roll_over", "^rollover^");
+ smileysMap1.put("redface", "^redface^");
+ smileysMap1.put("confused", "^confused^");
+ smileysMap1.put("innocent", "^innocent^");
+ smileysMap1.put("sleep", "^sleep^");
+ smileysMap1.put("lips_sealed", "^sealed^");
+ smileysMap1.put("cool", "^cool^");
+ smileysMap1.put("crazy", "^crazy^");
+ smileysMap1.put("mad", "^mad^");
+ smileysMap1.put("wav", "^wav^");
+ smileysMap1.put("BinkyBaby", "^binkybaby^");
+ smileysMap1.put("DontKnow", "^dontknow^");
+ smileysMap1.put("angry4", ":angry4:");
+ smileysMap1.put("angryAndHot", "^angryhot^");
+ smileysMap1.put("angry", "^angry^");
+ smileysMap1.put("bang_head", "^banghead^");
+ smileysMap1.put("CryBaby", "^crybaby^");
+ smileysMap1.put("Hello", "^hello^");
+ smileysMap1.put("jerk", "^jerk^");
+ smileysMap1.put("NoNo", "^nono^");
+ smileysMap1.put("NotWorthy", "^notworthy^");
+ smileysMap1.put("Off-topic", "^off-topic^");
+ smileysMap1.put("Puke", "^puke^");
+ smileysMap1.put("Shout", "^shout^");
+ smileysMap1.put("Slurp", "^slurp^");
+ smileysMap1.put("SuperConfused", "^superconfused^");
+ smileysMap1.put("SuperInnocent", "^superinnocent^");
+ smileysMap1.put("CellPhone", "^cellPhone^");
+ smileysMap1.put("Idiot", "^idiot^");
+ smileysMap1.put("Knuppel", "^knuppel^");
+ smileysMap1.put("TickedOff", "^tickedOff^");
+ smileysMap1.put("Peace", "^peace^");
+ smileysMap1.put("Suspicious", "^suspicious^");
+ smileysMap1.put("Caffine", "^caffine^");
+ smileysMap1.put("argue", "^argue^");
+ smileysMap1.put("banned2", "^banned2^");
+ smileysMap1.put("banned", "^banned^");
+ smileysMap1.put("bath", "^bath^");
+ smileysMap1.put("beg", "^beg^");
+ smileysMap1.put("bluescreen", "^bluescreen^");
+ smileysMap1.put("boil", "^boil^");
+ smileysMap1.put("bye", "^bye^");
+ smileysMap1.put("callmerip", "^callmerip^");
+ smileysMap1.put("carnaval", "^carnaval^");
+ smileysMap1.put("clap", "^clap^");
+ smileysMap1.put("coffepot", "^coffepot^");
+ smileysMap1.put("crap", "^crap^");
+ smileysMap1.put("curses", "^curses^");
+ smileysMap1.put("funny", "^funny^");
+ smileysMap1.put("guitar", "^guitar^");
+ smileysMap1.put("kissy", "^kissy^");
+ smileysMap1.put("band", "^band^");
+ smileysMap1.put("ivres", "^ivres^");
+ smileysMap1.put("kaloe", "^kaloe^");
+ smileysMap1.put("kremala", "^kremala^");
+ smileysMap1.put("moon", "^moon^");
+ smileysMap1.put("mopping", "^mopping^");
+ smileysMap1.put("mountza", "^mountza^");
+ smileysMap1.put("pcsleep", "^pcsleep^");
+ smileysMap1.put("pinokio", "^pinokio^");
+ smileysMap1.put("poke", "^poke^");
+ smileysMap1.put("seestars", "^seestars^");
+ smileysMap1.put("sfyri", "^sfyri^");
+ smileysMap1.put("spam", "^spam^");
+ smileysMap1.put("super", "^super^");
+ smileysMap1.put("tafos", "^tafos^");
+ smileysMap1.put("tomato", "^tomato^");
+ smileysMap1.put("ytold", "^ytold^");
+ smileysMap1.put("beer", "^beer^");
+ smileysMap1.put("ο fritz!!!", "^fritz^");
+ smileysMap1.put("o Wade!!!", "^wade^");
+ smileysMap1.put("bonjour", "^hat^");
+ smileysMap1.put("bonjour2", "^miss^");
+ smileysMap1.put("question", "^que^");
+ smileysMap1.put("shifty", "^shifty^");
+ smileysMap1.put("shy", "^shy^");
+ smileysMap1.put("music_listenning", "^music_listen^");
+ smileysMap1.put("bag_face", "^bagface^");
+ smileysMap1.put("rotation", "^rotate^");
+ smileysMap1.put("love", "^love^");
+ smileysMap1.put("speech", "^speech^");
+ smileysMap1.put("shocked", "^shocked^");
+ smileysMap1.put("extremely_shocked", "^ex_shocked^");
+ smileysMap1.put("smurf", "^smurf^");
+ smileysMap1.put("monster", "^monster^");
+ smileysMap1.put("pig", "^pig^");
+ smileysMap1.put("lol", "^lol^");
+
+ smileysMap2.put("Police", "^Police^");
+ smileysMap2.put("foyska", "^fouska^");
+ smileysMap2.put("nista", "^nysta^");
+ smileysMap2.put("10_7_3", "^sfinaki^");
+ smileysMap2.put("yu", "^yue^");
+ smileysMap2.put("a-eatpaper", "^eatpaper^");
+ smileysMap2.put("lypi", "^lypi^");
+ smileysMap2.put("megashok1wq", "^aytoxeir^");
+ smileysMap2.put("victory", "^victory^");
+ smileysMap2.put("filarakia", "^filarakia^");
+ smileysMap2.put("rofl", "^rolfmao^");
+ smileysMap2.put("locked", "^lock^");
+ smileysMap2.put("facepalm", "^facepalm^");
+
+ //html stuff on the beginning
+ bbMap.put("\n ", "");
+ //quotes and code headers
+ bbMap.put("\n\\s+?