示例#1
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate(savedInstanceState);
     SetContentView(Resource.Layout.LoadScreen);
     gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);
     LoadScreen();
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            // Create your application here
            //var mainIntent = new Intent(Application.Context, typeof(MainActivity));
            //if (Intent.Extras != null)
            //    mainIntent.PutExtras(Intent.Extras);
            //mainIntent.SetFlags(ActivityFlags.SingleTop);

            //StartActivity(mainIntent);

            SetContentView(Resource.Layout.SplashScreen);
            gifImageView = FindViewById <GifImageView>(Resource.Id.gifIamgeView);

            Stream input = Assets.Open("splash.gif");

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            Timer timer = new Timer();

            timer.Interval  = 5000;
            timer.AutoReset = false;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();
        }
示例#3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.GifViewer);
            var mToolbar = FindViewById <SupportToolbar>(Resource.Id.toolbar);

            SetSupportActionBar(mToolbar);
            SupportActionBar.Title = "";
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            _gifTextureView = FindViewById <GifImageView>(Resource.Id.gifViewImage);

            if (_gifTextureView == null)
            {
                return;
            }
            //String imageUrl = "file:///android_asset/anime.jpeg";
            _fileUrl = Intent.GetStringExtra("url") ?? string.Empty;
            progress = new ProgressDialog(this);
            progress.SetMessage("Загрузка...");
            progress.Show();
            startDownload();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SplashScreen);

            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);
            progressBar  = FindViewById <ProgressBar>(Resource.Id.pgRefresh);

            var input = Assets.Open("splash_screen.gif");
            var bytes = ConvertFileToByteArray(input);

            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            Timer timer = new Timer
            {
                Enabled   = true,
                Interval  = 3000,
                AutoReset = false
            };

            timer.Elapsed += (sender, e) => {
                StartActivity(new Intent(this, typeof(MainActivity)));
            };
        }
示例#5
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.home);
            TextView textView = FindViewById <TextView>(Resource.Id.text);

            gifImageView    = FindViewById <GifImageView>(Resource.Id.gifImageView);
            textView.Click += (o, e) => {
                //try
                //{
                //    ActionBar.Title = "Error downloading";
                //    using (var client = new HttpClient())
                //    {
                //        var bytes = await client.GetByteArrayAsync("http://dogoverflow.com/dRX5G8qK");
                //        gifImageView.SetBytes(bytes);
                //        gifImageView.StartAnimation();
                //    }
                //}
                //catch (Exception ex)
                //{
                //    ActionBar.Title = "Error downloading";
                //}
                var intent = new Intent(this, typeof(Friends));
                StartActivity(intent);
            };
        }
示例#6
0
        async ValueTask LoadAsync()
        {
            if (File.Exists(dataPath))
            {
                await LoadListAsync();

                return;
            }
            FindViewById <LinearLayout>(Resource.Id.linearLayout1).Visibility = ViewStates.Visible;
            var getBttton = FindViewById <Button>(Resource.Id.getButton);

            getBttton.Click += GetButtonClick;
            var progressBar = FindViewById <ProgressBar>(Resource.Id.loadProgress);

            progressBar.Visibility = ViewStates.Visible;
            var code = FindViewById <TextInputEditText>(Resource.Id.code);

            f****r = new HubCourseScheduleFucker.HubFucker();
            var s = await f****r.GetValidationCodeGifAsync();

            myGIFImage = FindViewById <GifImageView>(Resource.Id.myGIFImage);
            var buffer = new byte[s.Length];
            await s.ReadAsync(buffer);

            progressBar.Visibility = ViewStates.Gone;
            code.Visibility        = ViewStates.Visible;
            myGIFImage.SetBytes(buffer);
            myGIFImage.StartAnimation();
            getBttton.Visibility = ViewStates.Visible;
        }
