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
@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 vote down vote up
@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
@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
/**
 * 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
@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
@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 vote down vote up
@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
/**
 * 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
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 vote down vote up
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
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 vote down vote up
/**
 * 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
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 vote down vote up
public static int getLayoutDirection(View view) {
    if (Build.VERSION.SDK_INT >= 17) {
        return view.getLayoutDirection();
    }
    return View.LAYOUT_DIRECTION_LTR;
}
 
Example 15
@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 vote down vote up
@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 vote down vote up
public static int b(View view)
{
    return view.getLayoutDirection();
}
 
Example 18
public static int getLayoutDirection(View view) {
    return view.getLayoutDirection();
}
 
Example 19
public static int getLayoutDirection(View view) {
    return view.getLayoutDirection();
}
 
Example 20
Source Project: guideshow   File: ViewCompatJellybeanMr1.java    License: MIT License 4 votes vote down vote up
public static int getLayoutDirection(View view) {
    return view.getLayoutDirection();
}