diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cd22f77e..b3c840ca 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,7 +2,7 @@ image: openjdk:8-jdk
variables:
ANDROID_TARGET_SDK: "25"
- ANDROID_BUILD_TOOLS: "25.0.2"
+ ANDROID_BUILD_TOOLS: "25.0.3"
ANDROID_SDK_TOOLS: "25.2.5"
before_script:
diff --git a/app/build.gradle b/app/build.gradle
index 1517040e..83f079af 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 25
- buildToolsVersion "25.0.2"
+ buildToolsVersion "25.0.3"
defaultConfig {
vectorDrawables.useSupportLibrary = true
@@ -28,25 +28,25 @@ android {
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
- 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.android.support:appcompat-v7:25.3.1'
+ compile 'com.android.support:design:25.3.1'
+ compile 'com.android.support:support-v4:25.3.1'
+ compile 'com.android.support:cardview-v7:25.3.1'
+ compile 'com.android.support:recyclerview-v7:25.3.1'
+ compile 'com.google.firebase:firebase-crash:11.0.0'
+ compile 'com.squareup.okhttp3:okhttp:3.8.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
compile 'org.jsoup:jsoup:1.10.2'
compile 'com.github.franmontiel:PersistentCookieJar:v1.0.0'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.1'
- compile('com.mikepenz:materialdrawer:5.8.2@aar') {
+ compile('com.mikepenz:materialdrawer:5.9.2@aar') {
transitive = true
}
compile 'com.mikepenz:fontawesome-typeface:4.7.0.0@aar'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.5'
compile 'com.bignerdranch.android:expandablerecyclerview:3.0.0-RC1'
- compile 'me.zhanghai.android.materialprogressbar:library:1.3.0'
+ compile 'me.zhanghai.android.materialprogressbar:library:1.4.1'
compile 'com.jakewharton.timber:timber:4.5.1'
}
diff --git a/app/src/main/assets/apache_libraries.html b/app/src/main/assets/apache_libraries.html
index 2c0ceabc..2fe80f29 100644
--- a/app/src/main/assets/apache_libraries.html
+++ b/app/src/main/assets/apache_libraries.html
@@ -39,7 +39,7 @@
-
-
OkHttp v3.6.0 (Copyright ©2016 Square, Inc.)
+ OkHttp v3.8.0 (Copyright ©2016 Square, Inc.)
-
Picasso v2.5.2 (Copyright ©2013 Square, Inc.)
@@ -51,13 +51,13 @@
MPAndroidChart v3.0.1 (Copyright ©2016 Philipp Jahoda)
-
-
MaterialDrawer v5.8.2 (Copyright ©2016 Mike Penz)
+ MaterialDrawer v5.9.2 (Copyright ©2016 Mike Penz)
-
-
-
+
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 00dbb69a..57a97093 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
@@ -194,7 +194,7 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
} catch (SSLHandshakeException e) {
Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Timber.e("ERROR", e);
+ Timber.e(e, "Exception");
}
return null;
}
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 b4339f14..724bf3c3 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
@@ -189,7 +189,7 @@ public class DownloadsActivity extends BaseActivity implements DownloadsAdapter.
} catch (SSLHandshakeException e) {
Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Timber.e("ERROR", e);
+ Timber.e(e, "Exception");
}
return null;
}
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 8bcecc25..8ca74bdb 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
@@ -29,6 +29,7 @@ import gr.thmmy.mthmmy.base.BaseFragment;
import gr.thmmy.mthmmy.model.Board;
import gr.thmmy.mthmmy.model.Category;
import gr.thmmy.mthmmy.session.SessionManager;
+import gr.thmmy.mthmmy.utils.exceptions.ParseException;
import me.zhanghai.android.materialprogressbar.MaterialProgressBar;
import okhttp3.HttpUrl;
@@ -178,12 +179,15 @@ public class ForumFragment extends BaseFragment
categories.addAll(fetchedCategories);
fetchedCategories.clear();
return 0;
- } catch (IOException e) {
- Timber.d("Network Error", e);
+ } catch (ParseException e) {
+ Timber.e(e, "ParseException");
return 1;
- } catch (Exception e) {
- Timber.d("Exception", e);
+ } catch (IOException e) {
+ Timber.i(e, "Network Error");
return 2;
+ } catch (Exception e) {
+ Timber.e(e, "Exception");
+ return 3;
}
}
@@ -193,14 +197,13 @@ public class ForumFragment extends BaseFragment
if (result == 0)
forumAdapter.notifyParentDataSetChanged(false);
- else if (result == 1)
+ else if (result == 2)
Toast.makeText(getActivity(), "Network error", Toast.LENGTH_SHORT).show();
progressBar.setVisibility(ProgressBar.INVISIBLE);
}
- private void parse(Document document)
- {
+ private void parse(Document document) throws ParseException {
Elements categoryBlocks = document.select(".tborder:not([style])>table[cellpadding=5]");
if (categoryBlocks.size() != 0) {
for(Element categoryBlock: categoryBlocks)
@@ -225,7 +228,7 @@ public class ForumFragment extends BaseFragment
}
}
else
- Timber.e("Parsing failed!");
+ throw new ParseException("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 47f4678d..45b1140d 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
@@ -161,13 +161,13 @@ public class RecentFragment extends BaseFragment {
parse(document);
return 0;
} catch (ParseException e) {
- Timber.e("ParseException", e);
+ Timber.e(e, "ParseException");
return 1;
} catch (IOException e) {
- Timber.i("Network Error", e);
+ Timber.i(e, "Network Error");
return 2;
} catch (Exception e) {
- Timber.e("Exception", e);
+ Timber.e(e, "Exception");
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 08495dd9..e5a30cc8 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
@@ -276,11 +276,12 @@ public class ProfileActivity extends BaseActivity implements LatestPostsFragment
} catch (SSLHandshakeException e) {
Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Timber.e("ERROR", e);
+ Timber.e(e, "Exception");
}
return false;
}
+ //TODO: better parse error handling (ParseException etc.)
protected void onPostExecute(Boolean result) {
if (!result) { //Parse failed! //TODO report as ParseException?
Timber.d("Parse failed!");
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 5c3f8d40..d08ad37a 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
@@ -167,7 +167,7 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap
} catch (SSLHandshakeException e) {
Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Timber.e("ERROR", e);
+ Timber.e(e, "Exception");
}
return false;
}
@@ -185,6 +185,7 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap
isLoadingMore = false;
}
+ //TODO: better parse error handling (ParseException etc.)
private boolean parseLatestPosts(Document latestPostsPage) {
Elements latestPostsRows = latestPostsPage.
select("td:has(table:Contains(Show Posts)):not([style]) > table");
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 f573f3db..8e9ca93d 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
@@ -141,11 +141,12 @@ public class StatsFragment extends Fragment {
} catch (SSLHandshakeException e) {
Timber.w("Certificate problem (please switch to unsafe connection).");
} catch (Exception e) {
- Timber.e("ERROR", e);
+ Timber.e(e, "Exception");
}
return false;
}
+ //TODO: better parse error handling (ParseException etc.)
@Override
protected void onPostExecute(Boolean result) {
if (!result) { //Parse failed!
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java
index 7c42b8cd..f0220f82 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java
@@ -1,7 +1,5 @@
package gr.thmmy.mthmmy.activities.topic;
-import android.util.Log;
-
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
@@ -11,6 +9,7 @@ import java.util.Map;
import java.util.regex.Matcher;
import okhttp3.Response;
+import timber.log.Timber;
class Posting {
enum REPLY_STATUS {
@@ -26,8 +25,8 @@ class Posting {
String[] errors = postErrorPage.select("tr[id=errors] div[id=error_list]").first()
.toString().split("
");
for (int i = 0; i < errors.length; ++i) { //TODO test
- Log.d("TAG", String.valueOf(i));
- Log.d("TAG", errors[i]);
+ Timber.d(String.valueOf(i));
+ Timber.d(errors[i]);
}
for (String error : errors) {
if (error.contains("Your session timed out while posting") ||
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 050fea14..74dcadac 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
@@ -134,7 +134,7 @@ public class TopicActivity extends BaseActivity {
ThmmyPage.PageCategory target = ThmmyPage.resolvePageCategory(
Uri.parse(topicPageUrl));
if (!target.is(ThmmyPage.PageCategory.TOPIC)) {
- Timber.e("Bundle came with a non topic url!\nUrl:\n" + topicPageUrl);
+ Timber.e("Bundle came with a non topic url!\nUrl: %s" , topicPageUrl);
Toast.makeText(this, "An error has occurred\n Aborting.", Toast.LENGTH_SHORT).show();
finish();
}
@@ -517,10 +517,10 @@ public class TopicActivity extends BaseActivity {
parse(document);
return SUCCESS;
} catch (IOException e) {
- Timber.i("IO Exception", e);
+ Timber.i(e, "IO Exception");
return NETWORK_ERROR;
} catch (Exception e) {
- Timber.e("Exception", e);
+ Timber.e(e, "Exception");
return OTHER_ERROR;
}
}
@@ -568,7 +568,7 @@ public class TopicActivity extends BaseActivity {
break;
default:
//Parse failed - should never happen
- Timber.d("Parse failed!"); //TODO report ParseException?
+ Timber.d("Parse failed!"); //TODO report ParseException!!!
Toast.makeText(getBaseContext(), "Fatal Error", Toast.LENGTH_SHORT).show();
finish();
break;
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 3ce9c24d..c3e7271c 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
@@ -259,7 +259,7 @@ class TopicParser {
try {
attachedUrl = new URL(tmpAttachedFileUrlAndName.attr("href"));
} catch (MalformedURLException e) {
- Timber.e("Attached file malformed url", e);
+ Timber.e(e, "Attached file malformed url");
break;
}
String attachedFileName = tmpAttachedFileUrlAndName.text().substring(1);
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 9e935f69..3ca324ed 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/model/ThmmyPage.java
@@ -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;
- Timber.v("Unknown thmmy link found, link: " + uriString);
+ Timber.v("Unknown thmmy link found, link: %s" , uriString);
return PageCategory.UNKNOWN_THMMY;
}
return PageCategory.NOT_THMMY;
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 52883ef4..0283cef1 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/services/DownloadService.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/services/DownloadService.java
@@ -142,7 +142,7 @@ public class DownloadService extends IntentService {
fileName = file.getName();
- Timber.v("Started saving file " + fileName);
+ Timber.v("Started saving file %s" , fileName);
sendNotification(downloadId, STARTED, fileName);
sink = Okio.buffer(Okio.sink(file));
@@ -154,11 +154,11 @@ public class DownloadService extends IntentService {
Timber.e("Response not a binary file!");
} catch (FileNotFoundException e) {
Timber.i("Download failed...");
- Timber.e("FileNotFound", e);
+ Timber.e(e, "FileNotFound");
sendNotification(downloadId, FAILED, fileName);
} catch (IOException e) {
Timber.i("Download failed...");
- Timber.e("IOException", e);
+ Timber.e(e, "IOException");
sendNotification(downloadId, FAILED, fileName);
} finally {
if (sink != null) {
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 1455fb27..93b37b46 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java
@@ -154,10 +154,10 @@ public class SessionManager {
Timber.i("Login InterruptedIOException"); //users cancels LoginTask
return CANCELLED;
} catch (IOException e) {
- Timber.w("Login IOException", e);
+ Timber.w(e ,"Login IOException");
return CONNECTION_ERROR;
} catch (Exception e) {
- Timber.w("Login Exception (other)", e);
+ Timber.e(e, "Login Exception (other)");
return EXCEPTION;
}
}
@@ -223,7 +223,7 @@ public class SessionManager {
Timber.w("Logout IOException", e);
return CONNECTION_ERROR;
} catch (Exception e) {
- Timber.w("Logout Exception", e);
+ Timber.e(e, "Logout Exception");
return EXCEPTION;
} finally {
//All data should always be cleared from device regardless the result of logout
diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReportingTree.java b/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReportingTree.java
index 2aeca9a2..c5851d30 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReportingTree.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReportingTree.java
@@ -4,17 +4,17 @@ import android.util.Log;
import com.google.firebase.crash.FirebaseCrash;
-import gr.thmmy.mthmmy.utils.exceptions.UnknownException;
-import timber.log.Timber;
+import timber.log.Timber.DebugTree;
-public class CrashReportingTree extends Timber.Tree {
+public class CrashReportingTree extends DebugTree {
+
@Override
protected void log(int priority, String tag, String message, Throwable t) {
if (priority == Log.VERBOSE || priority == Log.DEBUG) {
return;
}
- String level="A";
+ String level;
if (priority == Log.INFO)
level = "I";
@@ -22,13 +22,18 @@ public class CrashReportingTree extends Timber.Tree {
level = "W";
else if(priority == Log.ERROR)
level = "E";
+ else
+ level = "A";
FirebaseCrash.log(level + "/" + tag + ": " + message);
- if(t==null)
- t = new UnknownException("UnknownException");
+ if(priority == Log.ERROR)
+ {
+ if (t!=null)
+ FirebaseCrash.report(t);
+ else
+ FirebaseCrash.report(new Exception(message));
+ }
- if ((priority == Log.ERROR))
- FirebaseCrash.report(t);
}
}
diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/exceptions/UnknownException.java b/app/src/main/java/gr/thmmy/mthmmy/utils/exceptions/UnknownException.java
deleted file mode 100644
index 81c890ad..00000000
--- a/app/src/main/java/gr/thmmy/mthmmy/utils/exceptions/UnknownException.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package gr.thmmy.mthmmy.utils.exceptions;
-
-/**
- * UnknownException is thrown upon an error (see Report.java in release), when no other specific
- * exception is set, to report to FireBase.
- */
-public class UnknownException extends Exception {
- public UnknownException() {
- }
-
- public UnknownException(String message) {
- super(message);
- }
-}
diff --git a/build.gradle b/build.gradle
index a40a0e30..f5ee47bc 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.3.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
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