示例#1
0
        static LayoutTransition CreateLayoutTransaction()
        {
            var layoutTransition = new LayoutTransition();

            //layoutTransition.SetAnimator(LayoutTransitionType.Appearing, new Animator(
            return(layoutTransition);
        }
示例#2
0
 public void StartTransition(LayoutTransition transition, ViewGroup container, View view, LayoutTransitionType transitionType)
 {
     if (StartTransitionAction != null)
     {
         StartTransitionAction(transition, container, view, transitionType);
     }
 }
示例#3
0
        public void LayoutTransitionCondition()
        {
            tlog.Debug(tag, $"LayoutTransitionCondition START");

            var testingTarget = new LayoutTransition();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");

            Assert.AreEqual(testingTarget.Condition, TransitionCondition.Unspecified, "Should be value set.");

            testingTarget.Condition = TransitionCondition.LayoutChanged;
            Assert.AreEqual(testingTarget.Condition, TransitionCondition.LayoutChanged, "Should be value set.");

            testingTarget.Condition = TransitionCondition.Add;
            Assert.AreEqual(testingTarget.Condition, TransitionCondition.Add, "Should be value set.");

            testingTarget.Condition = TransitionCondition.Remove;
            Assert.AreEqual(testingTarget.Condition, TransitionCondition.Remove, "Should be value set.");

            testingTarget.Condition = TransitionCondition.ChangeOnAdd;
            Assert.AreEqual(testingTarget.Condition, TransitionCondition.ChangeOnAdd, "Should be value set.");

            testingTarget.Condition = TransitionCondition.ChangeOnRemove;
            Assert.AreEqual(testingTarget.Condition, TransitionCondition.ChangeOnRemove, "Should be value set.");

            tlog.Debug(tag, $"LayoutTransitionCondition END (OK)");
        }
        private void setDevicesLayout()
        {
            mDevicesLayout = (LinearLayout)findViewById(R.id.main_panel);

            LayoutTransition transition = new LayoutTransition();

            transition.AnimateParentHierarchy = false;
            transition.enableTransitionType(LayoutTransition.DISAPPEARING);
            {
                // Fade out
                transition.setAnimator(LayoutTransition.DISAPPEARING, ObjectAnimator.ofFloat(null, View.ALPHA, 1, 0));

                transition.setStartDelay(LayoutTransition.DISAPPEARING, 0);
                transition.setDuration(LayoutTransition.DISAPPEARING, HIDE_ANIM_DURATION / 2);

                transition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, HIDE_ANIM_DURATION / 2);
                transition.setDuration(LayoutTransition.CHANGE_DISAPPEARING, HIDE_ANIM_DURATION / 2);
            }

            transition.enableTransitionType(LayoutTransition.APPEARING);
            {
                // Fade in
                transition.setAnimator(LayoutTransition.APPEARING, ObjectAnimator.ofFloat(null, View.ALPHA, 0, 1));

                transition.setStartDelay(LayoutTransition.CHANGE_APPEARING, 0);
                transition.setDuration(LayoutTransition.CHANGE_APPEARING, SHOW_ANIM_DURATION / 2);

                transition.setStartDelay(LayoutTransition.APPEARING, SHOW_ANIM_DURATION / 2);
                transition.setDuration(LayoutTransition.APPEARING, SHOW_ANIM_DURATION / 2);
            }

            mDevicesLayout.LayoutTransition = transition;
        }
示例#5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TextView[] myTextViews = new TextView[100];
            View[]     myAddViews  = new View[100];
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Adding);
            var TextIn     = FindViewById <EditText>(Resource.Id.textin);
            var ButtonAdd  = FindViewById <Button>(Resource.Id.add);
            var container  = FindViewById <LinearLayout>(Resource.Id.container);
            var ButtonNext = FindViewById <Button>(Resource.Id.buttonnext);

            ButtonAdd.Click += delegate
            {
                LayoutInflater inflate = (LayoutInflater)BaseContext.GetSystemService(Context.LayoutInflaterService);
                View           addView = LayoutInflater.Inflate(Resource.Layout.fila, null);
                TextView       textOut = addView.FindViewById <TextView>(Resource.Id.textout);
                textOut.Text   = TextIn.Text;
                myTextViews[n] = textOut;
                myAddViews[n]  = addView;
                Button ButtonRemove = addView.FindViewById <Button>(Resource.Id.remove);
                n++;
                ButtonRemove.Click += delegate
                {
                    ((LinearLayout)addView.Parent).RemoveView(addView);
                    for (int i = 0; i < n; i++)
                    {
                        if (addView == myAddViews[i])
                        {
                            for (int j = i; j < n; j++)
                            {
                                myAddViews[j]  = myAddViews[j + 1];
                                myTextViews[j] = myTextViews[j + 1];
                            }
                        }
                    }
                    n--;
                };

                container.AddView(addView);
                TextIn.Text = string.Empty;
            };

            LayoutTransition trans = new LayoutTransition();

            container.LayoutTransition = trans;

            ButtonNext.Click += delegate
            {
                if (n >= 2)
                {
                    Intent nextActivity = new Intent(this, typeof(Showing)); //CHANGE
                    nextActivity.PutExtra("counter", n.ToString());
                    for (int i = 0; i < n; i++)
                    {
                        nextActivity.PutExtra($"element{i}", myTextViews[i].Text);
                    }
                    StartActivity(nextActivity);
                }
            };
        }
