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

Commit 19a90b19 authored by Marcus Hagerott's avatar Marcus Hagerott Committed by Android (Google) Code Review
Browse files

Merge "Update SIM import UI to match designs" into ub-contactsdialer-h-dev

parents 2219c604 7217e698
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="#FF000000"
        android:pathData="M7,10l5,5 5,-5z"/>
</vector>
+45 −9
Original line number Diff line number Diff line
@@ -26,14 +26,13 @@

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            style="@style/ContactsToolbarStyle"
            style="@style/LightToolbarStyle"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            android:elevation="4dp"
            android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
            android:elevation="3dp"
            android:theme="@style/LightToolbarThemeOverlay"
            app:navigationContentDescription="@string/sim_import_cancel_content_description"
            app:navigationIcon="@drawable/ic_close_dk"
            app:navigationIcon="@drawable/ic_close_24dp"
            app:title="@string/sim_import_title_none_selected">

            <Button
@@ -46,14 +45,51 @@
                />
        </android.support.v7.widget.Toolbar>

        <FrameLayout

        <!-- This is managed by AccountHeaderPresenter so the IDs in this section must
             match the equivalent views in layout/editor_account_header.xml -->
        <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/account_header_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="?android:colorBackground"
            android:elevation="4dp">
            android:minHeight="48dp"
            android:orientation="horizontal"
            android:paddingEnd="32dp"
            android:paddingStart="16dp">

            <include layout="@layout/editor_account_header"/>
        </FrameLayout>
            <ImageView
                android:id="@+id/account_type_icon"
                android:layout_width="24dp"
                android:layout_height="24dp"
                android:layout_gravity="center_vertical"
                android:layout_marginEnd="32dp"/>

            <TextView
                android:id="@+id/account_name"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:ellipsize="end"
                android:gravity="center_vertical"
                android:lines="1"
                android:maxLines="1"
                android:textColor="@color/secondary_text_color"
                android:textSize="16sp"/>

            <ImageView
                android:id="@+id/account_expander_icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="9dp"
                android:layout_gravity="center_vertical"
                android:scaleType="center"
                android:src="@drawable/ic_arrow_drop_down_black_24dp"
                android:tint="?android:textColorSecondary"
                android:visibility="gone"/>
        </LinearLayout>

        <FrameLayout
            android:layout_width="match_parent"
+0 −3
Original line number Diff line number Diff line
@@ -1850,9 +1850,6 @@
    <!-- Toolbar title shown when importing SIM contacts and none are selected -->
    <string name="sim_import_title_none_selected">Select contacts</string>

    <!-- Toolbar title shown when importing SIM contacts and some are selected -->
    <string name="sim_import_title_some_selected_fmt"><xliff:g id="count">%d</xliff:g> Selected</string>

    <!-- Message shown when the SIM import screen is displayed but there are no contacts on the
         SIM card  -->
    <string name="sim_import_empty_message">No contacts on your SIM card</string>
+15 −0
Original line number Diff line number Diff line
@@ -231,6 +231,21 @@
        <item name="titleTextAppearance">@style/ContactsActionBarTitleTextAppCompat</item>
    </style>

    <style name="LightToolbarNavigationButtonStyle" parent="@style/Widget.AppCompat.Toolbar.Button.Navigation">
        <item name="android:tint">?android:textColorSecondary</item>
    </style>

    <style name="LightToolbarThemeOverlay" parent="@style/ThemeOverlay.AppCompat.ActionBar">
        <item name="toolbarNavigationButtonStyle">@style/LightToolbarNavigationButtonStyle</item>
    </style>

    <style name="LightToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
        <item name="android:background">@color/contextual_selection_bar_color</item>
        <item name="background">@color/contextual_selection_bar_color</item>
        <item name="android:titleTextAppearance">@style/ContactsActionBarTitleTextBlack</item>
        <item name="titleTextAppearance">@style/ContactsActionBarTitleTextBlack</item>
    </style>

    <!-- Text in the action bar at the top of the screen -->
    <style name="ContactsActionBarTitleText"
           parent="@android:style/TextAppearance.Material.Widget.ActionBar.Title">
