Android Open Source - Skeleton Layout Helper






From Project

Back to project page Skeleton.

License

The source code is released under:

Apache License

If you think the Android project Skeleton 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 com.gordon.skeleton.annotations;
//from   w w  w .  ja  va 2 s. com
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import java.util.LinkedHashMap;
import java.util.Map;

import flow.Layout;

/**
 * Created by kg on 11/4/14.
 */
public class LayoutHelper {

    private static final Map<Class, Integer> LAYOUT_CACHE = new LinkedHashMap<Class, Integer>();

    public static View inflate(Context context, ViewGroup parent, Object screen) {
        return LayoutInflater.from(context).inflate(getLayout(screen), parent, false);
    }

    private static int getLayout(Object screen) {
        Class screenType = screen.getClass();
        if (!LAYOUT_CACHE.containsKey(screenType)) {
            LAYOUT_CACHE.put(screenType, AnnotationHelper.getAnnotation(screen, Layout.class).value());
        }
        return LAYOUT_CACHE.get(screenType);
    }
}




Java Source Code List

com.gordon.skeleton.ApplicationTest.java
com.gordon.skeleton.SkeletonActivity.java
com.gordon.skeleton.annotations.AnnotationHelper.java
com.gordon.skeleton.annotations.LayoutHelper.java
com.gordon.skeleton.annotations.MenuLayout.java
com.gordon.skeleton.containers.Container.java
com.gordon.skeleton.flow.FlowBundler.java
com.gordon.skeleton.flow.GsonParcer.java
com.gordon.skeleton.presenters.Presenter.java
com.gordon.skeleton.screens.ScreenManager.java
com.gordon.skeleton.screens.ScreenSwitcher.java
com.gordon.skeleton.screens.Screen.java
com.gordon.skeleton.utils.SkeletonDialog.java