diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 838a98a6c..f5475c694 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -46,7 +46,7 @@ diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java index d5ea7e75a..1762fe4ee 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/AboutActivity.java @@ -23,7 +23,6 @@ import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; -import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.Button; @@ -58,8 +57,9 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote private List contributors = new ArrayList<>(); private AccountSearchDevAdapter accountSearchWebAdapterDeveloper; private AccountSearchDevAdapter accountSearchWebAdapterContributors; + @SuppressWarnings("FieldCanBeLocal") + private int DEV_COUNT = 1, CONTRIBUTOR_COUNT = 2; - @SuppressWarnings("deprecation") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -226,12 +226,12 @@ public class AboutActivity extends AppCompatActivity implements OnRetrieveRemote @Override public void onResume(){ super.onResume(); - if( developers != null && developers.size() > 0){ + if( developers != null && developers.size() == DEV_COUNT){ for(Account account: developers){ new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } } - if( contributors != null && contributors.size() > 0){ + if( contributors != null && contributors.size() == CONTRIBUTOR_COUNT){ for(Account account: contributors){ new RetrieveRelationshipAsyncTask(getApplicationContext(), account.getId(),AboutActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java index 57fb935bb..cca007b66 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/drawers/StatusListAdapter.java @@ -465,7 +465,7 @@ public class StatusListAdapter extends BaseAdapter implements OnPostActionInterf //Redraws top icons (boost/reply) final float scale = context.getResources().getDisplayMetrics().density; - if( !status.getIn_reply_to_account_id().equals("null") || !status.getIn_reply_to_id().equals("null") ){ + if( (status.getIn_reply_to_account_id()!= null && !status.getIn_reply_to_account_id().equals("null")) || (status.getIn_reply_to_id() != null && !status.getIn_reply_to_id().equals("null")) ){ Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_reply); img.setBounds(0,0,(int) (20 * iconSizePercent/100 * scale + 0.5f),(int) (15 * iconSizePercent/100 * scale + 0.5f)); holder.status_account_displayname.setCompoundDrawables( img, null, null, null); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java index 7f684d329..1d9d64a5b 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java @@ -1665,7 +1665,8 @@ public class Helper { Gson gson = new Gson(); String json = sharedpreferences.getString(Helper.SET_TEMP_STATUS + userId, null); Type type = new TypeToken>() {}.getType(); - return gson.fromJson(json, type); + ArrayList statuses = gson.fromJson(json, type); + return (statuses != null)?statuses:new ArrayList(); } @@ -1713,7 +1714,8 @@ public class Helper { Gson gson = new Gson(); String json = sharedpreferences.getString(Helper.SET_TEMP_NOTIFICATIONS + userId, null); Type type = new TypeToken>() {}.getType(); - return gson.fromJson(json, type); + ArrayList notifications = gson.fromJson(json, type); + return (notifications != null)?notifications:new ArrayList(); } }