diff --git a/app/build.gradle b/app/build.gradle index 37c77098..d5acf078 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -27,11 +27,11 @@ android { dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:25.0.1' - compile 'com.android.support:design:25.0.1' - compile 'com.android.support:support-v4:25.0.1' - compile 'com.android.support:cardview-v7:25.0.1' - compile 'com.android.support:recyclerview-v7:25.0.1' + compile 'com.android.support:appcompat-v7:25.1.0' + compile 'com.android.support:design:25.1.0' + compile 'com.android.support:support-v4:25.1.0' + compile 'com.android.support:cardview-v7:25.1.0' + compile 'com.android.support:recyclerview-v7:25.1.0' compile 'com.google.firebase:firebase-crash:10.0.1' compile 'com.squareup.okhttp3:okhttp:3.5.0' compile 'com.squareup.picasso:picasso:2.5.2' 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 f0beabe1..9c50d01d 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/LoginActivity.java @@ -93,21 +93,21 @@ public class LoginActivity extends BaseActivity { }); - GifDrawable gifFromPath = null; + //GIF logo init + GifImageView gifImageView = (GifImageView) findViewById(R.id.logo); try { - gifFromPath = new GifDrawable( getResources(), R.drawable.logo_animated ); - gifFromPath.setSpeed(0.75f); + final GifDrawable gifFromPath = new GifDrawable(getResources(), R.drawable.logo_animated); + gifFromPath.setSpeed(0.7f); gifFromPath.addAnimationListener(new AnimationListener() { @Override public void onAnimationCompleted(int loopNumber) { - recreate(); + gifFromPath.reset(); } }); + gifImageView.setImageDrawable(gifFromPath); } catch (IOException e) { - e.printStackTrace(); + Report.wtf(TAG,"IO at animated logo (?)"); } - GifImageView gifImageView = (GifImageView) findViewById(R.id.logo); - gifImageView.setImageDrawable(gifFromPath); } @Override 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 11fb18fb..b3f97961 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 @@ -58,6 +58,8 @@ public class RecentFragment extends Fragment { private OkHttpClient client; + private RecentTask recentTask; + // Required empty public constructor public RecentFragment() { } @@ -102,9 +104,11 @@ public class RecentFragment extends Fragment { if (sectionNumber == 1)//temp { if (topicSummaries.isEmpty()) - new RecentTask().execute(); - + { + recentTask =new RecentTask(); + recentTask.execute(); + } } Report.d(TAG, "onActivityCreated"); } @@ -158,7 +162,10 @@ public class RecentFragment extends Fragment { new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { - new RecentTask().execute(); + if(recentTask!=null&&recentTask.getStatus()!= AsyncTask.Status.RUNNING) { + recentTask = new RecentTask(); + recentTask.execute(); + } } @@ -183,6 +190,14 @@ public class RecentFragment extends Fragment { } } + @Override + public void onDestroy() { + super.onDestroy(); + if(recentTask!=null&&recentTask.getStatus()!= AsyncTask.Status.RUNNING) + recentTask.cancel(true); + } + + @Override public void onDetach() { super.onDetach(); @@ -215,7 +230,6 @@ public class RecentFragment extends Fragment { } protected Integer doInBackground(Void... voids) { - Request request = new Request.Builder() .url(thmmyUrl) .build(); @@ -225,10 +239,10 @@ public class RecentFragment extends Fragment { parse(document); return 0; } catch (IOException e) { - Report.d("DEB", "ERROR", e); + Report.d(TAG, "ERROR", e); return 1; } catch (Exception e) { - Report.d("DEB", "ERROR", e); + Report.d(TAG, "ERROR", e); return 2; } diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 0b147a93..62f6b036 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -25,8 +25,9 @@ android:layout_height="100dp"/> diff --git a/app/src/release/java/mthmmy.utils/Report.java b/app/src/release/java/mthmmy.utils/Report.java index 662c2a7d..25df4841 100644 --- a/app/src/release/java/mthmmy.utils/Report.java +++ b/app/src/release/java/mthmmy.utils/Report.java @@ -73,9 +73,9 @@ public class Report private static void exception(String level, String TAG, String message, Throwable tr) { FirebaseCrash.log(level + "/" + TAG + ": " + message + ": " + tr.getMessage()); - if(level.equals("E")) //report only serious exceptions + if(level.equals("E")||level.equals("WTF")) //report only serious exceptions FirebaseCrash.report(tr); } -} \ No newline at end of file +}