示例#7
0
        protected override void OnResume()
        {
            base.OnResume();
            SetContentView(Resource.Layout.GIFSplash);
            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageViews);

            Stream input = Assets.Open("splash2.gif");

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            if ((int)Build.VERSION.SdkInt >= 23)
            {
                if (CheckSelfPermission(Manifest.Permission.AccessFineLocation) != Permission.Granted ||
                    CheckSelfPermission(Manifest.Permission.AccessCoarseLocation) != Permission.Granted)
                {
                    RequestPermissions(Permissions, 0);
                }
            }

            var timer = new Timer
            {
                Interval  = 1500,
                AutoReset = false,
            };

            timer.Elapsed += Timer_Elapsed;
            timer.Start();
        }
示例#8
0
        private void SetPlaceholder()
        {
            gifImageView = view.FindViewById <GifImageView>(Resource.Id.gif_View);
            var bytes = GifViewHelper.ReadAllBytes(Resources.OpenRawResource(Resource.Drawable.rewards_placeholder));

            gifImageView.SetBytes(bytes);
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            gifImageView = FindViewById<GifImageView>(Resource.Id.gifImageView);
            btnToggle = FindViewById<Button>(Resource.Id.btnToggle);
            btnBlur = FindViewById<Button>(Resource.Id.btnBlur);
            var btnClear = FindViewById<Button>(Resource.Id.btnClear);
            gifImageView.OnFrameAvailableListener = this;

            blur = Blur.NewInstance(this);
            btnBlur.Click += (sender, e) => 
                {
                    shouldBlur = !shouldBlur;
                };

            btnClear.Click += (sender, e) => gifImageView.Clear();

            btnToggle.Click += (sender, e) => 
                {
                    try
                    {
                        if(gifImageView.IsAnimating)
                            gifImageView.StopAnimation();
                        else
                            gifImageView.StartAnimation();
                    }
                    catch(Exception ex)
                    {
                    }
                };

            btnBlur.Enabled = false;
            btnClear.Enabled = false;
            btnToggle.Enabled = false;
           
            try
            {
                ActionBar.Title = "Loading...";
                var client = new HttpClient();
                var bytes = await client.GetByteArrayAsync("http://dogoverflow.com/dRX5G8qK");
                gifImageView.SetBytes(bytes);
                gifImageView.StartAnimation();
                ActionBar.Title = "Gif!!!";
                btnBlur.Enabled = true;
                btnClear.Enabled = true;
                btnToggle.Enabled = true;
            }
            catch(Exception ex)
            {
                ActionBar.Title = "error downloading";
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Image> e)
        {
            base.OnElementChanged(e);
            if (e.OldElement != null || Element == null)
            {
                return;
            }
            gifImage = (GifImageView)Element;
            gif      = new Felipecsl.GifImageViewLib.GifImageView(Forms.Context);

            SetNativeControl(gif);
        }
        private void StartGif(string fileName, GifImageView viewName)
        {
            byte[] bytes;
            Stream input = Assets.Open(fileName);

            using (MemoryStream ms = new MemoryStream())
            {
                input.CopyTo(ms);
                bytes = ms.ToArray();
            }

            viewName.SetBytes(bytes);
            viewName.StartAnimation();
        }
        protected async override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Xamarin.Insights.Initialize("6a6eb93e563f008f1e2e8d05de4b8d4c182f2321", this);

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

            var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar (toolbar);

            accelerometerManager = new AccelerometerManager(this, this);

            buttonRandom = FindViewById<Button>(Resource.Id.button_random);
            buttonRandom.Click += async (sender, args) =>
            {
                state.CurrentTask = LoadImage(OverflowHelper.Animal.Random);
                await state.CurrentTask;
            };
            
            buttonPuppy = FindViewById<Button>(Resource.Id.button_puppy);
            buttonPuppy.Click += async (sender, args) =>
            {
                state.CurrentTask = LoadImage(OverflowHelper.Animal.Dog);
                await state.CurrentTask;
            };

            buttonKitty = FindViewById<Button>(Resource.Id.button_kitty);
            buttonKitty.Click += async (sender, args) => await LoadImage(OverflowHelper.Animal.Cat);

            progressBar = FindViewById<ProgressBar>(Resource.Id.progressbar);
            imageView = FindViewById<ImageView>(Resource.Id.imageview_animal);
            imageViewAnimated = FindViewById<GifImageView>(Resource.Id.imageview_animal_animated);
            progressBar.Visibility = ViewStates.Invisible;
            imageView.Visibility = ViewStates.Gone;
            imageViewAnimated.Visibility = ViewStates.Gone;

            if (state != null)
            {
                if (state.CurrentTask == null || state.CurrentTask.IsCompleted)
                    await SetImage();
            }
            else
            {
                state = new PuppyKittyState();
                state.SetDefault = true;
            }

        }
