From 5bcc99dfbaed27b9cf3c1738d27904e15742da0a Mon Sep 17 00:00:00 2001 From: vanitasvitae Date: Sun, 21 Aug 2016 17:04:51 +0200 Subject: [PATCH] Display app launcher icon instead of nothing when no avatar image set. Fix #55 --- .../diaspora_android/activity/MainActivity.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java index 9687de8f..7836f98c 100644 --- a/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java +++ b/app/src/main/java/com/github/dfa/diaspora_android/activity/MainActivity.java @@ -53,6 +53,7 @@ import android.text.Html; import android.text.SpannableString; import android.text.method.LinkMovementMethod; import android.text.util.Linkify; +import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.Menu; @@ -400,10 +401,17 @@ public class MainActivity extends AppCompatActivity navheaderDescription.setText(appSettings.getPodDomain()); } if (!appSettings.getAvatarUrl().equals("")) { - // Try to load image - if (!app.getAvatarImageLoader().loadToImageView(navheaderImage)) { - // If not yet loaded, start download - app.getAvatarImageLoader().startImageDownload(navheaderImage, appSettings.getAvatarUrl()); + Log.d(App.TAG, "AVATAR URL != \"\": "+appSettings.getAvatarUrl()); + //Display app launcher icon instead of default avatar asset + //(Which would by the way not load because of missing pod domain prefix in the url) + if(appSettings.getAvatarUrl().startsWith("/assets/user/default")) { + navheaderImage.setImageResource(R.drawable.ic_launcher); + } else { + // Try to load image + if (!app.getAvatarImageLoader().loadToImageView(navheaderImage)) { + // If not yet loaded, start download + app.getAvatarImageLoader().startImageDownload(navheaderImage, appSettings.getAvatarUrl()); + } } }