void Initialize()
        {
            Orientation = Orientation.Horizontal;

            var ps = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent,
                                                    LinearLayout.LayoutParams.MatchParent,
                                                    1.0f);
            ps.SetMargins (0, 0, 0, 0);

            mLeftView = new CardboardOverlayEyeView (Context);
            mLeftView.LayoutParameters = ps;
            AddView(mLeftView);

            mRightView = new CardboardOverlayEyeView (Context);
            mRightView.LayoutParameters = ps;
            AddView(mRightView);

            // Set some reasonable defaults.
            SetDepthOffset(0.016f);

            SetColor(Color.Rgb (150, 255, 180));
            Visibility = ViewStates.Visible;

            mTextFadeAnimation = new AlphaAnimation(1.0f, 0.0f);
            mTextFadeAnimation.Duration = 5000;
        }
Example #2
0
        protected override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            ActionBar.Hide(); 

            // Get our button from the layout resource,
            // and attach an event to it
            var layout = FindViewById<RelativeLayout> (Resource.Id.mainLayout);
            layout.SetBackgroundColor(Color.Black);
            var txt = FindViewById<TextView> (Resource.Id.introText);
            var logo = FindViewById<ImageView> (Resource.Id.logoImage);
            layout.SetCommand ("Click", Vm.LaunchCommand);

            TranslateAnimation transAnim = new TranslateAnimation(0, 0, -500, Resources.DisplayMetrics.HeightPixels / 5);
            transAnim.SetAnimationListener(this);
            transAnim.Interpolator = new BounceInterpolator();
            transAnim.StartOffset = 500;
            transAnim.Duration = 1500;
            transAnim.FillAfter = true;
            logo.StartAnimation(transAnim);

            AlphaAnimation fadeTextIn = new AlphaAnimation(0.0f, 1.0f); 
            txt.StartAnimation(fadeTextIn);
            fadeTextIn.StartOffset = transAnim.StartOffset + transAnim.Duration;
            fadeTextIn.Duration = 1000;
            fadeTextIn.FillAfter = true;
        }
Example #3
0
        public static void NoConnection()
        {
            var context = ViewHelper.CurrentActivity();
            context.RunOnUiThread(delegate
            {
                var NoConnection = context.FindViewById(Resource.Id.NoConnection);
                if (NoConnection != null)
                {
                    NoConnection.Visibility = ViewStates.Visible;

                    new Handler().PostDelayed(delegate
                    {
                        Android.Views.Animations.Animation fadeOut = new AlphaAnimation(1, 0);
                        fadeOut.Interpolator = new DecelerateInterpolator();
                        fadeOut.Duration = 1000;

                        AnimationSet animation = new AnimationSet(false);
                        animation.AddAnimation(fadeOut);
                        NoConnection.Animation = animation;
                        NoConnection.StartAnimation(animation);
                        new Handler().PostDelayed(delegate { NoConnection.Visibility = ViewStates.Gone; }, 1000);
                    }, 2000);
                }
            });
        }
 private Animation CreateAlphaInAnimation()
 {
     var an = new AlphaAnimation(0, 1)
     {
         Duration = AlphaDuration
     };
     return an;
 }
 internal void Hide()
 {
    if (this.ViewDetails != null && this.ViewDetails.AnimateClosing && this.View != null)
    {
       var animation1 = new AlphaAnimation(this.View.Alpha, 0);
       animation1.Duration = 500;
       animation1.StartOffset = 100;
       this.View.StartAnimation(animation1);
    }
 }
Example #6
0
        public void SetAnimatedVisibility(bool visible)
        {
            if ((visible && Visibility == ViewStates.Visible)
                || (!visible && Visibility == ViewStates.Invisible))
                return;

            if (visible)
                Visibility = ViewStates.Visible;

            var animation = new AlphaAnimation (visible ? 0 : 1,
                                                visible ? 1 : 0);
            animation.Duration = 250;
            if (!visible)
                animation.AnimationEnd += (sender, e) => Visibility = ViewStates.Invisible;
            StartAnimation (animation);
        }
 public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
 {
     if (Math.Abs(velocityX) < 500) return false;
     _lastView = _parentActivity.LastView;
     var animationSet = new AnimationSet(true)
     {
         Interpolator = new AccelerateDecelerateInterpolator(),
         Duration = 300,
         FillAfter = true
     };
     var animationRotate = new RotateAnimation(0, Math.Sign(velocityX)*15);
     var animationTranslate = new TranslateAnimation(0, Math.Sign(velocityX)*400,
         0, 10);
     var animationAlpha = new AlphaAnimation(1, 0);
     animationSet.AddAnimation(animationRotate);
     animationSet.AddAnimation(animationTranslate);
     animationSet.AddAnimation(animationAlpha);
     animationSet.AnimationEnd += AnimationSet_AnimationEnd;
     _lastView.StartAnimation(animationSet);
     return true;
 }
 private Animation CreateAlphaInAnimation()
 {
     AlphaAnimation an = new AlphaAnimation(0, 1);
     an.FillAfter = true;
     an.Duration = ALPHA_DURATION;
     return an;
 }
        /**
	 * A fade animation that will fade the subject in by changing alpha from 0 to 1.
	 * 
	 * @param duration the animation duration in milliseconds
	 * @param delay how long to wait before starting the animation, in milliseconds
	 * @return a fade animation
	 * @see #fadeInAnimation(View, long)
	 */

        public static Animation FadeInAnimation(long duration, long delay)
        {

            Animation fadeIn = new AlphaAnimation(0, 1);
            fadeIn.Interpolator = new DecelerateInterpolator();
            fadeIn.Duration = duration;
            fadeIn.StartOffset = delay;

            return fadeIn;
        }