示例#13
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);


            blur         = Blur.NewInstance(this);
            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);
            btnStart     = FindViewById <Button>(Resource.Id.btnStart);
            btnStop      = FindViewById <Button>(Resource.Id.btnStop);
            btnBlur      = FindViewById <Button>(Resource.Id.btnBlur);

            btnStart.SetOnClickListener(this);
            btnStop.SetOnClickListener(this);
            btnBlur.SetOnClickListener(this);

            gifImageView.OnFrameAvailableListener = this;
        }
示例#14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.SplashLayout);

            AniView = FindViewById <GifImageView>(Resource.Id.SplashLoadingAnimation);
            Status  = FindViewById <TextView>(Resource.Id.SplashStatusText);

            if ((int.Parse(Build.VERSION.Release.Split('.')[0])) >= 6)
            {
                CheckPermission();
            }
            else
            {
                InitLoad();
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            GifImageView.Image = UIImage.FromFile("Gif Images/tmp-1.png");

            GifImageView.AnimationImages = new UIImage[] {
                UIImage.FromFile("Gif Images/tmp-0.png")
                , UIImage.FromFile("Gif Images/tmp-1.png")
                , UIImage.FromFile("Gif Images/tmp-2.png")
                , UIImage.FromFile("Gif Images/tmp-3.png")
                , UIImage.FromFile("Gif Images/tmp-4.png")
                , UIImage.FromFile("Gif Images/tmp-5.png")
            };

            GifImageView.AnimationRepeatCount = 0;
            GifImageView.AnimationDuration    = .5;
            GifImageView.StartAnimating();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SplashScreen);

            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);

            Stream input = Assets.Open("splash_screen1.gif");

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            System.Timers.Timer timer = new  System.Timers.Timer();
            timer.Interval  = 5000;
            timer.AutoReset = false;
            timer.Elapsed  += TimerOnElapsed;
            timer.Start();
        }
示例#17
0
        private GifImageView gifImageView;        //using Felipecsl.GifImageViewLibrary;

        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SplashScreen);

            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);

            Stream input = Assets.Open("google-gif-logo.gif"); // en la carpeta assets esta el archivo "google-gif-logo.gif"

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            Timer timer = new Timer(); //using System.Timers;

            timer.Interval  = 5000;
            timer.AutoReset = false;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();
        }
示例#18
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SplashScreen);
            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);

            Stream input = Assets.Open("slidin_squares.gif");

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            //Wait for 6 seconds and start new Activity
            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval  = 3000;
            timer.AutoReset = false;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();
            Toast.MakeText(this, "Logging in...", ToastLength.Long).Show();
        }
示例#19
0
        protected override void OnResume()
        {
            base.OnResume();
            SetContentView(Resource.Layout.GIFSplash);
            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageViews);

            Stream input = Assets.Open("splash2.gif");

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            var timer = new Timer
            {
                Interval  = 1500,
                AutoReset = false,
            };

            timer.Elapsed += Timer_Elapsed;
            timer.Start();
        }
