Merge "Clean up/fix some minor focus-related code."
This commit is contained in:
23
packages/DocumentsUI/res/color/item_doc_grid_border.xml
Normal file
23
packages/DocumentsUI/res/color/item_doc_grid_border.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_focused="true"
|
||||
android:color="?android:attr/colorAccent"/>
|
||||
<item
|
||||
android:color="@android:color/transparent" />
|
||||
</selector>
|
||||
22
packages/DocumentsUI/res/drawable/item_doc_grid_border.xml
Normal file
22
packages/DocumentsUI/res/drawable/item_doc_grid_border.xml
Normal file
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/item_doc_grid_border"/>
|
||||
</shape>
|
||||
@@ -18,7 +18,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/item_doc_list_background"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:focusable="true">
|
||||
|
||||
<View
|
||||
android:id="@+id/focus_indicator"
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/grid_item_height"
|
||||
android:layout_margin="@dimen/grid_item_margin"
|
||||
android:background="@color/item_doc_grid_background">
|
||||
android:background="@color/item_doc_grid_background"
|
||||
android:focusable="true">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon_thumb"
|
||||
@@ -130,6 +131,7 @@
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/item_doc_grid_overlay"
|
||||
android:contentDescription="@null"
|
||||
android:background="@drawable/item_doc_grid_border"
|
||||
android:duplicateParentState="true" />
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/item_doc_list_background"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:focusable="true">
|
||||
|
||||
<View
|
||||
android:id="@+id/focus_indicator"
|
||||
|
||||
@@ -938,10 +938,6 @@ public class DirectoryFragment extends Fragment {
|
||||
|
||||
public DocumentHolder(View view) {
|
||||
super(view);
|
||||
// Setting this using android:focusable in the item layouts doesn't work for list items.
|
||||
// So we set it here. Note that touch mode focus is a separate issue - see
|
||||
// View.setFocusableInTouchMode and View.isInTouchMode for more info.
|
||||
view.setFocusable(true);
|
||||
view.setOnKeyListener(this);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user