Example usage for android.widget RelativeLayout CENTER_VERTICAL

List of usage examples for android.widget RelativeLayout CENTER_VERTICAL

Introduction

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

Prototype

int CENTER_VERTICAL

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

Click Source Link

Document

Rule that centers the child vertically with respect to the bounds of its RelativeLayout parent.

Usage

From source file:net.ibaixin.chat.view.PagerSlidingTabStrip.java

/**
 * tab/*from  w w  w.  java 2s . c o  m*/
 * @update 2015128 ?9:58:54
 * @param position
 * @param title
 */
private void addTextTab(final int position, CharSequence title) {
    //layout
    RelativeLayout tabLayout = new RelativeLayout(getContext());
    RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    tabLayout.setLayoutParams(layoutParams);

    RelativeLayout.LayoutParams textParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    textParams.addRule(RelativeLayout.CENTER_IN_PARENT);
    //tab
    TextView tab = new TextView(getContext());
    tab.setId(100 + position);
    tab.setText(title);
    tab.setGravity(Gravity.CENTER);
    tab.setSingleLine();
    tabLayout.addView(tab, textParams);

    //???
    RelativeLayout.LayoutParams viewParams = new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    viewParams.addRule(RelativeLayout.RIGHT_OF, tab.getId());
    viewParams.addRule(RelativeLayout.CENTER_VERTICAL);
    View view = new View(getContext());
    ViewGroup.LayoutParams vParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    view.setLayoutParams(vParams);
    tabLayout.addView(view, viewParams);

    addTab(position, tabLayout);

}

From source file:com.wdullaer.materialdatetimepicker.time.TimePickerView.java