Example #10
0
		public void ini(){

			Drawable dr = new BitmapDrawable (getBitmapFromAsset("images/1header.png"));
			header = new LinearLayout(context);
			header.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(125));
			header.Orientation = Orientation.Horizontal;
			header.SetGravity (GravityFlags.Center);
			header.SetBackgroundDrawable (dr);


			titulo_header = new TextView (context);
			titulo_header.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(550), -1);
			titulo_header.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
			titulo_header.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
			titulo_header.SetTextColor (Color.White);
			titulo_header.Gravity = GravityFlags.Center;
			//titulo_header.TextAlignment = TextAlignment.Center;

			placesInfoLayout = new LinearLayout (context);
			placesInfoLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			int space = Configuration.getWidth (30);
			placesInfoLayout.SetPadding(space,space,space,space);
			placesInfoLayout.Orientation = Orientation.Vertical;

			_mainLayout = new RelativeLayout (context);
			_mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);

			_mainLayout.AddView (header);

			mapImage = new ScaleImageView (context, null);
			mapImage.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
			mapSpace = new LinearLayout (context);
			mapSpace.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(640), Configuration.getWidth(640));
			mapSpace.SetY (Configuration.getHeight (125));
			mapSpace.SetGravity (GravityFlags.Left);
			mapSpace.SetBackgroundColor (Color.ParseColor ("#DFC6BB"));
			//HUILLCA-----------------------------------------
			mapSpaceMarker = new RelativeLayout (context);
			mapSpaceMarker.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth(640), Configuration.getWidth(640));
			mapSpaceMarker.SetY (Configuration.getHeight (125));
			mapSpaceMarker.SetGravity (GravityFlags.Left);
			mapSpaceMarker.SetBackgroundColor (Color.Transparent);

			iconMarker = new ImageIconMap (context);
			iconMarker.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (60), Configuration.getWidth (60));
			int w = Configuration.getWidth (70);
			int h = Configuration.getWidth (70);
			iconMarker.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/iconmap12.png"), w, h, true));
			iconMarker.SetX (-100);
			iconMarker.SetY (-100);
			mapSpaceMarker.AddView (iconMarker);

			var fadeIn = new AlphaAnimation(0, 1);
			fadeIn.Interpolator = new AccelerateInterpolator();
			fadeIn.Duration = 1000;

			fadeOut = new AlphaAnimation(1, 0);
			fadeOut.Interpolator = new DecelerateInterpolator();
			fadeOut.Duration = 3000;
			fadeOut.AnimationEnd += (s, e) => 
			{
				 /*ThreadPool.QueueUserWorkItem(state =>
					{
						Thread.Sleep(2000); //wait 2 sec
						//RunOnUiThread(() => iconMarker.StartAnimation(fadeOut));
					});*/
					iconMarker.StartAnimation(fadeIn);
					iconMarker.Visibility = ViewStates.Invisible;
			};
			//-------------------------------------------------------
			mapSpace.AddView (mapImage);



			placeSpace = new VerticalScrollView (context);
			placeSpace.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(375-85));
			placeSpace.SetY (Configuration.getHeight (125)+Configuration.getWidth(640));
			placeSpace.SetBackgroundColor (Color.White);

			placesContainer = new LinearLayout (context);
			placesContainer.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(375-85));
			placesContainer.Orientation = Orientation.Vertical;


			_mainLayout.AddView (mapSpace);
			_mainLayout.AddView (mapSpaceMarker);//HUILLCA
			_mainLayout.AddView (placeSpace);

			_publicidadLayout = new LinearLayout (context);
			_publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (85));
			Drawable drp = new BitmapDrawable (getBitmapFromAsset ("images/footerad.jpg"));
			_publicidadLayout.SetBackgroundDrawable (drp);
			_publicidadLayout.SetY (Configuration.getHeight(1136-85));
			_mainLayout.AddView (_publicidadLayout);
			_publicidadLayout.Click += delegate {
				if (adOpen) {


					hideAd ();
				} else {
					Random rnd = new Random();
					showAd (rnd.Next(3));
				}
			};



			_mainLayout.AddView (leyendaLayout);

			scrollPlaces = new VerticalScrollView (context);
			scrollPlaces.LayoutParameters = new VerticalScrollView.LayoutParams (-1,Configuration.getHeight(1136-125-85));
			scrollPlaces.AddView (placesInfoLayout);
			scrollPlaces.SetY (Configuration.getHeight (125));


			//mainLayout.AddView (placesInfoLayout);

			//iniPlancesList ();

		}