示例#6
0
        public void LayoutTransitionsHelperAddTransitionForCondition()
        {
            tlog.Debug(tag, $"LayoutTransitionsHelperAddTransitionForCondition START");

            Dictionary <TransitionCondition, TransitionList> targetTransitionList = new Dictionary <TransitionCondition, TransitionList>();

            TransitionList transitionList = new TransitionList();

            var addTransition = new LayoutTransition(TransitionCondition.Add,
                                                     AnimatableProperties.Position,
                                                     0.3f,
                                                     new TransitionComponents()
                                                     );

            transitionList.Add(addTransition);

            var layoutChangedTransition = new LayoutTransition(TransitionCondition.LayoutChanged,
                                                               AnimatableProperties.Opacity,
                                                               0.2f,
                                                               new TransitionComponents()
                                                               );

            transitionList.Add(layoutChangedTransition);


            targetTransitionList.Add(TransitionCondition.Add, transitionList);
            targetTransitionList.Add(TransitionCondition.LayoutChanged, transitionList);

            /**
             * conditionNotInDictionary = false
             */
            LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
                                                              TransitionCondition.LayoutChanged,
                                                              addTransition,
                                                              true);

            /**
             * conditionNotInDictionary = true
             * replaced
             */
            LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
                                                              TransitionCondition.Add,
                                                              addTransition,
                                                              false);

            /**
             * conditionNotInDictionary = true
             * new entry
             */
            LayoutTransitionsHelper.AddTransitionForCondition(targetTransitionList,
                                                              TransitionCondition.ChangeOnAdd,
                                                              addTransition,
                                                              false);

            tlog.Debug(tag, $"LayoutTransitionsHelperAddTransitionForCondition END (OK)");
        }
示例#7
0
 internal void AttachTransitionsToChildren(LayoutTransition transition)
 {
     // Iterate children, adding the transition unless a transition
     // for the same condition and property has already been
     // explicitly added.
     foreach (View view in Children)
     {
         LayoutTransitionsHelper.AddTransitionForCondition(view.LayoutTransitions, transition.Condition, transition, false);
     }
 }
示例#8
0
        public void LayoutTransitionConstructor()
        {
            tlog.Debug(tag, $"LayoutTransitionConstructor START");

            var testingTarget = new LayoutTransition();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");

            tlog.Debug(tag, $"LayoutTransitionConstructor END (OK)");
        }
示例#9
0
        public void LayoutTransitionTargetValue()
        {
            tlog.Debug(tag, $"LayoutTransitionTargetValue START");

            var testingTarget = new LayoutTransition();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");

            testingTarget.TargetValue = 1.0f;
            Assert.AreEqual(testingTarget.TargetValue, 1.0f, "Should be value set.");

            tlog.Debug(tag, $"LayoutTransitionTargetValue END (OK)");
        }
            public void Run()
            {
                try
                {
                    int textLengthNew = Option.TextLength;

                    if (Option.TextLengthType == TypeLine)
                    {
                        if (TextView.Layout.LineCount <= Option.TextLength)
                        {
                            TextView.SetText(Text, TextView.BufferType.Spannable);
                            return;
                        }

                        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams)TextView.LayoutParameters;

                        string subString = Text.ToString().Substring(TextView.Layout.GetLineStart(0), TextView.Layout.GetLineEnd(Option.TextLength - 1));
                        textLengthNew = subString.Length - (Option.MoreLabel.Length + 4 + lp.RightMargin / 6);
                    }

                    SpannableStringBuilder spendableStringBuilder = new SpannableStringBuilder(Text.SubSequence(0, textLengthNew));
                    spendableStringBuilder.Append(" ...");
                    spendableStringBuilder.Append(Option.MoreLabel);

                    SpannableString ss             = SpannableString.ValueOf(spendableStringBuilder);
                    ClickableSpan   rclickableSpan = new StRclickableSpan(Option, TextView, Text, StTools.StTypeText.ReadMore);

                    ss.SetSpan(rclickableSpan, ss.Length() - Option.MoreLabel.Length, ss.Length(), SpanTypes.ExclusiveExclusive);

                    switch (Build.VERSION.SdkInt)
                    {
                    case >= BuildVersionCodes.JellyBean when Option.ExpandAnimation:
                    {
                        LayoutTransition layoutTransition = new LayoutTransition();
                        layoutTransition.EnableTransitionType(LayoutTransitionType.Changing);
                        ((ViewGroup)TextView?.Parent).LayoutTransition = layoutTransition;
                        break;
                    }
                    }
                    //TextView.SetTextFuture(PrecomputedTextCompat.GetTextFuture(ss, TextViewCompat.GetTextMetricsParams(TextView), null));
                    TextView.SetText(ss, TextView.BufferType.Spannable);
                    TextView.MovementMethod = LinkMovementMethod.Instance;
                }
                catch (Exception e)
                {
                    Methods.DisplayReportResultTrack(e);
                }
            }
