Browse Source

Merge fix/ optimized imports

pull/24/head
Ezerous 8 years ago
parent
commit
69b61a8f67
  1. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java
  2. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java
  3. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/main/MainActivity.java
  4. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/main/forum/ForumAdapter.java
  5. 20
      app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

1
app/src/main/java/gr/thmmy/mthmmy/activities/BaseActivity.java

@ -8,7 +8,6 @@ import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
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.Toast; import android.widget.Toast;

6
app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java

@ -92,9 +92,9 @@ public class LoginActivity extends BaseActivity {
public void onBackPressed() { public void onBackPressed() {
// Disable going back to the MainActivity // Disable going back to the MainActivity
moveTaskToBack(true); moveTaskToBack(true);
// if(loginTask!=null && loginTask.getStatus() == AsyncTask.Status.RUNNING){ TODO if(loginTask!=null && loginTask.getStatus() == AsyncTask.Status.RUNNING){
// loginTask.cancel(true); loginTask.cancel(true);
// } }
} }
private void onLoginFailed() { private void onLoginFailed() {

4
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.R;
import gr.thmmy.mthmmy.activities.BaseActivity; import gr.thmmy.mthmmy.activities.BaseActivity;
import gr.thmmy.mthmmy.activities.LoginActivity; 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.forum.ForumFragment;
import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; 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; import static gr.thmmy.mthmmy.session.SessionManager.LOGGED_OUT;

2
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 java.util.List;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.data.TopicSummary;
import gr.thmmy.mthmmy.activities.main.recent.RecentFragment; import gr.thmmy.mthmmy.activities.main.recent.RecentFragment;
import gr.thmmy.mthmmy.data.TopicSummary;
/** /**

20
app/src/main/java/gr/thmmy/mthmmy/session/SessionManager.java

@ -1,7 +1,6 @@
package gr.thmmy.mthmmy.session; package gr.thmmy.mthmmy.session;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.Environment; import android.os.Environment;
import com.franmontiel.persistentcookiejar.PersistentCookieJar; import com.franmontiel.persistentcookiejar.PersistentCookieJar;
@ -13,14 +12,13 @@ import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import mthmmy.utils.Report;
import okhttp3.Cookie; import okhttp3.Cookie;
import okhttp3.FormBody; import okhttp3.FormBody;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
@ -155,15 +153,15 @@ public class SessionManager
//Handle exception //Handle exception
} }
catch (InterruptedIOException e){ 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; return CANCELLED;
} }
catch (IOException e) { catch (IOException e) {
Report.w(TAG, "Login IOException: "+ e.getMessage(), e); Report.w(TAG, "Login IOException", e);
return CONNECTION_ERROR; return CONNECTION_ERROR;
} }
catch (Exception e) { catch (Exception e) {
Report.w(TAG, "Login Exception (other): "+ e.getMessage(), e); Report.w(TAG, "Login Exception (other)", e);
return EXCEPTION; return EXCEPTION;
} }
} }
@ -232,10 +230,10 @@ public class SessionManager
return FAILURE; return FAILURE;
} }
} catch (IOException e) { } catch (IOException e) {
Report.w(TAG, "Logout IOException: "+ e.getMessage(), e); Report.w(TAG, "Logout IOException", e);
return CONNECTION_ERROR; return CONNECTION_ERROR;
} catch (Exception e) { } catch (Exception e) {
Report.w(TAG, "Logout Exception: "+ e.getMessage(), e); Report.w(TAG, "Logout Exception", e);
return EXCEPTION; return EXCEPTION;
} finally { } finally {
//All data should always be cleared from device regardless the result of logout //All data should always be cleared from device regardless the result of logout
@ -316,7 +314,7 @@ public class SessionManager
if (pictureFile == null) { if (pictureFile == null) {
Report.d(TAG, Report.d(TAG,
"Error creating media file, check storage permissions: ");// e.getMessage()); "Error creating media file, check storage permissions: ");
return; return;
} }
try { try {
@ -326,9 +324,9 @@ public class SessionManager
bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos); bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos);
fos.close(); fos.close();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
Report.d(TAG, "File not found: " + e.getMessage()); Report.d(TAG, "File not found");
} catch (IOException e) { } catch (IOException e) {
Report.d(TAG, "Error accessing file: " + e.getMessage()); Report.d(TAG, "Error accessing file"));
} }
returnImage[0] = pictureFile; returnImage[0] = pictureFile;
} }

Loading…
Cancel
Save