Example usage for android.widget RelativeLayout ALIGN_PARENT_LEFT

List of usage examples for android.widget RelativeLayout ALIGN_PARENT_LEFT

Introduction

In this page you can find the example usage for android.widget RelativeLayout ALIGN_PARENT_LEFT.

Prototype

int ALIGN_PARENT_LEFT

To view the source code for android.widget RelativeLayout ALIGN_PARENT_LEFT.

Click Source Link

Document

Rule that aligns the child's left edge with its RelativeLayout parent's left edge.

Usage

From source file:com.nextgis.ngm_clink_monitoring.fragments.MapFragment.java

protected void addMapButtons() {
    Context context = getActivity();

    if (mivZoomIn == null || mivZoomOut == null) {
        mivZoomIn = new ImageView(context);
        mivZoomIn.setImageResource(R.drawable.ic_plus);
        mivZoomIn.setId(ViewUtil.generateViewId());

        mivZoomOut = new ImageView(context);
        mivZoomOut.setImageResource(R.drawable.ic_minus);
        mivZoomOut.setId(ViewUtil.generateViewId());

        mivZoomIn.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mMapView.zoomIn();// ww w. j av a2s  . co m
            }
        });

        mivZoomOut.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                mMapView.zoomOut();
            }
        });
    }

    mButtonsRelativeLayout = (RelativeLayout) mMapRelativeLayout.findViewById(mButtonsRelativeLayoutId);

    if (null == mButtonsRelativeLayout) {
        mButtonsRelativeLayout = new RelativeLayout(context);
        mButtonsRelativeLayout.setId(mButtonsRelativeLayoutId);

        RelativeLayout.LayoutParams paramsButtonIn = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        RelativeLayout.LayoutParams paramsButtonOut = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        RelativeLayout.LayoutParams paramsButtonsRl = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);

        paramsButtonIn.setMargins(mMargins + 5, mMargins - 5, mMargins + 5, mMargins + 5);
        paramsButtonOut.setMargins(mMargins + 5, mMargins + 5, mMargins + 5, mMargins - 5);

        paramsButtonOut.addRule(RelativeLayout.BELOW, mivZoomIn.getId());
        paramsButtonsRl.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        paramsButtonsRl.addRule(RelativeLayout.CENTER_IN_PARENT);

        mButtonsRelativeLayout.addView(mivZoomIn, paramsButtonIn);
        mButtonsRelativeLayout.addView(mivZoomOut, paramsButtonOut);
        mMapRelativeLayout.addView(mButtonsRelativeLayout, paramsButtonsRl);
    }

    setZoomInEnabled(mMapView.canZoomIn());
    setZoomOutEnabled(mMapView.canZoomOut());
}

From source file:org.openremote.android.console.AppSettingsActivity.java

/**
 * Creates the auto layout.//  www  .  j av  a  2 s  .co  m
 * It contains toggle button to switch auto state, two text view to indicate auto messages.
 * 
 * @return the relative layout
 */
private RelativeLayout createAutoLayout() {
    RelativeLayout autoLayout = new RelativeLayout(this);
    autoLayout.setPadding(10, 5, 10, 10);
    autoLayout.setLayoutParams(new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, 80));
    TextView autoText = new TextView(this);
    RelativeLayout.LayoutParams autoTextLayout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    autoTextLayout.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    autoTextLayout.addRule(RelativeLayout.CENTER_VERTICAL);
    autoText.setLayoutParams(autoTextLayout);
    autoText.setText("Auto Discovery");

    ToggleButton autoButton = new ToggleButton(this);
    autoButton.setWidth(150);
    RelativeLayout.LayoutParams autoButtonLayout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    autoButtonLayout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    autoButtonLayout.addRule(RelativeLayout.CENTER_VERTICAL);
    autoButton.setLayoutParams(autoButtonLayout);
    autoButton.setChecked(autoMode);
    autoButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            appSettingsView.removeViewAt(2);
            currentServer = "";
            if (isChecked) {
                IPAutoDiscoveryServer.isInterrupted = false;
                appSettingsView.addView(constructAutoServersView(), 2);
            } else {
                IPAutoDiscoveryServer.isInterrupted = true;
                appSettingsView.addView(constructCustomServersView(), 2);
            }
            AppSettingsModel.setAutoMode(AppSettingsActivity.this, isChecked);
        }
    });

    TextView infoText = new TextView(this);
    RelativeLayout.LayoutParams infoTextLayout = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    infoTextLayout.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    infoTextLayout.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    infoText.setLayoutParams(infoTextLayout);
    infoText.setTextSize(10);
    infoText.setText("Turn off auto-discovery to input controller url manually.");

    autoLayout.addView(autoText);
    autoLayout.addView(autoButton);
    autoLayout.addView(infoText);
    return autoLayout;
}