示例#11
0
        public void LayoutTransitionAnimator()
        {
            tlog.Debug(tag, $"LayoutTransitionAnimator START");

            AlphaFunction        alphaFunction        = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
            TransitionComponents transitionComponents = new TransitionComponents(0, 64, alphaFunction);

            var testingTarget = new LayoutTransition();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");

            testingTarget.Animator = transitionComponents;
            Assert.AreEqual(testingTarget.Animator.GetDuration(), transitionComponents.GetDuration(), "Should be value set.");
            Assert.AreEqual(testingTarget.Animator.GetDelay(), transitionComponents.GetDelay(), "Should be value set.");

            tlog.Debug(tag, $"LayoutTransitionAnimator END (OK)");
        }
示例#12
0
        public void LayoutTransitionContructorWithParameters()
        {
            tlog.Debug(tag, $"LayoutTransitionContructorWithParameters START");

            TransitionComponents transitionComponents = new TransitionComponents();

            var testingTarget = new LayoutTransition(TransitionCondition.Unspecified,
                                                     AnimatableProperties.Position,
                                                     0.0f,
                                                     transitionComponents
                                                     );

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");

            transitionComponents.Dispose();
            tlog.Debug(tag, $"LayoutTransitionContructorWithParameters END (OK)");
        }
示例#13
0
        public void SetCardStreamAnimator(CardStreamAnimator animators)
        {
            if (animators == null)
            {
                mAnimators = new CardStreamAnimator.EmptyAnimator();
            }
            else
            {
                mAnimators = animators;
            }

            LayoutTransition layoutTransition = LayoutTransition;

            if (layoutTransition != null)
            {
                layoutTransition.SetAnimator(LayoutTransitionType.Appearing, mAnimators.GetAppearingAnimator(Context));
                layoutTransition.SetAnimator(LayoutTransitionType.Disappearing, mAnimators.GetDisappearingAnimator(Context));
            }
        }
示例#14
0
        public EditImageDialog(Activity context, CellControllerImage controller)
        {
            this.context    = context;
            this.controller = controller;

            mainView = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical
            };
            LayoutTransition lt = new LayoutTransition();

            lt.EnableTransitionType(LayoutTransitionType.Appearing);
            lt.EnableTransitionType(LayoutTransitionType.Changing);
            mainView.LayoutTransition = lt;

            imageView = new ImageView(context);
            mainView.AddView(imageView);

            controller.HookView(this);
        }
示例#15
0
        public void LayoutTransitionAnimatableProperty()
        {
            tlog.Debug(tag, $"LayoutTransitionAnimatableProperty START");

            var testingTarget = new LayoutTransition();

            Assert.IsNotNull(testingTarget, "null handle");
            Assert.IsInstanceOf <LayoutTransition>(testingTarget, "Should return LayoutTransition instance.");

            testingTarget.AnimatableProperty = AnimatableProperties.Position;
            Assert.AreEqual(testingTarget.AnimatableProperty, AnimatableProperties.Position, "Should be value set.");

            testingTarget.AnimatableProperty = AnimatableProperties.Size;
            Assert.AreEqual(testingTarget.AnimatableProperty, AnimatableProperties.Size, "Should be value set.");

            testingTarget.AnimatableProperty = AnimatableProperties.Opacity;
            Assert.AreEqual(testingTarget.AnimatableProperty, AnimatableProperties.Opacity, "Should be value set.");

            tlog.Debug(tag, $"LayoutTransitionAnimatableProperty END (OK)");
        }
示例#16
0
        public virtual void refresh()
        {
            updateThread = () =>
            {
                LayoutTransition trans = null;
                if (mParent != null)
                {
                    trans = mParent.mDevicesLayout.LayoutTransition;
                    mParent.mDevicesLayout.LayoutTransition = null;

                    if (mParent.getInfo().isDevExpanded(mData.mSapaApp.InstanceId))
                    {
                        if (mIsExpanded)
                        {
                            hide();
                        }
                        show(ShowMode.DISABLED_TRANSITION);
                        mIsExpanded = true;
                    }
                    else
                    {
                        if (mIsExpanded)
                        {
                            hide();
                        }
                        mIsExpanded = false;
                    }
                    if (trans != null)
                    {
                        mParent.mDevicesLayout.LayoutTransition = trans;
                    }
                }
            };

            if (Shown)
            {
                post(updateThread);
                updateThread = null;
            }
        }