Example #11
0
        private void OnSayHello(object sender, EventArgs e)
        {
            Toast.MakeText(this, "Hello, views!", ToastLength.Short).Show();

            var index = 0;
            foreach (var view in headerViews)
            {
                var anim = new AlphaAnimation(0.0f, 1.0f);
                anim.FillBefore = true;
                anim.Duration = 500;
                anim.StartOffset = index++ * 100;
                view.StartAnimation(anim);
            }
        }
        /**
	 * A fade animation that will fade the subject out by changing alpha from 1 to 0.
	 * 
	 * @param duration the animation duration in milliseconds
	 * @param delay how long to wait before starting the animation, in milliseconds
	 * @return a fade animation
	 * @see #fadeOutAnimation(View, long)
	 */

        public static Animation FadeOutAnimation(long duration, long delay)
        {

            Animation fadeOut = new AlphaAnimation(1, 0);
            fadeOut.Interpolator = new AccelerateInterpolator();
            fadeOut.StartOffset = delay;
            fadeOut.Duration = duration;

            return fadeOut;
        }
        public void ShowInvalid(string errorMessage)
        {
            nextMustBeDeleted = true;
            textErrorView.Text = errorMessage;
            AddView(textErrorView);
            textErrorView.Visibility = ViewStates.Visible;

            AnimationSet animationSet = new AnimationSet(true);

            AlphaAnimation fadeIn = new AlphaAnimation(0, 1);
            fadeIn.Duration = 300;

            AlphaAnimation fadeOut = new AlphaAnimation(1, 0);
            fadeOut.StartOffset = 300 + 300;
            fadeOut.Duration = 300;

            animationSet.AddAnimation(fadeIn);
            animationSet.AddAnimation(fadeOut);

            animationSet.FillAfter = true;
            animationSet.FillBefore = true;

            animationSet.AnimationEnd += (sender, args) =>
            {
                textErrorView.Visibility = ViewStates.Gone;
                RemoveView(textErrorView);
            };

            textErrorView.StartAnimation(animationSet);
        }
        private void animateAlphaTranslate(View view, float alphaFrom, float alphaTo, float xFrom, float xTo,
            bool requestFocus)
        {
            AnimationSet animationSet = new AnimationSet(true);

            AlphaAnimation fade = new AlphaAnimation(alphaFrom, alphaTo);
            fade.Duration = 350;

            TranslateAnimation slide = new TranslateAnimation(Dimension.RelativeToSelf, xFrom,
                                                              Dimension.RelativeToSelf, xTo,
                                                              Dimension.RelativeToSelf, 0,
                                                              Dimension.RelativeToSelf, 0);

            slide.Duration = 350;

            animationSet.AddAnimation(fade);
            animationSet.AddAnimation(slide);
            view.StartAnimation(animationSet);

            if (requestFocus)
            {
                animationSet.AnimationEnd += (obj, args) => view.RequestFocus();
            }
        }
Example #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Web);
            new Core.Menu(this);
            string name = Intent.GetStringExtra("name");
            if (string.IsNullOrEmpty(name))
            {
                name = "Default";
            }
            ////清理Webview缓存数据库 
            //try
            //{
            //    DeleteDatabase("webview.db");
            //    DeleteDatabase("webviewCache.db");
            //}
            //catch { }
            //WebView 缓存文件 
            //string local = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            //Java.IO.File appCacheDir = new Java.IO.File(local+ "/app_webview");
            ////删除webview 缓存 缓存目录 
            //if (appCacheDir.Exists())
            //{
            //    Core.SysVisitor.DeleteFolder(local + "/app_webview");
            //    //deleteFile(appCacheDir);
            //}
            WebView web_view = FindViewById<WebView>(Resource.Id.web_webView1);
            ImageButton Refresh = FindViewById<ImageButton>(Resource.Id.Web_Refresh);//刷新按钮
            Refresh.Click += delegate
            {
                Core.SysVisitor.GetVibrator(this);
                AlphaAnimation aAnima = new AlphaAnimation(1.0f, 0.0f);
                aAnima.Duration = 200;//确定持续时间  
                Refresh.StartAnimation(aAnima);
                aAnima = new AlphaAnimation(0.0f, 1.0f);
                aAnima.Duration = 200;//确定持续时间  
                Refresh.StartAnimation(aAnima);
                web_view.Reload();
            };
            Refresh.LongClick += delegate
            {
                Core.SysVisitor.GetVibrator(this);
                Refresh.Visibility = ViewStates.Gone;
            };

            web_view.Settings.JavaScriptEnabled = true;
            web_view.SetWebChromeClient(new WebChromeClient());
            // 设置可以支持缩放 
            web_view.Settings.SetSupportZoom(true);
            // 设置出现缩放工具 
            web_view.Settings.BuiltInZoomControls = true;

            string ls_date = DateTime.Now.ToString();
            string local_pwd = Core._publicfuns.of_GetMySysSet("Login", "password");
            local_pwd = baseclass.DES.of_DecryStr_64(local_pwd, "loginpasskey");
            String url = "http://" + Core.SysVisitor.of_GetHost() + ".36x.cn/wap/auto.ashx";
            string Params = "?action=" + name + "&date=" + ls_date;
            Params += "&str=" + baseclass.DES.of_EncryStrVc(Core.SysVisitor.UserName + "|" + local_pwd, "app" + ls_date);
            url = url + Params;
            if (!URLUtil.IsNetworkUrl(url))
            {
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.SetTitle("提示:");
                builder.SetMessage("找不到所访问的网页,请稍后重试");
                builder.SetPositiveButton("确定", delegate
                {
                    StartActivity(typeof(Index));
                });
                builder.Show();
                return;
            }
            //啟用Javascript Enable
            web_view.Settings.JavaScriptEnabled = true;
            web_view.SetWebChromeClient(new CustChromeWebViewClient(this));
            web_view.LoadUrl(url);
            // 重写SetWebViewClient方法,使得网页在应用内部打开而不是在外部浏览器打开
            web_view.SetWebViewClient(new CustWebViewClient(this));
            //ImageView inv = FindViewById<ImageView>(Resource.Id.web_cancel);
            //AlphaAnimation aAnima = new AlphaAnimation(0.0f, 1.0f);//从全不透明变为全透明  
            //aAnima.Duration = 2000;//确定持续时间  
            //inv.StartAnimation(aAnima);
            //inv.LongClick += delegate 
            //{
            //    Intent intent = new Intent();
            //    intent.SetClass(this, typeof(Index));
            //    StartActivity(intent);
            //    Finish();
            //};
        }
		/**
	 * Dismiss the current shown popover
	 * @param animated Whether it should be dismissed animated or not
	 */
		public void dissmissPopover (bool animated)
		{

			//Tell delegate we will dismiss
			if (del != null)
				del.popoverViewWillDismiss (this);

			//If we don't want animation
			if (!animated) {
				//Just remove views
				popoverView.RemoveAllViews ();
				RemoveAllViews ();
				Superview.RemoveView (this);
				//Tell delegate we did dismiss
				if (del != null)
					del.popoverViewDidDismiss (this);
			} else {
				//Continue only if there is not an animation in progress
				if (!isAnimating) {
					//Create alpha animation, with its listener
					AlphaAnimation animation = new AlphaAnimation (1.0f, 0.0f);
					animation.Duration = fadeAnimationTime;
					animation.AnimationStart += (object sender, Animation.AnimationStartEventArgs e) => {
					};
					animation.AnimationRepeat += (object sender, Animation.AnimationRepeatEventArgs e) => {

					};
					animation.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => {
						//Remove the view
						popoverView.RemoveAllViews ();
						RemoveAllViews ();
						this.Superview.RemoveView (this);
						//End animation
						isAnimating = false;
						//Tell delegate we did dismiss
						if (del != null)
							del.popoverViewDidDismiss (this);
					};

					//Start animation
					isAnimating = true;
					StartAnimation (animation);
				}

			}

		}
        private void PlayMetronome()
        {
            const int amp = 10000;
            double twopi = 8*Math.Atan(1.0);
            const double fr = 440.0;
            double ph = 0.0;

            int lastBpm = metronCurrentBpm;

            Animation anim = new AlphaAnimation(0.5f, 1.0f);
            anim.Duration = (60000/metronCurrentBpm)/2;
            anim.StartOffset = 0;
            anim.RepeatMode = RepeatMode.Reverse;
            anim.RepeatCount = Animation.Infinite;
            RunOnUiThread(() => { metronBpmText.StartAnimation(anim); });

            metronAudioTrack = new AudioTrack(Android.Media.Stream.Music, 44100, ChannelOut.Mono,
                Encoding.Pcm16bit, metronBuffSize, AudioTrackMode.Stream);

            metronAudioTrack.Play();

            while (reading)
            {
                Thread.Sleep(60000/metronCurrentBpm);

                if (lastBpm != metronCurrentBpm)
                {
                    // The BPM has changed - change the animation speed!
                    lastBpm = metronCurrentBpm;
                    anim.Duration = (60000/metronCurrentBpm)/2;

                    RunOnUiThread(() =>
                    {
                        metronBpmText.ClearAnimation();
                        metronBpmText.StartAnimation(anim);
                    });
                }

                for (int i = 0; i < metronAudioBuffer.Length; i++)
                {
                    metronAudioBuffer[i] = (short) (amp*Math.Sin(ph));
                    ph += twopi*fr/44100;
                }

                metronAudioTrack.Write(metronAudioBuffer, 0, metronAudioBuffer.Length);
            }

            metronAudioTrack.Stop();
            metronAudioTrack.Release();

            RunOnUiThread(() => { metronBpmText.ClearAnimation(); });
        }
 public void UnSelectedHolderSwipe()
 {
     Animation alphaAnim = new AlphaAnimation(1, 0);
     alphaAnim.Duration = 300;
     alphaAnim.AnimationEnd += (sender, args) =>
     {
         BackgroundView.Visibility = ViewStates.Gone;
     };
     BackgroundView.StartAnimation(alphaAnim);
     
 }
