Java Code Examples for android.widget.ViewAnimator

The following are top voted examples for showing how to use android.widget.ViewAnimator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: GitHub   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 2
Project: GitHub   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 3
Project: GitHub   File: SampleGalleryActivity.java   View source code 6 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.sample_gallery_activity);

  animator = (ViewAnimator) findViewById(R.id.animator);
  imageView = (ImageView) findViewById(R.id.image);

  findViewById(R.id.go).setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
      Intent gallery = new Intent(ACTION_PICK, EXTERNAL_CONTENT_URI);
      startActivityForResult(gallery, GALLERY_REQUEST);
    }
  });

  if (savedInstanceState != null) {
    image = savedInstanceState.getString(KEY_IMAGE);
    if (image != null) {
      loadImage();
    }
  }
}
 
Example 4
Project: bluetooth-chat-appliction   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 5
Project: buildAPKsApps   File: MediaPicker.java   View source code 6 votes vote down vote up
private View newList(
    final PickerQuery q, final ViewAnimator flip,
    AdapterView.OnItemClickListener click) {
  final View list = newList(q, click);
  list.setOnKeyListener(new View.OnKeyListener() {
      @Override
      public boolean onKey(View v, int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK &&
            event.getAction() == KeyEvent.ACTION_UP) {
          flip.setInAnimation(getContext(), R.anim.slide_in_left);
          flip.setOutAnimation(getContext(), R.anim.slide_out_right);
          flip.showPrevious();
          flip.removeView(list);
          flip.setInAnimation(getContext(), R.anim.slide_in_right);
          flip.setOutAnimation(getContext(), R.anim.slide_out_left);
          return true;
        }
        return false;
      }
    });
  return list;
}
 
Example 6
Project: IslamicLibraryAndroid   File: DisplayOptionsPopupFragment.java   View source code 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment

    View v = inflater.inflate(R.layout.display_options_popup, container);
    final ViewAnimator viewAnimator = v.findViewById(R.id.settings_view_container);
    viewAnimator.setDisplayedChild(mCurrentView);
    Window window = getDialog().getWindow();
    if (window != null) {
        window.setGravity(Gravity.TOP | Gravity.END);
        // window.setDimAmount(0);
        window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
        //getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        //window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }
    return v;
}
 
Example 7
Project: dab-iot   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 8
Project: apps-for-android   File: ViewPhotoActivity.java   View source code 6 votes vote down vote up
private void setupViews() {
    mContainer = (ViewGroup) findViewById(R.id.container_photo);
    mSwitcher = (ViewAnimator) findViewById(R.id.switcher_menu);
    mPhotoView = (ImageView) findViewById(R.id.image_photo);

    mPhotoTitle = (TextView) findViewById(R.id.caption_title);
    mPhotoDate = (TextView) findViewById(R.id.caption_date);

    findViewById(R.id.menu_back).setOnClickListener(this);
    findViewById(R.id.menu_set).setOnClickListener(this);

    mPhotoTitle.setText(mPhoto.getTitle());
    mPhotoDate.setText(mPhoto.getDate());

    mContainer.setVisibility(View.INVISIBLE);

    // Sets up a view tree observer. The photo will be scaled using the size
    // of one of our views so we must wait for the first layout pass to be
    // done to make sure we have the correct size.
    mContainer.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
 
Example 9
Project: apps-for-android   File: PhotostreamActivity.java   View source code 6 votes vote down vote up
private void setupViews() {
    mInflater = LayoutInflater.from(PhotostreamActivity.this);
    mNextAnimation = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_slide_next);
    mBackAnimation = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_slide_back);

    mSwitcher = (ViewAnimator) findViewById(R.id.switcher_menu);
    mMenuNext = findViewById(R.id.menu_next);
    mMenuBack = findViewById(R.id.menu_back);
    mMenuSeparator = findViewById(R.id.menu_separator);
    mGrid = (GridLayout) findViewById(R.id.grid_photos);

    mMenuNext.setOnClickListener(this);
    mMenuBack.setOnClickListener(this);
    mMenuBack.setVisibility(View.GONE);
    mMenuSeparator.setVisibility(View.GONE);
    mGrid.setClipToPadding(false);
}
 
