summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AllAppsTabbed.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-04-13 11:27:36 -0700
committerWinson Chung <winsonc@google.com>2011-04-14 10:13:09 -0700
commit97d85d23b013347bead4e2f5fa430a79ce69431e (patch)
tree4e72157c6814cb5c517b09ea14fd4474acb9c7c9 /src/com/android/launcher2/AllAppsTabbed.java
parent721a06bb6564a4ebe6dc6bf364cb569d255705ac (diff)
downloadandroid_packages_apps_Trebuchet-97d85d23b013347bead4e2f5fa430a79ce69431e.tar.gz
android_packages_apps_Trebuchet-97d85d23b013347bead4e2f5fa430a79ce69431e.tar.bz2
android_packages_apps_Trebuchet-97d85d23b013347bead4e2f5fa430a79ce69431e.zip
Fixing focus issues in Launcher (keyboard support).
Change-Id: Ieafd713393daf5628f229a66441bd3ed293245da
Diffstat (limited to 'src/com/android/launcher2/AllAppsTabbed.java')
-rw-r--r--src/com/android/launcher2/AllAppsTabbed.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java
index 059d0ae25..2deec8e1a 100644
--- a/src/com/android/launcher2/AllAppsTabbed.java
+++ b/src/com/android/launcher2/AllAppsTabbed.java
@@ -29,11 +29,13 @@ import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
+import android.view.ViewGroup;
import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.TextView;
import java.util.ArrayList;
+import java.util.Random;
/**
* Implements a tabbed version of AllApps2D.
@@ -80,6 +82,7 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans
};
// Create the tabs and wire them up properly
+ AllAppsTabKeyEventListener keyListener = new AllAppsTabKeyEventListener();
TextView tabView;
TabWidget tabWidget = (TabWidget) findViewById(com.android.internal.R.id.tabs);
tabView = (TextView) mInflater.inflate(R.layout.tab_widget_indicator, tabWidget, false);
@@ -90,6 +93,12 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans
tabView.setText(mContext.getString(R.string.all_apps_tab_downloaded));
addTab(newTabSpec(TAG_DOWNLOADED).setIndicator(tabView).setContent(contentFactory));
+ // Setup the key listener to jump between the last tab view and the market icon
+ View lastTab = tabWidget.getChildTabViewAt(tabWidget.getTabCount() - 1);
+ lastTab.setOnKeyListener(keyListener);
+ View shopButton = findViewById(R.id.market_button);
+ shopButton.setOnKeyListener(keyListener);
+
setOnTabChangedListener(new OnTabChangeListener() {
public void onTabChanged(String tabId) {
// animate the changing of the tab content by fading pages in and out
@@ -259,4 +268,12 @@ public class AllAppsTabbed extends TabHost implements AllAppsView, LauncherTrans
}
return true;
}
+
+ @Override
+ public int getDescendantFocusability() {
+ if (getVisibility() != View.VISIBLE) {
+ return ViewGroup.FOCUS_BLOCK_DESCENDANTS;
+ }
+ return super.getDescendantFocusability();
+ }
}