当前位置: 首页>>代码示例>>Java>>正文


Java TextUtilsCompat类代码示例

本文整理汇总了Java中android.support.v4.text.TextUtilsCompat的典型用法代码示例。如果您正苦于以下问题:Java TextUtilsCompat类的具体用法?Java TextUtilsCompat怎么用?Java TextUtilsCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TextUtilsCompat类属于android.support.v4.text包,在下文中一共展示了TextUtilsCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ListPopupWindow

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
/**
 * Create a new, empty popup window capable of displaying items from a ListAdapter.
 * Backgrounds should be set using {@link #setBackgroundDrawable(Drawable)}.
 *
 * @param context Context used for contained views.
 * @param attrs Attributes from inflating parent views used to style the popup.
 * @param defStyleAttr Default style attribute to use for popup content.
 * @param defStyleRes Default style to use for popup content.
 */
public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    mContext = context;

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPopupWindow,
            defStyleAttr, defStyleRes);
    mDropDownHorizontalOffset = a.getDimensionPixelOffset(
            R.styleable.ListPopupWindow_android_dropDownHorizontalOffset, 0);
    mDropDownVerticalOffset = a.getDimensionPixelOffset(
            R.styleable.ListPopupWindow_android_dropDownVerticalOffset, 0);
    if (mDropDownVerticalOffset != 0) {
        mDropDownVerticalOffsetSet = true;
    }
    a.recycle();

    mPopup = new PopupWindow(context, attrs, defStyleAttr);
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);

    // Set the default layout direction to match the default locale one
    final Locale locale = mContext.getResources().getConfiguration().locale;
    mLayoutDirection = TextUtilsCompat.getLayoutDirectionFromLocale(locale);
}
 
开发者ID:XhinLiang,项目名称:MDPreference,代码行数:31,代码来源:ListPopupWindow.java

示例2: ListPopupWindow

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
/**
 * Create a new, empty popup window capable of displaying items from a ListAdapter.
 * Backgrounds should be set using {@link #setBackgroundDrawable(android.graphics.drawable.Drawable)}.
 *
 * @param context Context used for contained views.
 * @param attrs Attributes from inflating parent views used to style the popup.
 * @param defStyleAttr Default style attribute to use for popup content.
 * @param defStyleRes Default style to use for popup content.
 */
public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    mContext = context;

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPopupWindow,
            defStyleAttr, defStyleRes);
    mDropDownHorizontalOffset = a.getDimensionPixelOffset(
            R.styleable.ListPopupWindow_android_dropDownHorizontalOffset, 0);
    mDropDownVerticalOffset = a.getDimensionPixelOffset(
            R.styleable.ListPopupWindow_android_dropDownVerticalOffset, 0);
    if (mDropDownVerticalOffset != 0) {
        mDropDownVerticalOffsetSet = true;
    }
    a.recycle();

    mPopup = new PopupWindow(context, attrs, defStyleAttr);
    mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NEEDED);

    // Set the default layout direction to match the default locale one
    final Locale locale = mContext.getResources().getConfiguration().locale;
    mLayoutDirection = TextUtilsCompat.getLayoutDirectionFromLocale(locale);
}
 
开发者ID:iamzhangdejian,项目名称:material-master,代码行数:31,代码来源:ListPopupWindow.java

示例3: animateTransition

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
@SuppressLint("InlinedApi")
protected void animateTransition(FragmentTransaction transaction, int direction) {
	boolean rtl = false;
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
		rtl = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == View.LAYOUT_DIRECTION_RTL;
	}
	if (direction == TRANSITION_HORIZONTAL) {
		if (rtl) {
			transaction.setCustomAnimations(R.animator.slide_left, R.animator.slide_right,
					R.animator.slide_back_right, R.animator.slide_back_left);
		} else {
			transaction.setCustomAnimations(R.animator.slide_back_right, R.animator.slide_back_left,
					R.animator.slide_left, R.animator.slide_right);
		}
	}
	if (direction == TRANSITION_VERTICAL && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {		
		transaction.setCustomAnimations(
                R.animator.anim_in, R.animator.anim_out, R.animator.anim_in_pop, R.animator.anim_out_pop);
	}
}
 
开发者ID:kanpol,项目名称:omni-note,代码行数:21,代码来源:BaseActivity.java