Example #19
0
 private void SwitchImage()
 {
     var fadeOutAnim = new AlphaAnimation(1.0f, 0.0f);
     fadeOutAnim.Duration = 500;
     //fadeOutAnim.SetAnimationListener(new Android.Views.Animations.in
     fadeOutAnim.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => {
         if (this._imageViewResource == Resource.Drawable.image1) {
             this.SetImageResource(Resource.Drawable.image2);
         }
         else {
             this.SetImageResource(Resource.Drawable.image1);
         }
         // fade in
         var fadeIn = new AlphaAnimation(0.0f, 1.0f);
         fadeIn.Duration = 500;
         this._imageView.StartAnimation(fadeIn);
     };
     this._imageView.StartAnimation(fadeOutAnim);
 }
		protected override async void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.profile);
			Log.Debug (tag, "INICIANDO PERFIL");

			Log.Debug (tag, "Seteando toolbar y scrollview");
			mToolbar = FindViewById<SupportToolBar> (Resource.Id.toolbar);
			mScrollView = FindViewById<ScrollView> (Resource.Id.scrollView);

			SetSupportActionBar (mToolbar);
			SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_arrow_back);
			SupportActionBar.SetDisplayHomeAsUpEnabled (true);
			SupportActionBar.SetHomeButtonEnabled (true);

			Point size = new Point ();
			Display display = WindowManager.DefaultDisplay;
			display.GetSize (size);
			mScreenHeight = size.Y;

			mScrollView.ViewTreeObserver.AddOnScrollChangedListener (this);

			nombreu = FindViewById<TextView> (Resource.Id.nombre);
			correou = FindViewById<TextView> (Resource.Id.correo);
			puntos = FindViewById<TextView> (Resource.Id.puntos);
			completado = FindViewById<TextView> (Resource.Id.completado);
			countup = FindViewById<TextView> (Resource.Id.countup);
			completadobarra = FindViewById<ProgressBar> (Resource.Id.completadobarra);
			entradasblog = new List<BlogEntry> ();
			updatefoto = FindViewById<Button> (Resource.Id.updatefoto);
			Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder (this);
			//progressBar.getProgressDrawable().setColorFilter(Color.RED, Mode.SRC_IN);
			completadobarra.ProgressDrawable.SetColorFilter(Color.ParseColor("#68FF68"), Android.Graphics.PorterDuff.Mode.SrcIn);
			source = 1;
			apath = "";
			imgUri = null;

			esperafoto = FindViewById<ProgressBar> (Resource.Id.esperafoto);

			//foto = FindViewById<PlifToolbarMenu.CircleImageView> (Resource.Id.fotoperfil);
			foto = FindViewById<ImageView> (Resource.Id.fotoperfil);
			Typeface font = Typeface.CreateFromAsset(Assets, "Fonts/fa.ttf");

			//Preferencias de la App
			var prefs = this.GetSharedPreferences("RunningAssistant.preferences", FileCreationMode.Private);

			idusuario = prefs.GetString ("id", null);
			correo = prefs.GetString ("email",null);

			var editor = prefs.Edit ();
			var nombre = prefs.GetString("nombre", null);
			SupportActionBar.Title = nombre;

			Log.Debug (tag, "Inicia foto de perfil");
			fotoperfil = FindViewById<ImageView> (Resource.Id.fotoperfil);

			try{
				JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+idusuario);
				Log.Debug ("json","SI existe la ruta");
				string extra="http://plif.mx/";
				string path = rutapre [0] ["imagen_usuarios"] ["ruta"];


				string first=path[0].ToString();

				if(first=="u" || first=="U"){
					//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
					path=extra+path;
				}else{
					//no hagas nada, la imagen es de google o de algun otro lado.
				}


				Log.Debug (tag, "La ruta es: "+path);
				rutafoto=path;
				Koush.UrlImageViewHelper.SetUrlDrawable(fotoperfil, path, Resource.Drawable.profile);
				hayimagen="si";
			}catch(Exception ex){
				Log.Debug ("json","no existe la ruta");
				fotoperfil.SetImageResource (Resource.Drawable.profile);
				hayimagen="no";
			}

			string url = "http://plif.mx/perfil/" + idusuario + ".json?droid";
			Log.Debug (tag, "la URL es: " + url);

			string completadonum = "";



			try{
			datos = await plifserver.FetchWeatherAsync(url);

			nombreu.Text = nombre;
			correou.Text = correo;
			puntos.Text = datos ["0"] ["Users"] ["puntos"]+" puntos";
			//Log.Debug(tag, "El completado: "+datos ["completadoperfil"]);

				int comptemp=Int32.Parse(datos ["completadoperfil"]);

				if(comptemp==20){
					//no hagas nada
				}else{
					comptemp=comptemp+20;
				}

				completadonum = comptemp.ToString();
			completado.Text="Tu perfil está completo al "+completadonum+"% ¡Complétalo desde nuestra web para ganar más puntos!";

		    //aqui ponemos lo que hay completado del perfil;

			}catch(Exception ex){
				Log.Debug (tag, "F**K!! "+ex.ToString() );
			}



			System.Threading.Tasks.Task.Factory.StartNew(() => {

				TextView cp = FindViewById<TextView> (Resource.Id.countup);
				int j = 0;
				Log.Debug(tag,"thread started");
				//while (j<100){
				for(j=0; j<=Int32.Parse(completadonum); j++){
					Log.Debug(tag,"Ciclo For");
					ThreadPool.QueueUserWorkItem (o => setprogreso (countup, j));
					Log.Debug(tag,"Se llama al ThreadPool");
					Thread.Sleep (25);
					Log.Debug(tag,"Retardo de 100ms");
					j++;
					Log.Debug(tag,"El nuevo valor de J: "+j);
				}
				//cp.Text = j.ToString()+"%";

			});

			//Creamos el inflater para las vistas de los negocios
			LayoutInflater inflater = LayoutInflater.From(this);

			//creamos la ll donde se van a meter las entradas
			LinearLayout blogcontainer = FindViewById<LinearLayout> (Resource.Id.blogcontainer);


			try{
			//Aquí vamos a llenar el blog
				JsonValue datosblog = datos["entradas"];
				foreach(JsonObject data in datosblog){
					Log.Debug(tag, "Entrada al blog: "+data["b"]["titulo"]);
					//JsonValue b = data["b"];
					//JsonValue cero = data ["0"];
					entradasblog.Add(new BlogEntry(){
						Id=data["b"]["id"],
						Titulo=data["b"]["titulo"],
						User=data["b"]["user"],
						FechaPublicacion=data["b"]["fecha_publicacion"],
						Likes = data["b"]["likes"],
						ImagenCabezado=data["b"]["imgencabezado"],
						Promedio="lel"
					});
				}

				Log.Debug(tag, "Justo antes del foreach del blog");
				for(int j=0; j<entradasblog.Count; j++){
					Log.Debug(tag, "Entramos al foreach del blog e inflamos");
					View row = inflater.Inflate(Resource.Layout.blog_row, blogcontainer, false);

					//ESTE SETEA EL NOMBRE
					Log.Debug(tag, "creamos textview");
					TextView tituloblog = row.FindViewById<TextView> (Resource.Id.entryname);
					Log.Debug(tag, "seteamos textview");
					tituloblog.Text = entradasblog [j].Titulo;

					//inicia estrellas
					//ESTE SETEA LAS ESTRELLAS DE LA CALIFICACION
					ImageView cali = row.FindViewById<ImageView> (Resource.Id.calificacion);

					string cal = entradasblog[j].Promedio;

					switch (cal) {

					case "0":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "null":
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case null:
						cali.SetImageResource (Resource.Drawable.e0);
						break;

					case "1":
						cali.SetImageResource (Resource.Drawable.e1);
						break;

					case "2":
						cali.SetImageResource (Resource.Drawable.e2);
						break;

					case "3":
						cali.SetImageResource (Resource.Drawable.e3);
						break;

					case "4":
						cali.SetImageResource (Resource.Drawable.e4);
						break;

					case "5":
						cali.SetImageResource (Resource.Drawable.e5);
						break;



					default:
						cali.SetImageResource (Resource.Drawable.e0);
						break;
					}
					//termina estrellas

					//inicia imagen
					//ESTE SETEA LA IMAGEN
					ImageView imagen = row.FindViewById<ImageView> (Resource.Id.NegocioFoto);

					if (entradasblog[j].ImagenCabezado == null || entradasblog[j].ImagenCabezado == "" || entradasblog[j].ImagenCabezado == "null") {
						//pon la imagen por defecto
						imagen.SetImageResource (Resource.Drawable.marca);
					} else {
						//TENEMOS QUE VERIFICAR SI LA IMAGEN ES DE GOOGLE O DE NOSOTROS!!!
						string extra="http://plif.mx/admin/";
						string ruta=entradasblog[j].ImagenCabezado;
						string first=ruta[0].ToString();

						if(first=="u" || first=="U"){
							//Toast.MakeText (Application.Context, "EMPIEZA CON U!!!", ToastLength.Long).Show ();
							ruta=extra+ruta;
						}else{
							//no hagas nada, la imagen es de google
						}

						Koush.UrlImageViewHelper.SetUrlDrawable (imagen, ruta, Resource.Drawable.bolaplace);
					//acaba imagen
					}

					//SETEA EL NUMERO DE CORAZONES
					TextView corazones = row.FindViewById<TextView> (Resource.Id.corazones);
					corazones.Text=entradasblog[j].Likes;


					Log.Debug(tag, "retornamos vista");
					blogcontainer.AddView(row);

				

				}//For


			}catch(Exception ex){
				Log.Debug (tag, "Algo en el blog falló D: "+ex.ToString());
			}


			updatefoto.SetTypeface(font, TypefaceStyle.Normal);

			updatefoto.Click += async (object sender, EventArgs e) => {
				//actualizamos la foto

				alert.SetTitle("Actualizar foto");

				alert.SetPositiveButton ("Desde cámara", (senderAlert, args) => {
					//abrimos el intent de la cámara
					updatefoto.Visibility=ViewStates.Gone;
					esperafoto.Visibility=ViewStates.Visible;
						

					source=2;

					Dictionary<string,string> diccionario = new Dictionary<string,string>();

					List <byte[]> fossbytes = new List<byte[]>();
					GetImage((async (b, p) =>  {
						Log.Debug(tag,"Inicia GETIMAGE");

						AlphaAnimation alpha = new AlphaAnimation(1.0F, 0.4F); // change values as you want
						alpha.Duration=500; // Make animation instant
						alpha.FillAfter=true; // Tell it to persist after the animation ends
						// And then on your imageview
						fotoperfil.StartAnimation(alpha);

						Java.IO.File f = new Java.IO.File(p[0]);
						stream = this.ContentResolver.OpenInputStream(Android.Net.Uri.FromFile(f));
						Bitmap temp =BitmapFactory.DecodeStream(stream);

						if(temp!=null){
							Log.Debug("FOSSBYTES","Inicia conversión a bytes!");
							byte[] tmp2 = pliffunctions.PathToByte2(p[0]);
							Log.Debug("FOSSBYTES","Termina conversión a bytes!");

							fossbytes.Add(tmp2);
							diccionario.Add("imagen_usuario_id",hayimagen);
							diccionario.Add("usuario_id",idusuario);


							try{
							//AQUI vamos a actualizar la foto del perfil con el codigo del multipart
							string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/UpdateImgPerfil", fossbytes, "nada", "file[]", "image/jpeg", diccionario, true);
							Log.Debug(tag,"Respuesta del servidor: "+resp);

							//PONEMOS LA IMAGEN, MOSTRAMOS EL BOTON Y OCULTAMOS EL PROGRESSBAR
							JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+idusuario);
							Log.Debug ("json","SI existe la ruta");
							string path = "http://plif.mx/"+rutapre [0] ["imagen_usuarios"] ["ruta"];
							Log.Debug (tag, "La ruta es: "+path);
								rutafoto=path;
							Koush.UrlImageViewHelper.SetUrlDrawable(fotoperfil, path, Resource.Drawable.profile);
							hayimagen="si";

							

							AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
							alpha2.Duration=500; // Make animation instant
							alpha2.FillAfter=true; // Tell it to persist after the animation ends
							// And then on your imageview
							updatefoto.Visibility=ViewStates.Visible;
							esperafoto.Visibility=ViewStates.Gone;
							fotoperfil.StartAnimation(alpha2);
							}catch(Exception ex){
								updatefoto.Visibility=ViewStates.Visible;
								esperafoto.Visibility=ViewStates.Gone;

								AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
								alpha2.Duration=500; // Make animation instant
								alpha2.FillAfter=true; // Tell it to persist after the animation ends
								// And then on your imageview
								fotoperfil.StartAnimation(alpha2);
								Toast.MakeText (Application.Context, "Ocurrió un error al actualizar la foto de perfil. Inténtalo de nuevo", ToastLength.Long).Show ();

							}

						}

					}));

				} );

				fotoperfil.Click += (object sender2, EventArgs e2) => {
					//abrimos el intent de pantalla completa
					Log.Debug(tag,"clickeo la imagen!");
					var pantallacompleta = new Intent (this, typeof(PantallaCompleta));
					pantallacompleta.PutExtra("ruta",rutafoto);

					StartActivity (pantallacompleta);

				};

				alert.SetNeutralButton ("Desde galería", (senderAlert, args) => {

					//abrimos el intent de la galería
					updatefoto.Visibility=ViewStates.Gone;
					esperafoto.Visibility=ViewStates.Visible;


					source=1;

					Dictionary<string,string> diccionario = new Dictionary<string,string>();

					List <byte[]> fossbytes = new List<byte[]>();
					GetImage((async (b, p) =>  {
						Log.Debug(tag,"Inicia GETIMAGE");

						AlphaAnimation alpha = new AlphaAnimation(1.0F, 0.4F); // change values as you want
						alpha.Duration=500; // Make animation instant
						alpha.FillAfter=true; // Tell it to persist after the animation ends
						// And then on your imageview
						fotoperfil.StartAnimation(alpha);

						Java.IO.File f = new Java.IO.File(p[0]);
						stream = this.ContentResolver.OpenInputStream(Android.Net.Uri.FromFile(f));
						Bitmap temp =BitmapFactory.DecodeStream(stream);

						if(temp!=null){
							Log.Debug("FOSSBYTES","Inicia conversión a bytes!");
							byte[] tmp2 = pliffunctions.PathToByte2(p[0]);
							Log.Debug("FOSSBYTES","Termina conversión a bytes!");

							fossbytes.Add(tmp2);
							diccionario.Add("imagen_usuario_id",hayimagen);
							diccionario.Add("usuario_id",idusuario);


							try{
								//AQUI vamos a actualizar la foto del perfil con el codigo del multipart
								string resp = await plifserver.PostMultiPartForm ("http://plif.mx/pages/UpdateImgPerfil", fossbytes, "nada", "file[]", "image/jpeg", diccionario, true);
								Log.Debug(tag,"Respuesta del servidor: "+resp);

								//PONEMOS LA IMAGEN, MOSTRAMOS EL BOTON Y OCULTAMOS EL PROGRESSBAR
								JsonValue rutapre = await plifserver.FetchWeatherAsync ("http://plif.mx/mobile/get_img_usr?id="+idusuario);
								Log.Debug ("json","SI existe la ruta");
								string path = "http://plif.mx/"+rutapre [0] ["imagen_usuarios"] ["ruta"];
								Log.Debug (tag, "La ruta es: "+path);
								rutafoto=path;
								Koush.UrlImageViewHelper.SetUrlDrawable(fotoperfil, path, Resource.Drawable.profile);
								hayimagen="si";



								AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
								alpha2.Duration=500; // Make animation instant
								alpha2.FillAfter=true; // Tell it to persist after the animation ends
								// And then on your imageview
								updatefoto.Visibility=ViewStates.Visible;
								esperafoto.Visibility=ViewStates.Gone;
								fotoperfil.StartAnimation(alpha2);
							}catch(Exception ex){
								updatefoto.Visibility=ViewStates.Visible;
								esperafoto.Visibility=ViewStates.Gone;

								AlphaAnimation alpha2 = new AlphaAnimation(0.4F, 1.0F); // change values as you want
								alpha2.Duration=500; // Make animation instant
								alpha2.FillAfter=true; // Tell it to persist after the animation ends
								// And then on your imageview
								fotoperfil.StartAnimation(alpha2);
								Toast.MakeText (Application.Context, "Ocurrió un error al actualizar la foto de perfil. Inténtalo de nuevo", ToastLength.Long).Show ();

							}

						}

					}));

				} );

				alert.Show();
		

			};


		}
 private void ResetAnimation()
 {
     SetBackGroundColor();
     Animation alphaAnim2 = new AlphaAnimation(0, 1);
     alphaAnim2.Duration = 300;
     BackgroundView.StartAnimation(alphaAnim2);
 }
 private Animation CreateAlphaOutAnimation()
 {
     AlphaAnimation an = new AlphaAnimation(1, 0);
     an.Duration = ALPHA_DURATION;
     an.FillAfter = true;
     return an;
 }