From source file:com.raspi.chatapp.ui.chatting.SendImageFragment.java

private void keyboardClosed() {
    if (keyboardShown) {
        try {/*from  w w  w .ja  va 2s .c  om*/
            showSystemUI();
            View buttons = getActivity().findViewById(R.id.send_image_buttons);
            View viewPager = getActivity().findViewById(R.id.send_image_view_pager);
            RelativeLayout.LayoutParams viewPagerParams = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
            viewPagerParams.addRule(RelativeLayout.ABOVE, R.id.send_image_overview);
            viewPagerParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
            viewPagerParams.addRule(RelativeLayout.ALIGN_PARENT_START);
            viewPager.setLayoutParams(viewPagerParams);
            RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            imageParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
            images.get(current).getImageLayout().setLayoutParams(imageParams);
            if (images.size() > 1)
                getActivity().findViewById(R.id.send_image_overview).setVisibility(View.VISIBLE);
            buttons.setVisibility(View.VISIBLE);
        } catch (Exception e) {
            e.printStackTrace();
        }
        keyboardShown = false;
    }
}

From source file:com.almalence.plugins.capture.video.VideoCapturePlugin.java

@Override
public void onGUICreate() {
    this.clearViews();

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ApplicationScreen.getMainContext());

    // change shutter icon
    isRecording = false;/*from   ww  w.  j  av  a 2s .c om*/
    prefs.edit().putBoolean("videorecording", false).commit();

    ApplicationScreen.getGUIManager().setShutterIcon(ShutterButton.RECORDER_START);

    onPreferenceCreate((PreferenceFragment) null);

    setupVideoSize(prefs);

    List<View> specialView = new ArrayList<View>();
    RelativeLayout specialLayout = (RelativeLayout) ApplicationScreen.instance
            .findViewById(R.id.specialPluginsLayout2);
    for (int i = 0; i < specialLayout.getChildCount(); i++)
        specialView.add(specialLayout.getChildAt(i));

    for (int j = 0; j < specialView.size(); j++) {
        View view = specialView.get(j);
        int view_id = view.getId();
        if (view_id == this.mRecordingTimeView.getId() || view_id == this.modeSwitcher.getId()) {
            if (view.getParent() != null)
                ((ViewGroup) view.getParent()).removeView(view);

            specialLayout.removeView(view);
        }
    }

    {
        final RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);

        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

        ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout3))
                .removeView(this.modeSwitcher);
        ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout3))
                .addView(this.modeSwitcher, params);

        this.modeSwitcher.setLayoutParams(params);
    }

    // Calculate right sizes for plugin's controls
    DisplayMetrics metrics = new DisplayMetrics();
    ApplicationScreen.instance.getWindowManager().getDefaultDisplay().getMetrics(metrics);
    float fScreenDensity = metrics.density;

    int iIndicatorSize = (int) (ApplicationScreen.getMainContext().getResources()
            .getInteger(R.integer.infoControlHeight) * fScreenDensity);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(iIndicatorSize, iIndicatorSize);
    int topMargin = ApplicationScreen.instance.findViewById(R.id.paramsLayout).getHeight()
            + (int) ApplicationScreen.getAppResources().getDimension(R.dimen.viewfinderViewsMarginTop);
    params.setMargins((int) (2 * ApplicationScreen.getGUIManager().getScreenDensity()), topMargin, 0, 0);

    params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);

    ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout2))
            .addView(this.mRecordingTimeView, params);

    this.mRecordingTimeView.setLayoutParams(params);

    LayoutInflater inflator = ApplicationScreen.instance.getLayoutInflater();
    buttonsLayout = inflator.inflate(R.layout.plugin_capture_video_layout, null, false);
    buttonsLayout.setVisibility(View.VISIBLE);

    timeLapseButton = (RotateImageView) buttonsLayout.findViewById(R.id.buttonTimeLapse);
    pauseVideoButton = (RotateImageView) ApplicationScreen.instance.findViewById(R.id.buttonVideoPause);
    stopVideoButton = (RotateImageView) ApplicationScreen.instance.findViewById(R.id.buttonVideoStop);

    snapshotSupported = CameraController.isVideoSnapshotSupported();
    takePictureButton = (RotateImageView) buttonsLayout.findViewById(R.id.buttonCaptureImage);

    timeLapseButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            TimeLapseDialog();
        }
    });

    pauseVideoButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            pauseVideoRecording();
        }
    });

    stopVideoButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            onShutterClick();
        }
    });

    if (snapshotSupported) {
        takePictureButton.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                takePicture();
            }

        });
    }

    for (int j = 0; j < specialView.size(); j++) {
        View view = specialView.get(j);
        int view_id = view.getId();
        if (view_id == this.buttonsLayout.getId()) {
            if (view.getParent() != null)
                ((ViewGroup) view.getParent()).removeView(view);

            specialLayout.removeView(view);
        }
    }

    params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    params.height = (int) ApplicationScreen.getAppResources().getDimension(R.dimen.videobuttons_size);

    params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);

    ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout2))
            .addView(this.buttonsLayout, params);

    this.buttonsLayout.setLayoutParams(params);

    if (snapshotSupported) {
        takePictureButton.setOrientation(ApplicationScreen.getGUIManager().getLayoutOrientation());
        takePictureButton.invalidate();
        // takePictureButton.requestLayout();
        displayTakePicture = true;
    } else {
        takePictureButton.setVisibility(View.GONE);
        displayTakePicture = false;
    }

    timeLapseButton.setOrientation(ApplicationScreen.getGUIManager().getLayoutOrientation());

    if (this.modeDRO() || CameraController.isRemoteCamera()) {
        takePictureButton.setVisibility(View.GONE);
        timeLapseButton.setVisibility(View.GONE);
    }

    if (prefs.getBoolean("videoStartStandardPref", false)) {
        DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                switch (which) {
                case DialogInterface.BUTTON_POSITIVE:
                    PluginManager.getInstance().onPause(true);
                    Intent intent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE);
                    ApplicationScreen.instance.startActivity(intent);
                    break;

                case DialogInterface.BUTTON_NEGATIVE:
                    // No button clicked
                    break;
                default:
                    break;
                }
            }
        };

        AlertDialog.Builder builder = new AlertDialog.Builder(ApplicationScreen.instance);
        builder.setMessage("You selected to start standard camera. Start camera?")
                .setPositiveButton("Yes", dialogClickListener).setNegativeButton("No", dialogClickListener)
                .show();
    }

    rotatorLayout = inflator.inflate(R.layout.plugin_capture_video_lanscaperotate_layout, null, false);
    rotatorLayout.setVisibility(View.VISIBLE);
    initRotateNotification(videoOrientation);

    List<View> specialViewRotator = new ArrayList<View>();
    RelativeLayout specialLayoutRotator = (RelativeLayout) ApplicationScreen.instance
            .findViewById(R.id.specialPluginsLayout);
    for (int i = 0; i < specialLayoutRotator.getChildCount(); i++)
        specialViewRotator.add(specialLayoutRotator.getChildAt(i));

    for (int j = 0; j < specialViewRotator.size(); j++) {
        View view = specialViewRotator.get(j);
        int view_id = view.getId();
        int layout_id = this.rotatorLayout.getId();
        if (view_id == layout_id) {
            if (view.getParent() != null)
                ((ViewGroup) view.getParent()).removeView(view);

            specialLayoutRotator.removeView(view);
        }
    }

    RelativeLayout.LayoutParams paramsRotator = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
            LayoutParams.WRAP_CONTENT);
    paramsRotator.height = (int) ApplicationScreen.getAppResources().getDimension(R.dimen.gui_element_2size);

    paramsRotator.addRule(RelativeLayout.CENTER_IN_PARENT);

    ((RelativeLayout) ApplicationScreen.instance.findViewById(R.id.specialPluginsLayout))
            .addView(this.rotatorLayout, paramsRotator);
}

