Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TIMOB-4482 Android: For TabGroup, put tabHost in a TiCompositeLayout so as to support position animation beyond screen size #553

Merged
merged 1 commit into from
Oct 18, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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