示例#17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            _layout = FindViewById <ViewGroup>(Resource.Id.myview);

            _viewTop    = FindViewById(Resource.Id.header);
            _viewBottom = FindViewById(Resource.Id.footer);

            var tx = new LayoutTransition();

            _layout.LayoutTransition = tx; // This is the magic.  So easy.

            _tag = new Tag("tag");
            _tv  = new TextView(this)
            {
                Text = "Now I'm here",
                Tag  = _tag,
            };
        }
示例#18
0
        protected override void OnLayout(bool changed, int l, int t, int r, int b)
        {
            base.OnLayout(changed, l, t, r, b);
            Log.Debug(TAG, "OnLayout: " + changed);

            if (changed && !mLayouted)
            {
                mLayouted = true;

                ObjectAnimator   animator;
                LayoutTransition layoutTransition = new LayoutTransition();

                animator = mAnimators.GetDisappearingAnimator(Context);
                layoutTransition.SetAnimator(LayoutTransitionType.Disappearing, animator);

                animator = mAnimators.GetAppearingAnimator(Context);
                layoutTransition.SetAnimator(LayoutTransitionType.Appearing, animator);

                layoutTransition.AddTransitionListener(mTransitionListener);

                if (animator != null)
                {
                    layoutTransition.SetDuration(animator.Duration);
                }

                LayoutTransition = layoutTransition;

                if (mShowInitialAnimation)
                {
                    RunInitialAnimations();
                }

                if (mFirstVisibleCardTag != null)
                {
                    ScrollToCard(mFirstVisibleCardTag);
                    mFirstVisibleCardTag = null;
                }
            }
        }
示例#19
0
        public void LayoutTransitionsHelperGetTransitionsListForCondition()
        {
            tlog.Debug(tag, $"LayoutTransitionsHelperGetTransitionsListForCondition START");

            TransitionList transitionList = new TransitionList();

            LayoutTransition addTransition = new LayoutTransition(TransitionCondition.Add,
                                                                  AnimatableProperties.Position,
                                                                  0.3f,
                                                                  new TransitionComponents()
                                                                  );

            LayoutTransition removeTransition = new LayoutTransition(TransitionCondition.Remove,
                                                                     AnimatableProperties.Position,
                                                                     0.0f,
                                                                     new TransitionComponents()
                                                                     );

            Dictionary <TransitionCondition, TransitionList> targetTransitionList = new Dictionary <TransitionCondition, TransitionList>();

            targetTransitionList.Add(TransitionCondition.Unspecified, transitionList);
            targetTransitionList.Add(TransitionCondition.LayoutChanged, transitionList);

            TransitionList transitionsForCondition = new TransitionList();

            var result = LayoutTransitionsHelper.GetTransitionsListForCondition(targetTransitionList,
                                                                                TransitionCondition.LayoutChanged,
                                                                                transitionsForCondition);

            Assert.AreEqual(true, result, "should be equal!");

            result = LayoutTransitionsHelper.GetTransitionsListForCondition(targetTransitionList,
                                                                            TransitionCondition.Add,
                                                                            transitionsForCondition);
            Assert.AreEqual(false, result, "should be equal!");

            tlog.Debug(tag, $"LayoutTransitionsHelperGetTransitionsListForCondition END (OK)");
        }
示例#20
0
        /// <summary>
        /// This method prepares view of actions (without application icon).
        /// </summary>
        internal virtual void prepareActions(int orientation, bool addView)
        {
            if (!Expanded)
            {
                createActionList();
                return;
            }
            LayoutTransition trans = null;

            if (mParent != null)
            {
                trans = mParent.mDevicesLayout.LayoutTransition;
                mParent.mDevicesLayout.LayoutTransition = null;
            }
            List <View> toBeRemoved = new List <View>();

            for (int i = 0, size = mActionButtonsLayout.ChildCount; i < size; ++i)
            {
                View           v    = mActionButtonsLayout.getChildAt(i);
                SapaActionInfo info = (SapaActionInfo)v.Tag;
                if (!mData.mActionMap.ContainsKey(info.Id))
                {
                    toBeRemoved.Add(v);
                }
            }
            if (toBeRemoved.Count > 0)
            {
                int sizeToRemove = toBeRemoved.Count;
                for (int i = 0; i < sizeToRemove; ++i)
                {
                    removeActionView(toBeRemoved[i]);
                }
            }
            HashSet <string> ids = new HashSet <string>();

            for (int i = 0, size = mActionButtonsLayout.ChildCount; i < size; ++i)
            {
                View           v    = mActionButtonsLayout.getChildAt(i);
                SapaActionInfo info = (SapaActionInfo)v.Tag;
                ids.Add(info.Id);
                if (!info.Equals(mData.mActionMap[info.Id]))
                {
                    replaceActionOnView(v, mData.mActionMap[info.Id]);
                }
            }
            IList <View> viewsToAdd = new List <View>();
            int          i          = -1;

            foreach (string actionId in mData.mActionMap.Keys)
            {
                ++i;
                if (ids.Contains(actionId))
                {
                    continue;
                }
                if (i == 1)
                {
                    viewsToAdd.Add(createActionView(mData.mActionMap[actionId], R.layout.action_button));
                }
                else
                {
                    viewsToAdd.Add(createActionView(mData.mActionMap[actionId], R.layout.action_button));
                }
            }
            if (viewsToAdd.Count > 0)
            {
                View viewToUpdate = mActionButtons[mActionButtons.Count - 1];
                foreach (View v in viewsToAdd)
                {
                    mActionButtons.Add(v);
                }
                replaceActionOnView(viewToUpdate, (SapaActionInfo)viewToUpdate.Tag);
                replaceActionOnView(viewsToAdd[0], (SapaActionInfo)viewsToAdd[0].Tag);
                if (viewsToAdd.Count > 1)
                {
                    replaceActionOnView(viewsToAdd[viewsToAdd.Count - 1], (SapaActionInfo)viewsToAdd[viewsToAdd.Count - 1].Tag);
                }

                int size = mActionButtons.Count;
                mParent.addSubViews(mActionButtons.subList(0, 1), this);
                mParent.addSubViews(mActionButtons.subList(1, size), mActionButtons[0]);
            }
            checkInvisibles();
            if (mParent != null && trans != null)
            {
                mParent.mDevicesLayout.LayoutTransition = trans;
            }
            if (mParent != null)
            {
                this.forceOrientationSet(mParent.Orientation);
            }
        }
