androidx.core.text.TextDirectionHeuristicsCompat Java Examples
The following examples show how to use
androidx.core.text.TextDirectionHeuristicsCompat.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StaticLayoutProxy.java From TextLayoutBuilder with Apache License 2.0 | 6 votes |
public static TextDirectionHeuristic fromTextDirectionHeuristicCompat( TextDirectionHeuristicCompat textDirection) { if (textDirection == TextDirectionHeuristicsCompat.LTR) { return TextDirectionHeuristics.LTR; } else if (textDirection == TextDirectionHeuristicsCompat.RTL) { return TextDirectionHeuristics.RTL; } else if (textDirection == TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR) { return TextDirectionHeuristics.FIRSTSTRONG_LTR; } else if (textDirection == TextDirectionHeuristicsCompat.FIRSTSTRONG_RTL) { return TextDirectionHeuristics.FIRSTSTRONG_RTL; } else if (textDirection == TextDirectionHeuristicsCompat.ANYRTL_LTR) { return TextDirectionHeuristics.ANYRTL_LTR; } else if (textDirection == TextDirectionHeuristicsCompat.LOCALE) { return TextDirectionHeuristics.LOCALE; } else { return TextDirectionHeuristics.FIRSTSTRONG_LTR; } }
Example #2
Source File: CollapsingTextHelper.java From UIWidget with Apache License 2.0 | 5 votes |
private boolean calculateIsRtl(CharSequence text) { final boolean defaultIsRtl = ViewCompat.getLayoutDirection(mView) == ViewCompat.LAYOUT_DIRECTION_RTL; return (defaultIsRtl ? TextDirectionHeuristicsCompat.FIRSTSTRONG_RTL : TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR).isRtl(text, 0, text.length()); }
Example #3
Source File: CollapsingTextHelper.java From material-components-android with Apache License 2.0 | 5 votes |
private boolean calculateIsRtl(@NonNull CharSequence text) { final boolean defaultIsRtl = isDefaultIsRtl(); return (defaultIsRtl ? TextDirectionHeuristicsCompat.FIRSTSTRONG_RTL : TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR) .isRtl(text, 0, text.length()); }
Example #4
Source File: AddonsActivity.java From Kore with Apache License 2.0 | 5 votes |
/** * Callbacks from Send text dialog */ @Override public void onSendTextFinished(String text, boolean done) { dialogShown = false; if (TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR.isRtl(text, 0, text.length())) { text = new StringBuilder(text).reverse().toString(); } sendTextInput(text,done, false); }
Example #5
Source File: RemoteActivity.java From Kore with Apache License 2.0 | 5 votes |
/** * Callbacks from Send text dialog */ public void onSendTextFinished(String text, boolean done) { if (TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR.isRtl(text, 0, text.length())) { text = new StringBuilder(text).reverse().toString(); } Input.SendText action = new Input.SendText(text, done); action.execute(hostManager.getConnection(), null, null); }
Example #6
Source File: SubtitleCollapsingTextHelper.java From collapsingtoolbarlayout-subtitle with Apache License 2.0 | 4 votes |
private boolean calculateIsRtl(@NonNull CharSequence text) { final boolean defaultIsRtl = ViewCompat.getLayoutDirection(view) == ViewCompat.LAYOUT_DIRECTION_RTL; return (defaultIsRtl ? TextDirectionHeuristicsCompat.FIRSTSTRONG_RTL : TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR).isRtl(text, 0, text.length()); }
Example #7
Source File: TextLayoutBuilderTest.java From TextLayoutBuilder with Apache License 2.0 | 4 votes |
@Test public void testSetTextDirection() { mLayout = mBuilder.setTextDirection(TextDirectionHeuristicsCompat.LOCALE).build(); assertEquals(mBuilder.getTextDirection(), TextDirectionHeuristicsCompat.LOCALE); }
Example #8
Source File: CollapsingTextHelper.java From cathode with Apache License 2.0 | 4 votes |
private boolean calculateIsRtl(CharSequence text) { final boolean defaultIsRtl = ViewCompat.getLayoutDirection(mView) == ViewCompat.LAYOUT_DIRECTION_RTL; return (defaultIsRtl ? TextDirectionHeuristicsCompat.FIRSTSTRONG_RTL : TextDirectionHeuristicsCompat.FIRSTSTRONG_LTR).isRtl(text, 0, text.length()); }