private void initView(Context context) {

    //        View.inflate(getContext(), R.layout.mdtp_time_picker_view, this);

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.mdtp_time_picker_view, this);

    KeyboardListener keyboardListener = new KeyboardListener();
    findViewById(R.id.time_picker_view).setOnKeyListener(keyboardListener);

    // If an accent color has not been set manually, get it from the context
    if (mAccentColor == -1) {
        mAccentColor = Utils.getAccentColorFromThemeIfAvailable(getContext());
    }//from  w ww . ja  v a  2  s  .c  o m

    // if theme mode has not been set by java code, check if it is specified in Style.xml
    if (!mThemeDarkChanged) {
        mThemeDark = Utils.isDarkTheme(getContext(), mThemeDark);
    }

    Resources res = getResources();
    //        Context context = getContext();
    mHourPickerDescription = res.getString(R.string.mdtp_hour_picker_description);
    mSelectHours = res.getString(R.string.mdtp_select_hours);
    mMinutePickerDescription = res.getString(R.string.mdtp_minute_picker_description);
    mSelectMinutes = res.getString(R.string.mdtp_select_minutes);
    mSecondPickerDescription = res.getString(R.string.mdtp_second_picker_description);
    mSelectSeconds = res.getString(R.string.mdtp_select_seconds);
    mSelectedColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_text_disabled_dark_theme);
    mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_date_picker_month_day_dark_theme);

    mHourView = (TextView) findViewById(R.id.hours);
    mHourView.setOnKeyListener(keyboardListener);
    mHourSpaceView = (TextView) findViewById(R.id.hour_space);
    mMinuteSpaceView = (TextView) findViewById(R.id.minutes_space);
    mMinuteView = (TextView) findViewById(R.id.minutes);
    mMinuteView.setOnKeyListener(keyboardListener);
    mSecondSpaceView = (TextView) findViewById(R.id.seconds_space);
    mSecondView = (TextView) findViewById(R.id.seconds);
    mSecondView.setOnKeyListener(keyboardListener);
    mAmPmTextView = (TextView) findViewById(R.id.ampm_label);
    mAmPmTextView.setOnKeyListener(keyboardListener);
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    mHapticFeedbackController = new HapticFeedbackController(getContext());
    mInitialTime = roundToNearest(mInitialTime);

    mTimePicker = (RadialPickerLayout) findViewById(R.id.time_picker);
    mTimePicker.setOnValueSelectedListener(this);
    mTimePicker.setOnKeyListener(keyboardListener);
    mTimePicker.initialize(getContext(), this, mInitialTime, mIs24HourMode);

    mHapticFeedbackController.start();

    int currentItemShowing = HOUR_INDEX;
    /* if (savedInstanceState != null &&
        savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING)) {
    currentItemShowing = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING);
     }*/
    setCurrentItemShowing(currentItemShowing, false, true, true);
    mTimePicker.invalidate();

    mHourView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(HOUR_INDEX, true, false, true);
            tryVibrate();
        }
    });
    mMinuteView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(MINUTE_INDEX, true, false, true);
            tryVibrate();
        }
    });
    mSecondView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            setCurrentItemShowing(SECOND_INDEX, true, false, true);
            tryVibrate();
        }
    });

    /*mOkButton = (Button) findViewById(R.id.ok);
    mOkButton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        if (mInKbMode && isTypedTimeFullyLegal()) {
            finishKbMode(false);
        } else {
            tryVibrate();
        }
        notifyOnDateListener();
    //                dismiss();
    }
    });
    mOkButton.setOnKeyListener(keyboardListener);
    mOkButton.setTypeface(TypefaceHelper.get(context, "Roboto-Medium"));
    if(mOkString != null) mOkButton.setText(mOkString);
    else mOkButton.setText(mOkResid);
            
    mCancelButton = (Button) findViewById(R.id.cancel);
    mCancelButton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        tryVibrate();
        if (getDialog() != null) getDialog().cancel();
    }
    });
    mCancelButton.setTypeface(TypefaceHelper.get(context, "Roboto-Medium"));
    if(mCancelString != null) mCancelButton.setText(mCancelString);
    else mCancelButton.setText(mCancelResid);
    mCancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE);*/

    // Enable or disable the AM/PM view.
    mAmPmHitspace = findViewById(R.id.ampm_hitspace);
    if (mIs24HourMode) {
        mAmPmTextView.setVisibility(View.GONE);
    } else {
        mAmPmTextView.setVisibility(View.VISIBLE);
        updateAmPmDisplay(mInitialTime.isAM() ? AM : PM);
        mAmPmHitspace.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // Don't do anything if either AM or PM are disabled
                if (isAmDisabled() || isPmDisabled())
                    return;

                tryVibrate();
                int amOrPm = mTimePicker.getIsCurrentlyAmOrPm();
                if (amOrPm == AM) {
                    amOrPm = PM;
                } else if (amOrPm == PM) {
                    amOrPm = AM;
                }
                mTimePicker.setAmOrPm(amOrPm);
            }
        });
    }

    // Disable seconds picker
    if (!mEnableSeconds) {
        mSecondSpaceView.setVisibility(View.GONE);
        findViewById(R.id.separator_seconds).setVisibility(View.GONE);
    }

    // Center stuff depending on what's visible
    if (mIs24HourMode && !mEnableSeconds) {
        // center first separator
        RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        paramsSeparator.addRule(RelativeLayout.CENTER_IN_PARENT);
        TextView separatorView = (TextView) findViewById(R.id.separator);
        separatorView.setLayoutParams(paramsSeparator);
    } else if (mEnableSeconds) {
        // link separator to minutes
        final View separator = findViewById(R.id.separator);
        RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        paramsSeparator.addRule(RelativeLayout.LEFT_OF, R.id.minutes_space);
        paramsSeparator.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
        separator.setLayoutParams(paramsSeparator);

        if (!mIs24HourMode) {
            // center minutes
            RelativeLayout.LayoutParams paramsMinutes = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            paramsMinutes.addRule(RelativeLayout.CENTER_IN_PARENT);
            mMinuteSpaceView.setLayoutParams(paramsMinutes);
        } else {
            // move minutes to right of center
            RelativeLayout.LayoutParams paramsMinutes = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            paramsMinutes.addRule(RelativeLayout.RIGHT_OF, R.id.center_view);
            mMinuteSpaceView.setLayoutParams(paramsMinutes);
        }
    }

    mAllowAutoAdvance = true;
    setHour(mInitialTime.getHour(), true);
    setMinute(mInitialTime.getMinute());
    setSecond(mInitialTime.getSecond());

    // Set up for keyboard mode.
    mDoublePlaceholderText = res.getString(R.string.mdtp_time_placeholder);
    mDeletedKeyFormat = res.getString(R.string.mdtp_deleted_key);
    mPlaceholderText = mDoublePlaceholderText.charAt(0);
    mAmKeyCode = mPmKeyCode = -1;
    generateLegalTimesTree();
    /*if (mInKbMode) {
    mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES);
    tryStartingKbMode(-1);
    mHourView.invalidate();
    } else if (mTypedTimes == null) {
    mTypedTimes = new ArrayList<>();
    }*/
    mTypedTimes = new ArrayList<>();
    // Set the title (if any)
    TextView timePickerHeader = (TextView) findViewById(R.id.time_picker_header);
    if (!mTitle.isEmpty()) {
        timePickerHeader.setVisibility(TextView.VISIBLE);
        timePickerHeader.setText(mTitle.toUpperCase(Locale.getDefault()));
    }

    // Set the theme at the end so that the initialize()s above don't counteract the theme.
    //        mOkButton.setTextColor(mAccentColor);
    //        mCancelButton.setTextColor(mAccentColor);
    timePickerHeader.setBackgroundColor(getResources().getColor(R.color.mdtp_white));
    findViewById(R.id.time_display_background).setBackgroundColor(getResources().getColor(R.color.mdtp_white));
    findViewById(R.id.time_display).setBackgroundColor(getResources().getColor(R.color.mdtp_white));

    /*if(getDialog() == null) {
    view.findViewById(R.id.done_background).setVisibility(View.GONE);
    }*/

    int circleBackground = ContextCompat.getColor(context, R.color.mdtp_circle_background);
    int backgroundColor = ContextCompat.getColor(context, R.color.mdtp_background_color);
    int darkBackgroundColor = ContextCompat.getColor(context, R.color.mdtp_light_gray);
    int lightGray = ContextCompat.getColor(context, R.color.mdtp_light_gray);

    //        mTimePicker.setBackgroundColor(mThemeDark? lightGray : circleBackground);
    mTimePicker.setBackgroundColor(mThemeDark ? lightGray : circleBackground);
    findViewById(R.id.time_picker_view).setBackgroundColor(mThemeDark ? darkBackgroundColor : backgroundColor);
}

