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

Commit 2829deb5 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Convert NavigationView to Fragment (1/2)

- Replace NavigationView with DrawerFragment
- Load groups and filters in DrawerFragment, rather than in
  PeopleActivity directly
- based on RecylcerView, which seems more future-proof
- LTR layout and A11Y is handled
- new badge is implemented
- menu selection is implemented

Bug: 34062530

Test: quick sanity check

Change-Id: I630978e64dc4fd386e25cedfd04f53ea2bd8679f
parent f06f9dc8
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -14,12 +14,9 @@
     limitations under the License.
-->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="@color/nav_item_selected_background">
  <item>
    <selector>
      <item android:drawable="@color/nav_item_selected_background" android:state_checked="true"/>
      <item android:drawable="@android:color/transparent"/>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
  <item android:state_activated="true"
        android:drawable="@color/drawer_selected_color"/>
  <item android:drawable="@drawable/ripple_background" />
</selector>
 No newline at end of file
  </item>
</ripple>
 No newline at end of file
+19 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright (C) 2017 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.
-->

<ripple xmlns:android="http://schemas.android.com/apk/res/android"
        android:color="@color/control_highlight_color" />
 No newline at end of file
+5 −10
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
@@ -42,15 +41,11 @@
            android:background="?android:attr/windowBackground" />
    </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/nav_view"
        android:theme="@style/NavigationDrawerMenuItemTextAppearance"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
    <fragment
        android:id="@+id/drawer"
        android:name="com.android.contacts.drawer.DrawerFragment"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:itemBackground="@drawable/drawer_item_background"
        app:headerLayout="@layout/nav_header_main"
        app:menu="@menu/activity_main_drawer"/>
        android:layout_width="@dimen/drawer_width"
        android:layout_height="match_parent" />

</android.support.v4.widget.DrawerLayout>
 No newline at end of file
+30 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>

<!-- Copyright (C) 2017 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.
-->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/list"
        android:background="#FAFAFA"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="@null" />
</FrameLayout>
 No newline at end of file
+41 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2016 The Android Open Source Project

<!-- Copyright (C) 2017 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.
@@ -15,18 +15,27 @@
     limitations under the License.
-->

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/assistant_new_badge"
    android:layout_width="wrap_content"
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/label_header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical"
    android:paddingLeft="@dimen/nav_new_badge_horizontal_pad"
    android:paddingTop="@dimen/nav_new_badge_vertical_pad"
    android:paddingRight="@dimen/nav_new_badge_horizontal_pad"
    android:paddingBottom="@dimen/nav_new_badge_vertical_pad"
    android:background="@drawable/new_badge_background"
    android:textSize="@dimen/nav_new_badge_font_size"
    android:textStyle="bold"
    android:textAllCaps="true"
    android:textColor="@android:color/white"
    android:text="@string/menu_assistant_new_badge"/>
 No newline at end of file
    android:orientation="vertical"
    android:background="@color/navigation_drawer_background_color">

    <include layout="@layout/drawer_horizontal_divider" />

    <FrameLayout
        style="@style/DrawerHeaderItemStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="false">

        <TextView
            android:id="@+id/title"
            style="@style/DrawerHeaderTextStyle"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"/>
    </FrameLayout>
</LinearLayout>
 No newline at end of file
Loading