示例#21
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Showing);

            string cant = Intent.GetStringExtra("counter" ?? "error");

            int.TryParse(cant, out numcant);
            string[] myTextViews = new string[numcant];
            for (int i = 0; i < numcant; i++)
            {
                myTextViews[i] = Intent.GetStringExtra($"element{i}" ?? "error");
            }

            var EnumText     = FindViewById <TextView>(Resource.Id.enumtext);
            var EnumElements = FindViewById <TextView>(Resource.Id.TextElement);
            var Elements     = FindViewById <TextView>(Resource.Id.Elements);
            var CantText     = FindViewById <TextView>(Resource.Id.TextCant);
            var ButtonBack   = FindViewById <Button>(Resource.Id.GoBack);
            var container    = FindViewById <LinearLayout>(Resource.Id.madre);
            var EnumMatriz   = FindViewById <TextView>(Resource.Id.matrizenum);
            var Matriz       = FindViewById <TextView>(Resource.Id.matriz);

            CantText.Text = myTextViews[Nelem];
            for (int i = 0; i < numcant; i++)
            {
                Elements.Text = Elements.Text + "\n" + myTextViews[i];
            }

            //EVENTO DE LA WEA
            ma  = new MatrizQ(numcant);
            mat = ma.returnMa();
            CheckBox[] myRButtons   = new CheckBox[1000];
            TextView[] myTextViews2 = new TextView[1000];
            View[]     myAddViews   = new View[100];

            void Evento(int Nelem)
            {
                for (int i = 0; i < numcant; i++)
                {
                    for (int j = 0; j < numcant; j++)
                    {
                        Matriz.Text = Matriz.Text + " " + mat[i][j].ToString();
                    }
                    Matriz.Text = Matriz.Text + "\n";
                }

                CantText.Text = myTextViews[Nelem];
                for (int j = Nelem + 1; j < numcant; j++)
                {
                    LayoutInflater inflate  = (LayoutInflater)BaseContext.GetSystemService(Context.LayoutInflaterService);
                    View           addView2 = LayoutInflater.Inflate(Resource.Layout.buttons, null);
                    TextView       nombreE  = addView2.FindViewById <TextView>(Resource.Id.nombre2);
                    nombreE.Text = myTextViews[j];
                    CheckBox compE = addView2.FindViewById <CheckBox>(Resource.Id.comp);
                    myRButtons[j]   = compE;
                    myTextViews2[j] = nombreE;
                    myAddViews[j]   = addView2;
                    container.AddView(addView2);
                    compE.CheckedChange += delegate
                    {
                    };
                }
            }

            Evento(Nelem);
            ButtonBack.Click += delegate
            {
                if (Nelem < numcant - 1)
                {
                    for (int j = Nelem + 1; j < numcant; j++)
                    {
                        if (true == myRButtons[j].Checked)
                        {
                            ma.setP(Nelem, j, 1);
                        }
                        else
                        {
                            ma.setP(Nelem, j, 0);
                        }
                    }
                    Matriz.Text = String.Empty;
                    cont++;
                    ButtonBack.Text = cont.ToString();

                    CantText.Text = String.Empty;

                    for (int j = Nelem + 1; j < numcant; j++)
                    {
                        myTextViews2[j].Visibility = ViewStates.Gone;
                        myRButtons[j].Visibility   = ViewStates.Gone;
                        myAddViews[j].Visibility   = ViewStates.Gone;
                    }
                    CantText.Text = String.Empty;
                    Nelem++;
                    Evento(Nelem);
                }
                else
                {
                    EnumText.Visibility     = ViewStates.Gone;
                    EnumElements.Visibility = ViewStates.Gone;
                    Elements.Visibility     = ViewStates.Gone;
                    CantText.Visibility     = ViewStates.Gone;
                    ButtonBack.Visibility   = ViewStates.Gone;
                    container.Visibility    = ViewStates.Gone;
                    Matriz.Text             = String.Empty;

                    for (int i = 0; i < numcant; i++)
                    {
                        for (int j = 0; j < numcant; j++)
                        {
                            Matriz.Text = Matriz.Text + " " + mat[i][j].ToString();
                        }
                        Matriz.Text = Matriz.Text + "\n";
                    }
                }
            };
            LayoutTransition trans = new LayoutTransition();

            container.LayoutTransition = trans;
        }