示例4: snap

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
protected void snap(@NonNull View subject, @Nullable String... dataPoints) {
    int rtl = layoutDirection == LayoutDirection.RTL
            ? View.LAYOUT_DIRECTION_RTL
            : TextUtilsCompat.getLayoutDirectionFromLocale(locale);
    //noinspection WrongConstant
    subject.setLayoutDirection(rtl);

    ViewHelpers viewHelpers = ViewHelpers.setupView(subject).setExactWidthDp(widthDp);
    if (heightDp != null) {
        viewHelpers.setExactHeightDp(heightDp);
    }
    viewHelpers.layout();

    List<String> list = new ArrayList<>();
    String byHeight = heightDp == null ? "" : ("x" + heightDp);
    list.add(widthDp + byHeight + "dp");
    list.add(locale.toString());
    list.add(layoutDirection == LayoutDirection.RTL ? "rtl" : "ltr");
    list.add("font" + fontScale.multiplier() + "x");
    list.add(theme.toString().toLowerCase(Locale.ENGLISH));
    list.addAll(Arrays.asList(ArrayUtils.nullToEmpty(dataPoints)));
    Screenshot.snap(subject).setName(testName(list)).record();
}
 
开发者ID:wikimedia,项目名称:apps-android-wikipedia,代码行数:24,代码来源:ViewTest.java

示例5: convertMarkup

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
@Override
public String convertMarkup(String markup, Context context) {
    AppSettings as = new AppSettings(context);
    String html = HTML100_BODY_PRE_BEGIN.replace("%FONT%", as.getFontFamily())
            + TextUtilsCompat.htmlEncode(markup)
            + HTML101_BODY_PRE_END;
    return putContentIntoTemplate(context, html);
}
 
开发者ID:gsantner,项目名称:markor,代码行数:9,代码来源:PlainTextConverter.java

示例6: convertMarkup

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
@Override
public String convertMarkup(String markup, Context context) {
    AppSettings as = new AppSettings(context);
    String html = HTML100_BODY_PRE_BEGIN.replace("%FONT%", as.getFontFamily())
            + parse(TextUtilsCompat.htmlEncode(markup))
            + HTML101_BODY_PRE_END;
    return putContentIntoTemplate(context, html);
}
 
开发者ID:gsantner,项目名称:markor,代码行数:9,代码来源:TodoTxtTextConverter.java

示例7: LabelSpan

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
public LabelSpan(int color) {
    this(color, new SpanDimensions() {
        @Override public int getPadding() {
            return 6;
        }

        @Override public int getPaddingExtraWidth() {
            return 0;
        }

        @Override public int getPaddingAfter() {
            return 0;
        }

        @Override public int getMaxWidth() {
            return 1000;//random number
        }

        @Override public float getRoundedCornerRadius() {
            return 5;
        }

        @Override public int getMarginTop() {
            return 8;
        }

        @Override public boolean isRtl() {
            return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault()) == ViewCompat.LAYOUT_DIRECTION_RTL;
        }
    });
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:32,代码来源:LabelSpan.java

示例8: getInstance

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
public static GravityCompatHelper getInstance() {
    if (mHelper == null) {
        mHelper = new GravityCompatHelper();
    }

    layoutDirection = TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault());

    return mHelper;
}
 
开发者ID:Freelander,项目名称:Blog,代码行数:10,代码来源:GravityCompatHelper.java

示例9: ListPopupWindow

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
public ListPopupWindow(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    this.mDropDownHeight = -2;
    this.mDropDownWidth = -2;
    this.mDropDownWindowLayoutType = 1002;
    this.mDropDownGravity = 0;
    this.mDropDownAlwaysVisible = false;
    this.mForceIgnoreOutsideTouch = false;
    this.mListItemExpandMaximum = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
    this.mPromptPosition = 0;
    this.mResizePopupRunnable = new ResizePopupRunnable();
    this.mTouchInterceptor = new PopupTouchInterceptor();
    this.mScrollListener = new PopupScrollListener();
    this.mHideSelector = new ListSelectorHider();
    this.mTempRect = new Rect();
    this.mContext = context;
    this.mHandler = new Handler(context.getMainLooper());
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ListPopupWindow, defStyleAttr, defStyleRes);
    this.mDropDownHorizontalOffset = a.getDimensionPixelOffset(R.styleable.ListPopupWindow_android_dropDownHorizontalOffset, 0);
    this.mDropDownVerticalOffset = a.getDimensionPixelOffset(R.styleable.ListPopupWindow_android_dropDownVerticalOffset, 0);
    if (this.mDropDownVerticalOffset != 0) {
        this.mDropDownVerticalOffsetSet = true;
    }
    a.recycle();
    this.mPopup = new AppCompatPopupWindow(context, attrs, defStyleAttr);
    this.mPopup.setInputMethodMode(1);
    this.mLayoutDirection = TextUtilsCompat.getLayoutDirectionFromLocale(this.mContext.getResources().getConfiguration().locale);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:28,代码来源:ListPopupWindow.java

