Fixing various issues with the dock.
- Prevent crash due to no overlays in certain device configurations - Fixing kb crash and adding content description for Apps button Change-Id: Ie2a2bc29e7b9408a165f93d108fdd803193afc29
This commit is contained in:
1 parent
092338a632
commit
7529fa2405
5 files changed
+30
-16
No files matched your search
@@ -330,16 +330,4 @@ public class BubbleTextView extends TextView implements VisibilityChangedBroadca
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event)
|
||||
|| super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
return FocusHelper.handleBubbleTextViewKeyEvent(this, keyCode, event)
|
||||
|| super.onKeyUp(keyCode, event);
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,20 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* A keyboard listener we set on all the workspace icons.
|
||||
*/
|
||||
class BubbleTextViewKeyEventListener implements View.OnKeyListener {
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
return FocusHelper.handleBubbleTextViewKeyEvent((BubbleTextView) v, keyCode, event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A keyboard listener we set on all the hotseat buttons.
|
||||
*/
|
||||
class HotseatKeyEventListener implements View.OnKeyListener {
|
||||
class HotseatBubbleTextViewKeyEventListener implements View.OnKeyListener {
|
||||
@Override
|
||||
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
||||
final Configuration configuration = v.getResources().getConfiguration();
|
||||
@@ -612,6 +622,7 @@ public class FocusHelper {
|
||||
final Workspace workspace = (Workspace) layout.getParent();
|
||||
final ViewGroup launcher = (ViewGroup) workspace.getParent();
|
||||
final ViewGroup tabs = (ViewGroup) launcher.findViewById(R.id.qsb_bar);
|
||||
final ViewGroup hotseat = (ViewGroup) launcher.findViewById(R.id.hotseat);
|
||||
int iconIndex = parent.indexOfChild(v);
|
||||
int iconCount = parent.getChildCount();
|
||||
int pageIndex = workspace.indexOfChild(layout);
|
||||
@@ -678,11 +689,13 @@ public class FocusHelper {
|
||||
break;
|
||||
case KeyEvent.KEYCODE_DPAD_DOWN:
|
||||
if (handleKeyEvent) {
|
||||
// Select the closest icon in the next line, otherwise select the tab bar
|
||||
// Select the closest icon in the next line, otherwise select the button bar
|
||||
View newIcon = getClosestBubbleTextViewOnLine(layout, parent, v, 1);
|
||||
if (newIcon != null) {
|
||||
newIcon.requestFocus();
|
||||
wasHandled = true;
|
||||
} else if (hotseat != null) {
|
||||
hotseat.requestFocus();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -57,6 +57,7 @@ public class Hotseat extends FrameLayout {
|
||||
|
||||
public void setup(Launcher launcher) {
|
||||
mLauncher = launcher;
|
||||
setOnKeyListener(new HotseatBubbleTextViewKeyEventListener());
|
||||
}
|
||||
|
||||
CellLayout getLayout() {
|
||||
@@ -96,11 +97,14 @@ public class Hotseat extends FrameLayout {
|
||||
inflater.inflate(R.layout.application, mContent, false);
|
||||
allAppsButton.setCompoundDrawablesWithIntrinsicBounds(null,
|
||||
context.getResources().getDrawable(R.drawable.apps_hotseat_button), null, null);
|
||||
// button.setText(context.getString(R.string.all_apps_button_label));
|
||||
// allAppsButton.setText(context.getString(R.string.all_apps_button_label));
|
||||
allAppsButton.setContentDescription(context.getString(R.string.all_apps_button_label));
|
||||
allAppsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(android.view.View v) {
|
||||
mLauncher.showAllApps(true);
|
||||
if (mLauncher != null) {
|
||||
mLauncher.showAllApps(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2874,6 +2874,13 @@ public final class Launcher extends Activity
|
||||
final Workspace workspace = mWorkspace;
|
||||
for (int i=start; i<end; i++) {
|
||||
final ItemInfo item = shortcuts.get(i);
|
||||
|
||||
// Short circuit if we are loading dock items for a configuration which has no dock
|
||||
if (item.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT &&
|
||||
mHotseat == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (item.itemType) {
|
||||
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
|
||||
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
|
||||
|
||||
@@ -453,6 +453,7 @@ public class Workspace extends SmoothPagedView
|
||||
final CellLayout layout;
|
||||
if (container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
|
||||
layout = mLauncher.getHotseat().getLayout();
|
||||
child.setOnKeyListener(null);
|
||||
|
||||
if (screen < 0) {
|
||||
screen = mLauncher.getHotseat().getOrderInHotseat(x, y);
|
||||
@@ -464,6 +465,7 @@ public class Workspace extends SmoothPagedView
|
||||
}
|
||||
} else {
|
||||
layout = (CellLayout) getChildAt(screen);
|
||||
child.setOnKeyListener(new BubbleTextViewKeyEventListener());
|
||||
}
|
||||
|
||||
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams();
|
||||
|
||||
Reference in new issue
Block a user