From source file:xyz.berial.textinputlayout.TextInputLayout.java

/**
 * /*  w  ww . j av a2 s  .c  o m*/
 *
 * @param enabled ?
 */
public void setCounterEnabled(boolean enabled) {
    if (mCounterEnabled != enabled) {
        if (enabled) {
            mCounterView = new TextView(getContext());
            // mCounterView.setVisibility(VISIBLE);
            if (mEditText != null && mEditText.length() > mCounterMaxLength) {
                mCounterView.setTextAppearance(getContext(), mErrorTextAppearance);
            } else {
                mCounterView.setTextAppearance(getContext(), R.style.TextAppearance_Design_Counter);
            }
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
            params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
            params.addRule(RelativeLayout.CENTER_VERTICAL);
            mBottomBar.addView(mCounterView, params);

            if (mEditText != null) {
                // Add some start/end padding to the counter so that it matches the EditText
                ViewCompat.setPaddingRelative(mCounterView, ViewCompat.getPaddingStart(mEditText), 0,
                        ViewCompat.getPaddingEnd(mEditText), mEditText.getPaddingBottom());
            }
            mCounterView.setText(mResources.getString(R.string.counterMaxLength, 0, mCounterMaxLength));
        } else {
            mBottomBar.removeView(mCounterView);
            mCounterView = null;
        }
        mCounterEnabled = enabled;
    }
}

From source file:com.cranberrygame.phonegap.plugin.ad.Util.java

private void _showBannerAd(String position, String size) {
    this.position = position;
    this.size = size;

    if (bannerAdPreloaded) {
        bannerAdPreloaded = false;//from   w w  w.  j a  v a 2s .  c  o m
    } else {
        _preloadBannerAd();
    }

    //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("Admob", "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 {
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
    }

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

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

/**
 * Creates the auto layout./*from ww w .ja  v  a 2 s.com*/
 * 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.uzmap.pkg.uzmodules.UISearchBar.SearchBarActivity.java

