Loading src/com/android/documentsui/dirlist/UserInputHandler.java +8 −6 Original line number Diff line number Diff line Loading @@ -429,7 +429,7 @@ public final class UserInputHandler<T extends InputEvent> // TODO: Refactor FocusManager to depend only on DocumentDetails so we can eliminate // difficult to test dependency on DocumentHolder. boolean onKey(DocumentHolder doc, int keyCode, KeyEvent event) { boolean onKey(@Nullable DocumentHolder doc, int keyCode, KeyEvent event) { // Only handle key-down events. This is simpler, consistent with most other UIs, and // enables the handling of repeated key events from holding down a key. if (event.getAction() != KeyEvent.ACTION_DOWN) { Loading @@ -441,13 +441,15 @@ public final class UserInputHandler<T extends InputEvent> return false; } int itemType = doc.getItemViewType(); // Ignore events sent to Addon Holders. if (doc != null) { int itemType = doc.getItemViewType(); if (itemType == DocumentsAdapter.ITEM_TYPE_HEADER_MESSAGE || itemType == DocumentsAdapter.ITEM_TYPE_INFLATED_MESSAGE || itemType == DocumentsAdapter.ITEM_TYPE_SECTION_BREAK) { return false; } } if (mFocusHandler.handleKey(doc, keyCode, event)) { // Handle range selection adjustments. Extending the selection will adjust the Loading tests/common/com/android/documentsui/bots/DirectoryListBot.java +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public class DirectoryListBot extends Bots.BaseBot { assertTrue(messageTextView.exists()); String msg = String.valueOf(message); assertEquals(String.format(msg, "TEST_ROOT_0"), messageTextView.getText()); assertEquals(msg, messageTextView.getText()); } Loading tests/functional/com/android/documentsui/FilesActivityDefaultsUiTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ package com.android.documentsui; import static com.android.documentsui.StubProvider.ROOT_0_ID; import static com.android.documentsui.StubProvider.ROOT_1_ID; import android.content.Intent; import android.provider.DocumentsContract; import android.os.RemoteException; import android.support.test.filters.LargeTest; import android.support.v7.recyclerview.R; import com.android.documentsui.base.RootInfo; import com.android.documentsui.base.Shared; Loading @@ -34,6 +34,11 @@ public class FilesActivityDefaultsUiTest extends ActivityTest<FilesActivity> { super(FilesActivity.class); } @Override protected void initTestFiles() throws RemoteException { // Overriding to init with no items in test roots } @Override protected RootInfo getInitialRoot() { return null; // test the default, unaffected state of the app. Loading @@ -50,6 +55,18 @@ public class FilesActivityDefaultsUiTest extends ActivityTest<FilesActivity> { } } public void testNavigate_FromEmptyDirectory() throws Exception { device.waitForIdle(); bots.roots.openRoot(rootDir0.title); String msg = String.valueOf(context.getString(R.string.empty)); bots.directory.assertMessageTextView(msg); // Check to make sure back button is properly handled by non-Doc type DocHolders device.pressBack(); } public void testDefaultRoots() throws Exception { device.waitForIdle(); Loading Loading
src/com/android/documentsui/dirlist/UserInputHandler.java +8 −6 Original line number Diff line number Diff line Loading @@ -429,7 +429,7 @@ public final class UserInputHandler<T extends InputEvent> // TODO: Refactor FocusManager to depend only on DocumentDetails so we can eliminate // difficult to test dependency on DocumentHolder. boolean onKey(DocumentHolder doc, int keyCode, KeyEvent event) { boolean onKey(@Nullable DocumentHolder doc, int keyCode, KeyEvent event) { // Only handle key-down events. This is simpler, consistent with most other UIs, and // enables the handling of repeated key events from holding down a key. if (event.getAction() != KeyEvent.ACTION_DOWN) { Loading @@ -441,13 +441,15 @@ public final class UserInputHandler<T extends InputEvent> return false; } int itemType = doc.getItemViewType(); // Ignore events sent to Addon Holders. if (doc != null) { int itemType = doc.getItemViewType(); if (itemType == DocumentsAdapter.ITEM_TYPE_HEADER_MESSAGE || itemType == DocumentsAdapter.ITEM_TYPE_INFLATED_MESSAGE || itemType == DocumentsAdapter.ITEM_TYPE_SECTION_BREAK) { return false; } } if (mFocusHandler.handleKey(doc, keyCode, event)) { // Handle range selection adjustments. Extending the selection will adjust the Loading
tests/common/com/android/documentsui/bots/DirectoryListBot.java +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public class DirectoryListBot extends Bots.BaseBot { assertTrue(messageTextView.exists()); String msg = String.valueOf(message); assertEquals(String.format(msg, "TEST_ROOT_0"), messageTextView.getText()); assertEquals(msg, messageTextView.getText()); } Loading
tests/functional/com/android/documentsui/FilesActivityDefaultsUiTest.java +19 −2 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ package com.android.documentsui; import static com.android.documentsui.StubProvider.ROOT_0_ID; import static com.android.documentsui.StubProvider.ROOT_1_ID; import android.content.Intent; import android.provider.DocumentsContract; import android.os.RemoteException; import android.support.test.filters.LargeTest; import android.support.v7.recyclerview.R; import com.android.documentsui.base.RootInfo; import com.android.documentsui.base.Shared; Loading @@ -34,6 +34,11 @@ public class FilesActivityDefaultsUiTest extends ActivityTest<FilesActivity> { super(FilesActivity.class); } @Override protected void initTestFiles() throws RemoteException { // Overriding to init with no items in test roots } @Override protected RootInfo getInitialRoot() { return null; // test the default, unaffected state of the app. Loading @@ -50,6 +55,18 @@ public class FilesActivityDefaultsUiTest extends ActivityTest<FilesActivity> { } } public void testNavigate_FromEmptyDirectory() throws Exception { device.waitForIdle(); bots.roots.openRoot(rootDir0.title); String msg = String.valueOf(context.getString(R.string.empty)); bots.directory.assertMessageTextView(msg); // Check to make sure back button is properly handled by non-Doc type DocHolders device.pressBack(); } public void testDefaultRoots() throws Exception { device.waitForIdle(); Loading