コード例 #1
0
        void tapAction()
        {
            var length = tHeight;

            if (expanded == true)
            {
                img.RotateTo(360, 250, Easing.Linear);
                dataView.Animate("expand", (arg) => {
                    dataView.TranslateTo(0, 0, 250);
                    dataView.HeightRequest = length;
                }, 0, 250, Easing.Linear, (arg1, arg2) => {
                    expanded           = !expanded;
                    dataView.IsVisible = true;
                    dataView.IsEnabled = true;
                });
            }
            else if (expanded == false)
            {
                img.RotateTo(180, 250, Easing.Linear);
                dataView.Animate("collapse", (arg) => {
                    dataView.TranslateTo(0, -length, 250);
                    dataView.HeightRequest = 0;
                }, 0, 250, Easing.Linear, (arg1, arg2) => {
                    expanded           = !expanded;
                    dataView.IsVisible = false;
                    dataView.IsEnabled = false;
                });
            }
        }
コード例 #2
0
ファイル: SearchPanel.cs プロジェクト: Sanshain/x-sms
        protected void SearchButton_Clicked(Layout rootLayout)
        {
            ContentPage page = rootLayout.Parent as ContentPage;

            if (SearchLayout != null)
            {
                if (SearchLayout.IsVisible && SearchLayout.Opacity > 0)
                {
                    return;                                                                             // Also impoertant as State attribute
                }
                if (SearchButton.State == (SearchPanelState.Hidden | SearchPanelState.InSearch))        // Clean
                {
                    (rootLayout.Parent as ContentPage).Title = this.DefaultTitle;
                    searchEntry.Text = "";

                    var animate_in = new Animation(v => listView.Scale = v, 1, 0.9);                   // анимация scale для listView
                    listView.Animate("list_in", animate_in, finished: (v, b) =>
                    {
                        var animate_out = new Animation(_v => listView.Scale = _v, 0.9, 1);
                        listView.Animate("list_out", animate_out, finished: (_v, _b) => { });
                    });
                }
                else if (SearchButton.State == SearchPanelState.Hidden)                                 // Show cleaned
                {
                    this.PreventAnimation();

                    if (SearchLayout.IsVisible = !SearchLayout.IsVisible)  //  true
                    {
                        var searchFrame = SearchLayout.Children.FirstOrDefault() as Frame;

                        if (animeted)
                        {
                            void FinishAction() => searchEntry?.Focus();       // Action FinishAction = () => searchFrame?.Content?.Focus();

                            SmoothAppearance(page.Width, FinishAction);
                        }
                        else
                        {
                            searchFrame?.Content?.Focus();
                        }

                        // (rootLayout.Parent as ContentPage).Title = "Диалоги";
                        // searchEntry.Text = "";
                    }
                }

                SearchButton.StateUpdate();
            }
            else
            {
                SearchButton.SearchLayout = SearchLayout = SearchLayoutCreation(rootLayout, page.Width);

                SearchButton.StateUpdate();
            }
        }
コード例 #3
0
 public static void androidMessagePrinter(string exp)           // this function prints the messages.
 {
     theMessageOutputFeild.Text = exp;
     if (theMessageOutputFeild.Alpha == 0 && OutputListView.Alpha == 1)
     {
         theMessageOutputFeild.Animate().AlphaBy(1.0f).SetDuration(500).Start();
         OutputListView.Animate().AlphaBy(-1.0f).SetDuration(500).Start();
     }
 }
