diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java index b6251643..560a10a9 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java @@ -8,7 +8,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; -import android.util.Log; import android.view.View; import android.widget.Toast; diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java index 52c69e07..63834b02 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java @@ -92,9 +92,9 @@ public class LoginActivity extends BaseActivity { public void onBackPressed() { // Disable going back to the MainActivity moveTaskToBack(true); -// if(loginTask!=null && loginTask.getStatus() == AsyncTask.Status.RUNNING){ TODO -// loginTask.cancel(true); -// } + if(loginTask!=null && loginTask.getStatus() == AsyncTask.Status.RUNNING){ + loginTask.cancel(true); + } } private void onLoginFailed() { 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 e7ea4ed2..c20709cb 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 @@ -13,10 +13,10 @@ import android.widget.Toast; import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.activities.BaseActivity; import gr.thmmy.mthmmy.activities.LoginActivity; -import gr.thmmy.mthmmy.activities.topic.TopicActivity; -import gr.thmmy.mthmmy.data.TopicSummary; import gr.thmmy.mthmmy.activities.main.forum.ForumFragment; import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; +import gr.thmmy.mthmmy.activities.topic.TopicActivity; +import gr.thmmy.mthmmy.data.TopicSummary; import static gr.thmmy.mthmmy.session.SessionManager.LOGGED_OUT; diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java index d01b9e08..9e7d54c3 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java @@ -9,8 +9,8 @@ import android.widget.TextView; import java.util.List; import gr.thmmy.mthmmy.R; -import gr.thmmy.mthmmy.data.TopicSummary; import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; +import gr.thmmy.mthmmy.data.TopicSummary; /** 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 2bd02620..c3aa9e18 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java +++ b/app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java @@ -1,7 +1,6 @@ package gr.thmmy.mthmmy.session; import android.content.SharedPreferences; -import android.graphics.Bitmap; import android.os.Environment; import com.franmontiel.persistentcookiejar.PersistentCookieJar; @@ -13,14 +12,13 @@ import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InterruptedIOException; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; +import mthmmy.utils.Report; import okhttp3.Cookie; import okhttp3.FormBody; import okhttp3.HttpUrl; @@ -155,15 +153,15 @@ public class SessionManager //Handle exception } catch (InterruptedIOException e){ - Report.i(TAG, "Login InterruptedIOException: "+ e.getMessage(), e); //users cancels LoginTask + Report.i(TAG, "Login InterruptedIOException", e); //users cancels LoginTask return CANCELLED; } catch (IOException e) { - Report.w(TAG, "Login IOException: "+ e.getMessage(), e); + Report.w(TAG, "Login IOException", e); return CONNECTION_ERROR; } catch (Exception e) { - Report.w(TAG, "Login Exception (other): "+ e.getMessage(), e); + Report.w(TAG, "Login Exception (other)", e); return EXCEPTION; } } @@ -232,10 +230,10 @@ public class SessionManager return FAILURE; } } catch (IOException e) { - Report.w(TAG, "Logout IOException: "+ e.getMessage(), e); + Report.w(TAG, "Logout IOException", e); return CONNECTION_ERROR; } catch (Exception e) { - Report.w(TAG, "Logout Exception: "+ e.getMessage(), e); + Report.w(TAG, "Logout Exception", e); return EXCEPTION; } finally { //All data should always be cleared from device regardless the result of logout @@ -316,7 +314,7 @@ public class SessionManager if (pictureFile == null) { Report.d(TAG, - "Error creating media file, check storage permissions: ");// e.getMessage()); + "Error creating media file, check storage permissions: "); return; } try { @@ -326,9 +324,9 @@ public class SessionManager bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos); fos.close(); } catch (FileNotFoundException e) { - Report.d(TAG, "File not found: " + e.getMessage()); + Report.d(TAG, "File not found"); } catch (IOException e) { - Report.d(TAG, "Error accessing file: " + e.getMessage()); + Report.d(TAG, "Error accessing file")); } returnImage[0] = pictureFile; }