Пример #1
0
 private void OnError(View v, BaseSliderView me)
 {
     if (mLoadListener != null)
     {
         mLoadListener.onEnd(false, me);
     }
     if (v.FindViewById(R.Id.loading_bar) != null)
     {
         v.FindViewById(R.Id.loading_bar).Visibility = Android.Views.ViewStates.Invisible;
     }
 }
Пример #2
0
 public OnClickListenerAnonymousInnerClassHelper(BaseSliderView outerInstance, View v, BaseSliderView me)
 {
     this.outerInstance = outerInstance;
     this.v             = v;
     this.me            = me;
 }
Пример #3
0
        /// <summary>
        /// When you want to implement your own slider view, please call this method in the end in `getView()` method </summary>
        /// <param name="v"> the whole view </param>
        /// <param name="targetImageView"> where to place image </param>
        //JAVA TO C# CONVERTER WARNING: 'final' parameters are not allowed in .NET:
        //ORIGINAL LINE: protected void bindEventAndShow(final android.view.View v, android.widget.ImageView targetImageView)
        protected internal virtual void bindEventAndShow(View v, ImageView targetImageView)
        {
            //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
            //ORIGINAL LINE: final BaseSliderView me = this;
            BaseSliderView me = this;

            v.SetOnClickListener(new OnClickListenerAnonymousInnerClassHelper(this, v, me));

            if (targetImageView == null)
            {
                return;
            }

            if (mLoadListener != null)
            {
                mLoadListener.onStart(me);
            }

            Picasso        p  = (mPicasso != null) ? mPicasso : Picasso.With(mContext);
            RequestCreator rq = null;

            if (mUrl != null)
            {
                rq = p.Load(mUrl);
            }
            else if (mFile != null)
            {
                rq = p.Load(mFile);
            }
            else if (mRes != 0)
            {
                rq = p.Load(mRes);
            }
            else
            {
                return;
            }

            if (rq == null)
            {
                return;
            }

            if (Empty != 0)
            {
                rq.Placeholder(Empty);
            }

            if (Error != 0)
            {
                rq.Error(Error);
            }

            switch (mScaleType)
            {
            case ScaleType.Fit:
                rq.Fit();
                break;

            case ScaleType.CenterCrop:
                rq.Fit().CenterCrop();
                break;

            case ScaleType.CenterInside:
                rq.Fit().CenterInside();
                break;
            }

            rq.Into(targetImageView, () => OnSuccess(v), () => OnError(v, me));
            //rq.Into(targetImageView, new CallbackAnonymousInnerClassHelper(this, v, me));
        }