1
0
Fork 0
mirror of https://github.com/gsantner/dandelion synced 2024-11-22 04:12:08 +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,12 +401,19 @@ public class MainActivity extends AppCompatActivity
navheaderDescription.setText(appSettings.getPodDomain());
}
if (!appSettings.getAvatarUrl().equals("")) {
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());
}
}
}
// Set visibility
Menu navMenu = navView.getMenu();