Search in sources :

Example 1 with TypedValue

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;
}
Also used : TextView(android.widget.TextView) LinearLayout(android.widget.LinearLayout) TypedValue(android.util.TypedValue)

Example 2 with TypedValue

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;
}
Also used : TypedArray(android.content.res.TypedArray) TypedValue(android.util.TypedValue)

Example 3 with TypedValue

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;
}
Also used : TypedArray(android.content.res.TypedArray) TypedValue(android.util.TypedValue)

Example 4 with TypedValue

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;
}
Also used : Drawable(android.graphics.drawable.Drawable) TypedValue(android.util.TypedValue)

Example 5 with TypedValue

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;
}
Also used : TypedValue(android.util.TypedValue)

Aggregations

TypedValue (android.util.TypedValue)1123 TypedArray (android.content.res.TypedArray)230 Resources (android.content.res.Resources)140 TextView (android.widget.TextView)85 Drawable (android.graphics.drawable.Drawable)66 View (android.view.View)63 Context (android.content.Context)58 ContextThemeWrapper (android.view.ContextThemeWrapper)57 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)46 Paint (android.graphics.Paint)45 DisplayMetrics (android.util.DisplayMetrics)42 IOException (java.io.IOException)40 AttributeSet (android.util.AttributeSet)37 ImageView (android.widget.ImageView)37 Test (org.junit.Test)34 SuppressLint (android.annotation.SuppressLint)33 LinearLayout (android.widget.LinearLayout)32 ViewGroup (android.view.ViewGroup)31 Point (android.graphics.Point)30 ColorStateList (android.content.res.ColorStateList)29