示例#22
0
        public override void Show()
        {
            using (var dialogView = (LinearLayout)LayoutInflater.From(Context).Inflate(Resource.Layout.lyt_claim_rewards, null))
            {
                dialogView.SetMinimumWidth((int)(Style.ScreenWidth * 0.8));

                _title          = dialogView.FindViewById <TextView>(Resource.Id.title);
                _title.Typeface = Style.Light;
                _title.Text     = AppSettings.LocalizationManager.GetText(LocalizationKeys.TimeToClaimRewards);

                var tokenOne = dialogView.FindViewById <TextView>(Resource.Id.token_one);
                tokenOne.Typeface = Style.Semibold;

                var tokenTwo = dialogView.FindViewById <TextView>(Resource.Id.token_two);
                tokenTwo.Typeface = Style.Semibold;

                var tokenThree = dialogView.FindViewById <TextView>(Resource.Id.token_three);
                tokenThree.Typeface = Style.Semibold;

                var tokenOneValue = dialogView.FindViewById <TextView>(Resource.Id.token_one_value);
                tokenOneValue.Typeface = Style.Semibold;
                tokenOneValue.Text     = _balance.RewardSteem.ToBalanceValueString();

                var tokenTwoValue = dialogView.FindViewById <TextView>(Resource.Id.token_two_value);
                tokenTwoValue.Typeface = Style.Semibold;
                tokenTwoValue.Text     = _balance.RewardSp.ToBalanceValueString();

                var tokenThreeValue = dialogView.FindViewById <TextView>(Resource.Id.token_three_value);
                tokenThreeValue.Typeface = Style.Semibold;
                tokenThreeValue.Text     = _balance.RewardSbd.ToBalanceValueString();

                switch (_balance.UserInfo.Chain)
                {
                case KnownChains.Steem:
                    tokenOne.Text   = CurrencyType.Steem.ToString().ToUpper();
                    tokenTwo.Text   = $"{CurrencyType.Steem.ToString()} Power".ToUpper();
                    tokenThree.Text = CurrencyType.Sbd.ToString().ToUpper();
                    break;

                case KnownChains.Golos:
                    tokenOne.Text   = CurrencyType.Golos.ToString().ToUpper();
                    tokenTwo.Text   = $"{CurrencyType.Golos.ToString()} Power".ToUpper();
                    tokenThree.Text = CurrencyType.Gbg.ToString().ToUpper();
                    break;
                }

                _claimBtnContainer = dialogView.FindViewById <RelativeLayout>(Resource.Id.claimBtnContainer);

                _claimBtn        = dialogView.FindViewById <Button>(Resource.Id.claimBtn);
                _claimBtn.Text   = AppSettings.LocalizationManager.GetText(LocalizationKeys.ClaimRewards);
                _claimBtn.Click += ClaimBtnOnClick;

                var closeBtn = dialogView.FindViewById <Button>(Resource.Id.close);
                closeBtn.Text   = AppSettings.LocalizationManager.GetText(LocalizationKeys.Close);
                closeBtn.Click += CloseBtnOnClick;

                _claimSpinner = dialogView.FindViewById <ProgressBar>(Resource.Id.claim_spinner);

                LayoutTransition transition = new LayoutTransition();
                transition.SetAnimateParentHierarchy(false);
                dialogView.LayoutTransition = transition;

                SetContentView(dialogView);
                Window.FindViewById(Resource.Id.design_bottom_sheet).SetBackgroundColor(Color.Transparent);
                var dialogPadding = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 10, Context.Resources.DisplayMetrics);
                Window.DecorView.SetPadding(dialogPadding, dialogPadding, dialogPadding, dialogPadding);
                base.Show();

                var bottomSheet = FindViewById <FrameLayout>(Resource.Id.design_bottom_sheet);
                BottomSheetBehavior.From(bottomSheet).State = BottomSheetBehavior.StateExpanded;
            }
        }
