Search in sources :

Example 1 with DynamicAttr

use of cn.feng.skin.manager.entity.DynamicAttr in project Android-Skin-Loader by fengjundev.

the class ArticleListFragment method dynamicAddTitleView.

private void dynamicAddTitleView() {
    TextView textView = new TextView(getActivity());
    textView.setText("Small Article (动态new)");
    RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    param.addRule(RelativeLayout.CENTER_IN_PARENT);
    textView.setLayoutParams(param);
    textView.setTextColor(getActivity().getResources().getColor(R.color.color_title_bar_text));
    textView.setTextSize(20);
    titleBarLayout.addView(textView);
    List<DynamicAttr> mDynamicAttr = new ArrayList<DynamicAttr>();
    mDynamicAttr.add(new DynamicAttr(AttrFactory.TEXT_COLOR, R.color.color_title_bar_text));
    dynamicAddView(textView, mDynamicAttr);
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) DynamicAttr(cn.feng.skin.manager.entity.DynamicAttr) RelativeLayout(android.widget.RelativeLayout) ArrayList(java.util.ArrayList) TextView(android.widget.TextView)

Example 2 with DynamicAttr

use of cn.feng.skin.manager.entity.DynamicAttr in project Android-Skin-Loader by fengjundev.

the class SkinInflaterFactory method dynamicAddSkinEnableView.

public void dynamicAddSkinEnableView(Context context, View view, List<DynamicAttr> pDAttrs) {
    List<SkinAttr> viewAttrs = new ArrayList<SkinAttr>();
    SkinItem skinItem = new SkinItem();
    skinItem.view = view;
    for (DynamicAttr dAttr : pDAttrs) {
        int id = dAttr.refResId;
        String entryName = context.getResources().getResourceEntryName(id);
        String typeName = context.getResources().getResourceTypeName(id);
        SkinAttr mSkinAttr = AttrFactory.get(dAttr.attrName, id, entryName, typeName);
        viewAttrs.add(mSkinAttr);
    }
    skinItem.attrs = viewAttrs;
    addSkinView(skinItem);
}
Also used : DynamicAttr(cn.feng.skin.manager.entity.DynamicAttr) SkinAttr(cn.feng.skin.manager.entity.SkinAttr) ArrayList(java.util.ArrayList) SkinItem(cn.feng.skin.manager.entity.SkinItem)

Aggregations

DynamicAttr (cn.feng.skin.manager.entity.DynamicAttr)2 ArrayList (java.util.ArrayList)2 LayoutParams (android.view.ViewGroup.LayoutParams)1 RelativeLayout (android.widget.RelativeLayout)1 TextView (android.widget.TextView)1 SkinAttr (cn.feng.skin.manager.entity.SkinAttr)1 SkinItem (cn.feng.skin.manager.entity.SkinItem)1