示例#20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SplashScreen);
            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);
            progressBar  = FindViewById <ProgressBar>(Resource.Id.progressBar);

            Stream input = Assets.Open("mhcho.gif");

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            //Wait for 3 seconds and start new Activity
            Timer timer = new Timer();

            timer.Interval  = 3000;
            timer.AutoReset = false;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.ActivityLogin);

            m_LoginError   = FindViewById <TextView>(Resource.Id.LoginError);
            m_UsernameView = FindViewById <EditText>(Resource.Id.LoginUser);
            m_PassView     = FindViewById <EditText>(Resource.Id.LoginPass);
            Button btnLogin = FindViewById <Button>(Resource.Id.LoginBtn);

            m_LoadingGif = FindViewById <GifImageView>(Resource.Id.loadingCat);

            System.IO.Stream input = Assets.Open("progress_nc.gif");
            byte[]           bytes = Utils.ConvertByteArray(input);

            m_LoadingGif.SetBytes(bytes);
            m_LoadingGif.StartAnimation();

            btnLogin.Click += BtnLogin_Click;
        }
示例#22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.SplashScreen);


            gifImageView = FindViewById <GifImageView>(Resource.Id.gifSplash);
            AssetManager assets = this.Assets;
            Stream       input  = assets.Open("splash_dragon5.gif");

            byte[] bytes = ConvertFileToByteArray(input);
            gifImageView.SetBytes(bytes);
            gifImageView.StartAnimation();

            //Wait for 3 seconds and start new Activity


            Timer timer = new Timer();

            timer.Interval  = 4200;
            timer.AutoReset = false;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();
        }
示例#23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.UserInfo);

            AutoCompleteTextView uAddress       = FindViewById <AutoCompleteTextView>(Resource.Id.address_et);
            TextView             uName          = FindViewById <TextView>(Resource.Id.user_name_text);
            EditText             uEmail         = FindViewById <EditText>(Resource.Id.email_et);
            EditText             uPhone         = FindViewById <EditText>(Resource.Id.phone_et);
            EditText             searchTextView = FindViewById <EditText>(Resource.Id.search_et);

            gifImage = FindViewById <GifImageView>(Resource.Id.gifImage);

            InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            User user = JSONData.usersObj[JSONData.currentUser];

            uName.Text    = "User name: " + user.UserName;
            uEmail.Text   = user.UserEmail;
            uPhone.Text   = user.UserPhone;
            uAddress.Text = user.UserAddress;

            GetGif(user.GifUrl);

            Button saveButton = FindViewById <Button>(Resource.Id.button_save);

            saveButton.Click += (s, e) =>
            {
                Toast.MakeText(this, $"Saving...", ToastLength.Short).Show();

                if (uEmail.Text != null)
                {
                    user.UserEmail = uEmail.Text;
                }
                if (uPhone.Text != null)
                {
                    user.UserPhone = uPhone.Text;
                }
                if (uAddress.Text != null)
                {
                    user.UserAddress = uAddress.Text;
                }
                user.GifUrl = url;

                JSONData.Serializing(this);

                Intent intent = new Intent(this, typeof(MainActivity));
                StartActivity(intent);
            };

            Button searchButton = FindViewById <Button>(Resource.Id.button_search);

            searchButton.Click += (s, e) =>
            {
                Toast.MakeText(this, "Searching...", ToastLength.Short).Show();
                searchingText = searchTextView.Text.ToString();
                searchingText.Replace(" ", "+");

                // hide keyboard
                imm.HideSoftInputFromWindow(this.CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);

                GetGif(null);
            };
        }
示例#24
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.GifViewer);
            var mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar);

            SetSupportActionBar(mToolbar);
            SupportActionBar.Title = "";
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            _gifTextureView = FindViewById<GifImageView>(Resource.Id.gifViewImage);

            if (_gifTextureView == null) return;
            //String imageUrl = "file:///android_asset/anime.jpeg";
            _fileUrl = Intent.GetStringExtra ("url") ?? string.Empty;
            progress = new ProgressDialog (this);
            progress.SetMessage ("Загрузка...");
            progress.Show();
            startDownload ();
        }
