Example #1
0
        public CarpaccioAction(string completeCall)
        {
            this.CompleteCall = completeCall;

            Function      = CarpaccioHelper.getFunctionName(completeCall);
            Args          = CarpaccioHelper.getAttributes(completeCall);
            Values        = Args;      //by default : values = args; if mapping, values will be calculated
            IsCallMapping = MappingManager.isCallMapping(Args);
        }
        public void materialAdapter(View view, string mappedName, string layoutName)
        {
            final int       layoutResId = getLayoutIdentifierFromString(view.getContext(), layoutName);
            final Carpaccio carpaccio   = CarpaccioHelper.findParentCarpaccio(view);

            if (carpaccio != null && layoutResId != -1 && view instanceof RecyclerView)
            {
                CommonViewController commonViewController = new CommonViewController();

                MaterialCarpaccioRecyclerViewAdapter adapter = new MaterialCarpaccioRecyclerViewAdapter(recyclerColumnCount, carpaccio, layoutResId, mappedName);

                commonViewController.setAdapterForRecyclerView(view, mappedName, layoutName, adapter);

                MaterialViewPagerHelper.registerRecyclerView((Activity)view.getContext(), (RecyclerView)view, null);
            }
        }
Example #3
0
        //object.image.getUrl()
        public string Evaluate(Object obj, string call)
        {
            if (!call.Contains(".")) //"object"
            {
                CarpaccioLogger.d(TAG, "call " + call + " on " + obj.GetType().Name);
                return(obj.ToString());
            }
            string function = call.Substring(call.IndexOf('.') + 1); //image.getUrl(); or //image
            string callToGetObject;

            if (function.Contains("."))
            {
                callToGetObject = function.Substring(0, function.IndexOf('.'));     //image
            }
            else
            {
                callToGetObject = function;     //image
            }
            string realCallToGetObject = GetFunctionName(callToGetObject);
            Object newObject           = CarpaccioHelper.callFunction(obj, realCallToGetObject);

            if (newObject != null)
            {
                CarpaccioLogger.d(TAG, "call " + realCallToGetObject + " return =" + newObject.GetType().Name);

                if (newObject is Java.Lang.String)
                {
                    return((string)newObject);
                }
                if (newObject is Java.Lang.Number)
                {
                    return(String.ValueOf(newObject));
                }
                return(Evaluate(newObject, function));
            }
            CarpaccioLogger.d(TAG, "call " + realCallToGetObject + " return = NULL");

            return(null);
        }