public override void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            if (resultCode != (int)Android.App.Result.Ok)
            {
                return;
            }

            switch (requestCode)
            {
            case RcAsset:
                string assetName = data.GetStringExtra(ExtraAnimationName);
                LottieComposition.FromAssetFileName(this.Context, assetName, (composition) =>
                {
                    SetComposition(composition, assetName);
                });
                break;

            case RcFile:
                Uri uri = data.Data;
                try
                {
                    string path = GetPath(uri);
                }
                catch (Exception ex)
                {
                    OnLoadError();
                }
                break;

            default:
                break;
            }
        }
예제 #2
0
 private void Init()
 {
     FocusableInTouchMode = true;
     LottieComposition.FromAssetFileName(this.Context, "Mobilo/BlinkingCursor.json", (composition) =>
     {
         cursorView = new LottieAnimationView(Context);
         cursorView.LayoutParameters = new LottieFontViewGroup.LayoutParams(
             ViewGroup.LayoutParams.WrapContent,
             ViewGroup.LayoutParams.WrapContent
             );
         cursorView.SetComposition(composition);
         cursorView.Loop(true);
         cursorView.PlayAnimation();
         AddView(cursorView);
     });
 }
예제 #3
0
        public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
        {
            if (keyCode == Keycode.Space)
            {
                AddSpace();
                return(true);
            }

            if (keyCode == Keycode.Del)
            {
                RemoveLastView();
                return(true);
            }

            if (!IsValidKey(keyCode))
            {
                return(base.OnKeyUp(keyCode, e));
            }


            string letter   = Char.ToUpper((char)e.UnicodeChar).ToString();
            string fileName = "Mobilo/" + letter + ".json";

            if (compositionMap.ContainsKey(fileName))
            {
                AddComposition(compositionMap[fileName]);
            }
            else
            {
                LottieComposition.FromAssetFileName(this.Context, fileName, (composition) =>
                {
                    if (!compositionMap.ContainsKey(fileName))
                    {
                        compositionMap.Add(fileName, composition);
                    }
                    AddComposition(composition);
                });
            }

            return(true);
        }