示例#25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            context = Application.Context;
            #region Мова
            ISharedPreferences       prefs  = PreferenceManager.GetDefaultSharedPreferences(context);
            ISharedPreferencesEditor editor = prefs.Edit();
            languagesId = prefs.GetInt("key_languageId", 1);

            if (languagesId == 1)
            {
                LanguageCodevalue = "en";
            }
            else
            if (languagesId == 2)
            {
                LanguageCodevalue = "fr";
            }
            else
            if (languagesId == 3)
            {
                LanguageCodevalue = "de";
            }
            else
            if (languagesId == 4)
            {
                LanguageCodevalue = "it";
            }
            else
            if (languagesId == 5)
            {
                LanguageCodevalue = "es";
            }
            else
            if (languagesId == 6)
            {
                LanguageCodevalue = "pt";
            }
            else
            if (languagesId == 7)
            {
                LanguageCodevalue = "cs";
            }
            else
            if (languagesId == 8)
            {
                LanguageCodevalue = "pl";
            }
            else
            if (languagesId == 9)
            {
                LanguageCodevalue = "ru";
            }
            else
            if (languagesId == 10)
            {
                LanguageCodevalue = "uk";
            }
            else
            if (languagesId == 11)
            {
                LanguageCodevalue = "ja";
            }
            else
            if (languagesId == 12)
            {
                LanguageCodevalue = "ko";
            }

            Android.Content.Res.Resources res = this.Resources;
            DisplayMetrics Dm = res.DisplayMetrics;
            Android.Content.Res.Configuration conf = res.Configuration;
            if (LanguageCodevalue != null)
            {
                conf.SetLocale(new Locale(LanguageCodevalue));
            }
            else
            {
                conf.SetLocale(new Locale("en"));
            }
            res.UpdateConfiguration(conf, Dm);
            #endregion

            Window.AddFlags(WindowManagerFlags.Fullscreen);
            SetContentView(Resource.Layout._splashScreenNew);
            gifImageView = FindViewById <GifImageView>(Resource.Id.gifSplashScreen);

            var assets1 = Assets.List(string.Empty);
            if (assets1.Any())

            {
                var videoFilename = assets1.FirstOrDefault(a => a.EndsWith(".gif"));

                if (!string.IsNullOrWhiteSpace(videoFilename))

                {
                    var fileDescriptor = Assets.OpenFd(videoFilename);

                    using (var input = this.Assets.Open(videoFilename, Access.Streaming))
                    {
                        byte[] buffer;
                        using (Stream s = input)
                        {
                            long length = fileDescriptor.Length;
                            buffer = new byte[length];
                            s.Read(buffer, 0, (int)length);

                            gifImageView.SetBytes(buffer);
                            gifImageView.StartAnimation();
                        }
                    }
                }
            }

            System.Timers.Timer timer = new System.Timers.Timer();
            timer.Interval  = 1400;
            timer.AutoReset = false;
            timer.Elapsed  += Timer_Elapsed;
            timer.Start();
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);
            var gifImageViewTrans = FindViewById <GifImageView>(Resource.Id.gifImageView2);

            btnToggle = FindViewById <Button>(Resource.Id.btnToggle);
            btnBlur   = FindViewById <Button>(Resource.Id.btnBlur);
            var btnClear = FindViewById <Button>(Resource.Id.btnClear);

            //if setting OnFrameAvailableListener you must call GC Collect()
            gifImageView.OnFrameAvailableListener = this;

            blur           = Blur.NewInstance(this);
            btnBlur.Click += (sender, e) =>
            {
                shouldBlur = !shouldBlur;
            };

            btnClear.Click += (sender, e) => gifImageView.Clear();

            btnToggle.Click += (sender, e) =>
            {
                try
                {
                    if (gifImageView.IsAnimating)
                    {
                        gifImageView.StopAnimation();
                    }
                    else
                    {
                        gifImageView.StartAnimation();
                    }
                }
                catch (Exception ex)
                {
                }
            };

            btnBlur.Enabled   = false;
            btnClear.Enabled  = false;
            btnToggle.Enabled = false;

            try
            {
                ActionBar.Title = "Loading...";
                var client = new HttpClient();
                var bytes  = await client.GetByteArrayAsync("http://dogoverflow.com/dogs/RX5G8qK.gif");

                gifImageView.SetBytes(bytes);
                gifImageView.StartAnimation();


                bytes = await client.GetByteArrayAsync("http://25.media.tumblr.com/c99a579db3ae0fc164bf4cca148885d3/tumblr_mjgv8kEuMg1s87n79o1_400.gif");

                gifImageViewTrans.SetBytes(bytes);
                gifImageViewTrans.StartAnimation();
                ActionBar.Title   = "Gif!!!";
                btnBlur.Enabled   = true;
                btnClear.Enabled  = true;
                btnToggle.Enabled = true;
            }
            catch (Exception ex)
            {
                ActionBar.Title = "error downloading";
                Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
            }
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            gifImageView = FindViewById<GifImageView>(Resource.Id.gifImageView);
            var gifImageViewTrans = FindViewById<GifImageView>(Resource.Id.gifImageView2);
            btnToggle = FindViewById<Button>(Resource.Id.btnToggle);
            btnBlur = FindViewById<Button>(Resource.Id.btnBlur);
            var btnClear = FindViewById<Button>(Resource.Id.btnClear);
            //if setting OnFrameAvailableListener you must call GC Collect()
            gifImageView.OnFrameAvailableListener = this;

            blur = Blur.NewInstance(this);
            btnBlur.Click += (sender, e) => 
                {
                    shouldBlur = !shouldBlur;
                };

            btnClear.Click += (sender, e) => gifImageView.Clear();

            btnToggle.Click += (sender, e) => 
                {
                    try
                    {
                        if(gifImageView.IsAnimating)
                            gifImageView.StopAnimation();
                        else
                            gifImageView.StartAnimation();
                    }
                    catch(Exception ex)
                    {
                    }
                };

            btnBlur.Enabled = false;
            btnClear.Enabled = false;
            btnToggle.Enabled = false;
           
            try
            {
                ActionBar.Title = "Loading...";
                var client = new HttpClient();
                var bytes = await client.GetByteArrayAsync("http://dogoverflow.com/dogs/RX5G8qK.gif");
                gifImageView.SetBytes(bytes);
                gifImageView.StartAnimation();


                bytes = await client.GetByteArrayAsync("http://25.media.tumblr.com/c99a579db3ae0fc164bf4cca148885d3/tumblr_mjgv8kEuMg1s87n79o1_400.gif");
                gifImageViewTrans.SetBytes(bytes);
                gifImageViewTrans.StartAnimation();
                ActionBar.Title = "Gif!!!";
                btnBlur.Enabled = true;
                btnClear.Enabled = true;
                btnToggle.Enabled = true;
            }
            catch(Exception ex)
            {
                ActionBar.Title = "error downloading";
                Toast.MakeText(this, ex.ToString(), ToastLength.Long).Show();
            }
        }
