Skip to content

Commit

Permalink
TIMOB-6486: Hook up click listeners for tabs
Browse files Browse the repository at this point in the history
Also added node_modules to git-ignore
  • Loading branch information
Allen Yeung committed Oct 12, 2012
1 parent 42bef91 commit c73d26c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -20,3 +20,4 @@ support/node_modules/*
anvil/driver/titanium_mobile
anvil/hub/config.js
support/mobileweb/dependencyAnalyzer/node_modules/*
anvil/driver/node_modules/*
Expand Up @@ -21,6 +21,7 @@
import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
Expand Down Expand Up @@ -87,7 +88,7 @@ private void setupTabHost() {
}

@Override
public void addTab(TabProxy tab) {
public void addTab(final TabProxy tab) {
TabWidget tabWidget = tabHost.getTabWidget();

final int tabIndex = tabHost.getTabWidget().getTabCount();
Expand All @@ -109,6 +110,18 @@ public void addTab(TabProxy tab) {
if (tabIndex == 0) {
tabHost.setOnTabChangedListener(this);
}

tabHost.getTabWidget().getChildTabViewAt(tabIndex).setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
// The default click listener for tab views is responsible for changing the selected tabs.
tabHost.setCurrentTab(tabIndex);

tab.fireEvent(TiC.EVENT_CLICK, null);
}
});
}

@Override
Expand Down

0 comments on commit c73d26c

Please sign in to comment.