Java Code Examples for android.util.AttributeSet#getAttributeCount()
The following examples show how to use
android.util.AttributeSet#getAttributeCount() .
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: CameraBridgeViewBase.java From FTCVision with MIT License | 6 votes |
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(); }
Example 2
Source File: CameraBridgeViewBase.java From sudokufx with Apache License 2.0 | 6 votes |
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(); }
Example 3
Source File: CameraBridgeViewBase.java From react-native-documentscanner-android with MIT License | 6 votes |
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(); }
Example 4
Source File: ColorPicker.java From xDrip-plus with GNU General Public License v3.0 | 6 votes |
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; } } } }
Example 5
Source File: CameraBridgeViewBase.java From MOAAP with MIT License | 6 votes |
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(); }
Example 6
Source File: CameraBridgeViewBase.java From faceswap with Apache License 2.0 | 6 votes |
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(); }
Example 7
Source File: CameraBridgeViewBase.java From OpenCvFaceDetect with Apache License 2.0 | 6 votes |
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(); }
Example 8
Source File: CameraBridgeViewBase.java From Android-Car-duino with GNU General Public License v2.0 | 6 votes |
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(); }
Example 9
Source File: CameraBridgeViewBase.java From OpenCV-android with Apache License 2.0 | 6 votes |
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(); }
Example 10
Source File: CameraBridgeViewBase.java From FaceT with Mozilla Public License 2.0 | 6 votes |
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(); }
Example 11
Source File: CameraBridgeViewBase.java From AndroidDocumentScanner with MIT License | 6 votes |
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(); }
Example 12
Source File: CameraBridgeViewBase.java From real_time_circle_detection_android with MIT License | 6 votes |
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(); }
Example 13
Source File: PackageLite.java From AtlasForAndroid with MIT License | 6 votes |
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; } } }
Example 14
Source File: TextViewPreference.java From sensordatacollector with GNU General Public License v2.0 | 6 votes |
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); } } }
Example 15
Source File: SkinAttrSupport.java From ReadMark with Apache License 2.0 | 5 votes |
/** * 把这个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; }
Example 16
Source File: PreviewListPreference.java From WhereYouGo with GNU General Public License v3.0 | 5 votes |
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; } } }
Example 17
Source File: SkinAttrSupport.java From ReadMark with Apache License 2.0 | 5 votes |
/** * 把这个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; }
Example 18
Source File: NS_MOBILE_EXTRA.java From styT with Apache License 2.0 | 5 votes |
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; } } }
Example 19
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
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); }
Example 20
Source File: PackageParser.java From AndroidComponentPlugin with Apache License 2.0 | 4 votes |
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); }