Example usage for android.widget RelativeLayout getLayoutParams

List of usage examples for android.widget RelativeLayout getLayoutParams

Introduction

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

Prototype

@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
public ViewGroup.LayoutParams getLayoutParams() 

Source Link

Document

Get the LayoutParams associated with this view.

Usage

From source file:cw.kop.autobackground.sources.SourceListFragment.java

/**
 * Shows LocalImageFragment to view images
 *
 * @param view  source card which was selected
 * @param index position of source in listAdapter
 *///from   w  w w  .  j  a  va 2 s  .  c o  m
private void showViewImageFragment(final View view, final int index) {
    sourceList.setOnItemClickListener(null);
    sourceList.setEnabled(false);

    listAdapter.saveData();
    Source item = listAdapter.getItem(index);
    String type = item.getType();
    String directory;
    if (type.equals(AppSettings.FOLDER)) {
        directory = item.getData().split(AppSettings.DATA_SPLITTER)[0];
    } else {
        directory = AppSettings.getDownloadPath() + "/" + item.getTitle() + " " + AppSettings.getImagePrefix();
    }

    Log.i(TAG, "Directory: " + directory);

    final RelativeLayout sourceContainer = (RelativeLayout) view.findViewById(R.id.source_container);
    final ImageView sourceImage = (ImageView) view.findViewById(R.id.source_image);
    final View imageOverlay = view.findViewById(R.id.source_image_overlay);
    final EditText sourceTitle = (EditText) view.findViewById(R.id.source_title);
    final ImageView deleteButton = (ImageView) view.findViewById(R.id.source_delete_button);
    final ImageView viewButton = (ImageView) view.findViewById(R.id.source_view_image_button);
    final ImageView editButton = (ImageView) view.findViewById(R.id.source_edit_button);
    final LinearLayout sourceExpandContainer = (LinearLayout) view.findViewById(R.id.source_expand_container);

    final float viewStartHeight = sourceContainer.getHeight();
    final float viewStartY = view.getY();
    final float overlayStartAlpha = imageOverlay.getAlpha();
    final float listHeight = sourceList.getHeight();
    Log.i(TAG, "listHeight: " + listHeight);
    Log.i(TAG, "viewStartHeight: " + viewStartHeight);

    final LocalImageFragment localImageFragment = new LocalImageFragment();
    Bundle arguments = new Bundle();
    arguments.putString("view_path", directory);
    localImageFragment.setArguments(arguments);

    Animation animation = new Animation() {

        private boolean needsFragment = true;

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {

            if (needsFragment && interpolatedTime >= 1) {
                needsFragment = false;
                getFragmentManager().beginTransaction()
                        .add(R.id.content_frame, localImageFragment, "image_fragment").addToBackStack(null)
                        .setTransition(FragmentTransaction.TRANSIT_NONE).commit();
            }
            ViewGroup.LayoutParams params = sourceContainer.getLayoutParams();
            params.height = (int) (viewStartHeight + (listHeight - viewStartHeight) * interpolatedTime);
            sourceContainer.setLayoutParams(params);
            view.setY(viewStartY - interpolatedTime * viewStartY);
            deleteButton.setAlpha(1.0f - interpolatedTime);
            viewButton.setAlpha(1.0f - interpolatedTime);
            editButton.setAlpha(1.0f - interpolatedTime);
            sourceTitle.setAlpha(1.0f - interpolatedTime);
            imageOverlay.setAlpha(overlayStartAlpha - overlayStartAlpha * (1.0f - interpolatedTime));
            sourceExpandContainer.setAlpha(1.0f - interpolatedTime);
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (needsListReset) {
                Parcelable state = sourceList.onSaveInstanceState();
                sourceList.setAdapter(null);
                sourceList.setAdapter(listAdapter);
                sourceList.onRestoreInstanceState(state);
                sourceList.setOnItemClickListener(SourceListFragment.this);
                sourceList.setEnabled(true);
                needsListReset = false;
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    ValueAnimator cardColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(),
            AppSettings.getDialogColor(appContext),
            getResources().getColor(AppSettings.getBackgroundColorResource()));
    cardColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            sourceContainer.setBackgroundColor((Integer) animation.getAnimatedValue());
        }

    });

    DecelerateInterpolator decelerateInterpolator = new DecelerateInterpolator(1.5f);

    animation.setDuration(INFO_ANIMATION_TIME);
    cardColorAnimation.setDuration(INFO_ANIMATION_TIME);

    animation.setInterpolator(decelerateInterpolator);
    cardColorAnimation.setInterpolator(decelerateInterpolator);

    needsListReset = true;
    cardColorAnimation.start();
    view.startAnimation(animation);

}