Example #23
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            logintracker = new LoginTracker (this);
            logintracker.StartTracking ();

            updateWithToken(AccessToken.CurrentAccessToken);

            //			LeaderBoardSelfCard selfcard = new LeaderBoardSelfCard (eventcard.eventinfo.seller_position,eventcard.eventinfo.gross_sales);
            //			List<LeaderBoardCard> boardcardlist = new List<LeaderBoardCard> ();
            //			bool havesetboardboardheader=false;
            //			for (int i = 0; i < eventcard.eventinfo.LeaderBoardList.Count; i++) {
            //				if (!havesetboardboardheader) {
            //					havesetboardboardheader = true;
            //					boardcardlist.Add (new LeaderBoardCard(eventcard.eventinfo.LeaderBoardList[i],1));
            //				}  else {
            //					boardcardlist.Add (new LeaderBoardCard(eventcard.eventinfo.LeaderBoardList[i],2));
            //				}
            //			}
            //			leaderboardadapter = new LeaderBoardAdapter (nn_activity,boardcardlist,selfcard);

            showprizeimganimation=new AlphaAnimation(0,1);
            showprizeimganimation.Duration=1000;
            showprizeimganimation.RepeatCount=0;
            showprizeimganimation.FillAfter=false;

            hideprizeimganimation=new AlphaAnimation(1,0);
            hideprizeimganimation.Duration=1000;
            hideprizeimganimation.RepeatCount=0;
            hideprizeimganimation.FillAfter=false;
        }