From source file:com.raspi.chatapp.ui.chatting.SendImageFragment.java

private void keyboardOpened() {
    if (!keyboardShown) {
        try {//  w  w  w .  ja  va 2 s . c  om
            View buttons = getActivity().findViewById(R.id.send_image_buttons);
            View viewPager = getActivity().findViewById(R.id.send_image_view_pager);
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
            params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
            params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
            params.addRule(RelativeLayout.ALIGN_PARENT_START);
            viewPager.setLayoutParams(params);
            RelativeLayout.LayoutParams imageParams = new RelativeLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            imageParams.addRule(RelativeLayout.ABOVE, R.id.send_image_description_layout);
            images.get(current).getImageLayout().setLayoutParams(imageParams);
            if (images.size() > 1)
                getActivity().findViewById(R.id.send_image_overview).setVisibility(View.GONE);
            buttons.setVisibility(View.GONE);
            hideSystemUI();
        } catch (Exception e) {
            e.printStackTrace();
        }
        keyboardShown = true;
    }
}

From source file:com.stemsc.bt.BarcodeCaptureActivity.java

@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {

    RelativeLayout.LayoutParams MyParams = new RelativeLayout.LayoutParams(64 * sbS.getProgress() / 10,
            72 * sbS.getProgress() / 10);
    MyParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    MyParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    MyParams.topMargin = sbW.getProgress();
    MyParams.leftMargin = sbH.getProgress();
    target.setLayoutParams(MyParams);/*from  w ww . jav a2 s.  c o  m*/

}

