Example usage for android.widget RelativeLayout BELOW

List of usage examples for android.widget RelativeLayout BELOW

Introduction

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

Prototype

int BELOW

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

Click Source Link

Document

Rule that aligns a child's top edge with another child's bottom edge.

Usage

From source file:com.bookkos.bircle.CaptureActivity.java

private void setBookRegistView() {
    int bookRegistRelativeLayout_width = displayWidth;
    int bookRegistRelativeLayout_height = displayHeight / 4;
    int bookRegistRelativeLayout_x = 0;
    int bookRegistRelativeLayout_y = displayHeight;
    bookRegistRelativeLayout.setTranslationX(bookRegistRelativeLayout_x);
    bookRegistRelativeLayout.setTranslationY(bookRegistRelativeLayout_y);
    bookRegistRelativeLayout.setLayoutParams(
            new FrameLayout.LayoutParams(bookRegistRelativeLayout_width, bookRegistRelativeLayout_height));

    int bookRegistLinearLayout_width = displayWidth;
    int bookRegistLinearLayout_height = bookRegistRelativeLayout_height / 3;
    bookRegistLinearLayout.setLayoutParams(
            new RelativeLayout.LayoutParams(bookRegistLinearLayout_width, bookRegistLinearLayout_height));
    RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams) bookRegistLinearLayout
            .getLayoutParams();//from w  w  w  .  j  a  v  a 2s .  co  m
    params1.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    bookRegistLinearLayout.setLayoutParams(params1);

    int bookRegistListViewLinearLayout_width = displayWidth;
    int bookRegistListViewLinearLayout_height = bookRegistRelativeLayout_height * 2 / 3;
    bookRegistListViewLinearLayout.setLayoutParams(new RelativeLayout.LayoutParams(
            bookRegistListViewLinearLayout_width, bookRegistListViewLinearLayout_height));
    RelativeLayout.LayoutParams params2 = (RelativeLayout.LayoutParams) bookRegistListViewLinearLayout
            .getLayoutParams();
    params2.addRule(RelativeLayout.BELOW, R.id.book_regist_linear_layout);
    bookRegistListViewLinearLayout.setLayoutParams(params2);

    int bookRegistListView_width = bookRegistListViewLinearLayout_width;
    int bookRegistListView_height = bookRegistListViewLinearLayout_height;
    bookRegistListView.setLayoutParams(
            new LinearLayout.LayoutParams(bookRegistListView_width, bookRegistListView_height));
    bookRegistListView.setAdapter(bookListViewAdapter);

    int bookRegistTextView_width = displayWidth * 4 / 5;
    int bookRegistTextView_height = bookRegistLinearLayout_height;
    int bookRegistTextView_x = 0;
    int bookRegistTextView_y = displayHeight;
    bookRegistTextView.setLayoutParams(
            new LinearLayout.LayoutParams(bookRegistTextView_width, bookRegistTextView_height, Gravity.LEFT));
    bookRegistTextView.setText("??");
    bookRegistTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f);

    int bookRegistCancelButton_width = displayWidth / 5;
    int bookRegistCancelButton_height = bookRegistLinearLayout_height;
    int bookRegistCancelButton_x = 0;
    int bookRegistCancelButton_y = displayHeight;
    bookRegistCancelButton.setLayoutParams(new LinearLayout.LayoutParams(bookRegistCancelButton_width,
            bookRegistCancelButton_height, Gravity.RIGHT));
    bookRegistCancelButton.setText("");
    bookRegistCancelButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize - displayInch * 1.5f);
    bookRegistCancelButton.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {
            animateTranslationY(bookRegistRelativeLayout, displayHeight - displayHeight / 4 - titleBarHeight,
                    displayHeight);
            arrayList.clear();
            bookListViewAdapter.clear();
            registButton.setEnabled(true);
            borrowReturnButton.setEnabled(true);
            registButton.setTextColor(Color.WHITE);
        }
    });
}

From source file:com.ludoscity.findmybikes.activities.NearbyActivity.java

