android.util.AttributeSet#getAttributeCount ( )源码实例Demo

下面列出了android.util.AttributeSet#getAttributeCount ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: OpenCV-android   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码2 项目: sensordatacollector   文件: TextViewPreference.java
public TextViewPreference(Context context, AttributeSet attrs)
{
    super(context, attrs);

    for(int i = 0; i < attrs.getAttributeCount(); i++) {
        String attr = attrs.getAttributeName(i);
        String val = attrs.getAttributeValue(i);

        if("title".equals(attr)) {
            this.title = context.getString(Integer.parseInt(val.substring(1)));
        }
        if("summary".equals(attr)) {
            this.description = context.getString(Integer.parseInt(val.substring(1)));
        }

        if("clickable".equals(attr) && "false".equals(val)) {
            this.setEnabled(false);
        }
    }
}
 
源代码3 项目: AtlasForAndroid   文件: PackageLite.java
private static void parseComponentData(PackageLite packageLite, XmlPullParser xmlPullParser, AttributeSet attributeSet, boolean z) throws XmlPullParserException {
    int i = 0;
    String str = packageLite.packageName;
    int i2 = 0;
    while (i < attributeSet.getAttributeCount()) {
        if (attributeSet.getAttributeName(i).equals(MtopResponse.KEY_NAME)) {
            String attributeValue = attributeSet.getAttributeValue(i);
            if (attributeValue.startsWith(".")) {
                attributeValue = str.concat(str);
            }
            packageLite.components.add(attributeValue);
            if (z && !(StringUtils.equals(attributeValue, XMLDISABLECOMPONENT_SSO_ALIPAY_AUTHENTICATION_SERVICE) && StringUtils.equals(attributeValue, XMLDISABLECOMPONENT_SSO_AUTHENTICATION_SERVICE))) {
                packageLite.disableComponents.add(attributeValue);
            }
            i2++;
        }
        if (i2 < attributeSet.getAttributeCount()) {
            i++;
        } else {
            return;
        }
    }
}
 
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码6 项目: FaceT   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码7 项目: FTCVision   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码8 项目: Android-Car-duino   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码9 项目: OpenCvFaceDetect   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码10 项目: faceswap   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码11 项目: MOAAP   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码12 项目: xDrip-plus   文件: ColorPicker.java
public ColorPicker(Context context, AttributeSet attrs) {
    super(context, attrs);
    if (attrs != null) {
        for (int i = 0; i < attrs.getAttributeCount(); i++) {
            if (attrs.getAttributeName(i).equals("defaultValue")) {
                final String this_value = attrs.getAttributeValue(i);

                if (this_value.length() > 0) {
                    if (debug)
                        Log.d(TAG, "Attribute debug: " + i + " " + attrs.getAttributeName(i) + " " + this_value);
                    if (this_value.startsWith("@")) {
                        localDefaultValue = Color.parseColor(getStringResourceByName(this_value));
                    } else {
                        localDefaultValue = Color.parseColor(this_value);
                    }
                    localDefaultValue = Color.parseColor(attrs.getAttributeValue(i));
                    super.defaultColor = localDefaultValue;
                } else {
                    Log.w(TAG, "No default value for colorpicker");
                }
                break;
            }

        }
    }
}
 
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码14 项目: sudokufx   文件: CameraBridgeViewBase.java
public CameraBridgeViewBase(Context context, AttributeSet attrs) {
    super(context, attrs);

    int count = attrs.getAttributeCount();
    Log.d(TAG, "Attr count: " + Integer.valueOf(count));

    TypedArray styledAttrs = getContext().obtainStyledAttributes(attrs, R.styleable.CameraBridgeViewBase);
    if (styledAttrs.getBoolean(R.styleable.CameraBridgeViewBase_show_fps, false))
        enableFpsMeter();

    mCameraIndex = styledAttrs.getInt(R.styleable.CameraBridgeViewBase_camera_id, -1);

    getHolder().addCallback(this);
    mMaxWidth = MAX_UNSPECIFIED;
    mMaxHeight = MAX_UNSPECIFIED;
    styledAttrs.recycle();
}
 