示例#23
0
		private void setDevicesLayout()
		{
			mDevicesLayout = (LinearLayout) findViewById(R.id.main_panel);

			LayoutTransition transition = new LayoutTransition();
			transition.AnimateParentHierarchy = false;
			transition.enableTransitionType(LayoutTransition.DISAPPEARING);
			{
				// Fade out
				transition.setAnimator(LayoutTransition.DISAPPEARING, ObjectAnimator.ofFloat(null, View.ALPHA, 1, 0));

				transition.setStartDelay(LayoutTransition.DISAPPEARING, 0);
				transition.setDuration(LayoutTransition.DISAPPEARING, HIDE_ANIM_DURATION / 2);

				transition.setStartDelay(LayoutTransition.CHANGE_DISAPPEARING, HIDE_ANIM_DURATION / 2);
				transition.setDuration(LayoutTransition.CHANGE_DISAPPEARING, HIDE_ANIM_DURATION / 2);
			}

			transition.enableTransitionType(LayoutTransition.APPEARING);
			{
				// Fade in
				transition.setAnimator(LayoutTransition.APPEARING, ObjectAnimator.ofFloat(null, View.ALPHA, 0, 1));

				transition.setStartDelay(LayoutTransition.CHANGE_APPEARING, 0);
				transition.setDuration(LayoutTransition.CHANGE_APPEARING, SHOW_ANIM_DURATION / 2);

				transition.setStartDelay(LayoutTransition.APPEARING, SHOW_ANIM_DURATION / 2);
				transition.setDuration(LayoutTransition.APPEARING, SHOW_ANIM_DURATION / 2);
			}

			mDevicesLayout.LayoutTransition = transition;
		}
