List of usage examples for android.view View LAYOUT_DIRECTION_LOCALE
int LAYOUT_DIRECTION_LOCALE
To view the source code for android.view View LAYOUT_DIRECTION_LOCALE.
Click Source Link
From source file:org.mozilla.focus.browser.LocalizedContent.java
private static void putLayoutDirectionIntoMap(WebView webView, Map<String, String> substitutionMap) { ViewCompat.setLayoutDirection(webView, View.LAYOUT_DIRECTION_LOCALE); final int layoutDirection = ViewCompat.getLayoutDirection(webView); final String direction; if (layoutDirection == View.LAYOUT_DIRECTION_LTR) { direction = "ltr"; } else if (layoutDirection == View.LAYOUT_DIRECTION_RTL) { direction = "rtl"; } else {// w w w . j a v a2 s . c o m direction = "auto"; } substitutionMap.put("%dir%", direction); }
From source file:com.android.contacts.common.list.ContactListItemView.java
public ContactListItemView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a;/* w w w . j av a 2 s .c o m*/ if (R.styleable.ContactListItemView != null) { // Read all style values a = getContext().obtainStyledAttributes(attrs, R.styleable.ContactListItemView); mPreferredHeight = a.getDimensionPixelSize(R.styleable.ContactListItemView_list_item_height, mPreferredHeight); mActivatedBackgroundDrawable = a.getDrawable(R.styleable.ContactListItemView_activated_background); mGapBetweenImageAndText = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_image_and_text, mGapBetweenImageAndText); mGapBetweenLabelAndData = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_label_and_data, mGapBetweenLabelAndData); mPresenceIconMargin = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_presence_icon_margin, mPresenceIconMargin); mPresenceIconSize = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_presence_icon_size, mPresenceIconSize); mDefaultPhotoViewSize = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_photo_size, mDefaultPhotoViewSize); mTextIndent = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_text_indent, mTextIndent); mTextOffsetTop = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_text_offset_top, mTextOffsetTop); mDataViewWidthWeight = a.getInteger(R.styleable.ContactListItemView_list_item_data_width_weight, mDataViewWidthWeight); mLabelViewWidthWeight = a.getInteger(R.styleable.ContactListItemView_list_item_label_width_weight, mLabelViewWidthWeight); mNameTextViewTextColor = a.getColor(R.styleable.ContactListItemView_list_item_name_text_color, mNameTextViewTextColor); mNameTextViewTextSize = (int) a.getDimension(R.styleable.ContactListItemView_list_item_name_text_size, (int) getResources().getDimension(R.dimen.contact_browser_list_item_text_size)); mVideoCallIconSize = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_video_call_icon_size, mVideoCallIconSize); mVideoCallIconMargin = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_video_call_icon_margin, mVideoCallIconMargin); setPaddingRelative(a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_left, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_top, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_right, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_bottom, 0)); a.recycle(); } mTextHighlighter = new TextHighlighter(Typeface.BOLD); if (R.styleable.Theme != null) { a = getContext().obtainStyledAttributes(R.styleable.Theme); mSecondaryTextColor = a.getColorStateList(R.styleable.Theme_android_textColorSecondary); a.recycle(); } mHeaderWidth = getResources().getDimensionPixelSize(R.dimen.contact_list_section_header_width); if (mActivatedBackgroundDrawable != null) { mActivatedBackgroundDrawable.setCallback(this); } mNameHighlightSequence = new ArrayList<HighlightSequence>(); mNumberHighlightSequence = new ArrayList<HighlightSequence>(); setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); }
From source file:com.android.contacts.list.ContactListItemView.java
public ContactListItemView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a;//w w w.ja v a 2 s. c o m if (R.styleable.ContactListItemView != null) { // Read all style values a = getContext().obtainStyledAttributes(attrs, R.styleable.ContactListItemView); mPreferredHeight = a.getDimensionPixelSize(R.styleable.ContactListItemView_list_item_height, mPreferredHeight); mActivatedBackgroundDrawable = a.getDrawable(R.styleable.ContactListItemView_activated_background); mGapBetweenImageAndText = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_image_and_text, mGapBetweenImageAndText); mGapBetweenIndexerAndImage = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_indexer_and_image, mGapBetweenIndexerAndImage); mGapBetweenLabelAndData = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_gap_between_label_and_data, mGapBetweenLabelAndData); mPresenceIconMargin = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_presence_icon_margin, mPresenceIconMargin); mPresenceIconSize = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_presence_icon_size, mPresenceIconSize); mDefaultPhotoViewSize = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_photo_size, mDefaultPhotoViewSize); mTextIndent = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_text_indent, mTextIndent); mTextOffsetTop = a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_text_offset_top, mTextOffsetTop); mAvatarOffsetTop = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_avatar_offset_top, mAvatarOffsetTop); mDataViewWidthWeight = a.getInteger(R.styleable.ContactListItemView_list_item_data_width_weight, mDataViewWidthWeight); mLabelViewWidthWeight = a.getInteger(R.styleable.ContactListItemView_list_item_label_width_weight, mLabelViewWidthWeight); mNameTextViewTextColor = a.getColor(R.styleable.ContactListItemView_list_item_name_text_color, mNameTextViewTextColor); mNameTextViewTextSize = (int) a.getDimension(R.styleable.ContactListItemView_list_item_name_text_size, (int) getResources().getDimension(R.dimen.contact_browser_list_item_text_size)); mVideoCallIconSize = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_video_call_icon_size, mVideoCallIconSize); mVideoCallIconMargin = a.getDimensionPixelOffset( R.styleable.ContactListItemView_list_item_video_call_icon_margin, mVideoCallIconMargin); setPaddingRelative(a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_left, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_top, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_right, 0), a.getDimensionPixelOffset(R.styleable.ContactListItemView_list_item_padding_bottom, 0)); a.recycle(); } mTextHighlighter = new TextHighlighter(Typeface.BOLD); if (R.styleable.Theme != null) { a = getContext().obtainStyledAttributes(R.styleable.Theme); mSecondaryTextColor = a.getColorStateList(R.styleable.Theme_android_textColorSecondary); a.recycle(); } mHeaderWidth = getResources().getDimensionPixelSize(R.dimen.contact_list_section_header_width); if (mActivatedBackgroundDrawable != null) { mActivatedBackgroundDrawable.setCallback(this); } mNameHighlightSequence = new ArrayList<HighlightSequence>(); mNumberHighlightSequence = new ArrayList<HighlightSequence>(); setLayoutDirection(View.LAYOUT_DIRECTION_LOCALE); }