1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-12-22 19:08:03 +01:00

Display app launcher icon instead of nothing when no avatar image set. Fix #55

This commit is contained in:
vanitasvitae 2016-08-21 17:04:51 +02:00
parent 024bba8260
commit 5bcc99dfba

View file

@ -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());
}
}
}