mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 968640 - Lazy init HomeBanner using ViewStub. r=lucasr
--HG-- rename : mobile/android/base/resources/layout/home_banner.xml => mobile/android/base/resources/layout/home_banner_content.xml
This commit is contained in:
parent
f18cfdd4bf
commit
a9933dccf8
@ -1656,7 +1656,8 @@ abstract public class BrowserApp extends GeckoApp
|
||||
|
||||
// Don't show the banner in guest mode.
|
||||
if (!getProfile().inGuestMode()) {
|
||||
final HomeBanner homeBanner = (HomeBanner) findViewById(R.id.home_banner);
|
||||
final ViewStub homeBannerStub = (ViewStub) findViewById(R.id.home_banner_stub);
|
||||
final HomeBanner homeBanner = (HomeBanner) homeBannerStub.inflate();
|
||||
mHomePager.setBanner(homeBanner);
|
||||
|
||||
// Remove the banner from the view hierarchy if it is dismissed.
|
||||
|
@ -70,7 +70,7 @@ public class HomeBanner extends LinearLayout
|
||||
public HomeBanner(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.home_banner, this);
|
||||
LayoutInflater.from(context).inflate(R.layout.home_banner_content, this);
|
||||
|
||||
mTextView = (TextView) findViewById(R.id.text);
|
||||
mIconView = (ImageView) findViewById(R.id.icon);
|
||||
|
@ -36,17 +36,12 @@
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"/>
|
||||
|
||||
<org.mozilla.gecko.home.HomeBanner android:id="@+id/home_banner"
|
||||
style="@style/Widget.HomeBanner"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/home_banner_height"
|
||||
android:background="@drawable/home_banner"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:translationY="@dimen/home_banner_height"/>
|
||||
<ViewStub android:id="@+id/home_banner_stub"
|
||||
android:layout="@layout/home_banner"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="@dimen/home_banner_height"
|
||||
android:layout_gravity="bottom"
|
||||
android:translationY="@dimen/home_banner_height"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
@ -3,34 +3,13 @@
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ImageView android:id="@+id/icon"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="48dip"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<TextView android:id="@+id/text"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingBottom="7dp"
|
||||
android:textAppearance="@style/TextAppearance.Widget.HomeBanner"
|
||||
android:layout_gravity="bottom"
|
||||
android:singleLine="false"
|
||||
android:maxLines="3"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<ImageButton android:id="@+id/close"
|
||||
android:layout_width="34dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/home_banner"
|
||||
android:scaleType="center"
|
||||
android:contentDescription="@string/close_tab"
|
||||
android:src="@drawable/tab_close"/>
|
||||
|
||||
</merge>
|
||||
<org.mozilla.gecko.home.HomeBanner xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/home_banner"
|
||||
style="@style/Widget.HomeBanner"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/home_banner"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
android:clickable="true"
|
||||
android:focusable="true"/>
|
||||
|
36
mobile/android/base/resources/layout/home_banner_content.xml
Normal file
36
mobile/android/base/resources/layout/home_banner_content.xml
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<ImageView android:id="@+id/icon"
|
||||
android:layout_width="48dip"
|
||||
android:layout_height="48dip"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:scaleType="centerInside"/>
|
||||
|
||||
<TextView android:id="@+id/text"
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginLeft="10dp"
|
||||
android:paddingTop="7dp"
|
||||
android:paddingBottom="7dp"
|
||||
android:textAppearance="@style/TextAppearance.Widget.HomeBanner"
|
||||
android:layout_gravity="bottom"
|
||||
android:singleLine="false"
|
||||
android:maxLines="3"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"/>
|
||||
|
||||
<ImageButton android:id="@+id/close"
|
||||
android:layout_width="34dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:background="@drawable/home_banner"
|
||||
android:scaleType="center"
|
||||
android:contentDescription="@string/close_tab"
|
||||
android:src="@drawable/tab_close"/>
|
||||
|
||||
</merge>
|
Loading…
Reference in New Issue
Block a user