Permalink
Browse files

TIMOB-6486: Hook up click listeners for tabs

Also added node_modules to git-ignore
  • Loading branch information...
Allen Yeung
Allen Yeung committed Oct 11, 2012
1 parent 42bef91 commit c73d26cfb9aee3159c1ed0a253f6e7762707c7a1
View
@@ -20,3 +20,4 @@ support/node_modules/*
anvil/driver/titanium_mobile
anvil/hub/config.js
support/mobileweb/dependencyAnalyzer/node_modules/*
+anvil/driver/node_modules/*
@@ -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;
@@ -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();
@@ -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

0 comments on commit c73d26c

Please sign in to comment.