blob: 93610e25b29b634d6ba530d56e1eb6050721a4f3 [file] [log] [blame]
Leon Scroggins571b3762010-05-26 10:25:01 -04001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.browser;
18
Michael Kolb11d19782011-03-20 10:17:40 -070019import com.android.browser.UI.DropdownChangeListener;
John Reck92026732011-02-15 10:12:30 -080020import com.android.browser.UrlInputView.UrlInputListener;
Michael Kolb11d19782011-03-20 10:17:40 -070021import com.android.browser.autocomplete.SuggestedTextController.TextChangeWatcher;
John Reck92026732011-02-15 10:12:30 -080022
Michael Kolb46f987e2011-04-05 10:39:10 -070023import android.animation.Animator;
24import android.animation.Animator.AnimatorListener;
25import android.animation.ObjectAnimator;
John Reck92026732011-02-15 10:12:30 -080026import android.app.SearchManager;
Leon Scroggins571b3762010-05-26 10:25:01 -040027import android.content.Context;
John Reck92026732011-02-15 10:12:30 -080028import android.content.Intent;
Leon Scroggins571b3762010-05-26 10:25:01 -040029import android.graphics.Bitmap;
30import android.graphics.Color;
31import android.graphics.drawable.BitmapDrawable;
32import android.graphics.drawable.Drawable;
33import android.graphics.drawable.LayerDrawable;
34import android.graphics.drawable.PaintDrawable;
John Reck92026732011-02-15 10:12:30 -080035import android.os.Bundle;
36import android.speech.RecognizerResultsIntent;
Michael Kolb11d19782011-03-20 10:17:40 -070037import android.text.TextUtils;
38import android.view.ContextThemeWrapper;
Michael Kolb7cdc4902011-02-03 17:54:40 -080039import android.view.Gravity;
Michael Kolb11d19782011-03-20 10:17:40 -070040import android.view.KeyEvent;
41import android.view.LayoutInflater;
Leon Scroggins571b3762010-05-26 10:25:01 -040042import android.view.View;
Michael Kolb11d19782011-03-20 10:17:40 -070043import android.view.View.OnClickListener;
44import android.view.View.OnFocusChangeListener;
Michael Kolb46f987e2011-04-05 10:39:10 -070045import android.view.ViewGroup;
Michael Kolb11d19782011-03-20 10:17:40 -070046import android.view.animation.Animation;
47import android.view.animation.Animation.AnimationListener;
48import android.view.animation.AnimationUtils;
49import android.webkit.WebView;
Michael Kolb7cdc4902011-02-03 17:54:40 -080050import android.widget.AbsoluteLayout;
Michael Kolb11d19782011-03-20 10:17:40 -070051import android.widget.ArrayAdapter;
52import android.widget.Button;
Michael Kolb46f987e2011-04-05 10:39:10 -070053import android.widget.FrameLayout;
Michael Kolb11d19782011-03-20 10:17:40 -070054import android.widget.ImageButton;
Leon Scroggins571b3762010-05-26 10:25:01 -040055import android.widget.ImageView;
Michael Kolb11d19782011-03-20 10:17:40 -070056import android.widget.ProgressBar;
57import android.widget.RelativeLayout;
58import android.widget.Spinner;
59import android.widget.TextView;
60
61import java.util.List;
Leon Scroggins571b3762010-05-26 10:25:01 -040062
63/**
64 * Base class for a title bar used by the browser.
65 */
Michael Kolb11d19782011-03-20 10:17:40 -070066public class TitleBarBase extends RelativeLayout
67 implements OnClickListener, OnFocusChangeListener, UrlInputListener,
68 TextChangeWatcher, DeviceAccountLogin.AutoLoginCallback {
John Reck94b7e042011-02-15 15:02:33 -080069
70 protected static final int PROGRESS_MAX = 100;
71
Leon Scroggins571b3762010-05-26 10:25:01 -040072 // These need to be set by the subclass.
73 protected ImageView mFavicon;
74 protected ImageView mLockIcon;
75
Michael Kolbfe251992010-07-08 15:41:55 -070076 protected Drawable mGenericFavicon;
John Reck92026732011-02-15 10:12:30 -080077 protected UiController mUiController;
78 protected BaseUi mBaseUi;
Michael Kolb46f987e2011-04-05 10:39:10 -070079 protected FrameLayout mParent;
80 protected PageProgressView mProgress;
John Reck92026732011-02-15 10:12:30 -080081 protected UrlInputView mUrlInput;
82 protected boolean mInVoiceMode;
Michael Kolb46f987e2011-04-05 10:39:10 -070083 protected View mContainer;
84
Leon Scroggins571b3762010-05-26 10:25:01 -040085
Michael Kolb11d19782011-03-20 10:17:40 -070086 // Auto-login UI
87 protected View mAutoLogin;
88 protected Spinner mAutoLoginAccount;
89 protected Button mAutoLoginLogin;
90 protected ProgressBar mAutoLoginProgress;
91 protected TextView mAutoLoginError;
92 protected ImageButton mAutoLoginCancel;
93 protected DeviceAccountLogin mAutoLoginHandler;
94 protected ArrayAdapter<String> mAccountsAdapter;
Michael Kolbfdb70242011-03-24 09:41:11 -070095 protected boolean mUseQuickControls;
Michael Kolb11d19782011-03-20 10:17:40 -070096
Michael Kolb46f987e2011-04-05 10:39:10 -070097 //state
98 protected boolean mShowing;
99 protected boolean mInLoad;
100 protected boolean mSkipTitleBarAnimations;
101 private Animator mTitleBarAnimator;
102
103 public TitleBarBase(Context context, UiController controller, BaseUi ui,
104 FrameLayout parent) {
Leon Scroggins571b3762010-05-26 10:25:01 -0400105 super(context, null);
John Reck92026732011-02-15 10:12:30 -0800106 mUiController = controller;
107 mBaseUi = ui;
Michael Kolb46f987e2011-04-05 10:39:10 -0700108 mParent = parent;
Leon Scroggins571b3762010-05-26 10:25:01 -0400109 mGenericFavicon = context.getResources().getDrawable(
110 R.drawable.app_web_browser_sm);
111 }
112
Michael Kolb11d19782011-03-20 10:17:40 -0700113 protected void initLayout(Context context, int layoutId) {
114 LayoutInflater factory = LayoutInflater.from(context);
115 factory.inflate(layoutId, this);
Michael Kolb46f987e2011-04-05 10:39:10 -0700116 mContainer = findViewById(R.id.taburlbar);
117 mProgress = (PageProgressView) findViewById(R.id.progress);
Michael Kolb11d19782011-03-20 10:17:40 -0700118 mUrlInput = (UrlInputView) findViewById(R.id.url);
119 mLockIcon = (ImageView) findViewById(R.id.lock);
120 mUrlInput.setUrlInputListener(this);
121 mUrlInput.setController(mUiController);
122 mUrlInput.setOnFocusChangeListener(this);
123 mUrlInput.setSelectAllOnFocus(true);
124 mUrlInput.addQueryTextWatcher(this);
125 mAutoLogin = findViewById(R.id.autologin);
126 mAutoLoginAccount = (Spinner) findViewById(R.id.autologin_account);
127 mAutoLoginLogin = (Button) findViewById(R.id.autologin_login);
128 mAutoLoginLogin.setOnClickListener(this);
129 mAutoLoginProgress = (ProgressBar) findViewById(R.id.autologin_progress);
130 mAutoLoginError = (TextView) findViewById(R.id.autologin_error);
131 mAutoLoginCancel = (ImageButton) mAutoLogin.findViewById(R.id.autologin_close);
132 mAutoLoginCancel.setOnClickListener(this);
133 }
134
135 protected void setupUrlInput() {
136 }
137
Michael Kolbfdb70242011-03-24 09:41:11 -0700138 protected void setUseQuickControls(boolean use) {
139 mUseQuickControls = use;
Michael Kolb46f987e2011-04-05 10:39:10 -0700140 setLayoutParams(makeLayoutParams());
Michael Kolbfdb70242011-03-24 09:41:11 -0700141 }
142
Michael Kolb46f987e2011-04-05 10:39:10 -0700143 void setShowProgressOnly(boolean progress) {
144 if (progress && !inAutoLogin()) {
145 mContainer.setVisibility(View.GONE);
146 } else {
147 mContainer.setVisibility(View.VISIBLE);
148 }
149 }
150
151 void setSkipTitleBarAnimations(boolean skip) {
152 mSkipTitleBarAnimations = skip;
153 }
154
155 void show() {
156 if (mUseQuickControls) {
157 mParent.addView(this);
158 } else {
159 if (!mSkipTitleBarAnimations) {
160 cancelTitleBarAnimation(false);
161 int visibleHeight = getVisibleTitleHeight();
162 float startPos = (-getEmbeddedHeight() + visibleHeight);
163 if (getTranslationY() != 0) {
164 startPos = Math.max(startPos, getTranslationY());
165 }
166 mTitleBarAnimator = ObjectAnimator.ofFloat(this,
167 "translationY",
168 startPos, 0);
169 mTitleBarAnimator.start();
170 }
171 mBaseUi.setTitleGravity(Gravity.TOP);
172 }
173 mShowing = true;
174 }
175
176 void hide() {
177 if (mUseQuickControls) {
178 mParent.removeView(this);
179 } else {
180 if (!mSkipTitleBarAnimations) {
181 cancelTitleBarAnimation(false);
182 int visibleHeight = getVisibleTitleHeight();
183 mTitleBarAnimator = ObjectAnimator.ofFloat(this,
184 "translationY", getTranslationY(),
185 (-getEmbeddedHeight() + visibleHeight));
186 mTitleBarAnimator.addListener(mHideTileBarAnimatorListener);
187 mTitleBarAnimator.start();
188 } else {
189 mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
190 }
191 }
192 mShowing = false;
193 }
194
195 boolean isShowing() {
196 return mShowing;
197 }
198
199 void cancelTitleBarAnimation(boolean reset) {
200 if (mTitleBarAnimator != null) {
201 mTitleBarAnimator.cancel();
202 mTitleBarAnimator = null;
203 }
204 if (reset) {
205 setTranslationY(0);
206 }
207 }
208
209 private AnimatorListener mHideTileBarAnimatorListener = new AnimatorListener() {
210
211 boolean mWasCanceled;
212 @Override
213 public void onAnimationStart(Animator animation) {
214 mWasCanceled = false;
215 }
216
217 @Override
218 public void onAnimationRepeat(Animator animation) {
219 }
220
221 @Override
222 public void onAnimationEnd(Animator animation) {
223 if (!mWasCanceled) {
224 setTranslationY(0);
225 }
226 mBaseUi.setTitleGravity(Gravity.NO_GRAVITY);
227 }
228
229 @Override
230 public void onAnimationCancel(Animator animation) {
231 mWasCanceled = true;
232 }
233 };
234
235 private int getVisibleTitleHeight() {
236 Tab tab = mBaseUi.getActiveTab();
237 WebView webview = tab != null ? tab.getWebView() : null;
238 return webview != null ? webview.getVisibleTitleHeight() : 0;
239 }
240
241 /**
242 * Update the progress, from 0 to 100.
243 */
244 void setProgress(int newProgress) {
245 if (newProgress >= PROGRESS_MAX) {
246 mProgress.setProgress(PageProgressView.MAX_PROGRESS);
247 mProgress.setVisibility(View.GONE);
248 mInLoad = false;
249 onProgressStopped();
250 // check if needs to be hidden
251 if (!isEditingUrl() && !inAutoLogin()) {
252 hide();
253 if (mUseQuickControls) {
254 setShowProgressOnly(false);
255 }
256 }
257 } else {
258 if (!mInLoad) {
259 mProgress.setVisibility(View.VISIBLE);
260 mInLoad = true;
261 onProgressStarted();
262 }
263 mProgress.setProgress(newProgress * PageProgressView.MAX_PROGRESS
264 / PROGRESS_MAX);
265 if (!mShowing) {
266 if (mUseQuickControls && !isEditingUrl()) {
267 setShowProgressOnly(true);
268 }
269 show();
270 }
271 }
272 }
273
274 protected void onProgressStarted() {
275 }
276
277 protected void onProgressStopped() {
278 }
Leon Scroggins571b3762010-05-26 10:25:01 -0400279
280 /* package */ void setLock(Drawable d) {
281 assert mLockIcon != null;
282 if (null == d) {
283 mLockIcon.setVisibility(View.GONE);
284 } else {
285 mLockIcon.setImageDrawable(d);
286 mLockIcon.setVisibility(View.VISIBLE);
287 }
288 }
289
290 /* package */ void setFavicon(Bitmap icon) {
291 assert mFavicon != null;
292 Drawable[] array = new Drawable[3];
293 array[0] = new PaintDrawable(Color.BLACK);
294 PaintDrawable p = new PaintDrawable(Color.WHITE);
295 array[1] = p;
296 if (icon == null) {
297 array[2] = mGenericFavicon;
298 } else {
299 array[2] = new BitmapDrawable(icon);
300 }
301 LayerDrawable d = new LayerDrawable(array);
302 d.setLayerInset(1, 1, 1, 1, 1);
303 d.setLayerInset(2, 2, 2, 2, 2);
304 mFavicon.setImageDrawable(d);
305 }
306
Michael Kolb29ccf8a2011-02-23 16:13:24 -0800307 public int getEmbeddedHeight() {
Michael Kolb46f987e2011-04-05 10:39:10 -0700308 int height = mContainer.getHeight();
309 if (mAutoLogin.getVisibility() == View.VISIBLE) {
310 height += mAutoLogin.getHeight();
311 }
312 return height;
Michael Kolb29ccf8a2011-02-23 16:13:24 -0800313 }
314
Michael Kolb11d19782011-03-20 10:17:40 -0700315 protected void updateAutoLogin(Tab tab, boolean animate) {
316 DeviceAccountLogin login = tab.getDeviceAccountLogin();
317 if (login != null) {
318 mAutoLoginHandler = login;
319 ContextThemeWrapper wrapper = new ContextThemeWrapper(mContext,
320 android.R.style.Theme_Holo_Light);
321 mAccountsAdapter = new ArrayAdapter<String>(wrapper,
322 android.R.layout.simple_spinner_item, login.getAccountNames());
323 mAccountsAdapter.setDropDownViewResource(
324 android.R.layout.simple_spinner_dropdown_item);
325 mAutoLoginAccount.setAdapter(mAccountsAdapter);
326 mAutoLoginAccount.setSelection(0);
327 mAutoLoginAccount.setEnabled(true);
328 mAutoLoginLogin.setEnabled(true);
329 mAutoLoginProgress.setVisibility(View.GONE);
330 mAutoLoginError.setVisibility(View.GONE);
331 switch (login.getState()) {
332 case DeviceAccountLogin.PROCESSING:
333 mAutoLoginAccount.setEnabled(false);
334 mAutoLoginLogin.setEnabled(false);
335 mAutoLoginProgress.setVisibility(View.VISIBLE);
336 break;
337 case DeviceAccountLogin.FAILED:
338 mAutoLoginProgress.setVisibility(View.GONE);
339 mAutoLoginError.setVisibility(View.VISIBLE);
340 break;
341 case DeviceAccountLogin.INITIAL:
342 break;
343 default:
344 throw new IllegalStateException();
345 }
346 showAutoLogin(animate);
Michael Kolb43909f22011-03-23 13:18:36 -0700347 } else {
348 hideAutoLogin(animate);
Michael Kolb11d19782011-03-20 10:17:40 -0700349 }
350 }
351
352 protected void showAutoLogin(boolean animate) {
Michael Kolb46f987e2011-04-05 10:39:10 -0700353 if (mUseQuickControls) {
354 mBaseUi.showTitleBar();
355 }
Michael Kolb11d19782011-03-20 10:17:40 -0700356 mAutoLogin.setVisibility(View.VISIBLE);
357 if (animate) {
358 mAutoLogin.startAnimation(AnimationUtils.loadAnimation(
359 getContext(), R.anim.autologin_enter));
360 }
361 }
362
363 protected void hideAutoLogin(boolean animate) {
364 mAutoLoginHandler = null;
Michael Kolb46f987e2011-04-05 10:39:10 -0700365 if (mUseQuickControls) {
366 mBaseUi.hideTitleBar();
Michael Kolb11d19782011-03-20 10:17:40 -0700367 mAutoLogin.setVisibility(View.GONE);
368 mBaseUi.refreshWebView();
Michael Kolb46f987e2011-04-05 10:39:10 -0700369 } else {
370 if (animate) {
371 Animation anim = AnimationUtils.loadAnimation(getContext(),
372 R.anim.autologin_exit);
373 anim.setAnimationListener(new AnimationListener() {
374 @Override
375 public void onAnimationEnd(Animation a) {
376 mAutoLogin.setVisibility(View.GONE);
377 mBaseUi.refreshWebView();
378 }
379
380 @Override
381 public void onAnimationStart(Animation a) {
382 }
383
384 @Override
385 public void onAnimationRepeat(Animation a) {
386 }
387 });
388 mAutoLogin.startAnimation(anim);
389 } else if (mAutoLogin.getAnimation() == null) {
390 mAutoLogin.setVisibility(View.GONE);
391 mBaseUi.refreshWebView();
392 }
Michael Kolb11d19782011-03-20 10:17:40 -0700393 }
394 }
395
396 @Override
397 public void loginFailed() {
398 mAutoLoginAccount.setEnabled(true);
399 mAutoLoginLogin.setEnabled(true);
400 mAutoLoginProgress.setVisibility(View.GONE);
401 mAutoLoginError.setVisibility(View.VISIBLE);
402 }
403
404
405 protected boolean inAutoLogin() {
406 return mAutoLoginHandler != null;
407 }
408
409 @Override
410 public void onClick(View v) {
411 if (mAutoLoginCancel == v) {
412 if (mAutoLoginHandler != null) {
413 mAutoLoginHandler.cancel();
414 mAutoLoginHandler = null;
415 }
416 hideAutoLogin(true);
417 } else if (mAutoLoginLogin == v) {
418 if (mAutoLoginHandler != null) {
419 mAutoLoginAccount.setEnabled(false);
420 mAutoLoginLogin.setEnabled(false);
421 mAutoLoginProgress.setVisibility(View.VISIBLE);
422 mAutoLoginError.setVisibility(View.GONE);
423 mAutoLoginHandler.login(
424 mAutoLoginAccount.getSelectedItemPosition(), this);
425 }
426 }
427 }
428
429 @Override
430 public void onFocusChange(View view, boolean hasFocus) {
431 // if losing focus and not in touch mode, leave as is
432 if (hasFocus || view.isInTouchMode() || mUrlInput.needsUpdate()) {
433 setFocusState(hasFocus);
434 }
435 if (hasFocus) {
436 mUrlInput.forceIme();
437 if (mInVoiceMode) {
438 mUrlInput.forceFilter();
439 }
440 } else if (!mUrlInput.needsUpdate()) {
441 mUrlInput.dismissDropDown();
442 mUrlInput.hideIME();
443 if (mUrlInput.getText().length() == 0) {
444 Tab currentTab = mUiController.getTabControl().getCurrentTab();
445 if (currentTab != null) {
446 mUrlInput.setText(currentTab.getUrl(), false);
447 }
448 }
449 }
450 mUrlInput.clearNeedsUpdate();
451 }
452
453 protected void setFocusState(boolean focus) {
454 if (focus) {
455 updateSearchMode(false);
456 }
457 }
458
459 protected void updateSearchMode(boolean userEdited) {
460 setSearchMode(!userEdited || TextUtils.isEmpty(mUrlInput.getUserText()));
461 }
462
463 protected void setSearchMode(boolean voiceSearchEnabled) {}
464
465 boolean isEditingUrl() {
466 return mUrlInput.hasFocus();
467 }
468
469 void stopEditingUrl() {
470 mUrlInput.clearFocus();
471 }
472
473 void setDisplayTitle(String title) {
474 if (!isEditingUrl()) {
475 mUrlInput.setText(title, false);
476 }
477 }
478
479 // UrlInput text watcher
480
481 @Override
482 public void onTextChanged(String newText) {
483 if (mUrlInput.hasFocus()) {
484 // check if input field is empty and adjust voice search state
485 updateSearchMode(true);
486 // clear voice mode when user types
487 setInVoiceMode(false, null);
488 }
489 }
490
491 // voicesearch
492
493 public void setInVoiceMode(boolean voicemode, List<String> voiceResults) {
494 mInVoiceMode = voicemode;
495 mUrlInput.setVoiceResults(voiceResults);
496 }
497
498 void setIncognitoMode(boolean incognito) {
499 mUrlInput.setIncognitoMode(incognito);
500 }
501
502 void clearCompletions() {
503 mUrlInput.setSuggestedText(null);
504 }
505
John Reck92026732011-02-15 10:12:30 -0800506 // UrlInputListener implementation
507
508 /**
509 * callback from suggestion dropdown
510 * user selected a suggestion
511 */
512 @Override
513 public void onAction(String text, String extra, String source) {
514 mUiController.getCurrentTopWebView().requestFocus();
515 mBaseUi.hideTitleBar();
516 Intent i = new Intent();
517 String action = null;
518 if (UrlInputView.VOICE.equals(source)) {
519 action = RecognizerResultsIntent.ACTION_VOICE_SEARCH_RESULTS;
520 source = null;
521 } else {
522 action = Intent.ACTION_SEARCH;
523 }
524 i.setAction(action);
525 i.putExtra(SearchManager.QUERY, text);
526 if (extra != null) {
527 i.putExtra(SearchManager.EXTRA_DATA_KEY, extra);
528 }
529 if (source != null) {
530 Bundle appData = new Bundle();
531 appData.putString(com.android.common.Search.SOURCE, source);
532 i.putExtra(SearchManager.APP_DATA, appData);
533 }
534 mUiController.handleNewIntent(i);
535 setDisplayTitle(text);
536 }
537
538 @Override
539 public void onDismiss() {
540 final Tab currentTab = mBaseUi.getActiveTab();
541 mBaseUi.hideTitleBar();
542 post(new Runnable() {
543 public void run() {
544 clearFocus();
545 if ((currentTab != null) && !mInVoiceMode) {
546 setDisplayTitle(currentTab.getUrl());
547 }
548 }
549 });
550 }
551
552 /**
553 * callback from the suggestion dropdown
554 * copy text to input field and stay in edit mode
555 */
556 @Override
557 public void onCopySuggestion(String text) {
558 mUrlInput.setText(text, true);
559 if (text != null) {
560 mUrlInput.setSelection(text.length());
561 }
562 }
563
John Reck94b7e042011-02-15 15:02:33 -0800564 public void setCurrentUrlIsBookmark(boolean isBookmark) {
565 }
566
Michael Kolb11d19782011-03-20 10:17:40 -0700567 @Override
568 public boolean dispatchKeyEventPreIme(KeyEvent evt) {
569 if (evt.getKeyCode() == KeyEvent.KEYCODE_BACK) {
570 // catch back key in order to do slightly more cleanup than usual
571 mUrlInput.clearFocus();
572 return true;
573 }
574 return super.dispatchKeyEventPreIme(evt);
575 }
576
577 protected WebView getCurrentWebView() {
578 Tab t = mBaseUi.getActiveTab();
579 if (t != null) {
580 return t.getWebView();
581 } else {
582 return null;
583 }
584 }
585
586 void registerDropdownChangeListener(DropdownChangeListener d) {
587 mUrlInput.registerDropdownChangeListener(d);
588 }
589
Michael Kolbfdb70242011-03-24 09:41:11 -0700590 /**
591 * called from the Ui when the user wants to edit
592 * @param clearInput clear the input field
593 */
Michael Kolb46f987e2011-04-05 10:39:10 -0700594 void startEditingUrl(boolean clearInput) {
595 // editing takes preference of progress
596 mContainer.setVisibility(View.VISIBLE);
597 if (mUseQuickControls) {
598 mProgress.setVisibility(View.GONE);
599 }
600 if (!mUrlInput.hasFocus()) {
601 mUrlInput.requestFocus();
602 }
603 if (clearInput) {
604 mUrlInput.setText("");
605 } else if (mInVoiceMode) {
606 mUrlInput.showDropDown();
607 }
608 }
609
610 private ViewGroup.LayoutParams makeLayoutParams() {
611 if (mUseQuickControls) {
612 return new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT,
613 LayoutParams.WRAP_CONTENT);
614 } else {
615 return new AbsoluteLayout.LayoutParams(
616 LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT,
617 0, 0);
618 }
619 }
Michael Kolbfdb70242011-03-24 09:41:11 -0700620
Leon Scroggins571b3762010-05-26 10:25:01 -0400621}