Example #24
0
        private void HandleTimerFadeOutZoomLabelElapsed(object sender, ElapsedEventArgs e)
        {
            if (!_isZoomLabelVisible)
                return;

            Post(() =>
            {
                if (DateTime.Now - _lastZoomUpdate > new TimeSpan(0, 0, 0, 0, 700))
                {
                    _isZoomLabelVisible = false;
                    //Console.WriteLine("WaveFormScrollView - HandleTimerFadeOutZoomLabelElapsed - Refreshing wave form bitmap...");
                    //WaveView.RefreshWaveFormBitmap();

                    var animFadeOut = new AlphaAnimation(1, 0);
                    animFadeOut.RepeatMode = RepeatMode.Reverse;
                    animFadeOut.FillAfter = true;
                    animFadeOut.Duration = 200;
                    _lblZoom.StartAnimation(animFadeOut);
                }
            });
        }
 private void SwitchColorBackGround()
 {
     Animation alphaAnim1 = new AlphaAnimation(1, 0);
     alphaAnim1.Duration = 300;
     alphaAnim1.AnimationEnd += (sender, args) =>
     {
         ResetAnimation();
     };
     BackgroundView.StartAnimation(alphaAnim1);
 }
Example #26
0
		/*	void BtnSing_Touch (object sender, View.TouchEventArgs e)
		{
			if (e.Event.Action == MotionEventActions.Down) {
				btnSingUp.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signuplisto.png"), Configuration.getWidth(507), Configuration.getHeight(78),true));
			}

			if (e.Event.Action == MotionEventActions.Up) {
				btnSingUp.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signupnolisto.png"), Configuration.getWidth(507), Configuration.getHeight(78),true));
				var com = ((LoginViewModel)this.DataContext).SignUpCommand;
				com.Execute(null);
			}						

		}

*/
		void BtnLogin_Click (object sender, EventArgs e)
		{
			AlphaAnimation animation = new AlphaAnimation(1.0f,0.0f);
			animation.Duration = 350;
			animation.AnimationEnd+= Animation_AnimationEnd;               

			relSingup.StartAnimation(animation);     
		}
