Exemplo n.º 1
0
        public async Task <Android.Views.View> Render(Renderer renderer)
        {
            View = (Lottie)renderer.View;
            var assembly = UIRuntime.CurrentActivity.GetType().GetAssembly();
            var stream   = new StreamReader(assembly.GetManifestResourceStream(View.AnimationJsonFile));

            Result = new Com.Airbnb.Lottie.LottieAnimationView(UIRuntime.CurrentActivity);
            Result.SetAnimationFromJson(stream.ReadToEnd());

            View.OnPlay.Handle(() => Result.PlayAnimation());
            View.OnPause.Handle(() => Result.PauseAnimation());
            View.OnLoopChanged.Handle((loop) => Result.Loop(loop));

            return(Result);
        }
Exemplo n.º 2
0
        public Task <UIView> Render(Renderer renderer)
        {
            if (Result == null)
            {
                View = (Lottie)renderer.View;
                var info = IO.File(View.AnimationJsonFile);

                Result = Airbnb.Lottie.LOTAnimationView.AnimationWithFilePath(info.FullName);
            }

            View.OnPlay.Handle(() => Result.Play());
            View.OnPause.Handle(() => Result.Pause());
            View.OnLoopChanged.Handle((loop) => Result.LoopAnimation = loop);

            return(Task.FromResult <UIView>(Result));
        }