コード例 #4
0
        private async void OnRecord(object sender, PropertyEventArgs <bool> args)
        {
            // Deteniendo grabación (Grabación terminada).
            if (args.Property)
            {
                // Actualizando UI.
                BottomToolbar.FindViewById(Resource.Id.menuRecord).Visibility = ViewStates.Visible;
                BottomToolbar.FindViewById(Resource.Id.menuStop).Visibility   = ViewStates.Gone;

                // Preparando Reproductor
                DibbiAudio.PreparePlay();

                // Preparando y mostrando dialogo de reproducción.
                DibbiPlayer.State = PlayerState.Preview;
                DibbiPlayer.Show(FragmentManager, "player_dialog");

                // Ocultado detalles de la ultima grabación.
                NotesList.Visibility = ViewStates.Visible;
                FindViewById <LinearLayout>(Resource.Id.RecordDescription).Visibility = ViewStates.Gone;
                FindViewById <TextView>(Resource.Id.RecordDuration).Text = "0:00";

                NotesList.Alpha = 1.0f;
            }
            // Iniciando grabación.
            else
            {
                // Actualizando UI.
                BottomToolbar.FindViewById(Resource.Id.menuRecord).Visibility = ViewStates.Gone;
                BottomToolbar.FindViewById(Resource.Id.menuStop).Visibility   = ViewStates.Visible;

                NotesList.Animate().Alpha(0.0f).SetDuration(400);
                await Task.Delay(400);

                // Mostrar detalles de la grabación.
                NotesList.Visibility = ViewStates.Gone;
                FindViewById <LinearLayout>(Resource.Id.RecordDescription).Visibility = ViewStates.Visible;
            }
        }