Example 10
Project: whereuat-android   File: AnimationFactory.java   View source code 6 votes vote down vote up
/**
 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will
 * initiate a {@link FlipAnimation} to show the next View.
 * If the currently visible view is the last view, flip direction will be reversed for this
 * transition.
 *
 * @param viewAnimator the {@code ViewAnimator}
 * @param dir the direction of flip
 * @param duration the transition duration in milliseconds
 */
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir,
                                  long duration) {

    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), duration, null);

    viewAnimator.setOutAnimation(animc[0]);
    viewAnimator.setInAnimation(animc[1]);

    viewAnimator.showNext();
}
 
Example 11
Project: FMTech   File: lit.java   View source code 6 votes vote down vote up
public final Dialog c(Bundle paramBundle)
{
  un localun = new un(this.ad);
  View localView = LayoutInflater.from(this.ad).inflate(efj.YN, null, false);
  this.ai = ((ViewAnimator)localView.findViewById(efj.YI));
  this.aj = ((RadioGroup)localView.findViewById(efj.YH));
  this.Z = new TextView(this.ad);
  int i = this.ai.getPaddingLeft();
  this.Z.setPadding(i, i, i, i);
  this.Z.setTextAppearance(this.ad, aaw.qG);
  TextView localTextView = this.Z;
  localun.a.f = localTextView;
  localun.a(localView);
  localun.a(fh.f, this);
  localun.b(fh.a, this);
  return localun.a();
}
 
Example 12
Project: test4XXX   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 13
Project: auid2   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 14
Project: phonepick   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 15
Project: mupdf-android   File: MuPDFFragment.java   View source code 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = getActivity().getLayoutInflater().inflate(R.layout.buttons,null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mInfoView = (TextView)mButtonsView.findViewById(R.id.info);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mReflowButton = (ImageButton)mButtonsView.findViewById(R.id.reflowButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mAnnotButton = (ImageButton)mButtonsView.findViewById(R.id.editAnnotButton);
	mAnnotTypeText = (TextView)mButtonsView.findViewById(R.id.annotType);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);
	mInfoView.setVisibility(View.INVISIBLE);
	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example 16
Project: mupdf-android   File: MuPDFActivity.java   View source code 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = getLayoutInflater().inflate(R.layout.buttons,null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mInfoView = (TextView)mButtonsView.findViewById(R.id.info);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mReflowButton = (ImageButton)mButtonsView.findViewById(R.id.reflowButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mAnnotButton = (ImageButton)mButtonsView.findViewById(R.id.editAnnotButton);
	mAnnotTypeText = (TextView)mButtonsView.findViewById(R.id.annotType);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);
	mInfoView.setVisibility(View.INVISIBLE);
	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example 17
Project: pga309-blutooth-android-tensometer   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 18
Project: binea_project_for_android   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 19
Project: ArduinoAndroidBluetoothSerialComm   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 20
Project: G-Suite-Hotels-Demo   File: Main.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 21
Project: HackChat   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 22
Project: One   File: FragmentTestActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 23
Project: picasso   File: SampleGalleryActivity.java   View source code 6 votes vote down vote up
@Override protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.sample_gallery_activity);

  animator = (ViewAnimator) findViewById(R.id.animator);
  imageView = (ImageView) findViewById(R.id.image);

  findViewById(R.id.go).setOnClickListener(new View.OnClickListener() {
    @Override public void onClick(View view) {
      Intent gallery = new Intent(ACTION_PICK, EXTERNAL_CONTENT_URI);
      startActivityForResult(gallery, GALLERY_REQUEST);
    }
  });

  if (savedInstanceState != null) {
    image = savedInstanceState.getString(KEY_IMAGE);
    if (image != null) {
      loadImage();
    }
  }
}
 