示例10: setLayoutDirection

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
/**
 * Force set layout direction to RTL or LTR by Locale.
 *
 * @param view
 * @param locale
 */
public static void setLayoutDirection(View view, Locale locale) {
    switch (TextUtilsCompat.getLayoutDirectionFromLocale(locale)) {
        case ViewCompat.LAYOUT_DIRECTION_RTL:
            ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_RTL);
            break;
        case ViewCompat.LAYOUT_DIRECTION_LTR:
        default:
            ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_LTR);
            break;
    }
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:18,代码来源:LocaleAwareAppCompatActivity.java

示例11: ListPopupWindow

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
public ListPopupWindow(Context paramContext, AttributeSet paramAttributeSet, int paramInt1, int paramInt2)
{
  this.mContext = paramContext;
  this.mHandler = new Handler(paramContext.getMainLooper());
  TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, R.styleable.ListPopupWindow, paramInt1, paramInt2);
  this.mDropDownHorizontalOffset = localTypedArray.getDimensionPixelOffset(R.styleable.ListPopupWindow_android_dropDownHorizontalOffset, 0);
  this.mDropDownVerticalOffset = localTypedArray.getDimensionPixelOffset(R.styleable.ListPopupWindow_android_dropDownVerticalOffset, 0);
  if (this.mDropDownVerticalOffset != 0) {
    this.mDropDownVerticalOffsetSet = true;
  }
  localTypedArray.recycle();
  this.mPopup = new AppCompatPopupWindow(paramContext, paramAttributeSet, paramInt1);
  this.mPopup.setInputMethodMode(1);
  this.mLayoutDirection = TextUtilsCompat.getLayoutDirectionFromLocale(this.mContext.getResources().getConfiguration().locale);
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:16,代码来源:ListPopupWindow.java

示例12: adjustIndexForDirectionality

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
private static int adjustIndexForDirectionality(int index) {
    if (TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
            == ViewCompat.LAYOUT_DIRECTION_RTL) {
        return CBD_TAB_COUNT - 1 - index;
    }
    return index;
}
 
开发者ID:mogoweb,项目名称:365browser,代码行数:8,代码来源:ClearBrowsingDataTabsFragment.java

示例13: ListPopupWindow

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
public ListPopupWindow(Context context, AttributeSet attributeset, int i, int j)
{
    mDropDownHeight = -2;
    mDropDownWidth = -2;
    mDropDownGravity = 0;
    mDropDownAlwaysVisible = false;
    mForceIgnoreOutsideTouch = false;
    mListItemExpandMaximum = 0x7fffffff;
    mPromptPosition = 0;
    mResizePopupRunnable = new ResizePopupRunnable();
    mTouchInterceptor = new PopupTouchInterceptor();
    mScrollListener = new PopupScrollListener();
    mHideSelector = new ListSelectorHider();
    mHandler = new Handler();
    mTempRect = new Rect();
    mContext = context;
    TypedArray typedarray = context.obtainStyledAttributes(attributeset, android.support.v7.appcompat.R.styleable.ListPopupWindow, i, j);
    mDropDownHorizontalOffset = typedarray.getDimensionPixelOffset(android.support.v7.appcompat.R.styleable.ListPopupWindow_android_dropDownHorizontalOffset, 0);
    mDropDownVerticalOffset = typedarray.getDimensionPixelOffset(android.support.v7.appcompat.R.styleable.ListPopupWindow_android_dropDownVerticalOffset, 0);
    if (mDropDownVerticalOffset != 0)
    {
        mDropDownVerticalOffsetSet = true;
    }
    typedarray.recycle();
    mPopup = new AppCompatPopupWindow(context, attributeset, i);
    mPopup.setInputMethodMode(1);
    mLayoutDirection = TextUtilsCompat.getLayoutDirectionFromLocale(mContext.getResources().getConfiguration().locale);
}
 
开发者ID:Hamz-a,项目名称:MyCTFWriteUps,代码行数:29,代码来源:ListPopupWindow.java

示例14: isRtl

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
public static boolean isRtl() {
  return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
      == ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:Elias33,项目名称:Quran,代码行数:5,代码来源:QuranUtils.java

示例15: isRTL

import android.support.v4.text.TextUtilsCompat; //导入依赖的package包/类
public static boolean isRTL() {
    return TextUtilsCompat.getLayoutDirectionFromLocale(Locale.getDefault())
            == android.support.v4.view.ViewCompat.LAYOUT_DIRECTION_RTL;
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:5,代码来源:Utils.java


注:本文中的android.support.v4.text.TextUtilsCompat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。