Bug 1412517 - Time picker layout broken when opened in landscape mode; r=jchen

MozReview-Commit-ID: HKidrZXrgqK

--HG--
extra : rebase_source : 1a714dbacc339a9b3b85c9114059520104d8b1a0
This commit is contained in:
Petru Lingurar 2018-06-22 18:33:32 +03:00
parent b9eed730ee
commit a162eddf84

View File

@ -5,7 +5,6 @@
package org.mozilla.gecko.prompts;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.R;
import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.ThreadUtils;
@ -20,8 +19,10 @@ import android.content.DialogInterface.OnClickListener;
import android.content.res.Resources;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.LinearLayout;
@ -366,7 +367,15 @@ public class Prompt implements OnClickListener, OnCancelListener, OnItemClickLis
linearLayout.setOrientation(LinearLayout.VERTICAL);
applyInputStyle(linearLayout, input);
linearLayout.addView(input.getView(mContext));
View widget = input.getView(mContext);
// Make sure the widget will not be chopped on smaller screens
LinearLayout.LayoutParams parentParams = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
parentParams.gravity = Gravity.CENTER;
widget.setLayoutParams(parentParams);
linearLayout.addView(widget);
return linearLayout;
}