Android Open Source - Paginize Inner Page Manager






From Project

Back to project page Paginize.

License

The source code is released under:

Copyright (c) 2014 neevek <i at neevek.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal ...

If you think the Android project Paginize listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package net.neevek.android.lib.paginize;
/*from  ww w .java  2 s. c om*/
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;

/**
 * InnerPageManager manages the InnerPages, it swaps(setPage) the pages
 * when requested. It is usually used in a Page that is designed to hold
 * multiple InnerPages.
 *
 * Date: 9/30/13
 * Time: 10:32 AM
 *
 * @author i@neevek.net
 * @version 1.0.0
 * @since 1.0.0
 */
public class InnerPageManager {
    private ViewGroup mContainerView;

    private InnerPage mCurPage;

    public InnerPageManager(ViewGroup containerView) {
        mContainerView = containerView;
    }

    public void setPage(InnerPage newPage, Object data) {
        InnerPage oldPage = mCurPage;
        if (newPage == oldPage) {
            return;
        }

        if (oldPage != null) {
            oldPage.onReplaced();
            oldPage.getView().setVisibility(View.GONE);
        }

        if (newPage != null) {
            View newPageView = newPage.getView();

            if (mContainerView.indexOfChild(newPageView) == -1) {
                mContainerView.addView(newPageView);
                newPage.onAttach();
            }

            newPageView.bringToFront();
            newPageView.setVisibility(View.VISIBLE);
            newPage.onSet(data);
        }

        mCurPage = newPage;
    }

    // this method is rarely needed
    public void removePage(InnerPage page) {
        mContainerView.removeView(page.getView());
        page.onDetach();
    }

    public void unsetPage() {
        setPage(null, null);
    }

    public boolean onBackPressed() {
        if (mCurPage != null) {
            return mCurPage.onBackPressed();
        }

        return false;
    }

    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (mCurPage != null) {
            mCurPage.onActivityResult(requestCode, resultCode, data);
        }
    }

    public void onPause() {
        if (mCurPage != null) {
            mCurPage.onPause();
        }
    }

    public void onResume() {
        if (mCurPage != null) {
            mCurPage.onResume();
        }
    }

    public void onShown(Object arg) {
        if (mCurPage != null) {
            mCurPage.onShown(arg);
        }
    }

    public void onHidden() {
        if (mCurPage != null) {
            mCurPage.onHidden();
        }
    }

    public void onCovered() {
        if (mCurPage != null) {
            mCurPage.onCovered();
        }
    }

    public void onUncovered(Object arg) {
        if (mCurPage != null) {
            mCurPage.onUncovered(arg);
        }
    }

    public InnerPage getCurrentPage() {
        return mCurPage;
    }
}




Java Source Code List

net.neevek.android.demo.paginize.activities.MainActivity.java
net.neevek.android.demo.paginize.pages.general.FrameInnerPage.java
net.neevek.android.demo.paginize.pages.general.FramePage.java
net.neevek.android.demo.paginize.pages.main.MainPage.java
net.neevek.android.demo.paginize.pages.main.TabPage1.java
net.neevek.android.demo.paginize.pages.main.TabPage2.java
net.neevek.android.demo.paginize.pages.other.AlertPage.java
net.neevek.android.demo.paginize.pages.other.ListItemPage.java
net.neevek.android.demo.paginize.pages.other.ListPage.java
net.neevek.android.demo.paginize.pages.other.TestPage.java
net.neevek.android.demo.paginize.pages.viewpager.MyViewPagerPage.java
net.neevek.android.demo.paginize.pages.viewpager.ViewPageSubPage1.java
net.neevek.android.demo.paginize.pages.viewpager.ViewPageSubPage2.java
net.neevek.android.lib.paginize.InnerPageContainer.java
net.neevek.android.lib.paginize.InnerPageManager.java
net.neevek.android.lib.paginize.InnerPage.java
net.neevek.android.lib.paginize.PageActivity.java
net.neevek.android.lib.paginize.PageDataCallback.java
net.neevek.android.lib.paginize.PageManager.java
net.neevek.android.lib.paginize.PagePagerAdapter.java
net.neevek.android.lib.paginize.Page.java
net.neevek.android.lib.paginize.ViewPagerInnerPage.java
net.neevek.android.lib.paginize.ViewPagerPage.java
net.neevek.android.lib.paginize.ViewWrapper.java
net.neevek.android.lib.paginize.anim.PageAnimator.java
net.neevek.android.lib.paginize.anim.SlidePageAnimator.java
net.neevek.android.lib.paginize.anim.ZoomPageAnimator.java
net.neevek.android.lib.paginize.annotation.DecoratePageConstructor.java
net.neevek.android.lib.paginize.annotation.InheritPageLayout.java
net.neevek.android.lib.paginize.annotation.InjectPageAnimator.java
net.neevek.android.lib.paginize.annotation.InjectView.java
net.neevek.android.lib.paginize.annotation.InnerPageContainerLayoutResId.java
net.neevek.android.lib.paginize.annotation.PageLayout.java
net.neevek.android.lib.paginize.annotation.SetListeners.java
net.neevek.android.lib.paginize.annotation.ViewPagerResId.java
net.neevek.android.lib.paginize.exception.InjectFailedException.java
net.neevek.android.lib.paginize.exception.NotImplementedInterfaceException.java
net.neevek.android.lib.paginize.util.AnnotationUtils.java
net.neevek.android.lib.paginize.util.ViewFinder.java