示例#28
0
 public LoadAnswerMessageHolder(View itemView) : base(itemView)
 {
     image = itemView.FindViewById <GifImageView>(Resource.Id.gifImageView);
 }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            gifImageView = FindViewById <GifImageView>(Resource.Id.gifImageView);
            btnToggle    = FindViewById <Button>(Resource.Id.btnToggle);
            btnBlur      = FindViewById <Button>(Resource.Id.btnBlur);
            var btnClear = FindViewById <Button>(Resource.Id.btnClear);

            gifImageView.OnFrameAvailableListener = this;

            blur           = Blur.NewInstance(this);
            btnBlur.Click += (sender, e) =>
            {
                shouldBlur = !shouldBlur;
            };

            btnClear.Click += (sender, e) => gifImageView.Clear();

            btnToggle.Click += (sender, e) =>
            {
                try
                {
                    if (gifImageView.IsAnimating)
                    {
                        gifImageView.StopAnimation();
                    }
                    else
                    {
                        gifImageView.StartAnimation();
                    }
                }
                catch (Exception ex)
                {
                }
            };

            btnBlur.Enabled   = false;
            btnClear.Enabled  = false;
            btnToggle.Enabled = false;

            try
            {
                ActionBar.Title = "Loading...";
                var client = new HttpClient();
                var bytes  = await client.GetByteArrayAsync("http://dogoverflow.com/dRX5G8qK");

                gifImageView.SetBytes(bytes);
                gifImageView.StartAnimation();
                ActionBar.Title   = "Gif!!!";
                btnBlur.Enabled   = true;
                btnClear.Enabled  = true;
                btnToggle.Enabled = true;
            }
            catch (Exception ex)
            {
                ActionBar.Title = "error downloading";
            }
        }
