Bug 998426 - Ensure shrunken toolbar consistency across API levels. r=wesj

This commit is contained in:
Michael Comella 2014-04-23 14:13:52 -07:00
parent a8d40c0ff2
commit 2421cb59dc

View File

@ -50,6 +50,7 @@ import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Interpolator;
import android.view.inputmethod.InputMethodManager;
@ -190,7 +191,10 @@ public class BrowserToolbar extends ThemedRelativeLayout
urlEditLayout = (ToolbarEditLayout) findViewById(R.id.edit_layout);
urlBarEntryDefaultLayoutParams = (RelativeLayout.LayoutParams) urlBarEntry.getLayoutParams();
urlBarEntryShrunkenLayoutParams = new RelativeLayout.LayoutParams(urlBarEntryDefaultLayoutParams);
// API level 19 adds a RelativeLayout.LayoutParams copy constructor, so we explicitly cast
// to ViewGroup.MarginLayoutParams to ensure consistency across platforms.
urlBarEntryShrunkenLayoutParams = new RelativeLayout.LayoutParams(
(ViewGroup.MarginLayoutParams) urlBarEntryDefaultLayoutParams);
urlBarEntryShrunkenLayoutParams.addRule(RelativeLayout.ALIGN_RIGHT, R.id.edit_layout);
urlBarEntryShrunkenLayoutParams.rightMargin = 0;