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.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
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() {
// 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() {

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.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;

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 gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.data.TopicSummary;
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;
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;
}

Loading…
Cancel
Save