use of android.util.TypedValue in project UltimateAndroid by cymcsg.
the class SlidingTabLayout method createDefaultTabView.
/**
* Create a default view to be used for tabs. This is called if a custom tab view is not set via
* {@link #setCustomTabView(int, int)}.
*/
protected TextView createDefaultTabView(Context context) {
TextView textView = new TextView(context);
textView.setGravity(Gravity.CENTER);
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
textView.setTypeface(Typeface.DEFAULT_BOLD);
textView.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground, outValue, true);
textView.setBackgroundResource(outValue.resourceId);
textView.setAllCaps(true);
int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
textView.setPadding(padding, padding, padding, padding);
return textView;
}
use of android.util.TypedValue in project UltimateAndroid by cymcsg.
the class FlexibleSpaceToolbarScrollViewActivity method getActionBarSize.
private int getActionBarSize() {
TypedValue typedValue = new TypedValue();
int[] textSizeAttr = new int[] { R.attr.actionBarSize };
int indexOfAttrTextSize = 0;
TypedArray a = obtainStyledAttributes(typedValue.data, textSizeAttr);
int actionBarSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1);
a.recycle();
return actionBarSize;
}
use of android.util.TypedValue in project UltimateAndroid by cymcsg.
the class FlexibleSpaceWithImageListViewActivity method getActionBarSize.
private int getActionBarSize() {
TypedValue typedValue = new TypedValue();
int[] textSizeAttr = new int[] { R.attr.actionBarSize };
int indexOfAttrTextSize = 0;
TypedArray a = obtainStyledAttributes(typedValue.data, textSizeAttr);
int actionBarSize = a.getDimensionPixelSize(indexOfAttrTextSize, -1);
a.recycle();
return actionBarSize;
}
use of android.util.TypedValue in project cw-omnibus by commonsguy.
the class ShareActionProvider method onCreateActionView.
/**
* {@inheritDoc}
*/
@Override
public View onCreateActionView() {
// Create the view and set its data model.
ActivityChooserModel dataModel = ActivityChooserModel.get(mContext, mShareHistoryFileName);
ActivityChooserView activityChooserView = new ActivityChooserView(mContext);
activityChooserView.setActivityChooserModel(dataModel);
// Lookup and set the expand action icon.
TypedValue outTypedValue = new TypedValue();
mContext.getTheme().resolveAttribute(R.attr.actionModeShareDrawable, outTypedValue, true);
Drawable drawable = mContext.getResources().getDrawable(outTypedValue.resourceId);
activityChooserView.setExpandActivityOverflowButtonDrawable(drawable);
activityChooserView.setProvider(this);
// Set content description.
activityChooserView.setDefaultActionButtonContentDescription(R.string.abs__shareactionprovider_share_with_application);
activityChooserView.setExpandActivityOverflowButtonContentDescription(R.string.abs__shareactionprovider_share_with);
return activityChooserView;
}
use of android.util.TypedValue in project cw-omnibus by commonsguy.
the class SearchView method getSearchIconId.
/**
* For a given suggestion and a given cursor row, get the action message. If
* not provided by the specific row/column, also check for a single
* definition (for the action key).
*
* @param c The cursor providing suggestions
* @param actionKey The actionkey record being examined
*
* @return Returns a string, or null if no action key message for this
* suggestion
*/
// TODO private static String getActionKeyMessage(Cursor c, SearchableInfo.ActionKeyInfo actionKey) {
// TODO String result = null;
// TODO // check first in the cursor data, for a suggestion-specific message
// TODO final String column = actionKey.getSuggestActionMsgColumn();
// TODO if (column != null) {
// TODO result = SuggestionsAdapter.getColumnString(c, column);
// TODO }
// TODO // If the cursor didn't give us a message, see if there's a single
// TODO // message defined
// TODO // for the actionkey (for all suggestions)
// TODO if (result == null) {
// TODO result = actionKey.getSuggestActionMsg();
// TODO }
// TODO return result;
// TODO }
private int getSearchIconId() {
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(R.attr.searchViewSearchIcon, outValue, true);
return outValue.resourceId;
}
Aggregations