|
@@ -5,6 +5,7 @@ import android.graphics.Bitmap;
|
|
|
import android.os.Bundle;
|
|
|
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
|
|
|
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
import android.view.ViewGroup;
|
|
@@ -217,18 +218,22 @@ public class UserCenterFragment extends BaseFragment {
|
|
|
}
|
|
|
tvUsername.setText(userInfoBean.getData().getUserName());
|
|
|
String headPic = userInfoBean.getData().getHeadPic();
|
|
|
- if(!headPic.startsWith("http")){
|
|
|
- headPic = UrlCat.HOST + headPic;
|
|
|
- }
|
|
|
- Glide.with(getActivity()).load(headPic).asBitmap().into(new BitmapImageViewTarget(ivHead){
|
|
|
-
|
|
|
- @Override
|
|
|
- protected void setResource(Bitmap resource) {
|
|
|
- RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), resource);
|
|
|
- circularBitmapDrawable.setCircular(true);
|
|
|
- ivHead.setImageDrawable(circularBitmapDrawable);
|
|
|
+ if(!TextUtils.isEmpty(headPic)){
|
|
|
+ if(!headPic.startsWith("http")){
|
|
|
+ headPic = UrlCat.HOST + headPic;
|
|
|
}
|
|
|
- });
|
|
|
+ Glide.with(getActivity()).load(headPic).asBitmap().into(new BitmapImageViewTarget(ivHead){
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void setResource(Bitmap resource) {
|
|
|
+ RoundedBitmapDrawable circularBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), resource);
|
|
|
+ circularBitmapDrawable.setCircular(true);
|
|
|
+ ivHead.setImageDrawable(circularBitmapDrawable);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ ivHead.setImageResource(R.drawable.default_head_icon);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Subscribe(threadMode = ThreadMode.MAIN)
|