From source file:com.forrestguice.suntimeswidget.EquinoxView.java

private void init(Context context, AttributeSet attrs) {
    initLocale(context);/*from w  ww.j  a v  a 2s .  c  o m*/
    initColors(context);
    LayoutInflater.from(context).inflate(R.layout.layout_view_equinox, this, true);

    if (attrs != null) {
        LinearLayout.LayoutParams lp = generateLayoutParams(attrs);
        centered = ((lp.gravity == Gravity.CENTER) || (lp.gravity == Gravity.CENTER_HORIZONTAL));
    }

    empty = (TextView) findViewById(R.id.txt_empty);

    flipper = (ViewFlipper) findViewById(R.id.info_equinoxsolstice_flipper);
    flipper.setOnTouchListener(cardTouchListener);

    notes = new ArrayList<EquinoxNote>();

    RelativeLayout thisYear = (RelativeLayout) findViewById(R.id.info_equinoxsolstice_thisyear);
    if (thisYear != null) {
        btn_flipperNext_thisYear = (ImageButton) thisYear.findViewById(R.id.info_time_nextbtn);
        btn_flipperNext_thisYear.setOnClickListener(onNextCardClick);
        btn_flipperNext_thisYear.setOnTouchListener(createButtonListener(btn_flipperNext_thisYear));

        btn_flipperPrev_thisYear = (ImageButton) thisYear.findViewById(R.id.info_time_prevbtn);
        btn_flipperPrev_thisYear.setVisibility(View.GONE);

        titleThisYear = (TextView) thisYear.findViewById(R.id.text_title);

        TextView txt_equinox_vernal_label = (TextView) thisYear
                .findViewById(R.id.text_date_equinox_vernal_label);
        TextView txt_equinox_vernal = (TextView) thisYear.findViewById(R.id.text_date_equinox_vernal);
        TextView txt_equinox_vernal_note = (TextView) thisYear.findViewById(R.id.text_date_equinox_vernal_note);
        note_equinox_vernal = addNote(txt_equinox_vernal_label, txt_equinox_vernal, txt_equinox_vernal_note, 0);

        TextView txt_solstice_summer_label = (TextView) thisYear
                .findViewById(R.id.text_date_solstice_summer_label);
        TextView txt_solstice_summer = (TextView) thisYear.findViewById(R.id.text_date_solstice_summer);
        TextView txt_solstice_summer_note = (TextView) thisYear
                .findViewById(R.id.text_date_solstice_summer_note);
        note_solstice_summer = addNote(txt_solstice_summer_label, txt_solstice_summer, txt_solstice_summer_note,
                0);

        TextView txt_equinox_autumnal_label = (TextView) thisYear
                .findViewById(R.id.text_date_equinox_autumnal_label);
        TextView txt_equinox_autumnal = (TextView) thisYear.findViewById(R.id.text_date_equinox_autumnal);
        TextView txt_equinox_autumnal_note = (TextView) thisYear
                .findViewById(R.id.text_date_equinox_autumnal_note);
        note_equinox_autumnal = addNote(txt_equinox_autumnal_label, txt_equinox_autumnal,
                txt_equinox_autumnal_note, 0);

        TextView txt_solstice_winter_label = (TextView) thisYear
                .findViewById(R.id.text_date_solstice_winter_label);
        TextView txt_solstice_winter = (TextView) thisYear.findViewById(R.id.text_date_solstice_winter);
        TextView txt_solstice_winter_note = (TextView) thisYear
                .findViewById(R.id.text_date_solstice_winter_note);
        note_solstice_winter = addNote(txt_solstice_winter_label, txt_solstice_winter, txt_solstice_winter_note,
                0);

        if (centered) {
            FrameLayout.LayoutParams lpThisYear = (FrameLayout.LayoutParams) thisYear.getLayoutParams();
            lpThisYear.gravity = Gravity.CENTER_HORIZONTAL;
            thisYear.setLayoutParams(lpThisYear);
        }
    }

    RelativeLayout nextYear = (RelativeLayout) findViewById(R.id.info_equinoxsolstice_nextyear);
    if (nextYear != null) {
        btn_flipperNext_nextYear = (ImageButton) nextYear.findViewById(R.id.info_time_nextbtn);
        btn_flipperNext_nextYear.setVisibility(View.GONE);

        btn_flipperPrev_nextYear = (ImageButton) nextYear.findViewById(R.id.info_time_prevbtn);
        btn_flipperPrev_nextYear.setOnClickListener(onPrevCardClick);
        btn_flipperPrev_nextYear.setOnTouchListener(createButtonListener(btn_flipperPrev_nextYear));

        titleNextYear = (TextView) nextYear.findViewById(R.id.text_title);

        TextView txt_equinox_vernal2_label = (TextView) nextYear
                .findViewById(R.id.text_date_equinox_vernal_label);
        TextView txt_equinox_vernal2 = (TextView) nextYear.findViewById(R.id.text_date_equinox_vernal);
        TextView txt_equinox_vernal2_note = (TextView) nextYear
                .findViewById(R.id.text_date_equinox_vernal_note);
        note_equinox_vernal2 = addNote(txt_equinox_vernal2_label, txt_equinox_vernal2, txt_equinox_vernal2_note,
                1);

        TextView txt_solstice_summer2_label = (TextView) nextYear
                .findViewById(R.id.text_date_solstice_summer_label);
        TextView txt_solstice_summer2 = (TextView) nextYear.findViewById(R.id.text_date_solstice_summer);
        TextView txt_solstice_summer2_note = (TextView) nextYear
                .findViewById(R.id.text_date_solstice_summer_note);
        note_solstice_summer2 = addNote(txt_solstice_summer2_label, txt_solstice_summer2,
                txt_solstice_summer2_note, 1);

        TextView txt_equinox_autumnal2_label = (TextView) nextYear
                .findViewById(R.id.text_date_equinox_autumnal_label);
        TextView txt_equinox_autumnal2 = (TextView) nextYear.findViewById(R.id.text_date_equinox_autumnal);
        TextView txt_equinox_autumnal2_note = (TextView) nextYear
                .findViewById(R.id.text_date_equinox_autumnal_note);
        note_equinox_autumnal2 = addNote(txt_equinox_autumnal2_label, txt_equinox_autumnal2,
                txt_equinox_autumnal2_note, 1);

        TextView txt_solstice_winter2_label = (TextView) nextYear
                .findViewById(R.id.text_date_solstice_winter_label);
        TextView txt_solstice_winter2 = (TextView) nextYear.findViewById(R.id.text_date_solstice_winter);
        TextView txt_solstice_winter2_note = (TextView) nextYear
                .findViewById(R.id.text_date_solstice_winter_note);
        note_solstice_winter2 = addNote(txt_solstice_winter2_label, txt_solstice_winter2,
                txt_solstice_winter2_note, 1);

        if (centered) {
            FrameLayout.LayoutParams lpNextYear = (FrameLayout.LayoutParams) nextYear.getLayoutParams();
            lpNextYear.gravity = Gravity.CENTER_HORIZONTAL;
            nextYear.setLayoutParams(lpNextYear);
        }
    }

    if (isInEditMode()) {
        updateViews(context, null);
    }
}

