Java Code Examples for com.libra.Utils#rp2px()

The following examples show how to use com.libra.Utils#rp2px() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineBase.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, int value) {
    boolean ret = super.setRPAttribute(key, value);

    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_paintWidth:
                mLineWidth = Utils.rp2px(value);
                if (mLineWidth <= 0) {
                    mLineWidth = 1;
                }
                break;
            default:
                ret = false;
                break;
        }
    }

    return ret;
}
 
Example 2
Source File: LineBase.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, float value) {
    boolean ret = super.setRPAttribute(key, value);

    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_paintWidth:
                mLineWidth = Utils.rp2px(value);
                if (mLineWidth <= 0) {
                    mLineWidth = 1;
                }
                break;
            default:
                ret = false;
                break;
        }
    }

    return ret;
}
 
Example 3
Source File: TextBase.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, float value) {
    boolean ret = super.setRPAttribute(key, value);

    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_textSize:
                mTextSize = Utils.rp2px(value);
                break;

            default:
                ret = false;
        }
    }

    return ret;
}
 
Example 4
Source File: TextBase.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, int value) {
    boolean ret = super.setRPAttribute(key, value);

    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_textSize:
                mTextSize = Utils.rp2px(value);
                break;

            default:
                ret = false;
        }
    }

    return ret;
}
 
Example 5
Source File: NativeText.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, int value) {
    boolean ret = super.setRPAttribute(key, value);
    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_lineHeight:
                mLineHeight = Utils.rp2px(value);
                break;
            default:
                ret = false;
                break;
        }

    }

    return ret;
}
 
Example 6
Source File: NativeText.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, float value) {
    boolean ret = super.setRPAttribute(key, value);
    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_lineHeight:
                mLineHeight = Utils.rp2px(value);
                break;
            default:
                ret = false;
                break;
        }

    }

    return ret;
}
 
Example 7
Source File: GridLayout.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, float value) {
    boolean ret = super.setRPAttribute(key, value);
    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_itemHeight:
                mItemHeight = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_itemHorizontalMargin:
                mItemHorizontalMargin = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_itemVerticalMargin:
                mItemVerticalMargin = Utils.rp2px(value);
                break;
            default:
                ret = false;
                break;
        }
    }
    return ret;
}
 
Example 8
Source File: GridLayout.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, int value) {
    boolean ret = super.setRPAttribute(key, value);
    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_itemHeight:
                mItemHeight = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_itemHorizontalMargin:
                mItemHorizontalMargin = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_itemVerticalMargin:
                mItemVerticalMargin = Utils.rp2px(value);
                break;
            default:
                ret = false;
                break;
        }
    }
    return ret;
}
 
Example 9
Source File: Scroller.java    From Virtualview-Android with MIT License 5 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, float value) {
    boolean ret = super.setRPAttribute(key, value);

    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_span:
                mSpan = Utils.rp2px(value);
                break;

            case StringBase.STR_ID_lineSpace:
                mLineSpace = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_firstSpace:
                mFirstSpace = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_lastSpace:
                mLastSpace = Utils.rp2px(value);
                break;
            default:
                ret = false;
                break;
        }
    }

    return ret;
}
 
Example 10
Source File: Scroller.java    From Virtualview-Android with MIT License 5 votes vote down vote up
@Override
protected boolean setRPAttribute(int key, int value) {
    boolean ret = super.setRPAttribute(key, value);

    if (!ret) {
        ret = true;
        switch (key) {
            case StringBase.STR_ID_span:
                mSpan = Utils.rp2px(value);
                break;

            case StringBase.STR_ID_lineSpace:
                mLineSpace = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_firstSpace:
                mFirstSpace = Utils.rp2px(value);
                break;
            case StringBase.STR_ID_lastSpace:
                mLastSpace = Utils.rp2px(value);
                break;
            default:
                ret = false;
                break;
        }
    }

    return ret;
}
 
Example 11
Source File: Layout.java    From Virtualview-Android with MIT License 4 votes vote down vote up
public boolean setRPAttribute(int key, float value) {
    boolean ret = true;

    switch (key) {
        case StringBase.STR_ID_layoutWidth:
            mLayoutWidth = Utils.rp2px(value);
            break;
        case StringBase.STR_ID_layoutHeight:
            mLayoutHeight = Utils.rp2px(value);
            break;
        case StringBase.STR_ID_layoutMargin:
            mLayoutMargin = Utils.rp2px(value);
            if (!isLayoutMarginLeftSet) {
                mLayoutMarginLeft = mLayoutMargin;
            }
            if (!isLayoutMarginRightSet) {
                mLayoutMarginRight = mLayoutMargin;
            }
            if (!isLayoutMarginTopSet) {
                mLayoutMarginTop = mLayoutMargin;
            }
            if (!isLayoutMarginBottomSet) {
                mLayoutMarginBottom = mLayoutMargin;
            }
            break;
        case StringBase.STR_ID_layoutMarginLeft:
            mLayoutMarginLeft = Utils.rp2px(value);
            isLayoutMarginLeftSet = true;
            break;
        case StringBase.STR_ID_layoutMarginRight:
            mLayoutMarginRight = Utils.rp2px(value);
            isLayoutMarginRightSet = true;
            break;
        case StringBase.STR_ID_layoutMarginTop:
            mLayoutMarginTop = Utils.rp2px(value);
            isLayoutMarginTopSet = true;
            break;
        case StringBase.STR_ID_layoutMarginBottom:
            mLayoutMarginBottom = Utils.rp2px(value);
            isLayoutMarginBottomSet = true;
            break;

        default:
            ret = false;
    }

    return ret;
}
 
Example 12
Source File: Layout.java    From Virtualview-Android with MIT License 4 votes vote down vote up
public boolean setRPAttribute(int key, int value) {
    boolean ret = true;

    switch (key) {
        case StringBase.STR_ID_layoutWidth:
            mLayoutWidth = Utils.rp2px(value);
            break;
        case StringBase.STR_ID_layoutHeight:
            mLayoutHeight = Utils.rp2px(value);
            break;
        case StringBase.STR_ID_layoutMargin:
            mLayoutMargin = Utils.rp2px(value);
            if (!isLayoutMarginLeftSet) {
                mLayoutMarginLeft = mLayoutMargin;
            }
            if (!isLayoutMarginRightSet) {
                mLayoutMarginRight = mLayoutMargin;
            }
            if (!isLayoutMarginTopSet) {
                mLayoutMarginTop = mLayoutMargin;
            }
            if (!isLayoutMarginBottomSet) {
                mLayoutMarginBottom = mLayoutMargin;
            }
            break;
        case StringBase.STR_ID_layoutMarginLeft:
            mLayoutMarginLeft = Utils.rp2px(value);
            isLayoutMarginLeftSet = true;
            break;
        case StringBase.STR_ID_layoutMarginRight:
            mLayoutMarginRight = Utils.rp2px(value);
            isLayoutMarginRightSet = true;
            break;
        case StringBase.STR_ID_layoutMarginTop:
            mLayoutMarginTop = Utils.rp2px(value);
            isLayoutMarginTopSet = true;
            break;
        case StringBase.STR_ID_layoutMarginBottom:
            mLayoutMarginBottom = Utils.rp2px(value);
            isLayoutMarginBottomSet = true;
            break;

        default:
            ret = false;
    }

    return ret;
}