示例#30
0
        private async void GetButtonClick(object sender, EventArgs e)
        {
            FindViewById <LinearLayout>(Resource.Id.linearLayout1).Visibility = ViewStates.Gone;
            await Task.Run(async() =>
            {
                RunOnUiThread(() =>
                {
                    progress.Visibility     = ViewStates.Visible;
                    progressBar1.Visibility = ViewStates.Visible;
                });
                try
                {
                    RunOnUiThread(() =>
                    {
                        progress.Text = "Logging in...This may take 20s";
                    });
                    await f****r.LoginAsync(FindViewById <TextInputEditText>(Resource.Id.stuId).Text,
                                            FindViewById <TextInputEditText>(Resource.Id.passwd).Text,
                                            FindViewById <TextInputEditText>(Resource.Id.code).Text);
                    RunOnUiThread(() =>
                    {
                        progress.Text = $"Fetching course data... {0}%";
                    });
                    for (int i = 0; i < 20; i++)
                    {
                        for (int j = 1; j < 8; j++)
                        {
                            var lects = await f****r.GetDailyLectureAsync(i + 1, (DayOfWeek)(j % 7));
                            RunOnUiThread(() =>
                            {
                                progress.Text = $"Fetching course data... {(int)((i * 7 + j) / 1.4)}%";
                            });
                            lectures.Add(new DailyLectures
                            {
                                DayOfWeek = (DayOfWeek)(j % 7),
                                Week      = i + 1,
                                Lectures  = lects
                            });
                        }
                    }
                    RunOnUiThread(async() =>
                    {
                        progress.Visibility     = ViewStates.Gone;
                        progressBar1.Visibility = ViewStates.Gone;
                        var s = System.Text.Json.JsonSerializer.Serialize(lectures);
                        await File.WriteAllTextAsync(dataPath, s);
                        FindViewById <LinearLayout>(Resource.Id.linearLayout1).Visibility = ViewStates.Gone;
                        await LoadListAsync();
                        Toast.MakeText(this, "done", ToastLength.Long).Show();
                    });
                }
                catch (Exception)
                {
                    RunOnUiThread(async() =>
                    {
                        Toast.MakeText(this, $"Login Failed!", ToastLength.Long).Show();
                        progress.Visibility     = ViewStates.Gone;
                        progressBar1.Visibility = ViewStates.Gone;
                        myGIFImage.Visibility   = ViewStates.Gone;
                        FindViewById <LinearLayout>(Resource.Id.linearLayout1).Visibility = ViewStates.Visible;
                        FindViewById <LinearLayout>(Resource.Id.linearLayout1).Visibility = ViewStates.Visible;
                        var getBttton          = FindViewById <Button>(Resource.Id.getButton);
                        var progressBar        = FindViewById <ProgressBar>(Resource.Id.loadProgress);
                        getBttton.Visibility   = ViewStates.Gone;
                        progressBar.Visibility = ViewStates.Visible;
                        var code        = FindViewById <TextInputEditText>(Resource.Id.code);
                        code.Visibility = ViewStates.Gone;
                        var s           = await f****r.GetValidationCodeGifAsync();

                        myGIFImage = FindViewById <GifImageView>(Resource.Id.myGIFImage);
                        myGIFImage.StopAnimation();
                        var buffer = new byte[s.Length];
                        await s.ReadAsync(buffer);

                        progressBar.Visibility = ViewStates.Gone;
                        code.Visibility        = ViewStates.Visible;
                        myGIFImage.SetBytes(buffer);
                        myGIFImage.StartAnimation();
                        myGIFImage.Visibility = ViewStates.Visible;
                        getBttton.Visibility  = ViewStates.Visible;
                    });
                }
            });
        }