示例#1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = inflater.Inflate(Resource.Layout.pager_parsingresults, container, false);

            view.FindViewById <TextView>(Resource.Id.titleTextView).Text = title;

            TextInputEditText textField = view.FindViewById <TextInputEditText>(Resource.Id.textTextField);

            textField.Text = text;
            textField.SetOnTouchListener(new EditTextTochListener(textField));

            TextInputEditText latexField = view.FindViewById <TextInputEditText>(Resource.Id.latexTextField);

            latexField.Text = latex;
            latexField.SetOnTouchListener(new EditTextTochListener(latexField));

            view.FindViewById <ImageButton>(Resource.Id.textCopyContent).Click += delegate
            {
                if (textField.Text != "")
                {
                    ClipboardManager clipboard = (ClipboardManager)view.Context.GetSystemService(Context.ClipboardService);
                    ClipData         clip      = ClipData.NewPlainText("text", textField.Text);
                    clipboard.PrimaryClip = clip;
                    Toast.MakeText(view.Context, "Текст скопирован в буфер обмена", ToastLength.Short).Show();
                }
            };
            view.FindViewById <ImageButton>(Resource.Id.textSendContent).Click += delegate
            {
                if (textField.Text != "")
                {
                    Intent shareIntent = new Intent();
                    shareIntent.SetAction(Intent.ActionSend);
                    shareIntent.PutExtra(Intent.ExtraSubject, "Devenir parsing result");
                    shareIntent.PutExtra(Intent.ExtraText, textField.Text);
                    shareIntent.SetType("text/plain");
                    StartActivity(shareIntent);
                }
            };

            view.FindViewById <ImageButton>(Resource.Id.latexCopyContent).Click += delegate
            {
                if (latexField.Text != "")
                {
                    ClipboardManager clipboard = (ClipboardManager)view.Context.GetSystemService(Context.ClipboardService);
                    ClipData         clip      = ClipData.NewPlainText("LaTeX", latexField.Text);
                    clipboard.PrimaryClip = clip;
                    Toast.MakeText(view.Context, "Текст скопирован в буфер обмена", ToastLength.Short).Show();
                }
            };
            view.FindViewById <ImageButton>(Resource.Id.latexSendContent).Click += delegate
            {
                if (latexField.Text != "")
                {
                    Intent shareIntent = new Intent();
                    shareIntent.SetAction(Intent.ActionSend);
                    shareIntent.PutExtra(Intent.ExtraSubject, "Devenir parsing result");
                    shareIntent.PutExtra(Intent.ExtraText, latexField.Text);
                    shareIntent.SetType("text/plain");
                    StartActivity(shareIntent);
                }
            };



            return(view);
        }