@SuppressWarnings("deprecation")
private void initData() {

    DisplayMetrics metric = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metric);
    mPref = getSharedPreferences("text", Context.MODE_PRIVATE);
    String text = mPref.getString("text", "");
    if (!TextUtils.isEmpty(text)) {
        mEditText.setText(text);//from w w  w  . j  ava2 s  .co  m
        mEditText.setSelection(text.length());
    }

    mNavigationLayout.setBackgroundColor(config.navBgColor);

    if (TextUtils.isEmpty(config.searchBoxBgImg)) {
        BitmapDrawable bitmapDrawable = new BitmapDrawable(BitmapFactory.decodeResource(getResources(),
                UZResourcesIDFinder.getResDrawableID("mo_searchbar_bg")));
        mRelativeLayout.setBackgroundDrawable(bitmapDrawable);
    } else {
        BitmapDrawable bitmapDrawable = new BitmapDrawable(generateBitmap(config.searchBoxBgImg));
        mRelativeLayout.setBackgroundDrawable(bitmapDrawable);
    }

    if (config.cancel_bg_bitmap != null) {
        mTextView.setBackgroundDrawable(new BitmapDrawable(config.cancel_bg_bitmap));
    } else {
        mTextView.setBackgroundColor(config.cancel_bg_color);
    }

    mTextView.setTextSize(config.cancel_size);
    mTextView.setTextColor(config.cancal_color);

    LayoutParams params = new LayoutParams(UZUtility.dipToPix(config.searchBoxWidth),
            UZUtility.dipToPix(config.searchBoxHeight));
    params.setMargins(UZUtility.dipToPix(10), 0, 0, 0);

    params.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    mEditText.setLayoutParams(params);

    WindowManager wm = this.getWindowManager();
    int width = wm.getDefaultDisplay().getWidth();

    double realWidth = width * 0.80;
    LayoutParams layoutParams = new LayoutParams((int) realWidth, UZUtility.dipToPix(config.searchBoxHeight));

    layoutParams.setMargins(UZUtility.dipToPix(5), 0, 0, 0);
    layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);

    layoutParams.topMargin = UZUtility.dipToPix(8);
    layoutParams.bottomMargin = UZUtility.dipToPix(8);

    mRelativeLayout.setLayoutParams(layoutParams);

    double cancelRealWidth = width * 0.15;

    int space = (width - (int) realWidth - (int) cancelRealWidth - UZUtility.dipToPix(5)) / 2;

    LayoutParams cancalTxtParam = new LayoutParams((int) cancelRealWidth,
            UZUtility.dipToPix(config.searchBoxHeight));

    cancalTxtParam.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
    cancalTxtParam.addRule(RelativeLayout.CENTER_VERTICAL);

    cancalTxtParam.rightMargin = space;
    cancalTxtParam.leftMargin = space;

    mTextView.setLayoutParams(cancalTxtParam);

    mListView.setBackgroundColor(config.list_bg_color);

    listSize = config.list_size;
    mCleanTextColor = config.clear_font_color;
    mCleanTextSize = config.clear_font_size;

    recordCount = config.historyCount;

    /**
     * add clean list item
     */
    int relativeLayoutCleanId = UZResourcesIDFinder.getResLayoutID("mo_searchbar_clean_item");
    relativeLayoutClean = (LinearLayout) View.inflate(getApplicationContext(), relativeLayoutCleanId, null);
    int tv_cleanId = UZResourcesIDFinder.getResIdID("tv_clean");
    mCleanTV = (TextView) relativeLayoutClean.findViewById(tv_cleanId);
    mCleanTV.setTextSize(mCleanTextSize);
    mCleanTV.setTextColor(mCleanTextColor);

    mCleanTV.setText(config.clearText);

    relativeLayoutClean
            .setBackgroundDrawable(addStateDrawable(config.clear_bg_color, config.clear_active_bg_color));
    list.clear();

    list.add(relativeLayoutClean);
    mPref = getSharedPreferences("history" + config.database, Context.MODE_PRIVATE);

    editor = mPref.edit();

    trimHistroyList(config.historyCount);

    @SuppressWarnings("unchecked")
    Map<String, String> map = (Map<String, String>) mPref.getAll();
    if (map != null) {
        if (map.size() != 0) {
            for (int i = 1; i <= map.size(); i++) {

                int listview_item = UZResourcesIDFinder.getResLayoutID("mo_searchbar_listview_item");
                LinearLayout linearLayout = (LinearLayout) View.inflate(SearchBarActivity.this, listview_item,
                        null);
                int tv_listId = UZResourcesIDFinder.getResIdID("tv_listview");
                TextView tv = (TextView) linearLayout.findViewById(tv_listId);
                tv.setTextSize(listSize);
                tv.setTextColor(config.list_color);

                linearLayout.setBackgroundDrawable(
                        addStateDrawable(config.list_bg_color, config.list_item_active_bg_color));

                int itemBorderLineId = UZResourcesIDFinder.getResIdID("item_border_line");
                linearLayout.findViewById(itemBorderLineId).setBackgroundColor(config.list_border_color);

                for (Entry<String, String> iterable_element : map.entrySet()) {
                    String key = iterable_element.getKey();
                    if ((i + "").equals(key)) {
                        tv.setText(iterable_element.getValue());
                    }
                }
                list.addFirst(linearLayout);
            }
            id = map.size();
        }
    }

    adapter = new MyAdapter();
    mListView.setAdapter(adapter);
}

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  w w  w .  jav a  2  s. c o 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.borax12.materialdaterangepicker.single.time.TimePickerDialog.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View view = inflater.inflate(R.layout.mdtp_time_picker_dialog_single, container, false);
    KeyboardListener keyboardListener = new KeyboardListener();
    view.findViewById(R.id.time_picker_dialog).setOnKeyListener(keyboardListener);

    // If an accent color has not been set manually, get it from the context
    if (mAccentColor == -1) {
        mAccentColor = Utils.getAccentColorFromThemeIfAvailable(getActivity());
    }/*from www . j  a va  2  s .  c om*/

    // if theme mode has not been set by java code, check if it is specified in Style.xml
    if (!mThemeDarkChanged) {
        mThemeDark = Utils.isDarkTheme(getActivity(), mThemeDark);
    }

    Resources res = getResources();
    Context context = getActivity();
    mHourPickerDescription = res.getString(R.string.mdtp_hour_picker_description);
    mSelectHours = res.getString(R.string.mdtp_select_hours);
    mMinutePickerDescription = res.getString(R.string.mdtp_minute_picker_description);
    mSelectMinutes = res.getString(R.string.mdtp_select_minutes);
    mSecondPickerDescription = res.getString(R.string.mdtp_second_picker_description);
    mSelectSeconds = res.getString(R.string.mdtp_select_seconds);
    mSelectedColor = ContextCompat.getColor(context, R.color.mdtp_white);
    mUnselectedColor = ContextCompat.getColor(context, R.color.mdtp_accent_color_focused);

    mHourView = (TextView) view.findViewById(R.id.hours);
    mHourView.setOnKeyListener(keyboardListener);
    mHourSpaceView = (TextView) view.findViewById(R.id.hour_space);
    mMinuteSpaceView = (TextView) view.findViewById(R.id.minutes_space);
    mMinuteView = (TextView) view.findViewById(R.id.minutes);
    mMinuteView.setOnKeyListener(keyboardListener);
    mSecondSpaceView = (TextView) view.findViewById(R.id.seconds_space);
    mSecondView = (TextView) view.findViewById(R.id.seconds);
    mSecondView.setOnKeyListener(keyboardListener);
    mAmPmTextView = (TextView) view.findViewById(R.id.ampm_label);
    mAmPmTextView.setOnKeyListener(keyboardListener);
    String[] amPmTexts = new DateFormatSymbols().getAmPmStrings();
    mAmText = amPmTexts[0];
    mPmText = amPmTexts[1];

    mHapticFeedbackController = new HapticFeedbackController(getActivity());
    mInitialTime = roundToNearest(mInitialTime);

    mTimePicker = (RadialPickerLayout) view.findViewById(R.id.time_picker);
    mTimePicker.setOnValueSelectedListener(this);
    mTimePicker.setOnKeyListener(keyboardListener);
    mTimePicker.initialize(getActivity(), this, mInitialTime, mIs24HourMode);

    int currentItemShowing = HOUR_INDEX;
    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_CURRENT_ITEM_SHOWING)) {
        currentItemShowing = savedInstanceState.getInt(KEY_CURRENT_ITEM_SHOWING);
    }
    setCurrentItemShowing(currentItemShowing, false, true, true);
    mTimePicker.invalidate();

    mHourView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(HOUR_INDEX, true, false, true);
            tryVibrate();
        }
    });
    mMinuteView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            setCurrentItemShowing(MINUTE_INDEX, true, false, true);
            tryVibrate();
        }
    });
    mSecondView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            setCurrentItemShowing(SECOND_INDEX, true, false, true);
            tryVibrate();
        }
    });

    mOkButton = (Button) view.findViewById(R.id.ok);
    mOkButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (mInKbMode && isTypedTimeFullyLegal()) {
                finishKbMode(false);
            } else {
                tryVibrate();
            }
            notifyOnDateListener();
            dismiss();
        }
    });
    mOkButton.setOnKeyListener(keyboardListener);
    mOkButton.setTypeface(TypefaceHelper.get(context, "Roboto-Medium"));
    if (mOkString != null)
        mOkButton.setText(mOkString);
    else
        mOkButton.setText(mOkResid);

    mCancelButton = (Button) view.findViewById(R.id.cancel);
    mCancelButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            tryVibrate();
            if (getDialog() != null)
                getDialog().cancel();
        }
    });
    mCancelButton.setTypeface(TypefaceHelper.get(context, "Roboto-Medium"));
    if (mCancelString != null)
        mCancelButton.setText(mCancelString);
    else
        mCancelButton.setText(mCancelResid);
    mCancelButton.setVisibility(isCancelable() ? View.VISIBLE : View.GONE);

    // Enable or disable the AM/PM view.
    mAmPmHitspace = view.findViewById(R.id.ampm_hitspace);
    if (mIs24HourMode) {
        mAmPmTextView.setVisibility(View.GONE);
    } else {
        mAmPmTextView.setVisibility(View.VISIBLE);
        updateAmPmDisplay(mInitialTime.isAM() ? AM : PM);
        mAmPmHitspace.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                // Don't do anything if either AM or PM are disabled
                if (isAmDisabled() || isPmDisabled())
                    return;

                tryVibrate();
                int amOrPm = mTimePicker.getIsCurrentlyAmOrPm();
                if (amOrPm == AM) {
                    amOrPm = PM;
                } else if (amOrPm == PM) {
                    amOrPm = AM;
                }
                mTimePicker.setAmOrPm(amOrPm);
            }
        });
    }

    // Disable seconds picker
    if (!mEnableSeconds) {
        mSecondSpaceView.setVisibility(View.GONE);
        view.findViewById(R.id.separator_seconds).setVisibility(View.GONE);
    }

    // Center stuff depending on what's visible
    if (mIs24HourMode && !mEnableSeconds) {
        // center first separator
        RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        paramsSeparator.addRule(RelativeLayout.CENTER_IN_PARENT);
        TextView separatorView = (TextView) view.findViewById(R.id.separator);
        separatorView.setLayoutParams(paramsSeparator);
    } else if (mEnableSeconds) {
        // link separator to minutes
        final View separator = view.findViewById(R.id.separator);
        RelativeLayout.LayoutParams paramsSeparator = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
                LayoutParams.WRAP_CONTENT);
        paramsSeparator.addRule(RelativeLayout.LEFT_OF, R.id.minutes_space);
        paramsSeparator.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
        separator.setLayoutParams(paramsSeparator);

        if (!mIs24HourMode) {
            // center minutes
            RelativeLayout.LayoutParams paramsMinutes = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            paramsMinutes.addRule(RelativeLayout.CENTER_IN_PARENT);
            mMinuteSpaceView.setLayoutParams(paramsMinutes);
        } else {
            // move minutes to right of center
            RelativeLayout.LayoutParams paramsMinutes = new RelativeLayout.LayoutParams(
                    LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            paramsMinutes.addRule(RelativeLayout.RIGHT_OF, R.id.center_view);
            mMinuteSpaceView.setLayoutParams(paramsMinutes);
        }
    }

    mAllowAutoAdvance = true;
    setHour(mInitialTime.getHour(), true);
    setMinute(mInitialTime.getMinute());
    setSecond(mInitialTime.getSecond());

    // Set up for keyboard mode.
    mDoublePlaceholderText = res.getString(R.string.mdtp_time_placeholder);
    mDeletedKeyFormat = res.getString(R.string.mdtp_deleted_key);
    mPlaceholderText = mDoublePlaceholderText.charAt(0);
    mAmKeyCode = mPmKeyCode = -1;
    generateLegalTimesTree();
    if (mInKbMode) {
        mTypedTimes = savedInstanceState.getIntegerArrayList(KEY_TYPED_TIMES);
        tryStartingKbMode(-1);
        mHourView.invalidate();
    } else if (mTypedTimes == null) {
        mTypedTimes = new ArrayList<>();
    }

    // Set the title (if any)
    TextView timePickerHeader = (TextView) view.findViewById(R.id.time_picker_header);
    if (!mTitle.isEmpty()) {
        timePickerHeader.setVisibility(TextView.VISIBLE);
        timePickerHeader.setText(mTitle);
    }

    // Set the theme at the end so that the initialize()s above don't counteract the theme.
    mOkButton.setTextColor(mAccentColor);
    mCancelButton.setTextColor(mAccentColor);
    timePickerHeader.setBackgroundColor(Utils.darkenColor(mAccentColor));
    view.findViewById(R.id.time_display_background).setBackgroundColor(mAccentColor);
    view.findViewById(R.id.time_display).setBackgroundColor(mAccentColor);

    if (getDialog() == null) {
        view.findViewById(R.id.done_background).setVisibility(View.GONE);
    }

    int circleBackground = ContextCompat.getColor(context, R.color.mdtp_circle_background);
    int backgroundColor = ContextCompat.getColor(context, R.color.mdtp_background_color);
    int darkBackgroundColor = ContextCompat.getColor(context, R.color.mdtp_light_gray);
    int lightGray = ContextCompat.getColor(context, R.color.mdtp_light_gray);

    mTimePicker.setBackgroundColor(mThemeDark ? lightGray : circleBackground);
    view.findViewById(R.id.time_picker_dialog)
            .setBackgroundColor(mThemeDark ? darkBackgroundColor : backgroundColor);
    return view;
}

