Java Code Examples for android.widget.RelativeLayout#ALIGN_PARENT_LEFT

The following examples show how to use android.widget.RelativeLayout#ALIGN_PARENT_LEFT . 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: GodotAdMob.java    From godot_modules with MIT License 6 votes vote down vote up
public void SetBannerBottomLeft()
{
	if (!initialized) return;

	if (layoutRule1 != RelativeLayout.ALIGN_PARENT_BOTTOM || 
		layoutRule2 != RelativeLayout.ALIGN_PARENT_LEFT)
	{
		activity.runOnUiThread(new Runnable() {
			public void run() {
				layoutRule1 = RelativeLayout.ALIGN_PARENT_BOTTOM; 
				layoutRule2 = RelativeLayout.ALIGN_PARENT_LEFT;
				
				Log.d("godot", "AdMob: Moving Banner to bottom left");
				
				if (adView != null)
				{
					SetBannerView();
				}			
			}
		});
	}
}
 
Example 2
Source File: GodotAdMob.java    From godot_modules with MIT License 6 votes vote down vote up
public void SetBannerTopLeft()
{
	if (!initialized) return;

	if (layoutRule1 != RelativeLayout.ALIGN_PARENT_TOP || 
		layoutRule2 != RelativeLayout.ALIGN_PARENT_LEFT)
	{
		activity.runOnUiThread(new Runnable() {
			public void run() {
				layoutRule1 = RelativeLayout.ALIGN_PARENT_TOP; 
				layoutRule2 = RelativeLayout.ALIGN_PARENT_LEFT;
				
				Log.d("godot", "AdMob: Moving Banner to top left");
				
				if (adView != null)
				{
					SetBannerView();
				}
			}
		});
	}
}
 
Example 3
Source File: GodotAdMob.java    From godot_modules with MIT License 6 votes vote down vote up
public GodotAdMob(Activity p_activity) {

		registerClass("AdMob", new String[] {"ShowBanner", "HideBanner",
				"SetBannerBottomLeft", "SetBannerTopLeft", "ShowInterstitial", "HasReceiveAd",
				"HasDismissScreen", "HasFailedToReceive","HasLeaveApplication","HasPresentScreen"});
		
		activity=p_activity;
		initialized = false;
		
		layoutRule1 = RelativeLayout.ALIGN_PARENT_BOTTOM;
		layoutRule2 = RelativeLayout.ALIGN_PARENT_LEFT;	

		activity.runOnUiThread(new Runnable() {
			public void run() {
				String key = GodotLib.getGlobal("admob/api_key");
				InitializeUIThread(key);
			}
		});	
	}
 
Example 4
Source File: EUExBase.java    From appcan-android with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected final void adptLayoutParams(RelativeLayout.LayoutParams rParms,
                                      FrameLayout.LayoutParams outParm) {
    if (null == rParms) {
        return;
    }
    int TRUE = RelativeLayout.TRUE;
    int ALIGN_PARENT_LEFT = RelativeLayout.ALIGN_PARENT_LEFT;
    int ALIGN_PARENT_TOP = RelativeLayout.ALIGN_PARENT_TOP;
    int ALIGN_PARENT_RIGHT = RelativeLayout.ALIGN_PARENT_RIGHT;
    int ALIGN_PARENT_BOTTOM = RelativeLayout.ALIGN_PARENT_BOTTOM;
    int CENTER_IN_PARENT = RelativeLayout.CENTER_IN_PARENT;
    int CENTER_HORIZONTAL = RelativeLayout.CENTER_HORIZONTAL;
    int CENTER_VERTICAL = RelativeLayout.CENTER_VERTICAL;
    try {
        int[] rules = rParms.getRules();
        if (rules[ALIGN_PARENT_LEFT] == TRUE) {
            outParm.gravity |= Gravity.LEFT;
        }
        if (rules[ALIGN_PARENT_TOP] == TRUE) {
            outParm.gravity |= Gravity.TOP;
        }
        if (rules[ALIGN_PARENT_RIGHT] == TRUE) {
            outParm.gravity |= Gravity.RIGHT;
        }
        if (rules[ALIGN_PARENT_BOTTOM] == TRUE) {
            outParm.gravity |= Gravity.BOTTOM;
        }
        if (rules[CENTER_IN_PARENT] == TRUE) {
            outParm.gravity |= Gravity.CENTER;
        }
        if (rules[CENTER_HORIZONTAL] == TRUE) {
            outParm.gravity |= Gravity.CENTER_HORIZONTAL;
        }
        if (rules[CENTER_VERTICAL] == TRUE) {
            outParm.gravity |= Gravity.CENTER_VERTICAL;
        }
    } catch (Exception e) {
        ;
    }
}
 
Example 5
Source File: HintCaseView.java    From hintcase with Apache License 2.0 4 votes vote down vote up
@NonNull
private FrameLayout getHintBlockFrameLayout() {
    int blockWidth = 0;
    int blockHeight = 0;
    int blockAlign = 0;
    switch (hintBlockPosition) {
        case HintCase.HINT_BLOCK_POSITION_TOP:
            blockWidth = parent.getWidth();
            blockHeight = shape.getTop()
                    - parent.getTop()
                    - DimenUtils.getStatusBarHeight(getContext());
            blockAlign = RelativeLayout.ALIGN_PARENT_TOP;
            break;
        case HintCase.HINT_BLOCK_POSITION_BOTTOM:
            blockWidth = parent.getWidth();
            blockHeight = parent.getBottom()
                    - navigationBarSizeIfExistAtTheBottom.y
                    - shape.getBottom();
            blockAlign = RelativeLayout.ALIGN_PARENT_BOTTOM;
            break;
        case HintCase.HINT_BLOCK_POSITION_LEFT:
            blockWidth = shape.getLeft() - parent.getLeft();
            blockHeight = parent.getHeight() - DimenUtils.getStatusBarHeight(getContext());
            blockAlign = RelativeLayout.ALIGN_PARENT_LEFT;
            break;
        case HintCase.HINT_BLOCK_POSITION_RIGHT:
            blockWidth = parent.getRight()
                    - navigationBarSizeIfExistOnTheRight.x
                    - shape.getRight();
            blockHeight = parent.getHeight() - DimenUtils.getStatusBarHeight(getContext());
            blockAlign = RelativeLayout.ALIGN_PARENT_RIGHT;
            break;
        case HintCase.HINT_BLOCK_POSITION_CENTER:
            blockWidth = parent.getWidth() - navigationBarSizeIfExistOnTheRight.x;
            blockHeight = parent.getHeight()
                    - navigationBarSizeIfExistAtTheBottom.y
                    - DimenUtils.getStatusBarHeight(getContext());
            blockAlign = RelativeLayout.ALIGN_PARENT_BOTTOM;
            break;

    }
    LayoutParams relativeLayoutParams =
            new LayoutParams(blockWidth, blockHeight);
    relativeLayoutParams.addRule(blockAlign);
    relativeLayoutParams.topMargin = DimenUtils.getStatusBarHeight(getContext());
    relativeLayoutParams.bottomMargin = navigationBarSizeIfExistAtTheBottom.y;
    relativeLayoutParams.rightMargin = navigationBarSizeIfExistOnTheRight.x;
    FrameLayout frameLayout = new FrameLayout(getContext());
    frameLayout.setLayoutParams(relativeLayoutParams);
    return frameLayout;
}