示例#24
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup c, Bundle b)
        {
            try
            {
                var layout = inflater.Inflate(Resource.Layout.layout_remote, c, false);
                Inject(layout);

                prefsMain = new Preferences();

                int lastTab = prefsMain.spMain.GetInt(PREF_FRAG_REM_LAST, 1);
                ViewHelper.AddTabLayoutTab(tlMain, "Player", lastTab == 0);
                ViewHelper.AddTabLayoutTab(tlMain, "Receiver", lastTab == 1);
                ViewHelper.AddTabLayoutTab(tlMain, "TV", lastTab == 2);

                tlMain.TabSelected += delegate
                {
                    prefsMain.PutInt(PREF_FRAG_REM_LAST, tlMain.SelectedTabPosition);
                    int lastState = BottomSheetBehavior.StateCollapsed;
                    if (bsbMain.State == BottomSheetBehavior.StateCollapsed ||
                        bsbMain.State == BottomSheetBehavior.StateExpanded)
                    {
                        lastState = bsbMain.State;
                    }
                    bsbMain.Hideable = true;
                    bsbMain.State    = BottomSheetBehavior.StateHidden;

                    RefreshButtons();


                    nvSheet.Post(delegate
                    {
                        try
                        {
                            bsbMain.State    = lastState;
                            bsbMain.Hideable = false;
                        }
                        catch (Exception e)
                        {
                            Toast.MakeText(Activity, $"UI Error: {e.Message}", ToastLength.Short).Show();
                        }
                    });
                };
                gt = new ViewHelper.GestureDetector(flGesture, Application.Context);
                gt.OnGestureEvent += delegate(int id)
                {
                    string cmd = GetCurCmd();
                    switch (id)
                    {
                    case 1:
                        cmd += CmdHelper.Menu.UP;
                        break;

                    case 2:
                        cmd += CmdHelper.Menu.LEFT;
                        break;

                    case 3:
                        cmd += CmdHelper.Menu.DOWN;
                        break;

                    case 4:
                        cmd += CmdHelper.Menu.RIGHT;
                        break;

                    case 5:
                        cmd += CmdHelper.Menu.ENTER;
                        break;
                    }
                    DeviceService.SendCommand($"{cmd}");
                };

                bsbMain = BottomSheetBehavior.From(nvSheet);
                var bsc = new ViewHelper.BrinBottomSheetCallBack();
                bsbMain.SetBottomSheetCallback(bsc);

                nvSheet.PostDelayed(delegate
                {
                    try
                    {
                        bsbMain.Hideable = true;
                        bsbMain.State    = BottomSheetBehavior.StateHidden;
                        bsbMain.State    = BottomSheetBehavior.StateCollapsed;
                        bsbMain.Hideable = false;
                    }
                    catch (Exception e)
                    {
                    }
                }, 1000);


                RefreshButtons();

                LayoutTransition transition = new LayoutTransition();
                transition.SetAnimateParentHierarchy(false);
                //llRemHolder.LayoutTransition = transition;

                OpenBroadcast();
                return(layout);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
示例#25
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Showing);

            string cant = Intent.GetStringExtra("counter" ?? "error");

            int.TryParse(cant, out numcant);
            string[] myTextViews = new string[numcant];

            var EnumText   = FindViewById <TextView>(Resource.Id.enumtext);
            var CantText   = FindViewById <TextView>(Resource.Id.TextCant);
            var ButtonBack = FindViewById <Button>(Resource.Id.GoBack);
            var container  = FindViewById <LinearLayout>(Resource.Id.madre);
            var Compatible = FindViewById <TextView>(Resource.Id.compatible);

            for (int i = 0; i < numcant; i++)
            {
                myTextViews[i] = Intent.GetStringExtra($"element{i}" ?? "error");
            }

            CantText.Text = myTextViews[Nelem];
            //EVENTO
            ma  = new MatrizQ(numcant);
            mat = ma.returnMa();
            CheckBox[] myRButtons   = new CheckBox[1000];
            TextView[] myTextViews2 = new TextView[1000];
            View[]     myAddViews   = new View[100];

            void Evento(int Nelem)
            {
                CantText.Text = myTextViews[Nelem];
                for (int j = Nelem + 1; j < numcant; j++)
                {
                    LayoutInflater inflate  = (LayoutInflater)BaseContext.GetSystemService(Context.LayoutInflaterService);
                    View           addView2 = LayoutInflater.Inflate(Resource.Layout.buttons, null);
                    TextView       nombreE  = addView2.FindViewById <TextView>(Resource.Id.nombre2);
                    nombreE.Text = myTextViews[j];
                    CheckBox compE = addView2.FindViewById <CheckBox>(Resource.Id.comp);
                    myRButtons[j]   = compE;
                    myTextViews2[j] = nombreE;
                    myAddViews[j]   = addView2;
                    container.AddView(addView2);

                    compE.CheckedChange += delegate {};
                }
            }

            Evento(Nelem);
            ButtonBack.Click += delegate
            {
                if (Nelem < numcant - 1)
                {
                    for (int j = Nelem + 1; j < numcant; j++)
                    {
                        if (true == myRButtons[j].Checked)
                        {
                            ma.setP(Nelem, j, 1);
                        }
                        else
                        {
                            ma.setP(Nelem, j, 0);
                        }
                    }

                    CantText.Text = String.Empty;

                    for (int j = Nelem + 1; j < numcant; j++)
                    {
                        myTextViews2[j].Visibility = ViewStates.Gone;
                        myRButtons[j].Visibility   = ViewStates.Gone;
                        myAddViews[j].Visibility   = ViewStates.Gone;
                    }
                    CantText.Text = String.Empty;
                    Nelem++;
                    Evento(Nelem);
                    if (Nelem == numcant - 1)
                    {
                        Compatible.Visibility = ViewStates.Gone;
                        ButtonBack.Text       = "Agrupar elementos químicos";
                    }
                }

                else
                {
                    EnumText.Visibility   = ViewStates.Gone;
                    CantText.Visibility   = ViewStates.Gone;
                    ButtonBack.Visibility = ViewStates.Gone;
                    container.Visibility  = ViewStates.Gone;
                    if (numcant >= 2)
                    {
                        this.Title = "ELEMENTOS AGRUPADOS";

                        ma.setMat(mat);
                        ma.Calc();
                        int[] arr = ma.getArr();
                        //ma.Ordenar();
                        int    aux2;
                        string aux3;
                        for (int i = 0; i < numcant; i++)
                        {
                            for (int j = 0; j < numcant; j++)
                            {
                                if (arr[i] < arr[j])
                                {
                                    aux2           = arr[i];
                                    arr[i]         = arr[j];
                                    arr[j]         = aux2;
                                    aux3           = myTextViews[i];
                                    myTextViews[i] = myTextViews[j];
                                    myTextViews[j] = aux3;
                                }
                            }
                        }
                        EnumText.Visibility = ViewStates.Visible;
                        EnumText.Text       = String.Empty;
                        //container.Visibility = ViewStates.Visible;
                        for (int i = 0; i < ma.getHab(); i++)
                        {
                            int aux4 = i + 1;
                            EnumText.SetTextColor(Android.Graphics.Color.Red);
                            EnumText.Text = EnumText.Text + "Los químicos en el cuarto #" + aux4 + ": \n";
                            //EnumText.SetTextColor(Android.Graphics.Color.White);
                            for (int j = 0; j < numcant; j++)
                            {
                                if (arr[j] == i)
                                {
                                    //View addView2 = LayoutInflater.Inflate(Resource.Layout.buttons, null);
                                    //TextView nombreE = addView2.FindViewById<TextView>(Resource.Id.nombre2);
                                    //nombreE.Text = myTextViews[j];
                                    //container.AddView(addView2);
                                    //EnumText.Text = EnumText.Text + "\n";
                                    EnumText.Text = EnumText.Text + myTextViews[j] + "\n";
                                }
                            }
                            EnumText.Text = EnumText.Text + "\n";
                        }
                    }
                }
            };
            LayoutTransition trans = new LayoutTransition();

            container.LayoutTransition = trans;
        }