Example 24
Project: WikiCards   File: CardActivity.java   View source code 6 votes vote down vote up
private void initFlipCard() {
  viewAnimator = (ViewAnimator) this.findViewById(R.id.viewFlipper);
  cardFront = LayoutInflater.from(this).inflate(R.layout.card, null);
  cardBack = LayoutInflater.from(this).inflate(R.layout.card, null);
  viewAnimator.addView(cardFront);
  viewAnimator.addView(cardBack);
  currentCard = cardFront;

  viewAnimator.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      flipCard();
      updateNavBar();
    }
  });
}
 
Example 25
Project: Secrecy_fDroid_DEPRECIATED   File: FilesListFragment.java   View source code 6 votes vote down vote up
@UiThread
void switchView(View parentView, int showView) {
    if (parentView == null)
        return;
    FilesListAdapter.ViewHolder holder = (FilesListAdapter.ViewHolder) parentView.getTag();

    ViewAnimator viewAnimator = holder.animator;
    viewAnimator.setInAnimation(context, R.anim.slide_down);
    int viewIndex = 0;
    switch (showView) {
        case R.id.dataLayout:
            viewIndex = 0;
            break;
        case R.id.DecryptLayout:
            viewIndex = 1;
            break;
    }
    viewAnimator.setDisplayedChild(viewIndex);
    holder.page = viewIndex;
}
 
Example 26
Project: android-FragmentTransition   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 27
Project: lab.mobile   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.menu_toggle_log:
            mLogShown = !mLogShown;
            ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
            if (mLogShown) {
                output.setDisplayedChild(1);
            } else {
                output.setDisplayedChild(0);
            }
            supportInvalidateOptionsMenu();
            return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 28
Project: secrecy   File: FilesListFragment.java   View source code 6 votes vote down vote up
void switchView(final View frame, final int showView) {
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            if (frame == null) {
                return;
            }
            FilesListAdapter.ViewHolder holder = (FilesListAdapter.ViewHolder) frame.getTag();
            ViewAnimator viewAnimator = holder.animator;
            int viewIndex = 0;
            switch (showView) {
                case R.id.dataLayout:
                    viewIndex = 0;
                    break;
                case R.id.DecryptLayout:
                    viewIndex = 1;
                    break;
            }
            viewAnimator.setDisplayedChild(viewIndex);
            viewAnimator.setInAnimation(null);
            holder.page = viewIndex;
        }
    });
}
 
Example 29
Project: NavBro-WebView   File: NavBroActivity.java   View source code 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	getWindow().requestFeature(Window.FEATURE_PROGRESS);
	getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);

	setContentView(
			getLayoutInflater().inflate(R.layout.main, null));

	this.viewAnimator = (ViewAnimator) findViewById(R.id.mainViewAnimatorLayout);

	this.myWebView = new MyWebView(this);
	this.myMenu = new MyMenu(this, myWebView, viewAnimator);

	viewAnimator.addView(myWebView);
	viewAnimator.addView(
			getLayoutInflater().inflate(R.layout.web_source, null));
	
	if(!startActivityFromWidget(getIntent())){
		startActivity();
	}
}
 
Example 30
Project: NavBro-WebView   File: MyMenu.java   View source code 6 votes vote down vote up
public MyMenu(NavBroActivity navAppActivity, MyWebView myWebView, ViewAnimator viewAnimator) {
	this.navAppActivity = navAppActivity;
	this.myWebView = myWebView;
	this.viewAnimator = viewAnimator;
	this.slidingMenu = new SlidingMenu(navAppActivity);
	slidingMenu.setMode(SlidingMenu.LEFT);
	slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
	slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
	slidingMenu.setShadowDrawable(R.drawable.my_menu_shadow);
	slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
	slidingMenu.setFadeDegree(0.35f);
	slidingMenu.attachToActivity(navAppActivity, SlidingMenu.SLIDING_CONTENT);
	slidingMenu.setMenu(R.layout.left_menu);
	
	this.view = slidingMenu.getMenu();
	
	setEventOnClickButton();
	setWebViewSettings();
}
 
