Avoids crashes

This commit is contained in:
tom79 2019-08-05 18:10:49 +02:00
parent 9d5129a9dd
commit 0e09591ce6
3 changed files with 95 additions and 86 deletions

View File

@ -1251,8 +1251,10 @@ public abstract class BaseMainActivity extends BaseActivity
// Retrieves instance
new RetrieveInstanceAsyncTask(getApplicationContext(), BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
// Retrieves filters
if( social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
new ManageFiltersAsyncTask(getApplicationContext(), GET_ALL_FILTER, null, BaseMainActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
}
/* Clean cache for statuses */
AsyncTask.execute(new Runnable() {

View File

@ -245,11 +245,13 @@ public class SyncTimelinesAsyncTask extends AsyncTask<Void, Void, Void> {
}
}
APIResponse apiResponse = null;
if( MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
List<app.fedilab.android.client.Entities.List> lists = null;
try {
apiResponse = new API(contextReference.get()).getLists();
lists = apiResponse.getLists();
}catch (Exception ignored){ }
} catch (Exception ignored) {
}
if (lists != null && lists.size() > 0) {
//Loop through results
@ -299,6 +301,7 @@ public class SyncTimelinesAsyncTask extends AsyncTask<Void, Void, Void> {
}
}
}
for (Iterator<ManageTimelines> it = manageTimelines.iterator(); it.hasNext();) {
if (!it.next().isDisplayed()) {
it.remove();

View File

@ -3151,6 +3151,7 @@ public class Helper {
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
}catch (Exception e){
try {
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
Glide.with(imageView.getContext())
.asDrawable()
@ -3170,6 +3171,7 @@ public class Helper {
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
}
}catch (Exception ignored){}
}
}else{
try {
@ -3179,6 +3181,7 @@ public class Helper {
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
}catch (Exception e){
try {
if (MainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.MASTODON || BaseMainActivity.social == UpdateAccountInfoAsyncTask.SOCIAL.PLEROMA) {
Glide.with(imageView.getContext())
.asDrawable()
@ -3198,6 +3201,7 @@ public class Helper {
.apply(new RequestOptions().transforms(new CenterCrop(), new RoundedCorners(10)))
.into(imageView);
}
}catch (Exception ignored){}
}
}