Пример #1
0
        public void OnTabSelected(ActionBar.Tab tab, FragmentTransaction ft)
        {
            TitlesFragment titleFrag = (TitlesFragment)FragmentManager.FindFragmentById(Resource.Id.frag_title);

            titleFrag.PopulateTitles(tab.Position);

            titleFrag.SelectPosition(0);
        }
Пример #2
0
        public void ToggleVisibleTitles()
        {
            // Use these for custom animations.
            FragmentManager fm         = FragmentManager;
            TitlesFragment  f          = (TitlesFragment)fm.FindFragmentById(Resource.Id.frag_title);
            View            titlesView = f.View;

            mLabelIndex = 1 - mLabelIndex;

            // Determine if we're in portrait, and whether we're showing or hiding the titles
            // with this toggle.
            bool isPortrait = Resources.Configuration.Orientation ==
                              Android.Content.Res.Orientation.Portrait;

            bool shouldShow = f.IsHidden || mCurrentTitlesAnimator != null;

            // Cancel the current titles animation if there is one.
            if (mCurrentTitlesAnimator != null)
            {
                mCurrentTitlesAnimator.Cancel();
            }

            // Begin setting up the object animator. We'll animate the bottom or right edge of the
            // titles view, as well as its alpha for a fade effect.
            ObjectAnimator objectAnimator = ObjectAnimator.OfPropertyValuesHolder(
                titlesView,
                PropertyValuesHolder.OfInt(
                    isPortrait ? "bottom" : "right",
                    shouldShow ? Resources.GetDimensionPixelSize(Resource.Dimension.titles_size)
                                 : 0),
                PropertyValuesHolder.OfFloat("alpha", shouldShow ? 1 : 0)
                );

            // At each step of the animation, we'll perform layout by calling setLayoutParams.
            ViewGroup.LayoutParams lp = titlesView.LayoutParameters;
            objectAnimator.AddUpdateListener(new AnimatorUpdateListener(isPortrait, titlesView, lp));

            if (shouldShow)
            {
                fm.BeginTransaction().Show(f).Commit();
                objectAnimator.AddListener(new ObjectAnimatorListenerAdapter(this));
            }
            else
            {
                objectAnimator.AddListener(new ObjectAnimatorListenerAdapter2(this, fm, f));
            }

            // Start the animation.
            objectAnimator.Start();
            mCurrentTitlesAnimator = objectAnimator;

            InvalidateOptionsMenu();

            // Manually trigger onNewIntent to check for ACTION_DIALOG.
            OnNewIntent(Intent);
        }
        bool ProcessDrop(DragEvent evt, ImageView imageView)
        {
            // Attempt to parse clip data with expected format: category||entry_id.
            // Ignore event if data does not conform to this format.
            ClipData data = evt.ClipData;

            if (data != null)
            {
                if (data.ItemCount > 0)
                {
                    ClipData.Item item     = data.GetItemAt(0);
                    String        textData = (String)item.Text;
                    if (textData != null)
                    {
                        StringTokenizer tokenizer = new StringTokenizer(textData, "||");
                        if (tokenizer.CountTokens() != 2)
                        {
                            return(false);
                        }
                        int category = -1;
                        int entryId  = -1;
                        try {
                            category = Java.Lang.Integer.ParseInt(tokenizer.NextToken());
                            entryId  = Java.Lang.Integer.ParseInt(tokenizer.NextToken());
                        } catch (NumberFormatException exception) {
                            return(false);
                        }
                        UpdateContentAndRecycleBitmap(category, entryId);
                        // Update list fragment with selected entry.
                        TitlesFragment titlesFrag = (TitlesFragment)
                                                    FragmentManager.FindFragmentById(Resource.Id.frag_title);
                        titlesFrag.SelectPosition(entryId);
                        return(true);
                    }
                }
            }
            return(false);
        }
Пример #4
0
			public ObjectAnimatorListenerAdapter2 (MainActivity parent, FragmentManager fm, TitlesFragment f)
			{
				this.parent = parent;
				this.fm = fm;
				this.f = f;
			}
Пример #5
0
 public ObjectAnimatorListenerAdapter2(MainActivity parent, FragmentManager fm, TitlesFragment f)
 {
     this.parent = parent;
     this.fm     = fm;
     this.f      = f;
 }