From source file:com.ibm.mil.readyapps.physio.fragments.PainLocationFragment.java

/**
 * Lays out the body using the front images.
 *//*from   w  ww . j ava 2  s  .c  om*/
private void setMaleFront() {

    front = true;

    RelativeLayout.LayoutParams lp;

    lp = new RelativeLayout.LayoutParams(dipToPixels(42), dipToPixels(65));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT);
    lp.bottomMargin = dipToPixels(304);
    head.setLayoutParams(lp);
    head.setBackground(getResources().getDrawable(R.drawable.male_head_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(58), dipToPixels(101));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT);
    lp.bottomMargin = dipToPixels(206);
    torso.setLayoutParams(lp);
    torso.setBackground(getResources().getDrawable(R.drawable.male_torso_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(67), dipToPixels(41));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.CENTER_IN_PARENT);
    lp.bottomMargin = dipToPixels(168);
    shorts.setLayoutParams(lp);
    shorts.setBackground(getResources().getDrawable(R.drawable.male_groin_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(37), dipToPixels(67));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(108);
    lp.leftMargin = dipToPixels(141);
    r_top.setLayoutParams(lp);
    r_top.setBackground(getResources().getDrawable(R.drawable.male_leftthigh_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(24), dipToPixels(76));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(40);
    lp.leftMargin = dipToPixels(137);
    r_bot.setLayoutParams(lp);
    r_bot.setBackground(getResources().getDrawable(R.drawable.male_leftcalf_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(24), dipToPixels(42));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(0);
    lp.leftMargin = dipToPixels(129);
    r_foot.setLayoutParams(lp);
    r_foot.setBackground(getResources().getDrawable(R.drawable.male_leftfoot_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(37), dipToPixels(67));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(109);
    lp.leftMargin = dipToPixels(182);
    l_top.setLayoutParams(lp);
    l_top.setBackground(getResources().getDrawable(R.drawable.male_rightthigh_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(24), dipToPixels(76));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(41);
    lp.leftMargin = dipToPixels(199);
    l_bot.setLayoutParams(lp);
    l_bot.setBackground(getResources().getDrawable(R.drawable.male_rightcalf_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(24), dipToPixels(42));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(1);
    lp.leftMargin = dipToPixels(207);
    l_foot.setLayoutParams(lp);
    l_foot.setBackground(getResources().getDrawable(R.drawable.male_rightfoot_foot_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(73), dipToPixels(92));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(215);
    lp.leftMargin = dipToPixels(87);
    r_arm.setLayoutParams(lp);
    r_arm.setBackground(getResources().getDrawable(R.drawable.male_leftarm_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(35), dipToPixels(35));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(186);
    lp.leftMargin = dipToPixels(61);
    r_hand.setLayoutParams(lp);
    r_hand.setBackground(getResources().getDrawable(R.drawable.male_lefthand_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(73), dipToPixels(92));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(215);
    lp.leftMargin = dipToPixels(200);
    l_arm.setLayoutParams(lp);
    l_arm.setBackground(getResources().getDrawable(R.drawable.male_rightarm_front_3x));

    lp = new RelativeLayout.LayoutParams(dipToPixels(35), dipToPixels(35));
    lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    lp.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    lp.bottomMargin = dipToPixels(186);
    lp.leftMargin = dipToPixels(265);
    l_hand.setLayoutParams(lp);
    l_hand.setBackground(getResources().getDrawable(R.drawable.male_righthand_front_3x));

    bodyLayout.invalidate();

}

From source file:com.appsimobile.appsii.Appsi.java

public SidebarHotspot.SwipeListener openSidebar(HotspotItem conf, CircularArray<HotspotPageEntry> entries,
        int flags, boolean animate) {

    LockableAsyncQueryHandler.lock();//from  ww  w  .j a  v a 2  s.  c om
    mSidebar.setSidebarOpening(true);

    if (!mLoaderManager.isStarted()) {
        mLoaderManager.doStart();
    }

    boolean fullscreen = mHotspotHelper.getTopOffset() == 0;

    mSidebar.setInFullScreenMode(fullscreen);

    mNotificationLikeOpener.mRemoveAfterScrollEnd = false;
    mScrollAnimationListener = null;
    mSidebar.animate().cancel();

    // users reported this may happen
    if (mSidebarVisible) {
        mPopupLayer.forceClose();
        mSidebarVisible = false;
    }

    int sidebarWidth = getSidebarWidth();

    mSidebarVisible = true;

    if (conf == null) {
        conf = getDefaultConfiguration();
    }

    SwipeListener result = null;
    boolean openLikeNotificationBar = (flags & OPEN_FLAG_LIKE_NOTIFICATION_BAR) != 0;
    mSidebar.setTag(conf);
    boolean left = conf.mLeft;

    boolean forceLeft = (flags & OPEN_FLAG_LEFT) != 0;
    boolean forceRight = (flags & OPEN_FLAG_RIGHT) != 0;

    if (forceLeft) {
        left = true;
    }
    if (forceRight) {
        left = false;
    }
    mSidebar.setIsLeft(left);

    View v = mSidebar.findViewById(R.id.sidebar_content);

    RelativeLayout.LayoutParams sidebarLayoutParams = (RelativeLayout.LayoutParams) v.getLayoutParams();
    sidebarLayoutParams.width = sidebarWidth;

    View container = mSidebar.findViewById(R.id.sidebar_container);
    RelativeLayout.LayoutParams slp = (RelativeLayout.LayoutParams) container.getLayoutParams();

    if (left) {
        slp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
        slp.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
        sidebarLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, 0);
        sidebarLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
    } else {
        slp.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
        slp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
        sidebarLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0);
        sidebarLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
    }

    if (animate && !openLikeNotificationBar) {

        mNotificationLikeOpener.cancel();

        if (left) {
            mSidebar.setTranslationX(-sidebarWidth);
            mSidebar.animate().setInterpolator(mInInterpolator).setDuration(400).setListener(null)
                    .translationX(0);
            mSidebar.findViewById(R.id.sidebar_left_shadow).setVisibility(View.GONE);
            mSidebar.findViewById(R.id.sidebar_right_shadow).setVisibility(View.VISIBLE);
        } else {
            mSidebar.setTranslationX(sidebarWidth);
            mSidebar.animate().setDuration(400).setListener(null).setInterpolator(mInInterpolator)
                    .translationX(0);
            mSidebar.findViewById(R.id.sidebar_left_shadow).setVisibility(View.VISIBLE);
            mSidebar.findViewById(R.id.sidebar_right_shadow).setVisibility(View.GONE);
        }
        updateDimColor(mSidebar, left);
        mPopupLayer.addPopupChild(mSidebar);
        mSidebar.updateAdapterData(conf.mDefaultPageId, entries);

        mScrollAnimationListener = null;
    } else if (openLikeNotificationBar) {
        result = mNotificationLikeOpener;

        if (left) {
            mSidebar.findViewById(R.id.sidebar_right_shadow).setVisibility(View.VISIBLE);
            mSidebar.findViewById(R.id.sidebar_left_shadow).setVisibility(View.GONE);
        } else {
            mSidebar.findViewById(R.id.sidebar_right_shadow).setVisibility(View.GONE);
            mSidebar.findViewById(R.id.sidebar_left_shadow).setVisibility(View.VISIBLE);
        }

        int w = mWindowManager.getDefaultDisplay().getWidth();
        int h = mWindowManager.getDefaultDisplay().getHeight();
        int sw = Math.min(w, h);

        mNotificationLikeOpener.setTargetView(mSidebar, sidebarWidth, sw, left);
        mSidebar.updateAdapterData(conf.mDefaultPageId, entries);
        mPopupLayer.addPopupChild(mSidebar);
    } else {
        mSidebar.setTranslationX(0);
        mPopupLayer.addPopupChild(mSidebar);
    }

    return result;
}

From source file:com.cranberrygame.cordova.plugin.ad.admob.Util.java

private void _showBannerAd_overlap(String position, String size) {
    //http://tigerwoods.tistory.com/11
    //http://developer.android.com/reference/android/widget/RelativeLayout.html
    //http://stackoverflow.com/questions/24900725/admob-banner-poitioning-in-android-on-bottom-of-the-screen-using-no-xml-relative
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(AdView.LayoutParams.WRAP_CONTENT,
            AdView.LayoutParams.WRAP_CONTENT);
    if (position.equals("top-left")) {
        Log.d(LOG_TAG, "top-left");
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    } else if (position.equals("top-center")) {
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
    } else if (position.equals("top-right")) {
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    } else if (position.equals("left")) {
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.addRule(RelativeLayout.CENTER_VERTICAL);
    } else if (position.equals("center")) {
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
        params.addRule(RelativeLayout.CENTER_VERTICAL);
    } else if (position.equals("right")) {
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
        params.addRule(RelativeLayout.CENTER_VERTICAL);
    } else if (position.equals("bottom-left")) {
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    } else if (position.equals("bottom-center")) {

        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
    } else if (position.equals("bottom-right")) {
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    } else {//from   ww  w. ja va2  s . co  m
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
    }

    //bannerViewLayout.addView(bannerView, params);
    bannerView.setLayoutParams(params);
    bannerViewLayout.addView(bannerView);
}

From source file:com.google.sample.cast.refplayer.Synchronization.java

/**
 *  Setting the Normal Clip bar(orange)//from  w w  w.  j  a va  2s.  com
 */
private void SetNormalClipBar() {
    /**
     *  Setting the clip bar (orange) */
    prev_end_p = (int) mDuration;
    seekBar = new RangeSeekBar(0, (int) mDuration, this);
    seekBar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {
        @Override
        public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar, Integer start_p, Integer end_p) {
            // handle changed range values
            Log.i(TAG, "Selected new range values: MIN=" + start_p + ", MAX=" + end_p);

            CurSysTime = System.currentTimeMillis();
            if (end_p > (CurSysTime - SysStartTime)) {
                seekBar.setSelectedMaxValue((int) (CurSysTime - SysStartTime));
                prev_end_p = (int) (CurSysTime - SysStartTime);
                seekVideoView();
                mVideoView.start();
                SystemClock.sleep(100);
                mVideoView.pause();
                mPreview.setVisibility(View.VISIBLE);
                if (condition == 2)
                    mSendClip.setVisibility(View.VISIBLE);
                SetReturnBtn();
            } else if (condition == 2 || condition == 3) {
                // Clip Condition
                mClipDuration.setText("  " + com.google.android.libraries.cast.companionlibrary.utils.Utils
                        .formatMillis(prev_end_p - prev_start_p) + "  ");
                mPreview.setVisibility(View.VISIBLE);
                if (condition == 2) {
                    mSendClip.setVisibility(View.VISIBLE);
                }
                SetReturnBtn();

                if (start_p != prev_start_p) {
                    mCurTime = start_p;
                    seekVideoView();

                    prev_start_p = start_p;
                    mVideoView.start();
                    SystemClock.sleep(100);
                    mVideoView.pause();
                }
                if (end_p != prev_end_p) {
                    mCurTime = end_p;
                    seekVideoView();

                    prev_end_p = end_p;
                    mVideoView.start();
                    SystemClock.sleep(100);
                    mVideoView.pause();
                }
            }

        }
    });
    seekVideoView();
    seekBar.setSelectedMaxValue(mCurTime); //Let the rangeseekbar start at the begin

    // add RangeSeekBar to pre-defined layout
    RelativeLayout layout = (RelativeLayout) findViewById(R.id.synchronization);
    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);

    params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, seekBar.getId());
    params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, seekBar.getId());
    params.addRule(RelativeLayout.BELOW, mVideoView.getId());
    seekBar.setVisibility(View.VISIBLE);
    layout.addView(seekBar, params);
}