Fix layout attire compatability

This commit is contained in:
Moez Bhatti
2015-11-16 06:37:56 -05:00
parent 0896e559f6
commit 302eea9a52
2 changed files with 11 additions and 7 deletions
@@ -2,6 +2,7 @@ package com.moez.QKSMS.ui.view;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.os.Build; import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.Layout; import android.text.Layout;
@@ -9,6 +10,7 @@ import android.text.SpannableStringBuilder;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue; import android.util.TypedValue;
import android.widget.TextView; import android.widget.TextView;
import com.moez.QKSMS.R;
import com.moez.QKSMS.common.FontManager; import com.moez.QKSMS.common.FontManager;
import com.moez.QKSMS.common.LiveViewManager; import com.moez.QKSMS.common.LiveViewManager;
import com.moez.QKSMS.common.TypefaceManager; import com.moez.QKSMS.common.TypefaceManager;
@@ -51,13 +53,11 @@ public class QKTextView extends TextView implements LiveView {
private void init(Context context, AttributeSet attrs) { private void init(Context context, AttributeSet attrs) {
mContext = context; mContext = context;
if (attrs != null) { if (attrs != null) {
for (int i = 0; i < attrs.getAttributeCount(); i++) { final TypedArray array = context.obtainStyledAttributes(attrs, R.styleable.QKTextView);
if (attrs.getAttributeName(i).equals("type")) { mType = array.getInt(R.styleable.QKTextView_type, FontManager.TEXT_TYPE_PRIMARY);
mType = Integer.decode(attrs.getAttributeValue(i)); array.recycle();
break;
}
}
} }
refresh(); refresh();
+5 -1
View File
@@ -19,7 +19,11 @@
</attr> </attr>
<declare-styleable name="RobotoTextView"> <declare-styleable name="RobotoTextView">
<attr name="typeface"/> <attr name="typeface" />
</declare-styleable>
<declare-styleable name="QKTextView">
<attr name="type" />
</declare-styleable> </declare-styleable>
<attr name="typeface"> <attr name="typeface">