Java Code Examples for android.widget.ViewFlipper#addView()

The following examples show how to use android.widget.ViewFlipper#addView() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecentActivity.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
void showLibrary(final LibraryAdapter libraryAdapter, final RecentAdapter recentAdapter) {
    if (recentBooksView == null) {
        recentBooksView = new RecentBooksView(getController(), recentAdapter);
        registerForContextMenu(recentBooksView);
    }
    if (libraryView == null) {
        libraryView = new LibraryView(getController(), libraryAdapter);
        registerForContextMenu(libraryView);
    }

    final ViewFlipper vf = getViewflipper();
    vf.removeAllViews();
    vf.addView(recentBooksView, VIEW_RECENT);
    vf.addView(libraryView, VIEW_LIBRARY);

    if (recentAdapter.getCount() == 0) {
        changeLibraryView(VIEW_LIBRARY);
    }
}
 
Example 2
Source File: BrowserActivity.java    From document-viewer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 *
 * @see org.emdev.ui.AbstractActionActivity#onCreateImpl(android.os.Bundle)
 */
@Override
protected void onCreateImpl(final Bundle savedInstanceState) {
    setContentView(R.layout.browser);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    final BrowserActivityController c = getController();

    viewflipper = (ViewFlipper) findViewById(R.id.browserflip);
    viewflipper.addView(LayoutUtils.fillInParent(viewflipper, new FileBrowserView(c, c.adapter)));
}
 
Example 3
Source File: RecentActivity.java    From document-viewer with GNU General Public License v3.0 5 votes vote down vote up
void showBookcase(final BooksAdapter bookshelfAdapter, final RecentAdapter recentAdapter) {
    final ViewFlipper vf = getViewflipper();
    vf.removeAllViews();
    if (bookcaseView == null) {
        bookcaseView = (BookcaseView) LayoutInflater.from(this).inflate(R.layout.bookcase_view, vf, false);
        bookcaseView.init(bookshelfAdapter, recentAdapter);
    }
    vf.addView(bookcaseView, 0);
}
 
Example 4
Source File: IntroActivity.java    From WhatsAppStatusSaver with Apache License 2.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_intro);
    final SharedPreferences sharedPref = getPreferences(Context.MODE_PRIVATE);
    alreadyOpened = sharedPref.getBoolean("already-opened", false);
    if (!alreadyOpened) {
        SharedPreferences.Editor editor = sharedPref.edit();
        editor.putBoolean("already-opened", true);
        editor.apply();
        Handler handler = new Handler();
        handler.postDelayed(
                new Runnable() {
                    public void run() {
                        startActivity(new Intent(IntroActivity.this, MainActivity.class));
                        finish();
                    }
                }, 21000L);
    } else {
        startActivity(new Intent(IntroActivity.this, MainActivity.class));
        finish();
    }

    mVisible = true;
    mControlsView = findViewById(R.id.fullscreen_content_controls);
    mContentView = findViewById(R.id.fullscreen_content);

    simpleViewFlipper = (ViewFlipper) findViewById(R.id.view_flipper); // get the reference of ViewFlipper
    // Set up the user interaction to manually show or hide the system UI.
    mContentView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            toggle();
        }
    });


    for (int i = 0; i < images.length; i++) {
        // create the object of ImageView
        ImageView imageView = new ImageView(this);
        imageView.setImageResource(images[i]); // set image in ImageView
        simpleViewFlipper.addView(imageView); // add the created ImageView in ViewFlipper
    }
    // Declare in and out animations and load them using AnimationUtils class
    Animation in = AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left);
    Animation out = AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right);
    // set the animation type's to ViewFlipper
    simpleViewFlipper.setInAnimation(in);
    simpleViewFlipper.setOutAnimation(out);
    // set interval time for flipping between views
    simpleViewFlipper.setFlipInterval(3000);
    // set auto start for flipping between views
    simpleViewFlipper.setAutoStart(true);

}
 
Example 5
Source File: MediaListView.java    From AlarmOn with Apache License 2.0 4 votes vote down vote up
public void addToFlipper(ViewFlipper flipper) {
  this.flipper = flipper;
  flipper.setAnimateFirstView(false);
  flipper.addView(this);
}