Skip to content

Commit

Permalink
Merge pull request #553 from billdawson/timob-4482
Browse files Browse the repository at this point in the history
TIMOB-4482 Android: For TabGroup, put tabHost in a TiCompositeLayout so as to support position animation beyond screen size
  • Loading branch information
donthorp committed Oct 18, 2011
2 parents 7221299 + cf438d6 commit faacbda
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions android/modules/ui/src/ti/modules/titanium/ui/TiTabActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2010 by Appcelerator, Inc. All Rights Reserved.
* Copyright (c) 2009-2011 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
Expand All @@ -10,7 +10,8 @@
import org.appcelerator.titanium.TiC;
import org.appcelerator.titanium.TiRootActivity;
import org.appcelerator.titanium.util.Log;
import org.appcelerator.titanium.util.TiConfig;
import org.appcelerator.titanium.view.TiCompositeLayout;
import org.appcelerator.titanium.view.TiCompositeLayout.LayoutArrangement;

import android.app.TabActivity;
import android.content.Intent;
Expand All @@ -19,6 +20,7 @@
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
Expand All @@ -28,7 +30,6 @@
public class TiTabActivity extends TabActivity
{
private static final String LCAT = "TiTabActivity";
private static final boolean DBG = TiConfig.LOGD;

protected TabGroupProxy proxy;
protected Handler handler;
Expand All @@ -48,9 +49,18 @@ protected void onCreate(Bundle savedInstanceState)
if (layoutResId == 0) {
throw new IllegalStateException("titanium_tabgroup layout resource not found. TabGroup cannot be created.");
}
Intent intent = getIntent();
handler = new Handler();

Intent intent = getIntent();
// Grab the TabHost from the layout and put it in a TiCompositeLayout
// so we can more easily support things like animation and
// our tab group being below/above screen.
TabHost tabHost = (TabHost) LayoutInflater.from(this).inflate(layoutResId, null);
TiCompositeLayout.LayoutParams tabHostLayout = new TiCompositeLayout.LayoutParams();
tabHostLayout.autoFillsHeight = true;
tabHostLayout.autoFillsWidth = true;
TiCompositeLayout layout = new TiCompositeLayout(this, LayoutArrangement.DEFAULT);
layout.addView(tabHost, tabHostLayout);

boolean fullscreen = false;
boolean navbar = false;
Expand Down Expand Up @@ -92,8 +102,7 @@ protected void onCreate(Bundle savedInstanceState)
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
}

setContentView(layoutResId);
TabHost tabHost = getTabHost();
setContentView(layout);

// The TabActivity requires that a tab be present and that the tab have
// some content (at least one View) *before* we get to the point where
Expand Down

0 comments on commit faacbda

Please sign in to comment.