From source file:cw.kop.autobackground.sources.SourceListFragment.java

private void startEditFragment(final View view, final int position) {
    sourceList.setOnItemClickListener(null);
    sourceList.setEnabled(false);/* w  w  w.  j  a v  a2  s  .c  o m*/
    listAdapter.saveData();

    Source dataItem = listAdapter.getItem(position);
    final SourceInfoFragment sourceInfoFragment = new SourceInfoFragment();
    sourceInfoFragment.setImageDrawable(((ImageView) view.findViewById(R.id.source_image)).getDrawable());
    Bundle arguments = new Bundle();
    arguments.putInt("position", position);
    arguments.putString("type", dataItem.getType());
    arguments.putString("title", dataItem.getTitle());
    arguments.putString("data", dataItem.getData());
    arguments.putInt("num", dataItem.getNum());
    arguments.putBoolean("use", dataItem.isUse());
    arguments.putBoolean("preview", dataItem.isPreview());
    String imageFileName = dataItem.getImageFile().getAbsolutePath();
    if (imageFileName != null && imageFileName.length() > 0) {
        arguments.putString("image", imageFileName);
    } else {
        arguments.putString("image", "");
    }

    arguments.putBoolean("use_time", dataItem.isUseTime());
    arguments.putString("time", dataItem.getTime());

    sourceInfoFragment.setArguments(arguments);

    final RelativeLayout sourceContainer = (RelativeLayout) view.findViewById(R.id.source_container);
    final CardView sourceCard = (CardView) view.findViewById(R.id.source_card);
    final View imageOverlay = view.findViewById(R.id.source_image_overlay);
    final EditText sourceTitle = (EditText) view.findViewById(R.id.source_title);
    final ImageView deleteButton = (ImageView) view.findViewById(R.id.source_delete_button);
    final ImageView viewButton = (ImageView) view.findViewById(R.id.source_view_image_button);
    final ImageView editButton = (ImageView) view.findViewById(R.id.source_edit_button);
    final LinearLayout sourceExpandContainer = (LinearLayout) view.findViewById(R.id.source_expand_container);

    final float cardStartShadow = sourceCard.getPaddingLeft();
    final float viewStartHeight = sourceContainer.getHeight();
    final float viewStartY = view.getY();
    final int viewStartPadding = view.getPaddingLeft();
    final float textStartX = sourceTitle.getX();
    final float textStartY = sourceTitle.getY();
    final float textTranslationY = sourceTitle.getHeight(); /*+ TypedValue.applyDimension(
                                                            TypedValue.COMPLEX_UNIT_DIP,
                                                            8,
                                                            getResources().getDisplayMetrics());*/

    Animation animation = new Animation() {

        private boolean needsFragment = true;

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {

            if (needsFragment && interpolatedTime >= 1) {
                needsFragment = false;
                getFragmentManager().beginTransaction()
                        .add(R.id.content_frame, sourceInfoFragment, "source_info_fragment")
                        .addToBackStack(null).setTransition(FragmentTransaction.TRANSIT_NONE).commit();
            }
            int newPadding = Math.round(viewStartPadding * (1 - interpolatedTime));
            int newShadowPadding = (int) (cardStartShadow * (1.0f - interpolatedTime));
            sourceCard.setShadowPadding(newShadowPadding, 0, newShadowPadding, 0);
            ((LinearLayout.LayoutParams) sourceCard.getLayoutParams()).topMargin = newShadowPadding;
            ((LinearLayout.LayoutParams) sourceCard.getLayoutParams()).bottomMargin = newShadowPadding;
            ((LinearLayout.LayoutParams) sourceCard.getLayoutParams()).leftMargin = newShadowPadding;
            ((LinearLayout.LayoutParams) sourceCard.getLayoutParams()).rightMargin = newShadowPadding;
            view.setPadding(newPadding, 0, newPadding, 0);
            view.setY(viewStartY - interpolatedTime * viewStartY);
            ViewGroup.LayoutParams params = sourceContainer.getLayoutParams();
            params.height = (int) (viewStartHeight + (screenHeight - viewStartHeight) * interpolatedTime);
            sourceContainer.setLayoutParams(params);
            sourceTitle.setY(textStartY + interpolatedTime * textTranslationY);
            sourceTitle.setX(textStartX + viewStartPadding - newPadding);
            deleteButton.setAlpha(1.0f - interpolatedTime);
            viewButton.setAlpha(1.0f - interpolatedTime);
            editButton.setAlpha(1.0f - interpolatedTime);
            sourceExpandContainer.setAlpha(1.0f - interpolatedTime);
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };

    animation.setAnimationListener(new Animation.AnimationListener() {
        @Override
        public void onAnimationStart(Animation animation) {

        }

        @Override
        public void onAnimationEnd(Animation animation) {
            if (needsListReset) {
                Parcelable state = sourceList.onSaveInstanceState();
                sourceList.setAdapter(null);
                sourceList.setAdapter(listAdapter);
                sourceList.onRestoreInstanceState(state);
                sourceList.setOnItemClickListener(SourceListFragment.this);
                sourceList.setEnabled(true);
                needsListReset = false;
            }
        }

        @Override
        public void onAnimationRepeat(Animation animation) {

        }
    });

    ValueAnimator cardColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(),
            AppSettings.getDialogColor(appContext),
            getResources().getColor(AppSettings.getBackgroundColorResource()));
    cardColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            sourceContainer.setBackgroundColor((Integer) animation.getAnimatedValue());
        }

    });

    ValueAnimator titleColorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(),
            sourceTitle.getCurrentTextColor(), getResources().getColor(R.color.BLUE_OPAQUE));
    titleColorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            sourceTitle.setTextColor((Integer) animation.getAnimatedValue());
        }

    });

    ValueAnimator titleShadowAlphaAnimation = ValueAnimator.ofObject(new ArgbEvaluator(),
            AppSettings.getColorFilterInt(appContext), getResources().getColor(android.R.color.transparent));
    titleShadowAlphaAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            sourceTitle.setShadowLayer(4, 0, 0, (Integer) animation.getAnimatedValue());
        }
    });

    ValueAnimator imageOverlayAlphaAnimation = ValueAnimator.ofFloat(imageOverlay.getAlpha(), 0f);
    imageOverlayAlphaAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            imageOverlay.setAlpha((Float) animation.getAnimatedValue());
        }
    });

    int transitionTime = INFO_ANIMATION_TIME;

    DecelerateInterpolator decelerateInterpolator = new DecelerateInterpolator(1.5f);

    animation.setDuration(transitionTime);
    cardColorAnimation.setDuration(transitionTime);
    titleColorAnimation.setDuration(transitionTime);
    titleShadowAlphaAnimation.setDuration(transitionTime);

    animation.setInterpolator(decelerateInterpolator);
    cardColorAnimation.setInterpolator(decelerateInterpolator);
    titleColorAnimation.setInterpolator(decelerateInterpolator);
    titleShadowAlphaAnimation.setInterpolator(decelerateInterpolator);

    if (imageOverlay.getAlpha() > 0) {
        imageOverlayAlphaAnimation.start();
    }

    handler.postDelayed(new Runnable() {
        @Override
        public void run() {
            if (needsListReset) {
                Parcelable state = sourceList.onSaveInstanceState();
                sourceList.setAdapter(null);
                sourceList.setAdapter(listAdapter);
                sourceList.onRestoreInstanceState(state);
                sourceList.setOnItemClickListener(SourceListFragment.this);
                sourceList.setEnabled(true);
                needsListReset = false;
            }
        }
    }, (long) (transitionTime * 1.1f));

    needsListReset = true;
    view.startAnimation(animation);
    cardColorAnimation.start();
    titleColorAnimation.start();
    titleShadowAlphaAnimation.start();
}

