ViewAnimator showNext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for ViewAnimator showNext method.

This code example shows how to use the following methods:showNext
     
    flipper=(ViewFlipper)findViewById(R.id.details);
  } 
   
  public void flip(View v) {
    flipper.showNext();
  } 
} 
7
CodeRank
This code example shows how to use the following methods:addView, getChildAt, getChildCount, removeViewAt, setInAnimation
	 * TODO remove 
	 * May return null 
	 */ 
	@Deprecated 
	public static View swap(ViewAnimator flipper, View view, Animation in, Animation out) {
		flipper.setInAnimation(in);
		flipper.setOutAnimation(out);
		 
		View returned = null;
		 
		if (flipper.getChildCount() == 2) {
			returned = flipper.getChildAt(0);
			flipper.removeViewAt(0);
		} 
		 
		flipper.addView(view);
		flipper.showNext();
		 
		return returned;
	} 

6
CodeRank
This code example shows how to use the following methods:addView, setInAnimation, setOutAnimation, showNext
						//could also be the action listener which is invalid 
						//ongoingAnimation=false; 
					}else { 
						 
						viewAnimator = (ViewAnimator)currentView;
						viewAnimator.addView(unboundNewView);
						//setup animation 
						 
						viewAnimator.setInAnimation(inAnimation);
						viewAnimator.setOutAnimation(outAnimation);
						//trigger the animation and the event listener when finished 
						ongoingAnimation=true;
						viewAnimator.showNext();
						 
					} 
				} 
				return true; 
			} 
 
			return super.onKeyDown(keyCode, event);
6
CodeRank
This code example shows how to use the following methods:getCurrentView, setInAnimation, setOutAnimation, showNext, showPrevious
This code example shows how to use the following methods:getDisplayedChild, setInAnimation, setOutAnimation, showNext
				} 
			} 
        }); 
        rightBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				if (animator.getDisplayedChild() == 0) {
			        title.setText("step #2");
			        leftBtn.setText("back");
					rightBtn.setText("ok");
					animator.setInAnimation(slideInLeft);
					animator.setOutAnimation(slideOutLeft);
					animator.showNext();
				} else { 
					String msg = "don't be suprized, but your first name is [" +
						firstName.getText() + "] and your last name is [" +
						lastName.getText() + "]";
					new AlertDialog.Builder(TestCustomTitle.this).setMessage(msg)
						.setTitle("hmmm...")
						.setIcon(android.R.drawable.ic_dialog_info)
						.setPositiveButton("ok", null)
6
CodeRank
This code example shows how to use the following methods:addView, getCurrentView, getDisplayedChild, showNext
    @Test 
    public void testAnimatorHandlesCyclingViews() { 
        View v1 = new View(null);
        View v2 = new View(null);
         
        animator.addView(v1);
        animator.addView(v2);
         
        animator.showNext();
         
        assertEquals(1, animator.getDisplayedChild());
        assertEquals(v2, animator.getCurrentView());
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getDisplayedChild, setInAnimation, setOutAnimation, showNext
				} 
			} 
        }); 
        rightBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				if (animator.getDisplayedChild() == 0) {
			        title.setText("step #2");
			        leftBtn.setText("back");
					rightBtn.setText("ok");
					animator.setInAnimation(slideInLeft);
					animator.setOutAnimation(slideOutLeft);
					animator.showNext();
				} else { 
					String msg = "don't be suprized, but your first name is [" +
						firstName.getText() + "] and your last name is [" +
						lastName.getText() + "]";
					new AlertDialog.Builder(TestCustomTitle.this).setMessage(msg)
						.setTitle("hmmm...")
						.setIcon(android.R.drawable.ic_dialog_info)
						.setPositiveButton("ok", null)
6
CodeRank
This code example shows how to use the following methods:inflate, addView, removeAllViews, showNext
 
        outState.putInt(KEY_SELECTED_TAB, selectedTab);
    } 
 
    protected void replaceContentWith(int resId) {
        mainContent.removeAllViews();
        mainContent.addView(getLayoutInflater().inflate(resId, mainContent, false));
        mainContent.showNext();
    } 
 
    @Override 
    public void onTabSelected(Tab tab, FragmentTransaction ft) {
        selectedTab = (Integer) tab.getTag();
        switch (selectedTab) {
        case TAB_ASSETS:
            replaceContentWith(R.layout.activity_experiment_designer_asset_view); 
            break; 
        case TAB_DATA_DESCRIPTORS:
            replaceContentWith(R.layout.activity_experiment_designer_data_view); 
            break; 
6
CodeRank
This code example shows how to use the following methods:getChildCount, getDisplayedChild, showNext
					// user walked past end of wizard, so return okay 
					WizardActivity.this.setResult(Activity.RESULT_OK);
					WizardActivity.this.finish();
				} else { 
					// show next step and update buttons 
					flipper.showNext();
					updateButtons(); 
				} 
			} 
		}); 
 
		prev = (Button)this.findViewById(R.id.action_prev);
		prev.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				if(isFirstDisplayed()) { 
					// user walked past beginning of wizard, so return that they cancelled 
					WizardActivity.this.setResult(Activity.RESULT_CANCELED);
					WizardActivity.this.finish();
				} else { 
					// show previous step and update buttons 

6
CodeRank
This code example shows how to use the following methods:getChildAt, getChildCount, getCurrentView, getDisplayedChild, setInAnimation
         * @param viewAnimator the {@code ViewAnimator} 
         * @param dir the direction of flip 
         */ 
        public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir) {  
                
                final View fromView = viewAnimator.getCurrentView();
                final int currentIndex = viewAnimator.getDisplayedChild();
                final int nextIndex = (currentIndex + 1)%viewAnimator.getChildCount();
                
                final View toView = viewAnimator.getChildAt(nextIndex);
 
                Animation[] animc = AnimationFactory.flipAnimation(fromView, toView, (nextIndex < currentIndex?dir.theOtherDirection():dir), 500, null);
  
                viewAnimator.setOutAnimation(animc[0]);
                viewAnimator.setInAnimation(animc[1]);
                
                viewAnimator.showNext();  
        } 
        
        ////////////// 

5
CodeRank

Related ViewAnimator showNext Questions & Answers:

showNext Method Overview
Manually shows the next child.
See Code Examples for other Android ViewAnimator Methods: