List of usage examples for android.content.res TypedArray getString
@Nullable public String getString(@StyleableRes int index)
From source file:com.github.shareme.gwsmaterialuikit.library.material.widget.EditText.java
@Override protected void applyStyle(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super.applyStyle(context, attrs, defStyleAttr, defStyleRes); CharSequence text = mInputView == null ? null : mInputView.getText(); removeAllViews();/*from w w w . j a v a 2 s.c o m*/ TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.EditText, defStyleAttr, defStyleRes); int labelPadding = -1; int labelTextSize = -1; ColorStateList labelTextColor = null; int supportPadding = -1; int supportTextSize = -1; ColorStateList supportColors = null; ColorStateList supportErrorColors = null; String supportHelper = null; String supportError = null; ColorStateList dividerColors = null; ColorStateList dividerErrorColors = null; int dividerHeight = -1; int dividerPadding = -1; int dividerAnimDuration = -1; mAutoCompleteMode = a.getInteger(R.styleable.EditText_et_autoCompleteMode, mAutoCompleteMode); if (needCreateInputView(mAutoCompleteMode)) { switch (mAutoCompleteMode) { case AUTOCOMPLETE_MODE_SINGLE: mInputView = new InternalAutoCompleteTextView(context, attrs, defStyleAttr); break; case AUTOCOMPLETE_MODE_MULTI: mInputView = new InternalMultiAutoCompleteTextView(context, attrs, defStyleAttr); break; default: mInputView = new InternalEditText(context, attrs, defStyleAttr); break; } ViewUtil.applyFont(mInputView, attrs, defStyleAttr, defStyleRes); if (text != null) mInputView.setText(text); mInputView.addTextChangedListener(new InputTextWatcher()); if (mDivider != null) { mDivider.setAnimEnable(false); ViewUtil.setBackground(mInputView, mDivider); mDivider.setAnimEnable(true); } } else ViewUtil.applyStyle(mInputView, attrs, defStyleAttr, defStyleRes); mInputView.setVisibility(View.VISIBLE); mInputView.setFocusableInTouchMode(true); for (int i = 0, count = a.getIndexCount(); i < count; i++) { int attr = a.getIndex(i); if (attr == R.styleable.EditText_et_labelEnable) mLabelEnable = a.getBoolean(attr, false); else if (attr == R.styleable.EditText_et_labelPadding) labelPadding = a.getDimensionPixelSize(attr, 0); else if (attr == R.styleable.EditText_et_labelTextSize) labelTextSize = a.getDimensionPixelSize(attr, 0); else if (attr == R.styleable.EditText_et_labelTextColor) labelTextColor = a.getColorStateList(attr); else if (attr == R.styleable.EditText_et_labelTextAppearance) getLabelView().setTextAppearance(context, a.getResourceId(attr, 0)); else if (attr == R.styleable.EditText_et_labelEllipsize) { int labelEllipsize = a.getInteger(attr, 0); switch (labelEllipsize) { case 1: getLabelView().setEllipsize(TruncateAt.START); break; case 2: getLabelView().setEllipsize(TruncateAt.MIDDLE); break; case 3: getLabelView().setEllipsize(TruncateAt.END); break; case 4: getLabelView().setEllipsize(TruncateAt.MARQUEE); break; default: getLabelView().setEllipsize(TruncateAt.END); break; } } else if (attr == R.styleable.EditText_et_labelInAnim) mLabelInAnimId = a.getResourceId(attr, 0); else if (attr == R.styleable.EditText_et_labelOutAnim) mLabelOutAnimId = a.getResourceId(attr, 0); else if (attr == R.styleable.EditText_et_supportMode) mSupportMode = a.getInteger(attr, 0); else if (attr == R.styleable.EditText_et_supportPadding) supportPadding = a.getDimensionPixelSize(attr, 0); else if (attr == R.styleable.EditText_et_supportTextSize) supportTextSize = a.getDimensionPixelSize(attr, 0); else if (attr == R.styleable.EditText_et_supportTextColor) supportColors = a.getColorStateList(attr); else if (attr == R.styleable.EditText_et_supportTextErrorColor) supportErrorColors = a.getColorStateList(attr); else if (attr == R.styleable.EditText_et_supportTextAppearance) getSupportView().setTextAppearance(context, a.getResourceId(attr, 0)); else if (attr == R.styleable.EditText_et_supportEllipsize) { int supportEllipsize = a.getInteger(attr, 0); switch (supportEllipsize) { case 1: getSupportView().setEllipsize(TruncateAt.START); break; case 2: getSupportView().setEllipsize(TruncateAt.MIDDLE); break; case 3: getSupportView().setEllipsize(TruncateAt.END); break; case 4: getSupportView().setEllipsize(TruncateAt.MARQUEE); break; default: getSupportView().setEllipsize(TruncateAt.END); break; } } else if (attr == R.styleable.EditText_et_supportMaxLines) getSupportView().setMaxLines(a.getInteger(attr, 0)); else if (attr == R.styleable.EditText_et_supportLines) getSupportView().setLines(a.getInteger(attr, 0)); else if (attr == R.styleable.EditText_et_supportSingleLine) getSupportView().setSingleLine(a.getBoolean(attr, false)); else if (attr == R.styleable.EditText_et_supportMaxChars) mSupportMaxChars = a.getInteger(attr, 0); else if (attr == R.styleable.EditText_et_helper) supportHelper = a.getString(attr); else if (attr == R.styleable.EditText_et_error) supportError = a.getString(attr); else if (attr == R.styleable.EditText_et_inputId) mInputView.setId(a.getResourceId(attr, 0)); else if (attr == R.styleable.EditText_et_dividerColor) dividerColors = a.getColorStateList(attr); else if (attr == R.styleable.EditText_et_dividerErrorColor) dividerErrorColors = a.getColorStateList(attr); else if (attr == R.styleable.EditText_et_dividerHeight) dividerHeight = a.getDimensionPixelSize(attr, 0); else if (attr == R.styleable.EditText_et_dividerPadding) dividerPadding = a.getDimensionPixelSize(attr, 0); else if (attr == R.styleable.EditText_et_dividerAnimDuration) dividerAnimDuration = a.getInteger(attr, 0); else if (attr == R.styleable.EditText_et_dividerCompoundPadding) mDividerCompoundPadding = a.getBoolean(attr, true); } a.recycle(); if (mInputView.getId() == 0) mInputView.setId(ViewUtil.generateViewId()); if (mDivider == null) { mDividerColors = dividerColors; mDividerErrorColors = dividerErrorColors; if (mDividerColors == null) { int[][] states = new int[][] { new int[] { -android.R.attr.state_focused }, new int[] { android.R.attr.state_focused, android.R.attr.state_enabled }, }; int[] colors = new int[] { ThemeUtil.colorControlNormal(context, 0xFF000000), ThemeUtil.colorControlActivated(context, 0xFF000000), }; mDividerColors = new ColorStateList(states, colors); } if (mDividerErrorColors == null) mDividerErrorColors = ColorStateList.valueOf(ThemeUtil.colorAccent(context, 0xFFFF0000)); if (dividerHeight < 0) dividerHeight = 0; if (dividerPadding < 0) dividerPadding = 0; if (dividerAnimDuration < 0) dividerAnimDuration = context.getResources().getInteger(android.R.integer.config_shortAnimTime); mDividerPadding = dividerPadding; mInputView.setPadding(0, 0, 0, mDividerPadding + dividerHeight); mDivider = new DividerDrawable(dividerHeight, mDividerCompoundPadding ? mInputView.getTotalPaddingLeft() : 0, mDividerCompoundPadding ? mInputView.getTotalPaddingRight() : 0, mDividerColors, dividerAnimDuration); mDivider.setInEditMode(isInEditMode()); mDivider.setAnimEnable(false); ViewUtil.setBackground(mInputView, mDivider); mDivider.setAnimEnable(true); } else { if (dividerHeight >= 0 || dividerPadding >= 0) { if (dividerHeight < 0) dividerHeight = mDivider.getDividerHeight(); if (dividerPadding >= 0) mDividerPadding = dividerPadding; mInputView.setPadding(0, 0, 0, mDividerPadding + dividerHeight); mDivider.setDividerHeight(dividerHeight); mDivider.setPadding(mDividerCompoundPadding ? mInputView.getTotalPaddingLeft() : 0, mDividerCompoundPadding ? mInputView.getTotalPaddingRight() : 0); } if (dividerColors != null) mDividerColors = dividerColors; if (dividerErrorColors != null) mDividerErrorColors = dividerErrorColors; mDivider.setColor(getError() == null ? mDividerColors : mDividerErrorColors); if (dividerAnimDuration >= 0) mDivider.setAnimationDuration(dividerAnimDuration); } if (labelPadding >= 0) getLabelView().setPadding(mDivider.getPaddingLeft(), 0, mDivider.getPaddingRight(), labelPadding); if (labelTextSize >= 0) getLabelView().setTextSize(TypedValue.COMPLEX_UNIT_PX, labelTextSize); if (labelTextColor != null) getLabelView().setTextColor(labelTextColor); if (mLabelEnable) { mLabelVisible = true; getLabelView().setText(mInputView.getHint()); addView(getLabelView(), 0, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); setLabelVisible(!TextUtils.isEmpty(mInputView.getText().toString()), false); } if (supportTextSize >= 0) getSupportView().setTextSize(TypedValue.COMPLEX_UNIT_PX, supportTextSize); if (supportColors != null) mSupportColors = supportColors; else if (mSupportColors == null) mSupportColors = context.getResources().getColorStateList(R.color.abc_secondary_text_material_light); if (supportErrorColors != null) mSupportErrorColors = supportErrorColors; else if (mSupportErrorColors == null) mSupportErrorColors = ColorStateList.valueOf(ThemeUtil.colorAccent(context, 0xFFFF0000)); if (supportPadding >= 0) getSupportView().setPadding(mDivider.getPaddingLeft(), supportPadding, mDivider.getPaddingRight(), 0); if (supportHelper == null && supportError == null) getSupportView().setTextColor(getError() == null ? mSupportColors : mSupportErrorColors); else if (supportHelper != null) setHelper(supportHelper); else setError(supportError); if (mSupportMode != SUPPORT_MODE_NONE) { switch (mSupportMode) { case SUPPORT_MODE_CHAR_COUNTER: getSupportView().setGravity(Gravity.END); updateCharCounter(mInputView.getText().length()); break; case SUPPORT_MODE_HELPER: case SUPPORT_MODE_HELPER_WITH_ERROR: getSupportView().setGravity(GravityCompat.START); break; } addView(getSupportView(), new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); } addView(mInputView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); requestLayout(); }
From source file:android.support.v71.widget.RecyclerView.java
public RecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); LogUtil.e("---------------RecyclerView --------------------- "); // /*from w w w . j a va 2 s . c om*/ setScrollContainer(true); // touch ? setFocusableInTouchMode(true); final int version = Build.VERSION.SDK_INT; //TODO > 16 ? mPostUpdatesOnAnimation = version >= 16; // ? ? ?? final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); // ? ? setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER); // ? mItemAnimator.setListener(mItemAnimatorListener); // ? adapter Manager initAdapterManager(); initChildrenHelper(); // If not explicitly specified this view is important for accessibility. // , RecycleView ?? accessibility if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } // ? AccessibilityManager ? ?, ? ??, ? app ? mAccessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); setAccessibilityDelegateCompat(new android.support.v71.widget.RecyclerViewAccessibilityDelegate(this)); // Create the layoutManager if specified. if (attrs != null) { int defStyleRes = 0; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecyclerView, defStyle, defStyleRes); //xml ? LayoutManager String layoutManagerName = a.getString(R.styleable.RecyclerView_layoutManager); a.recycle(); createLayoutManager(context, layoutManagerName, attrs, defStyle, defStyleRes); } // mScrollingChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true); }
From source file:org.kde.necessitas.ministro.ExtractStyle.java
public JSONObject extractTextAppearanceInformations(String styleName, String qtClass, AttributeSet attribSet, int textAppearance) { JSONObject json = new JSONObject(); try {//from w w w .ja v a2 s . c o m int textColorHighlight = 0; // ColorStateList textColor = null; // ColorStateList textColorHint = null; // ColorStateList textColorLink = null; // int textSize = 15; // int typefaceIndex = -1; // int styleIndex = -1; boolean allCaps = false; Class<?> attrClass = Class.forName("android.R$attr"); int styleId = attrClass.getDeclaredField(styleName).getInt(null); extractViewInformations(styleName, styleId, json, qtClass, attribSet); int[] textViewAttrs = (int[]) styleableClass.getDeclaredField("TextView").get(null); TypedArray a = m_theme.obtainStyledAttributes(null, textViewAttrs, styleId, 0); TypedArray appearance = null; if (-1 == textAppearance) textAppearance = a .getResourceId(styleableClass.getDeclaredField("TextView_textAppearance").getInt(null), -1); if (textAppearance != -1) appearance = m_theme.obtainStyledAttributes(textAppearance, (int[]) styleableClass.getDeclaredField("TextAppearance").get(null)); if (appearance != null) { int n = appearance.getIndexCount(); for (int i = 0; i < n; i++) { int attr = appearance.getIndex(i); if (attr == TextAppearance_textColorHighlight) textColorHighlight = appearance.getColor(attr, textColorHighlight); else if (attr == TextAppearance_textColor) textColor = appearance.getColorStateList(attr); else if (attr == TextAppearance_textColorHint) textColorHint = appearance.getColorStateList(attr); else if (attr == TextAppearance_textColorLink) textColorLink = appearance.getColorStateList(attr); else if (attr == TextAppearance_textSize) textSize = appearance.getDimensionPixelSize(attr, textSize); else if (attr == TextAppearance_typeface) typefaceIndex = appearance.getInt(attr, -1); else if (attr == TextAppearance_textStyle) styleIndex = appearance.getInt(attr, -1); else if (attr == TextAppearance_textAllCaps) allCaps = appearance.getBoolean(attr, false); } appearance.recycle(); } int n = a.getIndexCount(); for (int i = 0; i < n; i++) { int attr = a.getIndex(i); if (attr == TextView_editable) json.put("TextView_editable", a.getBoolean(attr, false)); else if (attr == TextView_inputMethod) json.put("TextView_inputMethod", a.getText(attr)); else if (attr == TextView_numeric) json.put("TextView_numeric", a.getInt(attr, 0)); else if (attr == TextView_digits) json.put("TextView_digits", a.getText(attr)); else if (attr == TextView_phoneNumber) json.put("TextView_phoneNumber", a.getBoolean(attr, false)); else if (attr == TextView_autoText) json.put("TextView_autoText", a.getBoolean(attr, false)); else if (attr == TextView_capitalize) json.put("TextView_capitalize", a.getInt(attr, -1)); else if (attr == TextView_bufferType) json.put("TextView_bufferType", a.getInt(attr, 0)); else if (attr == TextView_selectAllOnFocus) json.put("TextView_selectAllOnFocus", a.getBoolean(attr, false)); else if (attr == TextView_autoLink) json.put("TextView_autoLink", a.getInt(attr, 0)); else if (attr == TextView_linksClickable) json.put("TextView_linksClickable", a.getBoolean(attr, true)); else if (attr == TextView_linksClickable) json.put("TextView_linksClickable", a.getBoolean(attr, true)); else if (attr == TextView_drawableLeft) json.put("TextView_drawableLeft", getDrawable(a.getDrawable(attr), styleName + "_TextView_drawableLeft")); else if (attr == TextView_drawableTop) json.put("TextView_drawableTop", getDrawable(a.getDrawable(attr), styleName + "_TextView_drawableTop")); else if (attr == TextView_drawableRight) json.put("TextView_drawableRight", getDrawable(a.getDrawable(attr), styleName + "_TextView_drawableRight")); else if (attr == TextView_drawableBottom) json.put("TextView_drawableBottom", getDrawable(a.getDrawable(attr), styleName + "_TextView_drawableBottom")); else if (attr == TextView_drawableStart) json.put("TextView_drawableStart", getDrawable(a.getDrawable(attr), styleName + "_TextView_drawableStart")); else if (attr == TextView_drawableEnd) json.put("TextView_drawableEnd", getDrawable(a.getDrawable(attr), styleName + "_TextView_drawableEnd")); else if (attr == TextView_drawablePadding) json.put("TextView_drawablePadding", a.getDimensionPixelSize(attr, 0)); else if (attr == TextView_textCursorDrawable) json.put("TextView_textCursorDrawable", getDrawable(m_context.getResources().getDrawable(a.getResourceId(attr, 0)), styleName + "_TextView_textCursorDrawable")); else if (attr == TextView_maxLines) json.put("TextView_maxLines", a.getInt(attr, -1)); else if (attr == TextView_maxHeight) json.put("TextView_maxHeight", a.getDimensionPixelSize(attr, -1)); else if (attr == TextView_lines) json.put("TextView_lines", a.getInt(attr, -1)); else if (attr == TextView_height) json.put("TextView_height", a.getDimensionPixelSize(attr, -1)); else if (attr == TextView_minLines) json.put("TextView_minLines", a.getInt(attr, -1)); else if (attr == TextView_minHeight) json.put("TextView_minHeight", a.getDimensionPixelSize(attr, -1)); else if (attr == TextView_maxEms) json.put("TextView_maxEms", a.getInt(attr, -1)); else if (attr == TextView_maxWidth) json.put("TextView_maxWidth", a.getDimensionPixelSize(attr, -1)); else if (attr == TextView_ems) json.put("TextView_ems", a.getInt(attr, -1)); else if (attr == TextView_width) json.put("TextView_width", a.getDimensionPixelSize(attr, -1)); else if (attr == TextView_minEms) json.put("TextView_minEms", a.getInt(attr, -1)); else if (attr == TextView_minWidth) json.put("TextView_minWidth", a.getDimensionPixelSize(attr, -1)); else if (attr == TextView_gravity) json.put("TextView_gravity", a.getInt(attr, -1)); else if (attr == TextView_hint) json.put("TextView_hint", a.getText(attr)); else if (attr == TextView_text) json.put("TextView_text", a.getText(attr)); else if (attr == TextView_scrollHorizontally) json.put("TextView_scrollHorizontally", a.getBoolean(attr, false)); else if (attr == TextView_singleLine) json.put("TextView_singleLine", a.getBoolean(attr, false)); else if (attr == TextView_ellipsize) json.put("TextView_ellipsize", a.getInt(attr, -1)); else if (attr == TextView_marqueeRepeatLimit) json.put("TextView_marqueeRepeatLimit", a.getInt(attr, 3)); else if (attr == TextView_includeFontPadding) json.put("TextView_includeFontPadding", a.getBoolean(attr, true)); else if (attr == TextView_cursorVisible) json.put("TextView_cursorVisible", a.getBoolean(attr, true)); else if (attr == TextView_maxLength) json.put("TextView_maxLength", a.getInt(attr, -1)); else if (attr == TextView_textScaleX) json.put("TextView_textScaleX", a.getFloat(attr, 1.0f)); else if (attr == TextView_freezesText) json.put("TextView_freezesText", a.getBoolean(attr, false)); else if (attr == TextView_shadowColor) json.put("TextView_shadowColor", a.getInt(attr, 0)); else if (attr == TextView_shadowDx) json.put("TextView_shadowDx", a.getFloat(attr, 0)); else if (attr == TextView_shadowDy) json.put("TextView_shadowDy", a.getFloat(attr, 0)); else if (attr == TextView_shadowRadius) json.put("TextView_shadowRadius", a.getFloat(attr, 0)); else if (attr == TextView_enabled) json.put("TextView_enabled", a.getBoolean(attr, true)); else if (attr == TextView_textColorHighlight) textColorHighlight = a.getColor(attr, textColorHighlight); else if (attr == TextView_textColor) textColor = a.getColorStateList(attr); else if (attr == TextView_textColorHint) textColorHint = a.getColorStateList(attr); else if (attr == TextView_textColorLink) textColorLink = a.getColorStateList(attr); else if (attr == TextView_textSize) textSize = a.getDimensionPixelSize(attr, textSize); else if (attr == TextView_typeface) typefaceIndex = a.getInt(attr, typefaceIndex); else if (attr == TextView_textStyle) styleIndex = a.getInt(attr, styleIndex); else if (attr == TextView_password) json.put("TextView_password", a.getBoolean(attr, false)); else if (attr == TextView_lineSpacingExtra) json.put("TextView_lineSpacingExtra", a.getDimensionPixelSize(attr, 0)); else if (attr == TextView_lineSpacingMultiplier) json.put("TextView_lineSpacingMultiplier", a.getFloat(attr, 1.0f)); else if (attr == TextView_inputType) json.put("TextView_inputType", a.getInt(attr, EditorInfo.TYPE_NULL)); else if (attr == TextView_imeOptions) json.put("TextView_imeOptions", a.getInt(attr, EditorInfo.IME_NULL)); else if (attr == TextView_imeActionLabel) json.put("TextView_imeActionLabel", a.getText(attr)); else if (attr == TextView_imeActionId) json.put("TextView_imeActionId", a.getInt(attr, 0)); else if (attr == TextView_privateImeOptions) json.put("TextView_privateImeOptions", a.getString(attr)); else if (attr == TextView_textSelectHandleLeft && styleName.equals("textViewStyle")) json.put("TextView_textSelectHandleLeft", getDrawable(m_context.getResources().getDrawable(a.getResourceId(attr, 0)), styleName + "_TextView_textSelectHandleLeft")); else if (attr == TextView_textSelectHandleRight && styleName.equals("textViewStyle")) json.put("TextView_textSelectHandleRight", getDrawable(m_context.getResources().getDrawable(a.getResourceId(attr, 0)), styleName + "_TextView_textSelectHandleRight")); else if (attr == TextView_textSelectHandle && styleName.equals("textViewStyle")) json.put("TextView_textSelectHandle", getDrawable(m_context.getResources().getDrawable(a.getResourceId(attr, 0)), styleName + "_TextView_textSelectHandle")); else if (attr == TextView_textIsSelectable) json.put("TextView_textIsSelectable", a.getBoolean(attr, false)); else if (attr == TextView_textAllCaps) allCaps = a.getBoolean(attr, false); } a.recycle(); json.put("TextAppearance_textColorHighlight", textColorHighlight); json.put("TextAppearance_textColor", getColorStateList(textColor)); json.put("TextAppearance_textColorHint", getColorStateList(textColorHint)); json.put("TextAppearance_textColorLink", getColorStateList(textColorLink)); json.put("TextAppearance_textSize", textSize); json.put("TextAppearance_typeface", typefaceIndex); json.put("TextAppearance_textStyle", styleIndex); json.put("TextAppearance_textAllCaps", allCaps); } catch (Exception e) { e.printStackTrace(); } return json; }
From source file:cn.ismartv.tvrecyclerview.widget.RecyclerView.java
public RecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, CLIP_TO_PADDING_ATTR, defStyle, 0); mClipToPadding = a.getBoolean(0, true); a.recycle();/*from w ww . j a v a 2 s. c om*/ } else { mClipToPadding = true; } setScrollContainer(true); setFocusableInTouchMode(true); final int version = Build.VERSION.SDK_INT; mPostUpdatesOnAnimation = version >= 16; final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); setWillNotDraw(getOverScrollMode() == View.OVER_SCROLL_NEVER); mItemAnimator.setListener(mItemAnimatorListener); initAdapterManager(); initChildrenHelper(); // If not explicitly specified this view is important for accessibility. if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } mAccessibilityManager = (AccessibilityManager) getContext().getSystemService(Context.ACCESSIBILITY_SERVICE); setAccessibilityDelegateCompat(new RecyclerViewAccessibilityDelegate(this)); // Create the layoutManager if specified. boolean nestedScrollingEnabled = true; if (attrs != null) { int defStyleRes = 0; TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RecyclerView, defStyle, defStyleRes); String layoutManagerName = a.getString(R.styleable.RecyclerView_layoutManager); int descendantFocusability = a.getInt(R.styleable.RecyclerView_android_descendantFocusability, -1); if (descendantFocusability == -1) { setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); } a.recycle(); createLayoutManager(context, layoutManagerName, attrs, defStyle, defStyleRes); if (Build.VERSION.SDK_INT >= 21) { a = context.obtainStyledAttributes(attrs, NESTED_SCROLLING_ATTRS, defStyle, defStyleRes); nestedScrollingEnabled = a.getBoolean(0, true); a.recycle(); } } else { setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); } // Re-set whether nested scrolling is enabled so that it is set on all API levels setNestedScrollingEnabled(nestedScrollingEnabled); }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardViewBase.java
protected boolean setValueFromTheme(TypedArray remoteTypedArray, final int[] padding, final int localAttrId, final int remoteTypedArrayIndex) { try {//from ww w . jav a 2 s. c om switch (localAttrId) { case android.R.attr.background: Drawable keyboardBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); if (keyboardBackground == null) return false; CompatUtils.setViewBackgroundDrawable(this, keyboardBackground); break; case android.R.attr.paddingLeft: padding[0] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[0] == -1) return false; break; case android.R.attr.paddingTop: padding[1] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[1] == -1) return false; break; case android.R.attr.paddingRight: padding[2] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[2] == -1) return false; break; case android.R.attr.paddingBottom: padding[3] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (padding[3] == -1) return false; break; case R.attr.keyBackground: mKeyBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); if (mKeyBackground == null) return false; break; case R.attr.keyHysteresisDistance: mKeyHysteresisDistance = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (mKeyHysteresisDistance == -1) return false; break; case R.attr.verticalCorrection: mOriginalVerticalCorrection = mVerticalCorrection = remoteTypedArray .getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (mOriginalVerticalCorrection == -1) return false; break; case R.attr.keyTextSize: mKeyTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mKeyTextSize == -1) return false; // you might ask yourself "why did Menny sqrt root the factor?" // I'll tell you; the factor is mostly for the height, not the // font size, // but I also factorize the font size because I want the text to // be a little like // the key size. // the whole factor maybe too much, so I ease that a bit. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mKeyTextSize = (float) (mKeyTextSize * Math.sqrt(AnyApplication.getConfig().getKeysHeightFactorInLandscape())); else mKeyTextSize = (float) (mKeyTextSize * Math.sqrt(AnyApplication.getConfig().getKeysHeightFactorInPortrait())); Logger.d(TAG, "AnySoftKeyboardTheme_keyTextSize " + mKeyTextSize); break; case R.attr.keyTextColor: mKeyTextColor = remoteTypedArray.getColorStateList(remoteTypedArrayIndex); if (mKeyTextColor == null) { mKeyTextColor = new ColorStateList(new int[][] { { 0 } }, new int[] { remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFF000000) }); } break; case R.attr.labelTextSize: mLabelTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mLabelTextSize == -1) return false; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mLabelTextSize = mLabelTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mLabelTextSize = mLabelTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); break; case R.attr.keyboardNameTextSize: mKeyboardNameTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mKeyboardNameTextSize == -1) return false; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mKeyboardNameTextSize = mKeyboardNameTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mKeyboardNameTextSize = mKeyboardNameTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); break; case R.attr.keyboardNameTextColor: mKeyboardNameTextColor = remoteTypedArray.getColor(remoteTypedArrayIndex, Color.WHITE); break; case R.attr.shadowColor: mShadowColor = remoteTypedArray.getColor(remoteTypedArrayIndex, 0); break; case R.attr.shadowRadius: mShadowRadius = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); break; case R.attr.shadowOffsetX: mShadowOffsetX = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); break; case R.attr.shadowOffsetY: mShadowOffsetY = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); break; case R.attr.backgroundDimAmount: mBackgroundDimAmount = remoteTypedArray.getFloat(remoteTypedArrayIndex, -1f); if (mBackgroundDimAmount == -1f) return false; break; case R.attr.keyPreviewBackground: Drawable keyPreviewBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); if (keyPreviewBackground == null) return false; mPreviewPopupTheme.setPreviewKeyBackground(keyPreviewBackground); break; case R.attr.keyPreviewTextColor: mPreviewPopupTheme.setPreviewKeyTextColor(remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFFF)); break; case R.attr.keyPreviewTextSize: mPreviewPopupTheme .setPreviewKeyTextSize(remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0)); break; case R.attr.keyPreviewLabelTextSize: mPreviewPopupTheme .setPreviewLabelTextSize(remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0)); break; case R.attr.keyPreviewOffset: mPreviewPopupTheme .setVerticalOffset(remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0)); break; case R.attr.previewAnimationType: int previewAnimationType = remoteTypedArray.getInteger(remoteTypedArrayIndex, -1); if (previewAnimationType == -1) return false; mPreviewPopupTheme.setPreviewAnimationType(previewAnimationType); break; case R.attr.keyTextStyle: int textStyle = remoteTypedArray.getInt(remoteTypedArrayIndex, 0); switch (textStyle) { case 0: mKeyTextStyle = Typeface.DEFAULT; break; case 1: mKeyTextStyle = Typeface.DEFAULT_BOLD; break; case 2: mKeyTextStyle = Typeface.defaultFromStyle(Typeface.ITALIC); break; default: mKeyTextStyle = Typeface.defaultFromStyle(textStyle); break; } mPreviewPopupTheme.setKeyStyle(mKeyTextStyle); break; case R.attr.keyHorizontalGap: float themeHorizontalKeyGap = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeHorizontalKeyGap == -1) return false; mKeyboardDimens.setHorizontalKeyGap(themeHorizontalKeyGap); break; case R.attr.keyVerticalGap: float themeVerticalRowGap = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeVerticalRowGap == -1) return false; mKeyboardDimens.setVerticalRowGap(themeVerticalRowGap); break; case R.attr.keyNormalHeight: int themeNormalKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeNormalKeyHeight == -1) return false; mKeyboardDimens.setNormalKeyHeight(themeNormalKeyHeight); break; case R.attr.keyLargeHeight: int themeLargeKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeLargeKeyHeight == -1) return false; mKeyboardDimens.setLargeKeyHeight(themeLargeKeyHeight); break; case R.attr.keySmallHeight: int themeSmallKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, -1); if (themeSmallKeyHeight == -1) return false; mKeyboardDimens.setSmallKeyHeight(themeSmallKeyHeight); break; case R.attr.hintTextSize: mHintTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, -1); if (mHintTextSize == -1) return false; if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mHintTextSize = mHintTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mHintTextSize = mHintTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); break; case R.attr.hintTextColor: mHintTextColor = remoteTypedArray.getColorStateList(remoteTypedArrayIndex); if (mHintTextColor == null) { mHintTextColor = new ColorStateList(new int[][] { { 0 } }, new int[] { remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFF000000) }); } break; case R.attr.hintLabelVAlign: mHintLabelVAlign = remoteTypedArray.getInt(remoteTypedArrayIndex, Gravity.BOTTOM); break; case R.attr.hintLabelAlign: mHintLabelAlign = remoteTypedArray.getInt(remoteTypedArrayIndex, Gravity.RIGHT); break; case R.attr.hintOverflowLabel: mHintOverflowLabel = remoteTypedArray.getString(remoteTypedArrayIndex); break; } return true; } catch (Exception e) { // on API changes, so the incompatible themes wont crash me.. e.printStackTrace(); return false; } }
From source file:com.anysoftkeyboard.keyboards.views.AnyKeyboardBaseView.java
public boolean setValueFromTheme(TypedArray remoteTypedArray, final int[] padding, final int localAttrId, final int remoteTypedArrayIndex) { try {/*w w w . j av a 2s . c om*/ if (localAttrId == android.R.attr.background) { Drawable keyboardBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); Log.d(TAG, "AnySoftKeyboardTheme_android_background " + (keyboardBackground != null)); super.setBackgroundDrawable(keyboardBackground); } else if (localAttrId == android.R.attr.paddingLeft) { padding[0] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_android_paddingLeft " + padding[0]); } else if (localAttrId == android.R.attr.paddingTop) { padding[1] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_android_paddingTop " + padding[1]); } else if (localAttrId == android.R.attr.paddingRight) { padding[2] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_android_paddingRight " + padding[2]); } else if (localAttrId == android.R.attr.paddingBottom) { padding[3] = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_android_paddingBottom " + padding[3]); } else if (localAttrId == R.attr.keyBackground) { mKeyBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); Log.d(TAG, "AnySoftKeyboardTheme_keyBackground " + (mKeyBackground != null)); } else if (localAttrId == R.attr.keyHysteresisDistance) { mKeyHysteresisDistance = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_keyHysteresisDistance " + mKeyHysteresisDistance); } else if (localAttrId == R.attr.verticalCorrection) { mVerticalCorrection = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_verticalCorrection " + mVerticalCorrection); } else if (localAttrId == R.attr.keyPreviewBackground) { mPreviewKeyBackground = remoteTypedArray.getDrawable(remoteTypedArrayIndex); Log.d(TAG, "AnySoftKeyboardTheme_keyPreviewBackground " + (mPreviewKeyBackground != null)); } else if (localAttrId == R.attr.keyPreviewTextColor) { mPreviewKeyTextColor = remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFFF); Log.d(TAG, "AnySoftKeyboardTheme_keyPreviewTextColor " + mPreviewKeyTextColor); } else if (localAttrId == R.attr.keyPreviewTextSize) { mPreviewKeyTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_keyPreviewTextSize " + mPreviewKeyTextSize); } else if (localAttrId == R.attr.keyPreviewLabelTextSize) { mPreviewLabelTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_keyPreviewLabelTextSize " + mPreviewLabelTextSize); } else if (localAttrId == R.attr.keyPreviewOffset) { mPreviewOffset = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_keyPreviewOffset " + mPreviewOffset); } else if (localAttrId == R.attr.keyTextSize) { mKeyTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 18); // you might ask yourself "why did Menny sqrt root the factor?" // I'll tell you; the factor is mostly for the height, not the // font size, // but I also factorize the font size because I want the text to // be a little like // the key size. // the whole factor maybe too much, so I ease that a bit. if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mKeyTextSize = mKeyTextSize * FloatMath.sqrt(AnyApplication.getConfig().getKeysHeightFactorInLandscape()); else mKeyTextSize = mKeyTextSize * FloatMath.sqrt(AnyApplication.getConfig().getKeysHeightFactorInPortrait()); Log.d(TAG, "AnySoftKeyboardTheme_keyTextSize " + mKeyTextSize); } else if (localAttrId == R.attr.keyTextColor) { mKeyTextColor = remoteTypedArray.getColorStateList(remoteTypedArrayIndex); if (mKeyTextColor == null) { Log.d(TAG, "Creating an empty ColorStateList for mKeyTextColor"); mKeyTextColor = new ColorStateList(new int[][] { { 0 } }, new int[] { remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFF000000) }); } Log.d(TAG, "AnySoftKeyboardTheme_keyTextColor " + mKeyTextColor); } else if (localAttrId == R.attr.labelTextSize) { mLabelTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 14); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mLabelTextSize = mLabelTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mLabelTextSize = mLabelTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); Log.d(TAG, "AnySoftKeyboardTheme_labelTextSize " + mLabelTextSize); } else if (localAttrId == R.attr.keyboardNameTextSize) { mKeyboardNameTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 10); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mKeyboardNameTextSize = mKeyboardNameTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mKeyboardNameTextSize = mKeyboardNameTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); Log.d(TAG, "AnySoftKeyboardTheme_keyboardNameTextSize " + mKeyboardNameTextSize); } else if (localAttrId == R.attr.keyboardNameTextColor) { mKeyboardNameTextColor = remoteTypedArray.getColorStateList(remoteTypedArrayIndex); if (mKeyboardNameTextColor == null) { Log.d(TAG, "Creating an empty ColorStateList for mKeyboardNameTextColor"); mKeyboardNameTextColor = new ColorStateList(new int[][] { { 0 } }, new int[] { remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFFAAAAAA) }); } Log.d(TAG, "AnySoftKeyboardTheme_keyboardNameTextColor " + mKeyboardNameTextColor); } else if (localAttrId == R.attr.shadowColor) { mShadowColor = remoteTypedArray.getColor(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_shadowColor " + mShadowColor); } else if (localAttrId == R.attr.shadowRadius) { mShadowRadius = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_shadowRadius " + mShadowRadius); } else if (localAttrId == R.attr.shadowOffsetX) { mShadowOffsetX = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_shadowOffsetX " + mShadowOffsetX); } else if (localAttrId == R.attr.shadowOffsetY) { mShadowOffsetY = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_shadowOffsetY " + mShadowOffsetY); } else if (localAttrId == R.attr.backgroundDimAmount) { mBackgroundDimAmount = remoteTypedArray.getFloat(remoteTypedArrayIndex, 0.5f); Log.d(TAG, "AnySoftKeyboardTheme_backgroundDimAmount " + mBackgroundDimAmount); } else if (localAttrId == R.attr.keyTextStyle) { int textStyle = remoteTypedArray.getInt(remoteTypedArrayIndex, 0); switch (textStyle) { case 0: mKeyTextStyle = Typeface.DEFAULT; break; case 1: mKeyTextStyle = Typeface.DEFAULT_BOLD; break; case 2: mKeyTextStyle = Typeface.defaultFromStyle(Typeface.ITALIC); break; default: mKeyTextStyle = Typeface.defaultFromStyle(textStyle); break; } Log.d(TAG, "AnySoftKeyboardTheme_keyTextStyle " + mKeyTextStyle); } else if (localAttrId == R.attr.symbolColorScheme) { mSymbolColorScheme = remoteTypedArray.getInt(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_symbolColorScheme " + mSymbolColorScheme); } else if (localAttrId == R.attr.keyHorizontalGap) { float themeHorizotalKeyGap = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); mKeyboardDimens.setHorizontalKeyGap(themeHorizotalKeyGap); Log.d(TAG, "AnySoftKeyboardTheme_keyHorizontalGap " + themeHorizotalKeyGap); } else if (localAttrId == R.attr.keyVerticalGap) { float themeVerticalRowGap = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); mKeyboardDimens.setVerticalRowGap(themeVerticalRowGap); Log.d(TAG, "AnySoftKeyboardTheme_keyVerticalGap " + themeVerticalRowGap); } else if (localAttrId == R.attr.keyNormalHeight) { float themeNormalKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); mKeyboardDimens.setNormalKeyHeight(themeNormalKeyHeight); Log.d(TAG, "AnySoftKeyboardTheme_keyNormalHeight " + themeNormalKeyHeight); } else if (localAttrId == R.attr.keyLargeHeight) { float themeLargeKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); mKeyboardDimens.setLargeKeyHeight(themeLargeKeyHeight); Log.d(TAG, "AnySoftKeyboardTheme_keyLargeHeight " + themeLargeKeyHeight); } else if (localAttrId == R.attr.keySmallHeight) { float themeSmallKeyHeight = remoteTypedArray.getDimensionPixelOffset(remoteTypedArrayIndex, 0); mKeyboardDimens.setSmallKeyHeight(themeSmallKeyHeight); Log.d(TAG, "AnySoftKeyboardTheme_keySmallHeight " + themeSmallKeyHeight); } else if (localAttrId == R.attr.hintTextSize) { mHintTextSize = remoteTypedArray.getDimensionPixelSize(remoteTypedArrayIndex, 0); Log.d(TAG, "AnySoftKeyboardTheme_hintTextSize " + mHintTextSize); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) mHintTextSize = mHintTextSize * AnyApplication.getConfig().getKeysHeightFactorInLandscape(); else mHintTextSize = mHintTextSize * AnyApplication.getConfig().getKeysHeightFactorInPortrait(); Log.d(TAG, "AnySoftKeyboardTheme_hintTextSize with factor " + mHintTextSize); } else if (localAttrId == R.attr.hintTextColor) { mHintTextColor = remoteTypedArray.getColorStateList(remoteTypedArrayIndex); if (mHintTextColor == null) { Log.d(TAG, "Creating an empty ColorStateList for mHintTextColor"); mHintTextColor = new ColorStateList(new int[][] { { 0 } }, new int[] { remoteTypedArray.getColor(remoteTypedArrayIndex, 0xFF000000) }); } Log.d(TAG, "AnySoftKeyboardTheme_hintTextColor " + mHintTextColor); } else if (localAttrId == R.attr.hintLabelVAlign) { mHintLabelVAlign = remoteTypedArray.getInt(remoteTypedArrayIndex, Gravity.BOTTOM); Log.d(TAG, "AnySoftKeyboardTheme_hintLabelVAlign " + mHintLabelVAlign); } else if (localAttrId == R.attr.hintLabelAlign) { mHintLabelAlign = remoteTypedArray.getInt(remoteTypedArrayIndex, Gravity.RIGHT); Log.d(TAG, "AnySoftKeyboardTheme_hintLabelAlign " + mHintLabelAlign); } else if (localAttrId == R.attr.hintOverflowLabel) { mHintOverflowLabel = remoteTypedArray.getString(remoteTypedArrayIndex); Log.d(TAG, "AnySoftKeyboardTheme_hintOverflowLabel " + mHintOverflowLabel); } return true; } catch (Exception e) { // on API changes, so the incompatible themes wont crash me.. e.printStackTrace(); return false; } }