From source file:br.com.carlosrafaelgn.fplay.ActivityBrowserRadio.java

@SuppressWarnings("deprecation")
@Override//w ww. j  a  va 2 s  .c  o m
protected void onCreateLayout(boolean firstCreation) {
    setContentView(R.layout.activity_browser_radio);
    UI.smallTextAndColor((TextView) findViewById(R.id.lblLoading));
    list = (BgListView) findViewById(R.id.list);
    list.setOnKeyDownObserver(this);
    list.setScrollBarType((UI.browserScrollBarType == BgListView.SCROLLBAR_INDEXED) ? BgListView.SCROLLBAR_LARGE
            : UI.browserScrollBarType);
    list.setCustomEmptyText(getText(R.string.loading));
    list.setEmptyListOnClickListener(this);
    radioStationList.setObserver(list);
    panelLoading = (RelativeLayout) findViewById(R.id.panelLoading);
    btnGoBack = (BgButton) findViewById(R.id.btnGoBack);
    btnGoBack.setOnClickListener(this);
    btnGoBack.setIcon(UI.ICON_GOBACK);
    btnFavorite = (BgButton) findViewById(R.id.btnFavorite);
    btnFavorite.setOnClickListener(this);
    btnFavorite.setIcon(UI.ICON_FAVORITE_ON);
    btnSearch = (BgButton) findViewById(R.id.btnSearch);
    btnSearch.setOnClickListener(this);
    btnSearch.setIcon(UI.ICON_SEARCH);
    panelSecondary = (RelativeLayout) findViewById(R.id.panelSecondary);
    btnGoBackToPlayer = (BgButton) findViewById(R.id.btnGoBackToPlayer);
    btnGoBackToPlayer.setTextColor(UI.colorState_text_reactive);
    btnGoBackToPlayer.setOnClickListener(this);
    btnGoBackToPlayer.setCompoundDrawables(
            new TextIconDrawable(UI.ICON_RIGHT, UI.color_text, UI.defaultControlContentsSize), null, null,
            null);
    btnGoBackToPlayer.setDefaultHeight();
    btnAdd = (BgButton) findViewById(R.id.btnAdd);
    btnAdd.setTextColor(UI.colorState_text_reactive);
    btnAdd.setOnClickListener(this);
    btnAdd.setIcon(UI.ICON_ADD, true, false);
    sep2 = (TextView) findViewById(R.id.sep2);
    RelativeLayout.LayoutParams rp = new RelativeLayout.LayoutParams(UI.strokeSize,
            UI.defaultControlContentsSize);
    rp.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
    rp.addRule(RelativeLayout.LEFT_OF, R.id.btnPlay);
    rp.leftMargin = UI._8dp;
    rp.rightMargin = UI._8dp;
    sep2.setLayoutParams(rp);
    sep2.setBackgroundDrawable(new ColorDrawable(UI.color_highlight));
    btnPlay = (BgButton) findViewById(R.id.btnPlay);
    btnPlay.setTextColor(UI.colorState_text_reactive);
    btnPlay.setOnClickListener(this);
    btnPlay.setIcon(UI.ICON_PLAY, true, false);
    UI.prepareControlContainer(findViewById(R.id.panelControls), false, true);
    UI.prepareControlContainer(panelSecondary, true, false);
    if (UI.isLargeScreen)
        UI.prepareViewPaddingForLargeScreen(list, 0, 0);
    UI.prepareEdgeEffectColor(getApplication());
    updateButtons();
    doSearch();
}

