FileDocCategorySizeDatePackage
RsListRS.javaAPI DocAndroid 5.1 API5892Thu Mar 12 22:22:44 GMT 2015com.example.android.rs.miscsamples

RsListRS

public class RsListRS extends Object

Fields Summary
private final int
STATE_LAST_FOCUS
private static final String[]
DATA_LIST
private android.content.res.Resources
mRes
private RenderScriptGL
mRS
private Font
mItalic
ScriptField_ListAllocs_s
mListAllocs
private ScriptC_rslist
mScript
int
mLastX
int
mLastY
Constructors Summary
public RsListRS()


      
    
Methods Summary
public voidinit(RenderScriptGL rs, android.content.res.Resources res)

        mRS = rs;
        mRes = res;
        initRS();
    
private voidinitRS()


        mScript = new ScriptC_rslist(mRS, mRes, R.raw.rslist);

        mListAllocs = new ScriptField_ListAllocs_s(mRS, DATA_LIST.length);
        for (int i = 0; i < DATA_LIST.length; i ++) {
            ScriptField_ListAllocs_s.Item listElem = new ScriptField_ListAllocs_s.Item();
            listElem.text = Allocation.createFromString(mRS, DATA_LIST[i], Allocation.USAGE_SCRIPT);
            mListAllocs.set(listElem, i, false);
        }

        mListAllocs.copyAll();

        mScript.bind_gList(mListAllocs);

        mItalic = Font.create(mRS, mRes, "serif", Font.Style.BOLD_ITALIC, 8);
        mScript.set_gItalic(mItalic);

        mRS.bindRootScript(mScript);
    
public voidonActionDown(int x, int y)

        mScript.set_gDY(0.0f);

        mLastX = x;
        mLastY = y;
    
public voidonActionMove(int x, int y)

        int dx = mLastX - x;
        int dy = mLastY - y;

        if (Math.abs(dy) <= 2) {
            dy = 0;
        }

        mScript.set_gDY(dy);

        mLastX = x;
        mLastY = y;