+32 −6
Original line number Diff line number Diff line
@@ -27,11 +27,13 @@ import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.util.ArrayMap;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.ContentLoadingProgressBar;
import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.ListView;

@@ -60,7 +62,7 @@ import java.util.TreeSet;
 */
public class SimImportFragment extends DialogFragment
        implements LoaderManager.LoaderCallbacks<SimImportFragment.LoaderResult>,
        MultiSelectEntryContactListAdapter.SelectedContactsListener {
        MultiSelectEntryContactListAdapter.SelectedContactsListener, AbsListView.OnScrollListener {

    private static final String KEY_SELECTED_IDS = "selectedIds";
    private static final String ARG_SUBSCRIPTION_ID = "subscriptionId";
@@ -68,7 +70,9 @@ public class SimImportFragment extends DialogFragment
    private ContactsPreferences mPreferences;
    private AccountTypeManager mAccountTypeManager;
    private SimContactAdapter mAdapter;
    private View mAccountHeaderContainer;
    private AccountHeaderPresenter mAccountHeaderPresenter;
    private float mAccountScrolledElevationPixels;
    private ContentLoadingProgressBar mLoadingIndicator;
    private Toolbar mToolbar;
    private ListView mListView;
@@ -121,8 +125,11 @@ public class SimImportFragment extends DialogFragment
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        final View view = inflater.inflate(R.layout.fragment_sim_import, container, false);

        mAccountHeaderContainer = view.findViewById(R.id.account_header_container);
        mAccountScrolledElevationPixels = getResources()
                .getDimension(R.dimen.contact_list_header_elevation);
        mAccountHeaderPresenter = new AccountHeaderPresenter(
                view.findViewById(R.id.account_header_container));
                mAccountHeaderContainer);
        if (savedInstanceState != null) {
            mAccountHeaderPresenter.onRestoreInstanceState(savedInstanceState);
        } else {
@@ -139,6 +146,7 @@ public class SimImportFragment extends DialogFragment
        mAdapter.setAccount(mAccountHeaderPresenter.getCurrentAccount());

        mListView = (ListView) view.findViewById(R.id.list);
        mListView.setOnScrollListener(this);
        mListView.setAdapter(mAdapter);
        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
@@ -160,7 +168,8 @@ public class SimImportFragment extends DialogFragment
                dismiss();
            }
        });
        mImportButton.setEnabled(mAdapter.getSelectedContactIds().size() > 0);
        mImportButton.setVisibility(mAdapter.getSelectedContactIds().size() > 0 ?
                View.VISIBLE : View.GONE);

        mToolbar = (Toolbar) view.findViewById(R.id.toolbar);
        mToolbar.setNavigationOnClickListener(new View.OnClickListener() {
@@ -240,11 +249,10 @@ public class SimImportFragment extends DialogFragment
        if (selectedCount == 0) {
            mToolbar.setTitle(R.string.sim_import_title_none_selected);
        } else {
            mToolbar.setTitle(getString(R.string.sim_import_title_some_selected_fmt,
                    selectedCount));
            mToolbar.setTitle(String.valueOf(selectedCount));
        }
        if (mImportButton != null) {
            mImportButton.setEnabled(selectedCount > 0);
            mImportButton.setVisibility(selectedCount > 0 ? View.VISIBLE : View.GONE);
        }
    }

@@ -255,6 +263,24 @@ public class SimImportFragment extends DialogFragment
        return getActivity();
    }

    @Override
    public void onScrollStateChanged(AbsListView view, int scrollState) { }

    @Override
    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount,
            int totalItemCount) {
        int firstCompletelyVisibleItem = firstVisibleItem;
        if (view != null && view.getChildAt(0) != null && view.getChildAt(0).getTop() < 0) {
            firstCompletelyVisibleItem++;
        }

        if (firstCompletelyVisibleItem == 0) {
            ViewCompat.setElevation(mAccountHeaderContainer, 0);
        } else {
            ViewCompat.setElevation(mAccountHeaderContainer, mAccountScrolledElevationPixels);
        }
    }

    /**
     * Creates a fragment that will display contacts stored on the default SIM card
     */
Loading