private void setupTripDetailsWidget() {

    final Handler handler = new Handler(); //Need to wait for list selection

    handler.postDelayed(new Runnable() {
        @Override// ww  w  .  j a v  a  2 s .c  o  m
        public void run() {
            if (getListPagerAdapter()
                    .getHighlightedStationForPage(StationListPagerAdapter.DOCK_STATIONS) != null
                    && getListPagerAdapter()
                            .getHighlightedStationForPage(StationListPagerAdapter.BIKE_STATIONS) != null) {

                int locToAMinutes = 0;
                int AToBMinutes = 0;
                int BToSearchMinutes = 0;

                StationItem selectedStation = getListPagerAdapter()
                        .getHighlightedStationForPage(StationListPagerAdapter.BIKE_STATIONS);
                String formattedProximityString = Utils.getWalkingProximityString(selectedStation.getLocation(),
                        mCurrentUserLatLng, true, null, NearbyActivity.this);
                if (formattedProximityString.startsWith(">"))
                    locToAMinutes = 61;
                else if (!formattedProximityString.startsWith("<"))
                    locToAMinutes = Integer.valueOf(formattedProximityString.substring(1, 3));

                mTripDetailsProximityA.setText(formattedProximityString);

                selectedStation = getListPagerAdapter()
                        .getHighlightedStationForPage(StationListPagerAdapter.DOCK_STATIONS);
                formattedProximityString = Utils.getBikingProximityString(selectedStation.getLocation(),
                        getListPagerAdapter()
                                .getHighlightedStationForPage(StationListPagerAdapter.BIKE_STATIONS)
                                .getLocation(),
                        true, null, NearbyActivity.this);
                if (formattedProximityString.startsWith(">"))
                    AToBMinutes = 61;
                else if (!formattedProximityString.startsWith("<"))
                    AToBMinutes = Integer.valueOf(formattedProximityString.substring(1, 3));

                mTripDetailsProximityB.setText(formattedProximityString);

                //TODO: this string of if...elseif...elseif...else needs refactoring.
                // Explore extract methods or create some kind of tripdetailswidget configurator
                if (mStationMapFragment.getMarkerPickedPlaceVisibleLatLng() == null
                        && mStationMapFragment.getMarkerPickedFavoriteVisibleLatLng() == null) {
                    //no marker is showed

                    mTripDetailsBToDestinationRow.setVisibility(View.GONE);
                    ViewGroup.LayoutParams param = mTripDetailsSumSeparator.getLayoutParams();
                    ((RelativeLayout.LayoutParams) param).addRule(RelativeLayout.BELOW,
                            R.id.trip_details_a_to_b);
                } else if (mStationMapFragment.getMarkerPickedPlaceVisibleLatLng() != null) {
                    //Place marker is showed

                    formattedProximityString = Utils.getWalkingProximityString(selectedStation.getLocation(),
                            mStationMapFragment.getMarkerPickedPlaceVisibleLatLng(), true, null,
                            NearbyActivity.this);

                    if (formattedProximityString.startsWith(">"))
                        BToSearchMinutes = 61;
                    else if (!formattedProximityString.startsWith("<"))
                        BToSearchMinutes = Integer.valueOf(formattedProximityString.substring(1, 3));

                    mTripDetailsProximitySearch.setText(formattedProximityString);

                    mTripDetailsPinSearch.setVisibility(View.VISIBLE);
                    mTripDetailsPinFavorite.setVisibility(View.INVISIBLE);
                    mTripDetailsBToDestinationRow.setVisibility(View.VISIBLE);
                    ViewGroup.LayoutParams param = mTripDetailsSumSeparator.getLayoutParams();
                    ((RelativeLayout.LayoutParams) param).addRule(RelativeLayout.BELOW,
                            R.id.trip_details_b_to_search);
                } else if (mStationMapFragment
                        .getMarkerPickedFavoriteVisibleLatLng().latitude != mStationMapFragment
                                .getMarkerBVisibleLatLng().latitude
                        || mStationMapFragment
                                .getMarkerPickedFavoriteVisibleLatLng().longitude != mStationMapFragment
                                        .getMarkerBVisibleLatLng().longitude) {
                    //Favorite marker is showed and not on B station

                    formattedProximityString = Utils.getWalkingProximityString(selectedStation.getLocation(),
                            mStationMapFragment.getMarkerPickedFavoriteVisibleLatLng(), true, null,
                            NearbyActivity.this);

                    if (formattedProximityString.startsWith(">"))
                        BToSearchMinutes = 61;
                    else if (!formattedProximityString.startsWith("<"))
                        BToSearchMinutes = Integer.valueOf(formattedProximityString.substring(1, 3));

                    mTripDetailsProximitySearch.setText(formattedProximityString);

                    mTripDetailsPinSearch.setVisibility(View.INVISIBLE);
                    mTripDetailsPinFavorite.setVisibility(View.VISIBLE);
                    mTripDetailsBToDestinationRow.setVisibility(View.VISIBLE);
                    ViewGroup.LayoutParams param = mTripDetailsSumSeparator.getLayoutParams();
                    ((RelativeLayout.LayoutParams) param).addRule(RelativeLayout.BELOW,
                            R.id.trip_details_b_to_search);
                } else {
                    //Favorite marker is showed and on B station

                    mTripDetailsBToDestinationRow.setVisibility(View.GONE);
                    ViewGroup.LayoutParams param = mTripDetailsSumSeparator.getLayoutParams();
                    ((RelativeLayout.LayoutParams) param).addRule(RelativeLayout.BELOW,
                            R.id.trip_details_a_to_b);
                }

                int total = locToAMinutes + AToBMinutes + BToSearchMinutes;

                mTripDetailsProximityTotal
                        .setText(Utils.durationToProximityString(total, false, null, NearbyActivity.this));

            } else
                handler.postDelayed(this, 10);
        }
    }, 10);
}