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

Unverified Commit ec1d7d6c authored by yuichiro fujiwara's avatar yuichiro fujiwara Committed by Michael Bestas
Browse files

Place EmergencyInfo shortcut on drawer

Add EmegencyInfo shortcut on drawer list.
User can launch from the navigation drawer easily.

Bug: 38188696
Change-Id: I0c6a4b76cfbf55dfe3d08867dc1313739344ee49
parent 7ba8e375
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0"
        android:tint="?attr/colorControlNormal">
    <path
        android:pathData="M9.6,2v5.6l-5,-3L2,9l5,3l-5,3l2.3,4l5.3,-2.7v5.6h4.6v-5.6l5.3,2.7l2.3,-4l-5.6,-2.7L21.9,9l-2.3,-4l-5.3,3V2H9.6z"
        android:fillColor="#FFFFFF"/>
</vector>
+3 −0
Original line number Diff line number Diff line
@@ -74,6 +74,9 @@
    <!-- Menu ID for each filter menu item -->
    <item type="id" name="nav_filter" />

    <!-- Menu ID for ice item -->
    <item type="id" name="nav_emergency" />

    <!-- Menu ID for Settings menu -->
    <item type="id" name="nav_settings" />

+22 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2018 The LineageOS 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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

    <!--Explanation with icon of Drawer in Contacts. Your medical information ie. Date of birth, Bloodtype, allergic details can be recorded for reference. -->
    <string name="menu_emergency_information_txt">Emergency information</string>

</resources>
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
@@ -1233,6 +1233,15 @@ public class PeopleActivity extends AppCompatContactsActivity implements
        }
    }

    /*
     * Behavior when select Emergency information on Navigation drawer.
     */
    @Override
    public void onEmergencyViewSelected() {
        ImplicitIntentsUtil.startActivityOutsideApp(this,
                ImplicitIntentsUtil.getIntentForEmergencyInfo(this));
    }

    public boolean isGroupView() {
        return mCurrentView == ContactsView.GROUP_VIEW;
    }
+18 −1
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import com.android.contacts.list.ContactListFilter;
import com.android.contacts.model.account.AccountDisplayInfo;
import com.android.contacts.model.account.AccountDisplayInfoFactory;
import com.android.contacts.profile.ProfileItem;
import com.android.contacts.util.ImplicitIntentsUtil;
import com.android.contacts.util.SharedPreferenceUtil;
import com.android.contactsbind.HelpUtils;
import com.android.contactsbind.ObjectFactory;
@@ -54,9 +55,10 @@ public class DrawerAdapter extends BaseAdapter {
    private static final int VIEW_TYPE_NAV_SPACER = 6;
    private static final int VIEW_TYPE_NAV_DIVIDER = 7;
    private static final int VIEW_TYPE_PROFILE_ENTRY = 8;
    private static final int VIEW_TYPE_EMERGENCY_ITEM = 9;

    // This count must be updated if we add more view types.
    private static final int VIEW_TYPE_COUNT = 10;
    private static final int VIEW_TYPE_COUNT = 11;

    private static final int TYPEFACE_STYLE_ACTIVATE = R.style.DrawerItemTextActiveStyle;
    private static final int TYPEFACE_STYLE_INACTIVE = R.style.DrawerItemTextInactiveStyle;
@@ -79,6 +81,8 @@ public class DrawerAdapter extends BaseAdapter {
    //  [Create Label button]
    //  [Account Header]
    //  [Accounts]
    //  [Emergency information]
    //  [Emergency information spacer item]
    //  [Misc items] (a divider, Settings, Help & Feedback)
    //  [Navigation spacer item]
    private NavSpacerItem mNavSpacerItem = null;
@@ -90,6 +94,8 @@ public class DrawerAdapter extends BaseAdapter {
    private BaseDrawerItem mCreateLabelButton = null;
    private HeaderItem mAccountHeader = null;
    private List<AccountEntryItem> mAccountEntries = new ArrayList<>();
    private BaseDrawerItem mEmergencyItem = null;
    private DividerItem mEmergencyItemDivider = null;
    private List<BaseDrawerItem> mMiscItems = new ArrayList<>();

    private List<BaseDrawerItem> mItemsList = new ArrayList<>();
@@ -120,6 +126,11 @@ public class DrawerAdapter extends BaseAdapter {
        // Create Label Button
        mCreateLabelButton = new BaseDrawerItem(VIEW_TYPE_CREATE_LABEL, R.id.nav_create_label,
                R.string.menu_new_group_action_bar, R.drawable.quantum_ic_add_vd_theme_24);
        // Emergency information Item
        mEmergencyItem = new BaseDrawerItem(VIEW_TYPE_EMERGENCY_ITEM, R.id.nav_emergency,
                R.string.menu_emergency_information_txt,
                R.drawable.quantum_ic_drawer_emergency_info_24);
        mEmergencyItemDivider = new DividerItem();
        // Misc Items
        mMiscItems.add(new DividerItem());
        mMiscItems.add(new MiscItem(R.id.nav_settings, R.string.menu_settings,
@@ -150,6 +161,10 @@ public class DrawerAdapter extends BaseAdapter {
            mItemsList.add(mAccountHeader);
        }
        mItemsList.addAll(mAccountEntries);
        if (ImplicitIntentsUtil.getIntentForEmergencyInfo(mActivity) != null) {
            mItemsList.add(mEmergencyItemDivider);
            mItemsList.add(mEmergencyItem);
        }
        mItemsList.addAll(mMiscItems);
        mItemsList.add(mNavSpacerItem);
    }
@@ -224,6 +239,8 @@ public class DrawerAdapter extends BaseAdapter {
                return getBaseItemView(R.layout.nav_drawer_spacer, view, viewGroup);
            case VIEW_TYPE_NAV_DIVIDER:
                return getBaseItemView(R.layout.drawer_horizontal_divider, view, viewGroup);
            case VIEW_TYPE_EMERGENCY_ITEM:
                return getDrawerItemView(drawerItem, view, viewGroup);
        }
        throw new IllegalStateException("Unknown drawer item " + drawerItem);
    }
Loading