Commit 7f7cb25e authored by Adrien Maglo's avatar Adrien Maglo

ExpandableLayout: add a setIconAttribute method

parent ed6ed949
......@@ -24,6 +24,7 @@ import org.videolan.vlc.R;
import org.videolan.vlc.interfaces.OnExpandableListener;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
......@@ -41,10 +42,13 @@ public class ExpandableLayout extends LinearLayout {
private final LinearLayout mContent;
private Boolean mExpanded;
private OnExpandableListener listener = null;
private Context mContext;
public ExpandableLayout(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
LayoutInflater.from(context).inflate(R.layout.expandable_layout, this, true);
mHeaderLayout = findViewById(R.id.header_layout);
......@@ -84,6 +88,13 @@ public class ExpandableLayout extends LinearLayout {
mIcon.setVisibility(View.VISIBLE);
}
public void setIconAttribute(int attrid) {
TypedArray a = mContext.getTheme().obtainStyledAttributes(new int[] {attrid});
int resId = a.getResourceId(0, 0);
a.recycle();
setIcon(resId);
}
public void setContent(Context context, int resid) {
View view = LayoutInflater.from(context).inflate(resid, null, true);
mContent.addView(view);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment