Java Code Examples for android.view.View#getLayoutDirection()
The following examples show how to use
android.view.View#getLayoutDirection() .
These examples are extracted from open source projects.
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 Project: android_9.0.0_r45 File: AutofillPopupWindow.java License: Apache License 2.0 | 5 votes |
@Override protected void update(View anchor, WindowManager.LayoutParams params) { final int layoutDirection = anchor != null ? anchor.getLayoutDirection() : View.LAYOUT_DIRECTION_LOCALE; mWindowPresenter.show(params, getTransitionEpicenter(), isLayoutInsetDecor(), layoutDirection); }
Example 2
Source Project: FlowingPager File: ViewHelper.java License: Apache License 2.0 | 5 votes |
@SuppressLint("NewApi") static int getLayoutDirection(View v) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return v.getLayoutDirection(); } return View.LAYOUT_DIRECTION_LTR; }
Example 3
Source Project: LaunchEnr File: LauncherAccessibilityDelegate.java License: GNU General Public License v3.0 | 5 votes |
@Thunk private void performResizeAction(int action, View host, LauncherAppWidgetInfo info) { CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams(); CellLayout layout = (CellLayout) host.getParent().getParent(); layout.markCellsAsUnoccupiedForView(host); if (action == R.string.action_increase_width) { if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) { lp.cellX --; info.cellX --; } lp.cellHSpan ++; info.spanX ++; } else if (action == R.string.action_decrease_width) { lp.cellHSpan --; info.spanX --; } else if (action == R.string.action_increase_height) { if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) { lp.cellY --; info.cellY --; } lp.cellVSpan ++; info.spanY ++; } else if (action == R.string.action_decrease_height) { lp.cellVSpan --; info.spanY --; } layout.markCellsAsOccupiedForView(host); Rect sizeRange = new Rect(); AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange); ((LauncherAppWidgetHostView) host).updateAppWidgetSize(null, sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom); host.requestLayout(); mLauncher.getModelWriter().updateItemInDatabase(info); announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY)); }
Example 4
Source Project: cronet File: ApiCompatibilityUtils.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Returns true if view's layout direction is right-to-left. * * @param view the View whose layout is being considered */ public static boolean isLayoutRtl(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } else { // All layouts are LTR before JB MR1. return false; } }
Example 5
Source Project: Cybernet-VPN File: ViewHelper.java License: GNU General Public License v3.0 | 5 votes |
@SuppressLint("NewApi") static int getLayoutDirection(View v) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return v.getLayoutDirection(); } return View.LAYOUT_DIRECTION_LTR; }
Example 6
Source Project: Trebuchet File: LauncherAccessibilityDelegate.java License: GNU General Public License v3.0 | 5 votes |
@Thunk void performResizeAction(int action, View host, LauncherAppWidgetInfo info) { CellLayout.LayoutParams lp = (CellLayout.LayoutParams) host.getLayoutParams(); CellLayout layout = (CellLayout) host.getParent().getParent(); layout.markCellsAsUnoccupiedForView(host); if (action == R.string.action_increase_width) { if (((host.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) && layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) || !layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY)) { lp.cellX --; info.cellX --; } lp.cellHSpan ++; info.spanX ++; } else if (action == R.string.action_decrease_width) { lp.cellHSpan --; info.spanX --; } else if (action == R.string.action_increase_height) { if (!layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1)) { lp.cellY --; info.cellY --; } lp.cellVSpan ++; info.spanY ++; } else if (action == R.string.action_decrease_height) { lp.cellVSpan --; info.spanY --; } layout.markCellsAsOccupiedForView(host); Rect sizeRange = new Rect(); AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, sizeRange); ((LauncherAppWidgetHostView) host).updateAppWidgetSize(null, sizeRange.left, sizeRange.top, sizeRange.right, sizeRange.bottom); host.requestLayout(); LauncherModel.updateItemInDatabase(mLauncher, info); announceConfirmation(mLauncher.getString(R.string.widget_resized, info.spanX, info.spanY)); }
Example 7
Source Project: SwipeBack File: ViewHelper.java License: Apache License 2.0 | 5 votes |
@SuppressWarnings("") public static int getLayoutDirection(View v) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return v.getLayoutDirection(); } return View.LAYOUT_DIRECTION_LTR; }
Example 8
Source Project: 365browser File: ApiCompatibilityUtils.java License: Apache License 2.0 | 5 votes |
/** * Returns true if view's layout direction is right-to-left. * * @param view the View whose layout is being considered */ public static boolean isLayoutRtl(View view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } else { // All layouts are LTR before JB MR1. return false; } }
Example 9
Source Project: 365browser File: MaterialProgressDrawable.java License: Apache License 2.0 | 5 votes |
private static boolean isLayoutRtl(View view) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } else { // All layouts are LTR before JB MR1. return false; } }
Example 10
Source Project: WayHoo File: ViewHelper.java License: Apache License 2.0 | 5 votes |
public static int getLayoutDirection(View v) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return v.getLayoutDirection(); } return View.LAYOUT_DIRECTION_LTR; }
Example 11
Source Project: adt-leanback-support File: StreamingTextView.java License: Apache License 2.0 | 5 votes |
public static boolean isLayoutRtl(View view) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == view.getLayoutDirection(); } else { return false; } }
Example 12
Source Project: Android-Next File: ViewUtils.java License: Apache License 2.0 | 5 votes |
/** * 23 * Returns true if view's layout direction is right-to-left. * 24 * * 25 * @param view the View whose layout is being considered * 26 */ public static boolean isLayoutRtl(View view) { if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; } else { // All layouts are LTR before JB MR1. return false; } }
Example 13
Source Project: mollyim-android File: ConversationItemSwipeCallback.java License: GNU General Public License v3.0 | 4 votes |
private static float getSignFromDirection(@NonNull View view) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL ? -1f : 1f; }
Example 14
Source Project: SmartSwipe File: ViewCompat.java License: Apache License 2.0 | 4 votes |
public static int getLayoutDirection(View view) { if (Build.VERSION.SDK_INT >= 17) { return view.getLayoutDirection(); } return View.LAYOUT_DIRECTION_LTR; }
Example 15
Source Project: Transitions-Everywhere File: ViewUtils.java License: Apache License 2.0 | 4 votes |
@Override public boolean isRtl(@NonNull View view) { return view.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL; }
Example 16
Source Project: Dashchan File: DrawerLayout.java License: Apache License 2.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private static int getLayoutDirection(View v) { return C.API_JELLY_BEAN_MR1 ? v.getLayoutDirection() : 0; }
Example 17
Source Project: MiBandDecompiled File: an.java License: Apache License 2.0 | 4 votes |
public static int b(View view) { return view.getLayoutDirection(); }
Example 18
Source Project: CodenameOne File: ViewCompatJellybeanMr1.java License: GNU General Public License v2.0 | 4 votes |
public static int getLayoutDirection(View view) { return view.getLayoutDirection(); }
Example 19
Source Project: adt-leanback-support File: ViewCompatJellybeanMr1.java License: Apache License 2.0 | 4 votes |
public static int getLayoutDirection(View view) { return view.getLayoutDirection(); }
Example 20
Source Project: guideshow File: ViewCompatJellybeanMr1.java License: MIT License | 4 votes |
public static int getLayoutDirection(View view) { return view.getLayoutDirection(); }