From source file:com.zoffcc.applications.zanavi.Navit.java

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    if (last_orientation != newConfig.orientation) {
        // Checks the orientation of the screen
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
            // setContentView(R.layout.main_layout);

            // -- bottom bar --
            int h = NavitGraphics.mCanvasHeight;
            try {
                int h001;
                android.view.ViewGroup.LayoutParams lp001;

                View v003 = (View) findViewById(R.id.osd_nextturn_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_nextturn_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;/*from  w w  w. j a va  2s.  c o m*/
                v003.requestLayout();

                v003 = (View) findViewById(R.id.bottom_bar);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_bar_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                LinearLayout v002 = (LinearLayout) findViewById(R.id.bottom_slide_view);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_slide_view_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                v003 = (View) findViewById(R.id.osd_timetodest_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_timetodest_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                v002 = (LinearLayout) findViewById(R.id.bottom_line_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_line_container_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                RelativeLayout v001 = (RelativeLayout) findViewById(R.id.gui_top_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.gui_top_container_height);
                lp001 = v001.getLayoutParams();
                lp001.height = h001;
                v001.requestLayout();

                int ml = getResources().getDimensionPixelSize(R.dimen.margin_left_speeding);
                int mb = getResources().getDimensionPixelSize(R.dimen.margin_bottom_speeding);
                v003 = (View) findViewById(R.id.view_speeding);
                RelativeLayout.LayoutParams relativeParams_001 = (RelativeLayout.LayoutParams) v003
                        .getLayoutParams();
                relativeParams_001.setMargins(ml, 0, 0, mb); // left, top, right, bottom
                v003.setLayoutParams(relativeParams_001);
                v003.requestLayout();

                smaller_top_bar(true);

                // Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();

                bottom_bar_px = (int) getResources().getDimension(R.dimen.gui_top_container_height);
                bottom_bar_slider_shadow_px = (int) getResources()
                        .getDimension(R.dimen.bottom_slide_view_shadow_compat_height);

                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            } catch (Exception e) {
                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            }
            Navit.bottom_y_margin_bottom_bar_touch = Navit.cur_y_margin_bottom_bar_touch;
            // -- bottom bar --
        } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
            // setContentView(R.layout.main_layout);

            // -- bottom bar --
            int h = NavitGraphics.mCanvasHeight;
            try {
                int h001;
                android.view.ViewGroup.LayoutParams lp001;

                View v003 = (View) findViewById(R.id.osd_nextturn_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_nextturn_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                v003 = (View) findViewById(R.id.bottom_bar);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_bar_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                LinearLayout v002 = (LinearLayout) findViewById(R.id.bottom_slide_view);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_slide_view_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                v003 = (View) findViewById(R.id.osd_timetodest_new);
                h001 = getResources().getDimensionPixelSize(R.dimen.osd_timetodest_new_height);
                lp001 = v003.getLayoutParams();
                lp001.height = h001;
                v003.requestLayout();

                v002 = (LinearLayout) findViewById(R.id.bottom_line_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.bottom_line_container_height);
                lp001 = v002.getLayoutParams();
                lp001.height = h001;
                v002.requestLayout();

                RelativeLayout v001 = (RelativeLayout) findViewById(R.id.gui_top_container);
                h001 = getResources().getDimensionPixelSize(R.dimen.gui_top_container_height);
                lp001 = v001.getLayoutParams();
                lp001.height = h001;
                v001.requestLayout();

                int ml = getResources().getDimensionPixelSize(R.dimen.margin_left_speeding);
                int mb = getResources().getDimensionPixelSize(R.dimen.margin_bottom_speeding);
                v003 = (View) findViewById(R.id.view_speeding);
                RelativeLayout.LayoutParams relativeParams_001 = (RelativeLayout.LayoutParams) v003
                        .getLayoutParams();
                relativeParams_001.setMargins(ml, 0, 0, mb); // left, top, right, bottom
                v003.setLayoutParams(relativeParams_001);
                v003.requestLayout();

                smaller_top_bar(false);

                // Toast.makeText(this, "protrait", Toast.LENGTH_SHORT).show();

                bottom_bar_px = (int) getResources().getDimension(R.dimen.gui_top_container_height);
                bottom_bar_slider_shadow_px = (int) getResources()
                        .getDimension(R.dimen.bottom_slide_view_shadow_compat_height);

                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            } catch (Exception e) {
                Navit.cur_y_margin_bottom_bar_touch = h + Navit.actionBarHeight + bottom_bar_px
                        - Navit.bottom_bar_slider_shadow_px; // try to put view at bottom
            }
            Navit.bottom_y_margin_bottom_bar_touch = Navit.cur_y_margin_bottom_bar_touch;
            // -- bottom bar --
        }

        last_orientation = newConfig.orientation;
    }
}

From source file:com.zoffcc.applications.zanavi.Navit.java

void smaller_top_bar(boolean horizonzal) {
    // not working properly, deactivate for now ----------------
    if (2 == (1 + 1) * 1) {
        return;/* ww w .  j  av a 2 s.co  m*/
    }
    // not working properly, deactivate for now ----------------

    // -------------------------------------------------------------
    // -------------------------- smaller top bar  -----------------
    // -------------------------------------------------------------
    RelativeLayout v11 = (RelativeLayout) findViewById(R.id.gui_top_container);
    int h11 = getResources().getDimensionPixelSize(R.dimen.gui_top_container_height);
    if (horizonzal) {
        // h11 = (int) ((float) h11 * 0.8f);
        h11 = h11 * 1;
    } else {
        h11 = (int) ((float) h11 * 0.7f);
    }
    android.view.ViewGroup.LayoutParams lp11 = v11.getLayoutParams();
    lp11.height = h11;
    v11.requestLayout();
    // -------------------------------------------------------------
    // -------------------------- smaller top bar  -----------------
    // -------------------------------------------------------------
}