sPFApp/src/main/java/it/polimi/spf/app/fragments/profile/ProfileFragment.java
public <E> View createViewFor(ProfileField<E> field, ViewGroup container) {
        switch (mMode) {
            case SELF:
            case REMOTE:
                return mFactory.createViewForField(field, container, null);
            case EDIT:
                return mFactory.createViewForField(field, container, new ProfileFieldViewFactory.FieldValueListener<E>() {

                    @Override
                    public void onFieldValueChanged(ProfileField<E> field, E value) {
                        mContainer.setFieldValue(field, value);
                    }

                    @Override
                    public void onInvalidFieldValue(ProfileField<E> field, String fieldFriendlyName) {
                        Toast.makeText(getActivity(), "Invalid value for field " + fieldFriendlyName, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onCircleAdded(ProfileField<E> field, String circle) {
                        Log.d(TAG, "Circle " + circle + " added to field " + field + " of persona " + mCurrentPersona);
                        SPF.get().getProfileManager().addGroupToField(field, circle, mCurrentPersona);
                    }

                    @Override
                    public void onCircleRemoved(ProfileField<E> field, String circle) {
                        Log.d(TAG, "Circle " + circle + " removed from field " + field + " of persona " + mCurrentPersona);
                        SPF.get().getProfileManager().removeGroupFromField(field, circle, mCurrentPersona);
                    }
                });
            default:
                return null;
        }
    }
public <E> View createViewFor(ProfileField<E> field, ViewGroup container) {
        switch (mMode) {
            case SELF:
            case REMOTE:
                return mFactory.createViewForField(field, container, null);
            case EDIT:
                return mFactory.createViewForField(field, container, new ProfileFieldViewFactory.FieldValueListener<E>() {

                    @Override
                    public void onFieldValueChanged(ProfileField<E> field, E value) {
                        mContainer.setFieldValue(field, value);
                    }

                    @Override
                    public void onInvalidFieldValue(ProfileField<E> field, String fieldFriendlyName) {
                        Toast.makeText(getActivity(), "Invalid value for field " + fieldFriendlyName, Toast.LENGTH_SHORT).show();
                    }

                    @Override
                    public void onCircleAdded(ProfileField<E> field, String circle) {
                        Log.d(TAG, "Circle " + circle + " added to field " + field + " of persona " + mCurrentPersona);
                        SPF.get().getProfileManager().addGroupToField(field, circle, mCurrentPersona);
                    }

                    @Override
                    public void onCircleRemoved(ProfileField<E> field, String circle) {
                        Log.d(TAG, "Circle " + circle + " removed from field " + field + " of persona " + mCurrentPersona);
                        SPF.get().getProfileManager().removeGroupFromField(field, circle, mCurrentPersona);
                    }
                });
            default:
                return null;
        }
    }
public < E > View createViewFor ( ProfileField < E > field , ViewGroup container ) { switch ( mMode ) { case SELF : case REMOTE : return mFactory . createViewForField ( field , container , null ) ; case EDIT : return mFactory . createViewForField ( field , container , new ProfileFieldViewFactory . FieldValueListener < E > ( ) { @ Override public void onFieldValueChanged ( ProfileField < E > field , E value ) { mContainer . setFieldValue ( field , value ) ; } @ Override public void onInvalidFieldValue ( ProfileField < E > field , String fieldFriendlyName ) { Toast . makeText ( getActivity ( ) , "Invalid value for field " + fieldFriendlyName , Toast . LENGTH_SHORT ) . show ( ) ; } @ Override public void onCircleAdded ( ProfileField < E > field , String circle ) { Log . d ( TAG , "Circle " + circle + " added to field " + field + " of persona " + mCurrentPersona ) ; SPF . get ( ) . getProfileManager ( ) . addGroupToField ( field , circle , mCurrentPersona ) ; } @ Override public void onCircleRemoved ( ProfileField < E > field , String circle ) { Log . d ( TAG , "Circle " + circle + " removed from field " + field + " of persona " + mCurrentPersona ) ; SPF . get ( ) . getProfileManager ( ) . removeGroupFromField ( field , circle , mCurrentPersona ) ; } } ) ; default : return null ; } }
Creates a view for the given profile field. Depending on the {@link Mode}
of visualization, the view may allow the modification of the value. This
method will not attach the view to the provided {@link ViewGroup}

@param field     - the field for which to create the view.
@param container - the container to which the view will be attached, needed by
{@link LayoutInflater#inflate(int, ViewGroup, boolean)} to
evaluate layout params.
@return
Creates a view for the given profile field . Depending on the { @link Mode } of visualization the view may allow the modification of the value . This method will not attach the view to the provided { @link ViewGroup }