Fixing focus issues in Launcher (keyboard support).
Change-Id: Ieafd713393daf5628f229a66441bd3ed293245da
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user