package org.ligi.androidhelper.helpers;

import android.app.Activity;

public class ActivityHelper {

    private Activity mActivity;

    public ActivityHelper(Activity activity) {
        mActivity =activity;
    }

    public <T> T findById(int id) {
        return (T) mActivity.findViewById(id);
    }
}

@@ -62,16 +62,98 @@
 ctivity;
+%0Aimport android.content.pm.ActivityInfo;%0Aimport android.content.res.Configuration;
 %0A%0Apublic
@@ -381,11 +381,2168 @@
 );%0A    %7D
+%0A%0A    /**%0A     * dynamically disable rotation%0A     * to be used in onCreate%0A     * slightly modified from http://stackoverflow.com/a/8765901/322642%0A     */%0A    public void disableRotation() %7B%0A        switch (mActivity.getResources().getConfiguration().orientation)%7B%0A            case Configuration.ORIENTATION_PORTRAIT:%0A                if(android.os.Build.VERSION.SDK_INT %3C android.os.Build.VERSION_CODES.FROYO)%7B%0A                    mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);%0A                %7D else %7B%0A                    int rotation = mActivity.getWindowManager().getDefaultDisplay().getRotation();%0A                    if(rotation == android.view.Surface.ROTATION_90%7C%7C rotation == android.view.Surface.ROTATION_180)%7B%0A                        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);%0A                    %7D else %7B%0A                        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);%0A                    %7D%0A                %7D%0A                break;%0A%0A            case Configuration.ORIENTATION_LANDSCAPE:%0A                if(android.os.Build.VERSION.SDK_INT %3C android.os.Build.VERSION_CODES.FROYO)%7B%0A                    mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);%0A                %7D else %7B%0A                    int rotation = mActivity.getWindowManager().getDefaultDisplay().getRotation();%0A                    if(rotation == android.view.Surface.ROTATION_0 %7C%7C rotation == android.view.Surface.ROTATION_90)%7B%0A                        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);%0A                    %7D else %7B%0A                        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);%0A                    %7D%0A                %7D%0A                break;%0A        %7D//switch%0A    %7D%0A%0A    /**%0A     * dynamically enable rotation%0A     * counterpart to enableRotation%0A     * slightly modified from http://stackoverflow.com/a/8765901/322642%0A     */%0A    public void enableRotation() %7B%0A        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);%0A    %7D
 %0A%7D%0A

add function to enable and disable screen rotation