OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.banners; | 5 package org.chromium.chrome.browser.banners; |
6 | 6 |
7 import android.animation.ObjectAnimator; | 7 import android.animation.ObjectAnimator; |
8 import android.app.Activity; | 8 import android.app.Activity; |
9 import android.app.PendingIntent; | 9 import android.app.PendingIntent; |
10 import android.content.ActivityNotFoundException; | 10 import android.content.ActivityNotFoundException; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 private int mInstallState; | 152 private int mInstallState; |
153 | 153 |
154 /** | 154 /** |
155 * Creates a BannerView and adds it to the given ContentViewCore. | 155 * Creates a BannerView and adds it to the given ContentViewCore. |
156 * @param contentViewCore ContentViewCore to display the AppBannerView for. | 156 * @param contentViewCore ContentViewCore to display the AppBannerView for. |
157 * @param observer Class that is alerted for AppBannerView events. | 157 * @param observer Class that is alerted for AppBannerView events. |
158 * @param data Data about the app. | 158 * @param data Data about the app. |
159 * @return The created banner. | 159 * @return The created banner. |
160 */ | 160 */ |
161 public static AppBannerView create( | 161 public static AppBannerView create( |
162 ContentViewCore contentViewCore, Observer observer,AppData data) { | 162 ContentViewCore contentViewCore, Observer observer, AppData data) { |
163 Context context = contentViewCore.getContext().getApplicationContext(); | 163 Context context = contentViewCore.getContext().getApplicationContext(); |
164 AppBannerView banner = | 164 AppBannerView banner = |
165 (AppBannerView) LayoutInflater.from(context).inflate(BANNER_LAYO
UT, null); | 165 (AppBannerView) LayoutInflater.from(context).inflate(BANNER_LAYO
UT, null); |
166 banner.initialize(observer, data); | 166 banner.initialize(observer, data); |
167 banner.addToView(contentViewCore); | 167 banner.addToView(contentViewCore); |
168 return banner; | 168 return banner; |
169 } | 169 } |
170 | 170 |
171 /** | 171 /** |
172 * Creates a BannerView from an XML layout. | 172 * Creates a BannerView from an XML layout. |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 | 848 |
849 /** | 849 /** |
850 * Calculates how tall the given View has been measured to be, including its
margins. | 850 * Calculates how tall the given View has been measured to be, including its
margins. |
851 * @param view View to measure. | 851 * @param view View to measure. |
852 * @return Measured height of the view plus its margins. | 852 * @return Measured height of the view plus its margins. |
853 */ | 853 */ |
854 private static int getHeightWithMargins(View view) { | 854 private static int getHeightWithMargins(View view) { |
855 return view.getMeasuredHeight() + getMarginHeight(view); | 855 return view.getMeasuredHeight() + getMarginHeight(view); |
856 } | 856 } |
857 } | 857 } |
OLD | NEW |