diff --git a/library/src/main/java/org/lucasr/dspec/DesignSpecActivity.java b/library/src/main/java/org/lucasr/dspec/DesignSpecActivity.java new file mode 100644 index 0000000..8d9319c --- /dev/null +++ b/library/src/main/java/org/lucasr/dspec/DesignSpecActivity.java @@ -0,0 +1,46 @@ +package org.lucasr.dspec; + +import android.app.Activity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.FrameLayout; + +/** + * Created with IntelliJ IDEA. + * User: Sergey Chuvashev + * Date: 08.09.14 + * Time: 23:30 + */ +public class DesignSpecActivity extends Activity { + + private DesignSpecFrameLayout mDesignSpecFrameLayout; + + @Override + public void onContentChanged() { + super.onContentChanged(); + + ViewGroup rootView = (ViewGroup) findViewById(android.R.id.content); + + DesignSpecFrameLayout designSpecFrameLayout = new DesignSpecFrameLayout(this); + + mDesignSpecFrameLayout = designSpecFrameLayout; + + int childCount = rootView.getChildCount(); + + View child; + for (int i = childCount - 1; i >= 0; i--) { + child = rootView.getChildAt(i); + rootView.removeView(child); + designSpecFrameLayout.addView(child); + } + + rootView.addView(designSpecFrameLayout, + new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); + } + + public DesignSpec getDesignSpec() { + return mDesignSpecFrameLayout.getDesignSpec(); + } + +}