Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38e94747 authored by Ben Kwa's avatar Ben Kwa
Browse files

Clean up/fix some minor focus-related code.

- Cleanup: Set the focusable flag in xml rather than in java.
- Add a border for the currently focused item in grid mode.

BUG=24326989

Change-Id: Ib17e93c377fb6b16bf8a7eccfb213f521d9596f0
parent 3b2872a8
Loading
Loading
Loading
Loading
+23 −0
Original line number Original line Diff line number Diff line
<?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 −0
Original line number Original line Diff line number Diff line
<?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>
+2 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,8 @@
    android:layout_width="match_parent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/item_doc_list_background"
    android:background="@drawable/item_doc_list_background"
    android:orientation="horizontal">
    android:orientation="horizontal"
    android:focusable="true">


    <View
    <View
        android:id="@+id/focus_indicator"
        android:id="@+id/focus_indicator"
+3 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,8 @@
    android:layout_width="match_parent"
    android:layout_width="match_parent"
    android:layout_height="@dimen/grid_item_height"
    android:layout_height="@dimen/grid_item_height"
    android:layout_margin="@dimen/grid_item_margin"
    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
    <ImageView
        android:id="@+id/icon_thumb"
        android:id="@+id/icon_thumb"
@@ -130,6 +131,7 @@
        android:layout_height="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/item_doc_grid_overlay"
        android:src="@drawable/item_doc_grid_overlay"
        android:contentDescription="@null"
        android:contentDescription="@null"
        android:background="@drawable/item_doc_grid_border"
        android:duplicateParentState="true" />
        android:duplicateParentState="true" />


    <ImageView
    <ImageView
+2 −1
Original line number Original line Diff line number Diff line
@@ -18,7 +18,8 @@
    android:layout_width="match_parent"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/item_doc_list_background"
    android:background="@drawable/item_doc_list_background"
    android:orientation="horizontal">
    android:orientation="horizontal"
    android:focusable="true">
  
  
    <View
    <View
        android:id="@+id/focus_indicator"
        android:id="@+id/focus_indicator"
Loading