源代码15 项目: ReadMark   文件: SkinAttrSupport.java
/**
 * 把这个View的属性中需要的(SkinType, entryName)对取出来(作为SkinAttr类)
 * @param context
 * @param attrs
 * @return
 */
public static List<SkinAttr> getAttrs(Context context, AttributeSet attrs) {
    //把background、src、textColor解析出来
    List<SkinAttr> result = new ArrayList<>();

    //开始解析所有属性
    int length = attrs.getAttributeCount();
    for (int i=0; i<length; i++){
        //获取属性名称
        String name = attrs.getAttributeName(i);
        //获取属性值
        String value = attrs.getAttributeValue(i);
        //Log.e(TAG, name + "  "+ value);

        //检查是否存在所需属性名称
        SkinType skinType = getTargetSkinType(name);

        //如果是所需要的属性名
        if(skinType != null){
            //获取属性值名称
            String resName = getResName(context, value);

            if(TextUtils.isEmpty(resName)){
                continue;
            }

            SkinAttr attr = new SkinAttr(resName, skinType);
            result.add(attr);
        }

    }
    return result;
}
 
源代码16 项目: ReadMark   文件: SkinAttrSupport.java
/**
 * 把这个View的属性中需要的(SkinType, entryName)对取出来(作为SkinAttr类)
 * @param context
 * @param attrs
 * @return
 */
public static List<SkinAttr> getAttrs(Context context, AttributeSet attrs) {
    //把background、src、textColor解析出来
    List<SkinAttr> result = new ArrayList<>();

    //开始解析所有属性
    int length = attrs.getAttributeCount();
    for (int i=0; i<length; i++){
        //获取属性名称
        String name = attrs.getAttributeName(i);
        //获取属性值
        String value = attrs.getAttributeValue(i);
        //Log.e(TAG, name + "  "+ value);

        //检查是否存在所需属性名称
        SkinType skinType = getTargetSkinType(name);

        //如果是所需要的属性名
        if(skinType != null){
            //获取属性值名称
            String resName = getResName(context, value);

            if(TextUtils.isEmpty(resName)){
                continue;
            }

            SkinAttr attr = new SkinAttr(resName, skinType);
            result.add(attr);
        }

    }
    return result;
}
 
源代码17 项目: WhereYouGo   文件: PreviewListPreference.java
public PreviewListPreference(Context context, AttributeSet attrs) {
    super(context, attrs);
    summaryTemplate = super.getSummary();

    for (int i = 0; i < attrs.getAttributeCount(); i++) {

        String attr = attrs.getAttributeName(i);
        String val = attrs.getAttributeValue(i);
        if (attr.equalsIgnoreCase("previewTemplate")) {
            previewTemplate = val;
        }
    }
}
 
源代码18 项目: styT   文件: NS_MOBILE_EXTRA.java
public NS_MOBILE_EXTRA(Context context, AttributeSet attrs) {
    super(context, attrs);
    setDialogLayoutResource(R.layout.preference_seekbar);

    for (int i = 0; i < attrs.getAttributeCount(); i++) {
        String attr = attrs.getAttributeName(i);
        if (attr.equalsIgnoreCase("pref_kind")) {
            prefKind = attrs.getAttributeValue(i);
            break;
        }
    }
}
 
源代码19 项目: AndroidComponentPlugin   文件: PackageParser.java
private static PackageLite parsePackageLite(Resources res, XmlPullParser parser,
        AttributeSet attrs, int flags, String[] outError) throws IOException,
        XmlPullParserException {

    int type;
    while ((type = parser.next()) != XmlPullParser.START_TAG
            && type != XmlPullParser.END_DOCUMENT) {
        ;
    }

    if (type != XmlPullParser.START_TAG) {
        outError[0] = "No start tag found";
        return null;
    }
    if (DEBUG_PARSER)
        Slog.v(TAG, "Root element name: '" + parser.getName() + "'");
    if (!parser.getName().equals("manifest")) {
        outError[0] = "No <manifest> tag";
        return null;
    }
    String pkgName = attrs.getAttributeValue(null, "package");
    if (pkgName == null || pkgName.length() == 0) {
        outError[0] = "<manifest> does not specify package";
        return null;
    }
    String nameError = validateName(pkgName, true);
    if (nameError != null && !"android".equals(pkgName)) {
        outError[0] = "<manifest> specifies bad package name \""
            + pkgName + "\": " + nameError;
        return null;
    }
    int installLocation = PARSE_DEFAULT_INSTALL_LOCATION;
    for (int i = 0; i < attrs.getAttributeCount(); i++) {
        String attr = attrs.getAttributeName(i);
        if (attr.equals("installLocation")) {
            installLocation = attrs.getAttributeIntValue(i,
                    PARSE_DEFAULT_INSTALL_LOCATION);
            break;
        }
    }

    // Only search the tree when the tag is directly below <manifest>
    final int searchDepth = parser.getDepth() + 1;

    final List<VerifierInfo> verifiers = new ArrayList<VerifierInfo>();
    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
            && (type != XmlPullParser.END_TAG || parser.getDepth() >= searchDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }

        if (parser.getDepth() == searchDepth && "package-verifier".equals(parser.getName())) {
            final VerifierInfo verifier = parseVerifier(res, parser, attrs, flags, outError);
            if (verifier != null) {
                verifiers.add(verifier);
            }
        }
    }

    return new PackageLite(pkgName.intern(), installLocation, verifiers);
}
 
源代码20 项目: AndroidComponentPlugin   文件: PackageParser.java
private static PackageLite parsePackageLite(Resources res, XmlPullParser parser,
        AttributeSet attrs, int flags, String[] outError) throws IOException,
        XmlPullParserException {

    int type;
    while ((type = parser.next()) != XmlPullParser.START_TAG
            && type != XmlPullParser.END_DOCUMENT) {
        ;
    }

    if (type != XmlPullParser.START_TAG) {
        outError[0] = "No start tag found";
        return null;
    }
    if (DEBUG_PARSER)
        Slog.v(TAG, "Root element name: '" + parser.getName() + "'");
    if (!parser.getName().equals("manifest")) {
        outError[0] = "No <manifest> tag";
        return null;
    }
    String pkgName = attrs.getAttributeValue(null, "package");
    if (pkgName == null || pkgName.length() == 0) {
        outError[0] = "<manifest> does not specify package";
        return null;
    }
    String nameError = validateName(pkgName, true);
    if (nameError != null && !"android".equals(pkgName)) {
        outError[0] = "<manifest> specifies bad package name \""
            + pkgName + "\": " + nameError;
        return null;
    }
    int installLocation = PARSE_DEFAULT_INSTALL_LOCATION;
    int versionCode = 0;
    int numFound = 0;
    for (int i = 0; i < attrs.getAttributeCount(); i++) {
        String attr = attrs.getAttributeName(i);
        if (attr.equals("installLocation")) {
            installLocation = attrs.getAttributeIntValue(i,
                    PARSE_DEFAULT_INSTALL_LOCATION);
            numFound++;
        } else if (attr.equals("versionCode")) {
            versionCode = attrs.getAttributeIntValue(i, 0);
            numFound++;
        }
        if (numFound >= 2) {
            break;
        }
    }

    // Only search the tree when the tag is directly below <manifest>
    final int searchDepth = parser.getDepth() + 1;

    final List<VerifierInfo> verifiers = new ArrayList<VerifierInfo>();
    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
            && (type != XmlPullParser.END_TAG || parser.getDepth() >= searchDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }

        if (parser.getDepth() == searchDepth && "package-verifier".equals(parser.getName())) {
            final VerifierInfo verifier = parseVerifier(res, parser, attrs, flags, outError);
            if (verifier != null) {
                verifiers.add(verifier);
            }
        }
    }

    return new PackageLite(pkgName.intern(), versionCode, installLocation, verifiers);
}