From source file:com.spoiledmilk.ibikecph.LeftMenu.java

@SuppressWarnings("deprecation")
public void updateControls() {
    LOG.d("LeftMenu updateControls");
    if (!IbikeApplication.isUserLogedIn()) {
        favoritesContainer.setBackgroundDrawable(null);
        textFavoriteHint.setTextColor(getHintDisabledTextColor());
        textNewFavorite.setTextColor(Color.rgb(60, 60, 60));
        imgAdd.setImageResource(R.drawable.fav_plus_none);
        favoritesList.setAdapter(null);//from  w ww .  j  a  v  a2  s.  c  o m
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, Util.dp2px(150));
        favoritesContainerHeight = Util.dp2px(150);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
        params.addRule(RelativeLayout.BELOW, favoritesHeaderContainer.getId());
        favoritesContainer.setLayoutParams(params);
        addContainer.setPadding((int) (Util.getScreenWidth() / 7 + Util.dp2px(7)), (int) Util.dp2px(5), 0,
                (int) Util.dp2px(34));
        // getView().findViewById(R.id.imgRightArrow).setVisibility(View.INVISIBLE);
        textFavoriteHint.setVisibility(View.VISIBLE);
        btnEditFavorites.setVisibility(View.INVISIBLE);
        btnEditFavorites.setEnabled(false);
        lastListDivider.setVisibility(View.GONE);
        params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.topMargin = Util.dp2px(3);
        // imgAdd.setLayoutParams(params);
        textNewFavorite.setPadding(Util.dp2px(0), 0, 0, Util.dp2px(0));
        params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.bottomMargin = Util.getDensity() >= 2 ? Util.dp2px(40) : Util.dp2px(20);
        addContainer.setLayoutParams(params);
        addContainer.setPadding(Util.getDensity() >= 2 ? Util.dp2px(60) : Util.dp2px(40), Util.dp2px(7), 0,
                Util.dp2px(7));
        addContainer.setBackgroundColor(Color.TRANSPARENT);
        addContainer.setClickable(false);
    } else if (favorites == null || favorites.size() == 0) {
        favoritesContainer.setBackgroundResource(R.drawable.add_fav_background_selector);
        addContainer.setBackgroundColor(Color.TRANSPARENT);// addContainer.setBackgroundResource(R.drawable.add_fav_background_selector);
        lastListDivider.setVisibility(View.GONE);
        favoritesList.setVisibility(View.GONE);
        textFavoriteHint.setVisibility(View.VISIBLE);
        // getView().findViewById(R.id.imgRightArrow).setVisibility(View.VISIBLE);
        favoritesContainer.setClickable(true);
        imgAdd.setImageResource(R.drawable.fav_add);
        textFavoriteHint.setTextColor(getHintEnabledTextColor());
        textNewFavorite.setTextColor(getAddFavoriteTextColor());
        btnEditFavorites.setVisibility(View.INVISIBLE);
        btnEditFavorites.setEnabled(false);
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                RelativeLayout.LayoutParams.WRAP_CONTENT, Util.dp2px(150));
        favoritesContainerHeight = Util.dp2px(150);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
        params.addRule(RelativeLayout.BELOW, getView().findViewById(R.id.favoritesHeaderContainer).getId());
        favoritesContainer.setLayoutParams(params);
        addContainer.setPadding((int) (Util.getScreenWidth() / 7 + Util.dp2px(7)), (int) Util.dp2px(5), 0,
                (int) Util.dp2px(34));
        params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
        params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
        params.topMargin = Util.dp2px(3);
        // imgAdd.setLayoutParams(params);
        textNewFavorite.setPadding(0, 0, 0, 0);
        params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
                RelativeLayout.LayoutParams.WRAP_CONTENT);
        params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        params.addRule(RelativeLayout.CENTER_HORIZONTAL);
        params.bottomMargin = Util.getDensity() >= 2 ? Util.dp2px(40) : Util.dp2px(20);
        addContainer.setLayoutParams(params);
        addContainer.setPadding(Util.getDensity() >= 2 ? Util.dp2px(0) : Util.dp2px(10), Util.dp2px(7), 0,
                Util.dp2px(7));
        addContainer.setClickable(false);
    } else {
        // Loged in, and there is a list of favorites
        favoritesList.clearAnimations();
        favoritesList.setVisibility(View.VISIBLE);
        if (listAdapter != null) {
            ((FavoritesAdapter) listAdapter).setIsEditMode(isEditMode);
            btnEditFavorites.setVisibility(isEditMode ? View.INVISIBLE : View.VISIBLE);
            btnEditFavorites.setEnabled(!isEditMode);
            btnDone.setVisibility(isEditMode ? View.VISIBLE : View.INVISIBLE);
            btnDone.setEnabled(isEditMode);
        }
        textFavoriteHint.setVisibility(View.GONE);
        if (getView() != null) {
            addContainer.setVisibility(isEditMode ? View.GONE : View.VISIBLE);
            // getView().findViewById(R.id.imgRightArrow).setVisibility(View.GONE);
            getView().findViewById(R.id.favoritesContainer).setClickable(false);
            int count = favorites.size();
            int listHeight = count * (menuItemHeight) + Util.dp2px(1) * count;
            int viewHeight = (int) (Util.getScreenHeight() - Util.dp2px(26)); //
            // screen height without the
            // notifications bar
            int avaliableHeight = viewHeight - (menuItemHeight * (getMenuItemsCount() + (isEditMode ? 0 : 1)))
                    - (getMenuItemsCount() * dividerHeight);
            LOG.d("available height = " + avaliableHeight);
            LOG.d("list height = " + listHeight);
            if (listHeight > avaliableHeight) {
                listHeight = avaliableHeight;
            }
            RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                    RelativeLayout.LayoutParams.MATCH_PARENT,
                    (isEditMode ? listHeight : (listHeight + menuItemHeight)));
            favoritesContainerHeight = (isEditMode ? listHeight : (listHeight + menuItemHeight));
            params.addRule(RelativeLayout.CENTER_HORIZONTAL);
            params.addRule(RelativeLayout.BELOW, getView().findViewById(R.id.horizontalDivider1).getId());
            favoritesContainer.setLayoutParams(params);
            params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, listHeight);
            params.addRule(RelativeLayout.CENTER_HORIZONTAL);
            params.addRule(RelativeLayout.ALIGN_PARENT_TOP);
            getView().findViewById(R.id.favoritesListContainer).setLayoutParams(params);
            imgAdd.setImageResource(R.drawable.fav_add);
            textFavoriteHint.setTextColor(Color.WHITE);
            textNewFavorite.setTextColor(getAddFavoriteTextColor());
            lastListDivider.setVisibility(
                    (isEditMode || favorites.size() <= getFavoritesVisibleItemCount()) ? View.GONE
                            : View.VISIBLE);
            updateFavoritesContainer();
            addContainer.setPadding((int) Util.dp2px(30), (int) Util.dp2px(0), 0, (int) Util.dp2px(0));
            params = new RelativeLayout.LayoutParams(Util.dp2px(14), Util.dp2px(14));
            params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
            params.addRule(RelativeLayout.CENTER_VERTICAL);
            params.bottomMargin = Util.dp2px(0);
            // imgAdd.setLayoutParams(params);
            params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, menuItemHeight);
            params.addRule(RelativeLayout.BELOW, getView().findViewById(R.id.favoritesListContainer).getId());
            if (!isEditMode) {
                addContainer.setLayoutParams(params);
            }
            addContainer.setBackgroundResource(R.drawable.add_fav_background_selector);
            addContainer.setClickable(true);
            textNewFavorite.setPadding(Util.dp2px(4), 0, 0, 0);
            ((FavoritesAdapter) listAdapter).notifyDataSetChanged();
        }
    }

}