Android Open Source - Paginize Inner Page Container






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;
/* w w w . j  a v a2 s .co  m*/
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup;
import net.neevek.android.lib.paginize.annotation.InnerPageContainerLayoutResId;
import net.neevek.android.lib.paginize.exception.InjectFailedException;

/**
 * An InnerPageContainer is a Page that is used to contain & manage InnerPages
 *
 * Date: 1/1/14
 * Time: 11:06 AM
 *
 * @author i@neevek.net
 * @version 1.0.0
 * @since 1.0.0
 */
public abstract class InnerPageContainer extends Page {
    private InnerPageManager mInnerPageManager;

    public InnerPageContainer(PageActivity pageActivity) {
        super(pageActivity);

        Class clazz = getClass();

        InnerPageContainerLayoutResId resIdAnnotation = null;

        try {
            do {
                if (clazz.isAnnotationPresent(InnerPageContainerLayoutResId.class)) {
                    resIdAnnotation = (InnerPageContainerLayoutResId)clazz.getAnnotation(InnerPageContainerLayoutResId.class);
                    break;
                }
            } while ((clazz = clazz.getSuperclass()) != InnerPageContainer.class);

        } catch (Exception e) {
            e.printStackTrace();
            throw new InjectFailedException(e);
        }

        if (resIdAnnotation == null) {
            throw new IllegalStateException("Must specify a layout for InnerPageContainer with the @InnerPageContainerLayoutResId annotation.");
        }

        View container = getView().findViewById(resIdAnnotation.value());
        if (container == null) {
            throw new IllegalStateException("Can not find the layout with the specified resource ID: " + resIdAnnotation.value());
        }
        if (!(container instanceof ViewGroup)) {
            throw new IllegalStateException("The specified layout for InnerPageContainer is not of type ViewGroup.");
        }
        mInnerPageManager = new InnerPageManager((ViewGroup)container);
    }

    public InnerPageManager getInnerPageManager() {
        return mInnerPageManager;
    }


    public void setInnerPage(InnerPage newPage, Object data) {
        mInnerPageManager.setPage(newPage, data);
    }

    public void unsetInnerPage() {
        mInnerPageManager.unsetPage();
    }

    public InnerPage getCurrentInnerPage() {
        return mInnerPageManager.getCurrentPage();
    }

    @Override
    public void onResume() {
        mInnerPageManager.onResume();
    }

    @Override
    public void onPause() {
        mInnerPageManager.onPause();
    }

    @Override
    public boolean onBackPressed() {
        return mInnerPageManager.onBackPressed();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        mInnerPageManager.onActivityResult(requestCode, resultCode, data);
    }

    @Override
    public void onShown(Object arg) {
        mInnerPageManager.onShown(arg);
    }

    @Override
    public void onHidden() {
        mInnerPageManager.onHidden();
    }

    @Override
    public void onCovered() {
        mInnerPageManager.onCovered();
    }

    @Override
    public void onUncovered(Object arg) {
        mInnerPageManager.onUncovered(arg);
    }
}




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