@Override
  protected void onUserAction(
      String userActionName, BaseUserPortraitInteractor interactor, Object... args) {

    try {
      if (UPLOAD_PORTRAIT.equals(userActionName)) {
        UserPortraitUploadInteractor userPortraitInteractor =
            (UserPortraitUploadInteractor) getInteractor(userActionName);
        String path = (String) args[0];
        if (_userId != 0) {
          userPortraitInteractor.upload(_userId, path);
        }
      } else {
        UserPortraitLoadInteractor userPortraitLoadInteractor =
            (UserPortraitLoadInteractor) getInteractor(userActionName);
        if (_portraitId != 0 && _uuid != null) {
          userPortraitLoadInteractor.load(_male, _portraitId, _uuid);
        } else {
          if (SessionContext.hasUserInfo() && _userId == 0) {
            userPortraitLoadInteractor.load(SessionContext.getLoggedUser().getId());
          } else {
            userPortraitLoadInteractor.load(_userId);
          }
        }
      }
    } catch (Exception e) {
      onUserPortraitLoadFailure(e);
    }
  }
  @Override
  protected View createScreenletView(Context context, AttributeSet attributes) {
    TypedArray typedArray =
        context
            .getTheme()
            .obtainStyledAttributes(attributes, R.styleable.UserPortraitScreenlet, 0, 0);

    _autoLoad = typedArray.getBoolean(R.styleable.UserPortraitScreenlet_autoLoad, true);
    _male = typedArray.getBoolean(R.styleable.UserPortraitScreenlet_male, true);
    _portraitId = typedArray.getInt(R.styleable.UserPortraitScreenlet_portraitId, 0);
    _uuid = typedArray.getString(R.styleable.UserPortraitScreenlet_uuid);
    _editable = typedArray.getBoolean(R.styleable.UserPortraitScreenlet_editable, false);

    int offlinePolicy =
        typedArray.getInt(
            R.styleable.UserPortraitScreenlet_offlinePolicy, OfflinePolicy.REMOTE_ONLY.ordinal());
    _offlinePolicy = OfflinePolicy.values()[offlinePolicy];

    _userId =
        castToLongOrUseDefault(typedArray.getString(R.styleable.UserPortraitScreenlet_userId), 0L);

    if (SessionContext.hasUserInfo() && _portraitId == 0 && _uuid == null && _userId == 0) {
      _userId = SessionContext.getLoggedUser().getId();
    }

    int layoutId =
        typedArray.getResourceId(R.styleable.UserPortraitScreenlet_layoutId, getDefaultLayoutId());

    typedArray.recycle();

    return LayoutInflater.from(context).inflate(layoutId, null);
  }