Example #27
0
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            IsChildFragment = true;

            showprizeimganimation=new AlphaAnimation(0,1);
            showprizeimganimation.Duration=1000;
            showprizeimganimation.RepeatCount=0;
            showprizeimganimation.FillAfter=true;
            showprizeimganimation.AnimationEnd+= (object sender, Animation.AnimationEndEventArgs e) => {
                prizeinfocontainer.Tag=1;
                prizeinfocontainer.Visibility=ViewStates.Visible;
            };

            hideprizeimganimation=new AlphaAnimation(1,0);
            hideprizeimganimation.Duration=1000;
            hideprizeimganimation.RepeatCount=0;
            hideprizeimganimation.FillAfter=true;
            hideprizeimganimation.AnimationEnd+= (object sender, Animation.AnimationEndEventArgs e) => {
                prizeinfocontainer.Tag=0;
                prizeinfocontainer.Visibility=ViewStates.Invisible;
            };
        }
Example #28
0
 private Animation CreateAlphaOutAnimation()
 {
     AlphaAnimation an = new AlphaAnimation(1, 0)
     {
         Duration = AlphaDuration,
         FillAfter = true
     };
     return an;
 }
		//********************************************************************
		// PUBLIC METHODS
		//********************************************************************
		/**
	 * This method shows a popover in a ViewGroup, from an origin rect (relative to the Application Window)
	 * @param group The group we want to insert the popup. Normally a Relative Layout so it can stand on top of everything
	 * @param originRect The rect we want the popup to appear from (relative to the Application Window!)
	 * @param arrowDirections The mask of bits to tell in which directions we want the popover to be shown
	 * @param animated Whether is animated, or not
	 */
		public void showPopoverFromRectInViewGroup (ViewGroup group, Rect originRect, int arrowDirections, bool animated)
		{

			//First, tell delegate we will show
			if (del != null)
				del.popoverViewWillShow (this);

			//Save superview
			Superview = group;

			//First, add the view to the view group. The popover will cover the whole area
			LayoutParams insertParams = new  LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent);
			group.AddView (this, insertParams);

			//Now, save rect for the layout (is the same as the superview)
			popoverLayoutRect = PopoverView.getFrameForView (Superview);

			//Add available rects
			addAvailableRects (originRect, arrowDirections);
			//Get best rect
			int best = getBestRect ();

			//Add popover
//				Rect bestRect = possibleRects.get(best);
			Rect bestRect = null; 
			possibleRects.TryGetValue (best, out bestRect);
			addPopoverInRect (bestRect);
			//Add arrow image
			addArrow (originRect, best);


			//If we don't want animation, just tell the delegate
			if (!animated) {
				//Tell delegate we did show
				if (del != null)
					del.popoverViewDidShow (this);
			}
				//If we want animation, animate it!
				else {
				//Continue only if we are not animating
				if (!isAnimating) {

					//Create alpha animation, with its listener
					AlphaAnimation animation = new AlphaAnimation (0.0f, 1.0f);
					animation.Duration = fadeAnimationTime;
					animation.AnimationStart += (object sender, Animation.AnimationStartEventArgs e) => {
					};
					animation.AnimationRepeat += (object sender, Animation.AnimationRepeatEventArgs e) => {
					};
					animation.AnimationEnd += (object sender, Animation.AnimationEndEventArgs e) => {
						//End animation
						isAnimating = false;
						//Tell delegate we did show
						if (del != null)
							del.popoverViewDidShow (this);
					};
								
					//Start animation
					isAnimating = true;
					StartAnimation (animation);

				}
			}

		}