use of android.content.res.Resources.Theme in project k-9 by k9mail.
the class FoldableLinearLayout method processAttributes.
/**
* Load given attributes to inner variables,
*
* @param context
* @param attrs
*/
private void processAttributes(Context context, AttributeSet attrs) {
Theme theme = context.getTheme();
TypedValue outValue = new TypedValue();
boolean found = theme.resolveAttribute(R.attr.iconActionCollapse, outValue, true);
if (found) {
mIconActionCollapseId = outValue.resourceId;
}
found = theme.resolveAttribute(R.attr.iconActionExpand, outValue, true);
if (found) {
mIconActionExpandId = outValue.resourceId;
}
if (attrs != null) {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.FoldableLinearLayout, 0, 0);
mFoldedLabel = a.getString(R.styleable.FoldableLinearLayout_foldedLabel);
mUnFoldedLabel = a.getString(R.styleable.FoldableLinearLayout_unFoldedLabel);
a.recycle();
}
// If any attribute isn't found then set a default one
mFoldedLabel = (mFoldedLabel == null) ? "No text!" : mFoldedLabel;
mUnFoldedLabel = (mUnFoldedLabel == null) ? "No text!" : mUnFoldedLabel;
}
use of android.content.res.Resources.Theme in project little-bear-dictionary by daimajia.
the class QueryWordFragment method onCreateOptionsMenu.
@SuppressLint("NewApi")
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
mSearchView = new SearchView(mActionBar.getThemedContext());
mSearchView.setQueryHint(getActivity().getString(R.string.query_hint));
Theme theme = getActivity().getTheme();
AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) mSearchView.findViewById(R.id.abs__search_src_text);
TypedValue typedValue = new TypedValue();
if (theme.resolveAttribute(R.attr.search_view_text_color, typedValue, true)) {
autoCompleteTextView.setTextColor(typedValue.data);
} else {
autoCompleteTextView.setTextColor(Color.BLACK);
}
mActionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_TITLE | ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_HOME_AS_UP);
ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
layoutParams.setMargins(0, 0, 15, 0);
mActionBar.setCustomView(mSearchView, layoutParams);
inflater.inflate(R.menu.search_split_menu, menu);
mSearchView.setOnQueryTextListener(this);
mSearchView.setId(android.R.id.inputArea);
mSearchView.setIconifiedByDefault(true);
}
Aggregations