Example 31
Project: mkRemote   File: Main.java   View source code 6 votes vote down vote up
protected ViewAnimator buildView() {
    LayoutInflater li = getLayoutInflater();
    ViewAnimator va = (ViewAnimator) li.inflate(R.layout.base, null);
    View v = li.inflate(R.layout.main, null);
    if (app.isLite()) {
        ((ImageView) v.findViewById(R.id.logo)).setImageResource(R.drawable.logo_lite);
    }
    View touch = v.findViewById(R.id.touch_screen);
    touch.setOnTouchListener(simpleTouchHandler);
    LockSlider ls = (LockSlider) v.findViewById(R.id.drawer);
    if (sharedPreferences.getBoolean(MkRemotePreferences.cs(R.string.c_lock_on), false)) {
        ls.lock();
    } else {
        ls.unlock();
    }
    va.addView(v, MAIN_VIEW);
    va.addView(li.inflate(R.layout.keyboard, null), KEYBOARD_VIEW);
    va.addView(new View(this), BLANK_VIEW);
    va.setDisplayedChild(currentView);
    return va;
}
 
Example 32
Project: MyMuPdfSample   File: MuPDFActivity.java   View source code 6 votes vote down vote up
private void makeButtonsView() {
	mButtonsView = getLayoutInflater().inflate(R.layout.buttons,null);
	mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
	mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
	mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
	mInfoView = (TextView)mButtonsView.findViewById(R.id.info);
	mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
	mReflowButton = (ImageButton)mButtonsView.findViewById(R.id.reflowButton);
	mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
	mAnnotButton = (ImageButton)mButtonsView.findViewById(R.id.editAnnotButton);
	mAnnotTypeText = (TextView)mButtonsView.findViewById(R.id.annotType);
	mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
	mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
	mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
	mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
	mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
	mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton);
	mTopBarSwitcher.setVisibility(View.INVISIBLE);
	mPageNumberView.setVisibility(View.INVISIBLE);
	mInfoView.setVisibility(View.INVISIBLE);
	mPageSlider.setVisibility(View.INVISIBLE);
}
 
Example 33
Project: javocsoft-toolbox   File: AnimationFactory.java   View source code 6 votes vote down vote up
/**
 * Flip to the next view of the {@code ViewAnimator}'s subviews. A call 
 * to this method will initiate a {@link FlipAnimation} to show the next 
 * View. If the currently visible view is the last view, flip direction 
 * will be reversed for this transition.
 *  
 * @param viewAnimator the {@code ViewAnimator}
 * @param dir the direction of flip
 * @param duration the transition duration in milliseconds
 */
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir, long duration) {   
	
	final View fromView = viewAnimator.getCurrentView();
	final int currentIndex = viewAnimator.getDisplayedChild();
	final int nextIndex = (currentIndex + 1)%viewAnimator.getChildCount();
	
	final View toView = viewAnimator.getChildAt(nextIndex);		
			
	if(android.os.Build.VERSION.SDK_INT>=12) {
		//New way of flipping.
		flipTransition(fromView, toView);
	}else{
		//Traditional flip.
		Animation[] animc = AnimationFactory.flipAnimation(fromView, toView, 
				(nextIndex < currentIndex?dir.theOtherDirection():dir), duration, null);
		viewAnimator.setOutAnimation(animc[0]);
		viewAnimator.setInAnimation(animc[1]);
		viewAnimator.showNext();
	}	   
}
 
Example 34
Project: AnimationApiDemos   File: BookActivity.java   View source code 6 votes vote down vote up
private void useCodeAnimation(ViewAnimator pages) {
	// 用代码定义一个动画
	AnimationSet slideAnimationSet = new AnimationSet(true);

	// 平移动画
	TranslateAnimation slide = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT, 1f, Animation.RELATIVE_TO_PARENT,
			0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0);

	// 缩放动画
	ScaleAnimation scale = new ScaleAnimation(10, 1, 10, 1);
	// 把平移和缩放动画加入动画集合
	slideAnimationSet.addAnimation(slide);
	slideAnimationSet.addAnimation(scale);

	// 持续时间设置为1000ms
	slideAnimationSet.setDuration(1000);

	// 设置动画
	pages.setInAnimation(slideAnimationSet);
}
 
Example 35
Project: q-mail   File: RecipientMvpView.java   View source code 5 votes vote down vote up
public RecipientMvpView(MessageCompose activity) {
    this.activity = activity;

    toView = (RecipientSelectView) activity.findViewById(R.id.to);
    ccView = (RecipientSelectView) activity.findViewById(R.id.cc);
    bccView = (RecipientSelectView) activity.findViewById(R.id.bcc);
    ccWrapper = activity.findViewById(R.id.cc_wrapper);
    ccDivider = activity.findViewById(R.id.cc_divider);
    bccWrapper = activity.findViewById(R.id.bcc_wrapper);
    bccDivider = activity.findViewById(R.id.bcc_divider);
    recipientExpanderContainer = (ViewAnimator) activity.findViewById(R.id.recipient_expander_container);
    cryptoStatusView = (ToolableViewAnimator) activity.findViewById(R.id.crypto_status);
    cryptoStatusView.setOnClickListener(this);
    cryptoSpecialModeIndicator = (ToolableViewAnimator) activity.findViewById(R.id.crypto_special_mode);
    cryptoSpecialModeIndicator.setOnClickListener(this);

    toView.setOnFocusChangeListener(this);
    ccView.setOnFocusChangeListener(this);
    bccView.setOnFocusChangeListener(this);

    View recipientExpander = activity.findViewById(R.id.recipient_expander);
    recipientExpander.setOnClickListener(this);

    View toLabel = activity.findViewById(R.id.to_label);
    View ccLabel = activity.findViewById(R.id.cc_label);
    View bccLabel = activity.findViewById(R.id.bcc_label);
    toLabel.setOnClickListener(this);
    ccLabel.setOnClickListener(this);
    bccLabel.setOnClickListener(this);
}
 
Example 36
Project: GitHub   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem logToggle = menu.findItem(R.id.menu_toggle_log);
    logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator);
    logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log);

    return super.onPrepareOptionsMenu(menu);
}
 
Example 37
Project: GitHub   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem logToggle = menu.findItem(R.id.menu_toggle_log);
    logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator);
    logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log);

    return super.onPrepareOptionsMenu(menu);
}
 
Example 38
Project: bluetooth-chat-appliction   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem logToggle = menu.findItem(R.id.menu_toggle_log);
    logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator);
    logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log);

    return super.onPrepareOptionsMenu(menu);
}
 
Example 39
Project: SmartRC   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuItem logToggle = menu.findItem(R.id.menu_toggle_log);
    logToggle.setVisible(findViewById(R.id.sample_output) instanceof ViewAnimator);
    logToggle.setTitle(mLogShown ? R.string.sample_hide_log : R.string.sample_show_log);

    return super.onPrepareOptionsMenu(menu);
}
 
Example 40
Project: FastAndroid   File: ContactDetailActivity.java   View source code 5 votes vote down vote up
private void initView() {
    mTargetPortrait = (AsyncImageView) findViewById(R.id.target_portrait);
    mTargetName = (TextView) findViewById(R.id.target_name);
    mArrow = (ImageView) findViewById(R.id.target_group_arrow);
    mContactName = (TextView) findViewById(R.id.contact_name);
    mMessage = (EditText) findViewById(R.id.message);
    mSend = (TextView) findViewById(R.id.send);
    mCancel = (TextView) findViewById(R.id.cancel);
    mViewAnimator = (ViewAnimator) findViewById(R.id.va_detail);
    mGridView = (GridView) findViewById(R.id.gridview);

    mCancel.requestFocus();
    this.setFinishOnTouchOutside(false);
}