コード例 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            ActionBar.Hide();
            this.Window.ClearFlags(WindowManagerFlags.Fullscreen);             //to hide
            SetContentView(Resource.Layout.Main);
            androidSetup();


            enterSolve.Click += (object sender, EventArgs e) =>
            {
                androidMatAppProcess();
            };

            enterClear.Click += (object sender, EventArgs e) =>
            {
                sol.resetExpressionList();
                sol = new StringObserver();
                AndroidInterface.resetTheDisplayList();
                sol.theVariableList     = new List <string>();
                theStringInput.Text     = "";
                theVariableAdapter      = new VariableListAdapter(this, sol.theVariableList);
                theVariableList.Adapter = theVariableAdapter;
                if (prefix)
                {
                    theVariableAdapter      = new VariableListAdapter(this, thePrefixList);
                    theVariableList.Adapter = theVariableAdapter;
                }
                if (constants)
                {
                    theVariableAdapter      = new VariableListAdapter(this, theConstantList);
                    theVariableList.Adapter = theVariableAdapter;
                }
                if (functions)
                {
                    theVariableAdapter      = new VariableListAdapter(this, theSimpleFunctionList);
                    theVariableList.Adapter = theVariableAdapter;
                }
                if (matfunctions)
                {
                    theVariableAdapter      = new VariableListAdapter(this, theMatrixFunctions);
                    theVariableList.Adapter = theVariableAdapter;
                }
            };

            plus.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "+");
                theStringInput.SetSelection(pos + 1);
            };

            minus.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "-");
                theStringInput.SetSelection(pos + 1);
            };

            multiply.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "*");
                theStringInput.SetSelection(pos + 1);
            };

            divide.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "/");
                theStringInput.SetSelection(pos + 1);
            };

            power.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "^(");
                theStringInput.SetSelection(pos + 2);
            };
            semiColon.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, ";");
                theStringInput.SetSelection(pos + 1);
            };

            smallBraketEnd.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, ")");
                theStringInput.SetSelection(pos + 1);
            };

            factorial.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "!");
                theStringInput.SetSelection(pos + 1);
            };

            smallBraketStart.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "(");
                theStringInput.SetSelection(pos + 1);
            };

            squareBraketEnd.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "]");
                theStringInput.SetSelection(pos + 1);
            };

            squareBraketStart.Click += (object sender, EventArgs e) =>
            {
                int pos = theStringInput.SelectionStart;
                theStringInput.Text = theStringInput.Text.Insert(theStringInput.SelectionStart, "[");
                theStringInput.SetSelection(pos + 1);
            };

            cleanInput.Click += (object sender, EventArgs e) =>
            {
                theStringInput.Text = "";
            };

            theVariableList.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
            {
                string toBeAdded = string.Empty;
                if (variable)
                {
                    toBeAdded = (sol.theVariableList[e.Position]);
                }
                else if (prefix)
                {
                    toBeAdded = (thePrefixList[e.Position]);
                }
                else if (constants)
                {
                    toBeAdded = (theConstantList[e.Position]);
                    toBeAdded = MatApp.theConstantList.constantInputManager(toBeAdded);
                }
                else if (functions)
                {
                    toBeAdded = theSimpleFunctionList[e.Position];
                    toBeAdded = (cUnderstander.binCommandInputManager(toBeAdded));
                }
                else if (matfunctions)
                {
                    toBeAdded = theMatrixFunctions[e.Position];
                    toBeAdded = cUnderstander.matrixFunctionInputManager(toBeAdded);
                }
                int pos = theStringInput.SelectionStart;

                string theIn = theStringInput.Text;
                if (!string.IsNullOrWhiteSpace(theIn) && theIn.Length != theStringInput.SelectionStart)
                {
                    theIn = theIn.Remove(theStringInput.SelectionStart);
                }
                MatappAI.InputIntelligence intel = new MatappAI.InputIntelligence(theIn, toBeAdded);
                intel.constants    = MatApp.theConstantList.getConstantListForIntelligence();
                intel.variables    = sol.theVariableList;
                intel.prefix       = thePrefixList;
                intel.function     = theSimpleFunctionList;
                intel.matfunctions = theMatrixFunctionListForIntelligence;
                intel.Process();
                string r = intel.getResult();
                theStringInput.Text = theStringInput.Text.Insert(pos, r);
                theStringInput.SetSelection(pos + r.Length);
            };


            ShowVariable.Click += (object sender, EventArgs e) =>
            {
                variable     = true; constants = false; prefix = false; functions = false;
                matfunctions = false;                  //
                if (theStringInput.Text == "")
                {
                    theStringInput.Hint = "ƒ(x)";
                }
                androidSideBarButtonAction();
                theVariableAdapter      = new VariableListAdapter(this, sol.theVariableList);
                theVariableList.Adapter = theVariableAdapter;
            };

            ShowPrefix.Click += (object sender, EventArgs e) =>
            {
                variable     = false; constants = false; prefix = true; functions = false;
                matfunctions = false;
                if (theStringInput.Text == "")
                {
                    theStringInput.Hint = "ƒ(x)";
                }
                androidSideBarButtonAction();
                theVariableAdapter      = new VariableListAdapter(this, thePrefixList);
                theVariableList.Adapter = theVariableAdapter;
            };

            ShowConstants.Click += (object sender, EventArgs e) =>
            {
                variable     = false; constants = true; prefix = false; functions = false;
                matfunctions = false;
                if (theStringInput.Text == "")
                {
                    theStringInput.Hint = "ƒ(x)";
                }
                androidSideBarButtonAction();
                theVariableAdapter      = new VariableListAdapter(this, theConstantList);
                theVariableList.Adapter = theVariableAdapter;
            };

            ShowFunctions.Click += (object sender, EventArgs e) =>
            {
                variable     = false; constants = false; prefix = false; functions = true;
                matfunctions = false;
                if (theStringInput.Text == "")
                {
                    theStringInput.Hint = "ƒ(x)";
                }
                androidSideBarButtonAction();
                theVariableAdapter      = new VariableListAdapter(this, theSimpleFunctionList);
                theVariableList.Adapter = theVariableAdapter;
            };

            ShowMatrixFunctions.Click += (object sender, EventArgs e) =>
            {
                variable     = false; constants = false; prefix = false; functions = false;
                matfunctions = true;
                if (theStringInput.Text == "")
                {
                    theStringInput.Hint = "[ 3 3 ; 3 3] a 2x2 matrix";
                }
                androidSideBarButtonAction();
                theVariableAdapter      = new VariableListAdapter(this, theMatrixFunctions);
                theVariableList.Adapter = theVariableAdapter;
            };


            theStringInput.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) =>
            {
                if (theSolutionOutput.Alpha == 0 && theReportMessageView.Alpha == 1)
                {
                    theSolutionOutput.Animate().AlphaBy(1.0f).SetDuration(500).Start();
                    theReportMessageView.Animate().AlphaBy(-1.0f).SetDuration(500).Start();
                }
            };
        }        // end method on create