Merge "Fixed no contacts layout on nexus 7." into lmp-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 69d211e..1175fe7 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -176,6 +176,11 @@
<data android:mimeType="vnd.android.cursor.item/postal-address_v2" />
<data android:mimeType="vnd.android.cursor.item/postal-address" />
</intent-filter>
+
+ <intent-filter>
+ <action android:name="com.android.contacts.action.JOIN_CONTACT" />
+ <category android:name="android.intent.category.DEFAULT" />
+ </intent-filter>
</activity>
<!-- Backwards compatibility: somebody may have hard coded this activity name -->
@@ -195,17 +200,6 @@
android:exported="true"
/>
- <!-- An activity for joining contacts -->
- <activity android:name=".activities.JoinContactActivity"
- android:theme="@style/JoinContactActivityTheme"
- android:clearTaskOnLaunch="true"
- >
- <intent-filter>
- <action android:name="com.android.contacts.action.JOIN_CONTACT" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
-
<!-- Used to set options -->
<activity
android:name=".preference.ContactsPreferenceActivity"
diff --git a/res/layout-sw600dp/join_contact_picker.xml b/res/layout-sw600dp/join_contact_picker.xml
deleted file mode 100644
index 9de85db..0000000
--- a/res/layout-sw600dp/join_contact_picker.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<view xmlns:android="http://schemas.android.com/apk/res/android"
- class="com.android.contacts.widget.FullHeightLinearLayout"
- style="@style/ContactPickerLayout"
- android:orientation="vertical">
- <!-- See also comments in contact_picker.xml -->
- <view
- class="android.widget.SearchView"
- android:id="@+id/search_view"
- android:layout_width="match_parent"
- android:maxWidth="@dimen/contact_picker_search_view_max_width"
- android:layout_height="wrap_content"
- android:layout_marginLeft="0dip"
- android:layout_marginRight="@dimen/list_visible_scrollbar_padding"
- android:layout_marginStart="0dip"
- android:layout_marginEnd="@dimen/list_visible_scrollbar_padding"
- android:paddingRight="0dip"
- android:paddingEnd="0dip"
- android:iconifiedByDefault="false" />
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:id="@+id/list_container" />
-</view>
diff --git a/res/layout/join_contact_picker.xml b/res/layout/join_contact_picker.xml
deleted file mode 100644
index ee30525..0000000
--- a/res/layout/join_contact_picker.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.
--->
-
-<view xmlns:android="http://schemas.android.com/apk/res/android"
- class="com.android.contacts.widget.FullHeightLinearLayout"
- style="@style/ContactPickerLayout"
- android:orientation="vertical">
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:id="@+id/list_container" />
-</view>
diff --git a/res/layout/quickcontact_content.xml b/res/layout/quickcontact_content.xml
index bab8b6d..b72340b 100644
--- a/res/layout/quickcontact_content.xml
+++ b/res/layout/quickcontact_content.xml
@@ -18,65 +18,36 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
- android:id="@+id/content_scroller">
+ android:id="@+id/content_scroller"
+ android:background="@color/card_margin_color">
<!-- All the cards should be inserted into this LinearLayout -->
<LinearLayout
android:layout_width="match_parent"
- android:layout_height="match_parent"
+ android:layout_height="wrap_content"
android:orientation="vertical"
- android:id="@+id/card_container"
android:paddingTop="@dimen/first_card_marginTop"
- android:background="@color/card_margin_color" >
+ android:id="@+id/card_container" >
- <!-- We cannot set the border directly on ExpandingEntryCardView without it looking
- funny because of the card's elevation value. So we need a parent FrameLayout -->
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/quickcontact_card_border">
- <com.android.contacts.quickcontact.ExpandingEntryCardView
- style="@style/ExpandingEntryCardStyle"
- android:id="@+id/no_contact_data_card"
- android:visibility="gone" />
- </FrameLayout>
+ <com.android.contacts.quickcontact.ExpandingEntryCardView
+ style="@style/ExpandingEntryCardStyle"
+ android:id="@+id/no_contact_data_card"
+ android:visibility="gone" />
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/quickcontact_card_border">
- <com.android.contacts.quickcontact.ExpandingEntryCardView
- style="@style/ExpandingEntryCardStyle"
- android:id="@+id/communication_card"
- android:visibility="gone" />
- </FrameLayout>
+ <com.android.contacts.quickcontact.ExpandingEntryCardView
+ style="@style/ExpandingEntryCardStyle"
+ android:id="@+id/communication_card"
+ android:visibility="gone" />
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/quickcontact_card_border">
- <com.android.contacts.quickcontact.ExpandingEntryCardView
- style="@style/ExpandingEntryCardStyle"
- android:id="@+id/recent_card"
- android:visibility="gone" />
- </FrameLayout>
+ <com.android.contacts.quickcontact.ExpandingEntryCardView
+ style="@style/ExpandingEntryCardStyle"
+ android:id="@+id/recent_card"
+ android:visibility="gone" />
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:background="@drawable/quickcontact_card_border">
- <com.android.contacts.quickcontact.ExpandingEntryCardView
- style="@style/ExpandingEntryCardStyle"
- android:id="@+id/about_card"
- android:visibility="gone" />
- </FrameLayout>
-
- <!-- Fill the rest of the LinearLayout with the correct background color -->
- <View
- android:id="@+id/card_empty_space"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="@color/card_margin_color" />
+ <com.android.contacts.quickcontact.ExpandingEntryCardView
+ style="@style/ExpandingEntryCardStyle"
+ android:id="@+id/about_card"
+ android:visibility="gone" />
</LinearLayout>
diff --git a/res/menu/search_menu.xml b/res/menu/search_menu.xml
new file mode 100644
index 0000000..355442e
--- /dev/null
+++ b/res/menu/search_menu.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+ <item
+ android:id="@+id/menu_search"
+ android:icon="@drawable/ic_ab_search"
+ android:title="@string/menu_search"
+ android:showAsAction="always" />
+</menu>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index aa28dbf..17b1f69 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -19,12 +19,6 @@
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
</style>
- <style name="JoinContactActivityTheme" parent="ContactPickerTheme" >
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">match_parent</item>
- <!-- In the contact picker screen we're using adjustResize but we don't want it here. -->
- <item name="android:windowSoftInputMode">adjustUnspecified</item>
- </style>
<style name="DetailActivityTheme" parent="@android:Theme.Dialog">
<item name="android:windowContentOverlay">@null</item>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 1eae4d0..af3c031 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -171,9 +171,6 @@
<item name="android:layout_height">match_parent</item>
</style>
- <style name="JoinContactActivityTheme" parent="ContactPickerTheme" >
- </style>
-
<style name="ContactsPreferencesTheme" parent="@style/PeopleTheme">
<item name="android:listViewStyle">@style/ListViewStyle</item>
</style>
diff --git a/src/com/android/contacts/activities/ContactSelectionActivity.java b/src/com/android/contacts/activities/ContactSelectionActivity.java
index c67a50e..c35f192 100644
--- a/src/com/android/contacts/activities/ContactSelectionActivity.java
+++ b/src/com/android/contacts/activities/ContactSelectionActivity.java
@@ -27,9 +27,12 @@
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Intents.Insert;
+import android.provider.ContactsContract.Intents.UI;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
@@ -48,6 +51,7 @@
import com.android.contacts.list.ContactsRequest;
import com.android.contacts.common.list.DirectoryListLoader;
import com.android.contacts.list.EmailAddressPickerFragment;
+import com.android.contacts.list.JoinContactListFragment;
import com.android.contacts.list.LegacyPhoneNumberPickerFragment;
import com.android.contacts.list.OnContactPickerActionListener;
import com.android.contacts.list.OnEmailAddressPickerActionListener;
@@ -71,15 +75,18 @@
private static final int SUBACTIVITY_ADD_TO_EXISTING_CONTACT = 0;
private static final String KEY_ACTION_CODE = "actionCode";
+ private static final String KEY_SEARCH_MODE = "searchMode";
private static final int DEFAULT_DIRECTORY_RESULT_LIMIT = 20;
private ContactsIntentResolver mIntentResolver;
protected ContactEntryListFragment<?> mListFragment;
private int mActionCode = -1;
+ private boolean mIsSearchMode;
private ContactsRequest mRequest;
private SearchView mSearchView;
+ private View mSearchViewContainer;
public ContactSelectionActivity() {
mIntentResolver = new ContactsIntentResolver(this);
@@ -99,6 +106,7 @@
if (savedState != null) {
mActionCode = savedState.getInt(KEY_ACTION_CODE);
+ mIsSearchMode = savedState.getBoolean(KEY_SEARCH_MODE);
}
// Extract relevant information from the intent
@@ -131,9 +139,9 @@
private void prepareSearchViewAndActionBar() {
final ActionBar actionBar = getActionBar();
- final View searchViewContainer = LayoutInflater.from(actionBar.getThemedContext())
+ mSearchViewContainer = LayoutInflater.from(actionBar.getThemedContext())
.inflate(R.layout.custom_action_bar, null);
- mSearchView = (SearchView) searchViewContainer.findViewById(R.id.search_view);
+ mSearchView = (SearchView) mSearchViewContainer.findViewById(R.id.search_view);
// Postal address pickers (and legacy pickers) don't support search, so just show
// "HomeAsUp" button and title.
@@ -148,25 +156,39 @@
return;
}
+ actionBar.setDisplayShowHomeEnabled(true);
+ actionBar.setDisplayHomeAsUpEnabled(true);
+
// In order to make the SearchView look like "shown via search menu", we need to
// manually setup its state. See also DialtactsActivity.java and ActionBarAdapter.java.
mSearchView.setIconifiedByDefault(true);
mSearchView.setQueryHint(getString(R.string.hint_findContacts));
mSearchView.setIconified(false);
+ mSearchView.setFocusable(true);
mSearchView.setOnQueryTextListener(this);
mSearchView.setOnCloseListener(this);
mSearchView.setOnQueryTextFocusChangeListener(this);
- actionBar.setCustomView(searchViewContainer,
+ actionBar.setCustomView(mSearchViewContainer,
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
actionBar.setDisplayShowCustomEnabled(true);
- actionBar.setDisplayShowHomeEnabled(true);
- actionBar.setDisplayHomeAsUpEnabled(true);
- actionBar.setDisplayShowTitleEnabled(false);
- // Clear focus and suppress keyboard show-up.
- mSearchView.clearFocus();
+ configureSearchMode();
+ }
+
+ private void configureSearchMode() {
+ final ActionBar actionBar = getActionBar();
+ if (mIsSearchMode) {
+ actionBar.setDisplayShowTitleEnabled(false);
+ mSearchViewContainer.setVisibility(View.VISIBLE);
+ mSearchView.requestFocus();
+ } else {
+ actionBar.setDisplayShowTitleEnabled(true);
+ mSearchViewContainer.setVisibility(View.GONE);
+ mSearchView.setQuery(null, true);
+ }
+ invalidateOptionsMenu();
}
@Override
@@ -175,7 +197,11 @@
case android.R.id.home:
// Go back to previous screen, intending "cancel"
setResult(RESULT_CANCELED);
- finish();
+ onBackPressed();
+ return true;
+ case R.id.menu_search:
+ mIsSearchMode = !mIsSearchMode;
+ configureSearchMode();
return true;
}
return super.onOptionsItemSelected(item);
@@ -185,6 +211,7 @@
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(KEY_ACTION_CODE, mActionCode);
+ outState.putBoolean(KEY_SEARCH_MODE, mIsSearchMode);
}
private void configureActivityTitle() {
@@ -239,6 +266,11 @@
setTitle(R.string.contactPickerActivityTitle);
break;
}
+
+ case ContactsRequest.ACTION_PICK_JOIN: {
+ setTitle(R.string.titleJoinContactDataWith);
+ break;
+ }
}
}
@@ -307,10 +339,18 @@
case ContactsRequest.ACTION_PICK_POSTAL: {
PostalAddressPickerFragment fragment = new PostalAddressPickerFragment();
+
mListFragment = fragment;
break;
}
+ case ContactsRequest.ACTION_PICK_JOIN: {
+ JoinContactListFragment joinFragment = new JoinContactListFragment();
+ joinFragment.setTargetContactId(getTargetContactId());
+ mListFragment = joinFragment;
+ break;
+ }
+
default:
throw new IllegalStateException("Invalid action code: " + mActionCode);
}
@@ -347,6 +387,9 @@
} else if (mListFragment instanceof EmailAddressPickerFragment) {
((EmailAddressPickerFragment) mListFragment).setOnEmailAddressPickerActionListener(
new EmailAddressPickerActionListener());
+ } else if (mListFragment instanceof JoinContactListFragment) {
+ ((JoinContactListFragment) mListFragment).setOnContactPickerActionListener(
+ new JoinContactActionListener());
} else {
throw new IllegalStateException("Unsupported list fragment type: " + mListFragment);
}
@@ -460,6 +503,27 @@
}
}
+ private final class JoinContactActionListener implements OnContactPickerActionListener {
+ @Override
+ public void onPickContactAction(Uri contactUri) {
+ Intent intent = new Intent(null, contactUri);
+ setResult(RESULT_OK, intent);
+ finish();
+ }
+
+ @Override
+ public void onShortcutIntentCreated(Intent intent) {
+ }
+
+ @Override
+ public void onCreateNewContactAction() {
+ }
+
+ @Override
+ public void onEditContactAction(Uri contactLookupUri) {
+ }
+ }
+
private final class PostalAddressPickerActionListener implements
OnPostalAddressPickerActionListener {
@Override
@@ -546,6 +610,19 @@
}
}
+ private long getTargetContactId() {
+ Intent intent = getIntent();
+ final long targetContactId = intent.getLongExtra(UI.TARGET_CONTACT_ID_EXTRA_KEY, -1);
+ if (targetContactId == -1) {
+ Log.e(TAG, "Intent " + intent.getAction() + " is missing required extra: "
+ + UI.TARGET_CONTACT_ID_EXTRA_KEY);
+ setResult(RESULT_CANCELED);
+ finish();
+ return -1;
+ }
+ return targetContactId;
+ }
+
private void startCreateNewContactActivity() {
Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
intent.putExtra(ContactEditorActivity.INTENT_KEY_FINISH_ACTIVITY_ON_SAVE_COMPLETED, true);
@@ -574,4 +651,26 @@
}
}
}
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ super.onCreateOptionsMenu(menu);
+
+ final MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.search_menu, menu);
+
+ final MenuItem searchItem = menu.findItem(R.id.menu_search);
+ searchItem.setVisible(!mIsSearchMode);
+ return true;
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (mIsSearchMode) {
+ mIsSearchMode = false;
+ configureSearchMode();
+ } else {
+ super.onBackPressed();
+ }
+ }
}
diff --git a/src/com/android/contacts/activities/JoinContactActivity.java b/src/com/android/contacts/activities/JoinContactActivity.java
deleted file mode 100644
index c345a01..0000000
--- a/src/com/android/contacts/activities/JoinContactActivity.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- */
-
-package com.android.contacts.activities;
-
-
-import android.app.ActionBar;
-import android.app.ActionBar.LayoutParams;
-import android.app.Fragment;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.ContactsContract;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.View.OnFocusChangeListener;
-import android.view.inputmethod.InputMethodManager;
-import android.widget.SearchView;
-import android.widget.SearchView.OnCloseListener;
-import android.widget.SearchView.OnQueryTextListener;
-
-import com.android.contacts.ContactsActivity;
-import com.android.contacts.R;
-import com.android.contacts.common.list.ContactEntryListFragment;
-import com.android.contacts.list.JoinContactListFragment;
-import com.android.contacts.list.OnContactPickerActionListener;
-
-/**
- * An activity that shows a list of contacts that can be joined with the target contact.
- */
-public class JoinContactActivity extends ContactsActivity
- implements OnQueryTextListener, OnCloseListener, OnFocusChangeListener {
-
- private static final String TAG = "JoinContactActivity";
-
- /**
- * The action for the join contact activity.
- * <p>
- * Input: extra field {@link #EXTRA_TARGET_CONTACT_ID} is the aggregate ID.
- * TODO: move to {@link ContactsContract}.
- */
- public static final String JOIN_CONTACT = "com.android.contacts.action.JOIN_CONTACT";
-
- /**
- * Used with {@link #JOIN_CONTACT} to give it the target for aggregation.
- * <p>
- * Type: LONG
- */
- public static final String EXTRA_TARGET_CONTACT_ID = "com.android.contacts.action.CONTACT_ID";
-
- private static final String KEY_TARGET_CONTACT_ID = "targetContactId";
-
- private long mTargetContactId;
-
- private JoinContactListFragment mListFragment;
- private SearchView mSearchView;
-
- @Override
- public void onAttachFragment(Fragment fragment) {
- if (fragment instanceof JoinContactListFragment) {
- mListFragment = (JoinContactListFragment) fragment;
- setupActionListener();
- }
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- Intent intent = getIntent();
- mTargetContactId = intent.getLongExtra(EXTRA_TARGET_CONTACT_ID, -1);
- if (mTargetContactId == -1) {
- Log.e(TAG, "Intent " + intent.getAction() + " is missing required extra: "
- + EXTRA_TARGET_CONTACT_ID);
- setResult(RESULT_CANCELED);
- finish();
- return;
- }
-
- setContentView(R.layout.join_contact_picker);
- setTitle(R.string.titleJoinContactDataWith);
-
- if (mListFragment == null) {
- mListFragment = new JoinContactListFragment();
-
- getFragmentManager().beginTransaction()
- .replace(R.id.list_container, mListFragment)
- .commitAllowingStateLoss();
- }
-
- prepareSearchViewAndActionBar();
- }
-
- private void setupActionListener() {
- mListFragment.setTargetContactId(mTargetContactId);
- mListFragment.setOnContactPickerActionListener(new OnContactPickerActionListener() {
- @Override
- public void onPickContactAction(Uri contactUri) {
- Intent intent = new Intent(null, contactUri);
- setResult(RESULT_OK, intent);
- finish();
- }
-
- @Override
- public void onShortcutIntentCreated(Intent intent) {
- }
-
- @Override
- public void onCreateNewContactAction() {
- }
-
- @Override
- public void onEditContactAction(Uri contactLookupUri) {
- }
- });
- }
-
- private void prepareSearchViewAndActionBar() {
- final ActionBar actionBar = getActionBar();
- if (actionBar != null) {
- final View searchViewOnLayout = findViewById(R.id.search_view);
- if (searchViewOnLayout != null) {
- searchViewOnLayout.setVisibility(View.GONE);
- }
-
- final View searchViewLayout = LayoutInflater.from(actionBar.getThemedContext())
- .inflate(R.layout.custom_action_bar, null);
- mSearchView = (SearchView) searchViewLayout.findViewById(R.id.search_view);
-
- // In order to make the SearchView look like "shown via search menu", we need to
- // manually setup its state. See also DialtactsActivity.java and ActionBarAdapter.java.
- mSearchView.setIconifiedByDefault(true);
- mSearchView.setQueryHint(getString(R.string.hint_findContacts));
- mSearchView.setIconified(false);
-
- mSearchView.setOnQueryTextListener(this);
- mSearchView.setOnCloseListener(this);
- mSearchView.setOnQueryTextFocusChangeListener(this);
-
- actionBar.setCustomView(searchViewLayout,
- new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
- actionBar.setDisplayShowCustomEnabled(true);
- actionBar.setDisplayShowHomeEnabled(true);
- actionBar.setDisplayHomeAsUpEnabled(true);
- } else {
- mSearchView = (SearchView) findViewById(R.id.search_view);
- mSearchView.setQueryHint(getString(R.string.hint_findContacts));
- mSearchView.setOnQueryTextListener(this);
- mSearchView.setOnQueryTextFocusChangeListener(this);
- }
-
- // Clear focus and suppress keyboard show-up.
- mSearchView.clearFocus();
- }
-
- @Override
- public boolean onQueryTextChange(String newText) {
- mListFragment.setQueryString(newText, true);
- return false;
- }
-
- @Override
- public boolean onQueryTextSubmit(String query) {
- return false;
- }
-
- @Override
- public boolean onClose() {
- if (!TextUtils.isEmpty(mSearchView.getQuery())) {
- mSearchView.setQuery(null, true);
- }
- return true;
- }
-
- @Override
- public void onFocusChange(View view, boolean hasFocus) {
- switch (view.getId()) {
- case R.id.search_view: {
- if (hasFocus) {
- showInputMethod(mSearchView.findFocus());
- }
- }
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // Go back to previous screen, intending "cancel"
- setResult(RESULT_CANCELED);
- finish();
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- protected void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- outState.putLong(KEY_TARGET_CONTACT_ID, mTargetContactId);
- }
-
- @Override
- protected void onRestoreInstanceState(Bundle savedInstanceState) {
- super.onRestoreInstanceState(savedInstanceState);
- mTargetContactId = savedInstanceState.getLong(KEY_TARGET_CONTACT_ID);
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- if (requestCode == ContactEntryListFragment.ACTIVITY_REQUEST_CODE_PICKER
- && resultCode == RESULT_OK) {
- mListFragment.onPickerResult(data);
- }
- }
-
- private void showInputMethod(View view) {
- final InputMethodManager imm = (InputMethodManager)
- getSystemService(Context.INPUT_METHOD_SERVICE);
- if (imm != null) {
- if (!imm.showSoftInput(view, 0)) {
- Log.w(TAG, "Failed to show soft input method.");
- }
- }
- }
-}
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index 1b950d2..b4ec7f9 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -49,6 +49,7 @@
import android.provider.ContactsContract.Contacts;
import android.provider.ContactsContract.Groups;
import android.provider.ContactsContract.Intents;
+import android.provider.ContactsContract.Intents.UI;
import android.provider.ContactsContract.QuickContact;
import android.provider.ContactsContract.RawContacts;
import android.text.TextUtils;
@@ -71,7 +72,6 @@
import com.android.contacts.R;
import com.android.contacts.activities.ContactEditorAccountsChangedActivity;
import com.android.contacts.activities.ContactEditorActivity;
-import com.android.contacts.activities.JoinContactActivity;
import com.android.contacts.common.model.AccountTypeManager;
import com.android.contacts.common.model.ValuesDelta;
import com.android.contacts.common.model.account.AccountType;
@@ -1377,8 +1377,8 @@
mContactIdForJoin = ContentUris.parseId(contactLookupUri);
mContactWritableForJoin = isContactWritable();
- final Intent intent = new Intent(JoinContactActivity.JOIN_CONTACT);
- intent.putExtra(JoinContactActivity.EXTRA_TARGET_CONTACT_ID, mContactIdForJoin);
+ final Intent intent = new Intent(UI.PICK_JOIN_CONTACT_ACTION);
+ intent.putExtra(UI.TARGET_CONTACT_ID_EXTRA_KEY, mContactIdForJoin);
startActivityForResult(intent, REQUEST_CODE_JOIN);
}
diff --git a/src/com/android/contacts/list/ContactsIntentResolver.java b/src/com/android/contacts/list/ContactsIntentResolver.java
index 838393e..b4416be 100644
--- a/src/com/android/contacts/list/ContactsIntentResolver.java
+++ b/src/com/android/contacts/list/ContactsIntentResolver.java
@@ -173,6 +173,8 @@
request.setContactUri(data);
intent.setAction(Intent.ACTION_DEFAULT);
intent.setData(null);
+ } else if (UI.PICK_JOIN_CONTACT_ACTION.equals(action)) {
+ request.setActionCode(ContactsRequest.ACTION_PICK_JOIN);
}
// Allow the title to be set to a custom String using an extra on the intent
String title = intent.getStringExtra(UI.TITLE_EXTRA_KEY);
diff --git a/src/com/android/contacts/list/ContactsRequest.java b/src/com/android/contacts/list/ContactsRequest.java
index 2a26ddf..7955fde 100644
--- a/src/com/android/contacts/list/ContactsRequest.java
+++ b/src/com/android/contacts/list/ContactsRequest.java
@@ -77,6 +77,9 @@
/** Show all contacts and activate the specified one */
public static final int ACTION_VIEW_CONTACT = 140;
+ /** Show contacts recommended for joining with a specified target contact */
+ public static final int ACTION_PICK_JOIN = 150;
+
private boolean mValid = true;
private int mActionCode = ACTION_DEFAULT;
private Intent mRedirectIntent;
diff --git a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
index 2063c51..b9603e5 100644
--- a/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
+++ b/src/com/android/contacts/quickcontact/ExpandingEntryCardView.java
@@ -15,11 +15,6 @@
*/
package com.android.contacts.quickcontact;
-import com.android.contacts.R;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ValueAnimator;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
@@ -27,18 +22,25 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
+import android.transition.ChangeBounds;
+import android.transition.ChangeScroll;
+import android.transition.Fade;
+import android.transition.Transition;
+import android.transition.Transition.TransitionListener;
+import android.transition.TransitionManager;
+import android.transition.TransitionSet;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.TouchDelegate;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
-import android.view.ViewTreeObserver.OnPreDrawListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
+import com.android.contacts.R;
+
import java.util.ArrayList;
import java.util.List;
@@ -48,6 +50,11 @@
public class ExpandingEntryCardView extends LinearLayout {
private static final String TAG = "ExpandingEntryCardView";
+ private static final int DURATION_EXPAND_ANIMATION_FADE_IN = 200;
+ private static final int DELAY_EXPAND_ANIMATION_FADE_IN = 100;
+
+ public static final int DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS = 300;
+ public static final int DURATION_COLLAPSE_ANIMATION_CHANGE_BOUNDS = 300;
/**
* Entry data.
@@ -150,6 +157,7 @@
public interface ExpandingEntryCardViewListener {
void onCollapse(int heightDelta);
+ void onExpand(int heightDelta);
}
private View mExpandCollapseButton;
@@ -171,6 +179,8 @@
private int mThemeColor;
private ColorFilter mThemeColorFilter;
private boolean mIsAlwaysExpanded;
+ /** The ViewGroup to run the expand/collapse animation on */
+ private ViewGroup mAnimationViewGroup;
private final OnClickListener mExpandCollapseButtonListener = new OnClickListener() {
@Override
@@ -214,7 +224,7 @@
*/
public void initialize(List<List<Entry>> entries, int numInitialVisibleEntries,
boolean isExpanded, boolean isAlwaysExpanded,
- ExpandingEntryCardViewListener listener) {
+ ExpandingEntryCardViewListener listener, ViewGroup animationViewGroup) {
LayoutInflater layoutInflater = LayoutInflater.from(getContext());
mIsExpanded = isExpanded;
mIsAlwaysExpanded = isAlwaysExpanded;
@@ -235,6 +245,7 @@
mCollapsedEntriesCount = mEntries.size();
}
mListener = listener;
+ mAnimationViewGroup = animationViewGroup;
if (mIsExpanded) {
updateExpandCollapseButton(getCollapseButtonText());
@@ -300,37 +311,41 @@
private void addEntry(View entry) {
if (mEntriesViewGroup.getChildCount() > 0) {
- View separator = new View(getContext());
- separator.setBackgroundColor(getResources().getColor(
- R.color.expanding_entry_card_item_separator_color));
- LayoutParams layoutParams = generateDefaultLayoutParams();
- Resources resources = getResources();
- layoutParams.height = resources.getDimensionPixelSize(
- R.dimen.expanding_entry_card_item_separator_height);
- // The separator is aligned with the text in the entry. This is offset by a default
- // margin. If there is an icon present, the icon's width and margin are added
- int marginStart = resources.getDimensionPixelSize(
- R.dimen.expanding_entry_card_item_padding_start);
- ImageView entryIcon = (ImageView) entry.findViewById(R.id.icon);
- if (entryIcon.getDrawable() != null) {
- int imageWidthAndMargin =
- resources.getDimensionPixelSize(
- R.dimen.expanding_entry_card_item_icon_width) +
- resources.getDimensionPixelSize(
- R.dimen.expanding_entry_card_item_image_spacing);
- marginStart += imageWidthAndMargin;
- }
- if (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
- layoutParams.rightMargin = marginStart;
- } else {
- layoutParams.leftMargin = marginStart;
- }
- separator.setLayoutParams(layoutParams);
- mEntriesViewGroup.addView(separator);
+ mEntriesViewGroup.addView(createSeparator(entry));
}
mEntriesViewGroup.addView(entry);
}
+ private View createSeparator(View entry) {
+ View separator = new View(getContext());
+ separator.setBackgroundColor(getResources().getColor(
+ R.color.expanding_entry_card_item_separator_color));
+ LayoutParams layoutParams = generateDefaultLayoutParams();
+ Resources resources = getResources();
+ layoutParams.height = resources.getDimensionPixelSize(
+ R.dimen.expanding_entry_card_item_separator_height);
+ // The separator is aligned with the text in the entry. This is offset by a default
+ // margin. If there is an icon present, the icon's width and margin are added
+ int marginStart = resources.getDimensionPixelSize(
+ R.dimen.expanding_entry_card_item_padding_start);
+ ImageView entryIcon = (ImageView) entry.findViewById(R.id.icon);
+ if (entryIcon.getDrawable() != null) {
+ int imageWidthAndMargin =
+ resources.getDimensionPixelSize(
+ R.dimen.expanding_entry_card_item_icon_width) +
+ resources.getDimensionPixelSize(
+ R.dimen.expanding_entry_card_item_image_spacing);
+ marginStart += imageWidthAndMargin;
+ }
+ if (getLayoutDirection() == View.LAYOUT_DIRECTION_RTL) {
+ layoutParams.rightMargin = marginStart;
+ } else {
+ layoutParams.leftMargin = marginStart;
+ }
+ separator.setLayoutParams(layoutParams);
+ return separator;
+ }
+
private CharSequence getExpandButtonText() {
if (!TextUtils.isEmpty(mExpandButtonText)) {
return mExpandButtonText;
@@ -455,14 +470,14 @@
}
final TextView header = (TextView) view.findViewById(R.id.header);
- if (entry.getHeader() != null) {
+ if (!TextUtils.isEmpty(entry.getHeader())) {
header.setText(entry.getHeader());
} else {
header.setVisibility(View.GONE);
}
final TextView subHeader = (TextView) view.findViewById(R.id.sub_header);
- if (entry.getSubHeader() != null) {
+ if (!TextUtils.isEmpty(entry.getSubHeader())) {
subHeader.setText(entry.getSubHeader());
} else {
subHeader.setVisibility(View.GONE);
@@ -476,7 +491,7 @@
}
final TextView text = (TextView) view.findViewById(R.id.text);
- if (entry.getText() != null) {
+ if (!TextUtils.isEmpty(entry.getText())) {
text.setText(entry.getText());
} else {
text.setVisibility(View.GONE);
@@ -543,77 +558,102 @@
}
private void expand() {
- final int startingHeight = mEntriesViewGroup.getHeight();
+ ChangeBounds boundsTransition = new ChangeBounds();
+ boundsTransition.setDuration(DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
+
+ Fade fadeIn = new Fade(Fade.IN);
+ fadeIn.setDuration(DURATION_EXPAND_ANIMATION_FADE_IN);
+ fadeIn.setStartDelay(DELAY_EXPAND_ANIMATION_FADE_IN);
+
+ TransitionSet transitionSet = new TransitionSet();
+ transitionSet.addTransition(boundsTransition);
+ transitionSet.addTransition(fadeIn);
+
+ final ViewGroup transitionViewContainer = mAnimationViewGroup == null ?
+ this : mAnimationViewGroup;
+
+ transitionSet.addListener(new TransitionListener() {
+ @Override
+ public void onTransitionStart(Transition transition) {
+ // The listener is used to turn off suppressing, the proper delta is not necessary
+ mListener.onExpand(0);
+ }
+
+ @Override
+ public void onTransitionEnd(Transition transition) {
+ }
+
+ @Override
+ public void onTransitionCancel(Transition transition) {
+ }
+
+ @Override
+ public void onTransitionPause(Transition transition) {
+ }
+
+ @Override
+ public void onTransitionResume(Transition transition) {
+ }
+ });
+
+ TransitionManager.beginDelayedTransition(transitionViewContainer, transitionSet);
mIsExpanded = true;
// In order to insert new entries, we may need to inflate them for the first time
inflateAllEntries(LayoutInflater.from(getContext()));
insertEntriesIntoViewGroup();
updateExpandCollapseButton(getCollapseButtonText());
-
- // When expanding, all the TextViews haven't been laid out yet. Therefore,
- // calling measure() would return an incorrect result. Therefore, we need a pre draw
- // listener.
- final ViewTreeObserver observer = mEntriesViewGroup.getViewTreeObserver();
- observer.addOnPreDrawListener(new OnPreDrawListener() {
- @Override
- public boolean onPreDraw() {
- if (observer.isAlive()) {
- mEntriesViewGroup.getViewTreeObserver().removeOnPreDrawListener(this);
- }
- createExpandAnimator(startingHeight, mEntriesViewGroup.getHeight()).start();
- // Do not draw the final frame of the animation immediately.
- return false;
- }
- });
}
private void collapse() {
- int startingHeight = mEntriesViewGroup.getHeight();
- int finishHeight = measureCollapsedViewGroupHeight();
- mListener.onCollapse(startingHeight - finishHeight);
-
+ final int startingHeight = mEntriesViewGroup.getMeasuredHeight();
mIsExpanded = false;
updateExpandCollapseButton(getExpandButtonText());
- createExpandAnimator(startingHeight, finishHeight).start();
- }
- private int measureCollapsedViewGroupHeight() {
- if (mCollapsedEntriesCount == 0) {
- return 0;
- }
- final View bottomCollapsedView = mEntryViews.get(mCollapsedEntriesCount - 1).get(0);
- return bottomCollapsedView.getTop() + bottomCollapsedView.getHeight();
- }
+ final ChangeBounds boundsTransition = new ChangeBounds();
+ boundsTransition.setDuration(DURATION_COLLAPSE_ANIMATION_CHANGE_BOUNDS);
- /**
- * Create ValueAnimator that performs an expand animation on the content LinearLayout.
- *
- * The animation needs to be performed manually using a ValueAnimator, since LinearLayout
- * doesn't have a single set-able height property (ie, no setHeight()).
- */
- private ValueAnimator createExpandAnimator(int start, int end) {
- ValueAnimator animator = ValueAnimator.ofInt(start, end);
- animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ final ChangeScroll scrollTransition = new ChangeScroll();
+ scrollTransition.setDuration(DURATION_COLLAPSE_ANIMATION_CHANGE_BOUNDS);
+
+ TransitionSet transitionSet = new TransitionSet();
+ transitionSet.addTransition(boundsTransition);
+ transitionSet.addTransition(scrollTransition);
+
+ final ViewGroup transitionViewContainer = mAnimationViewGroup == null ?
+ this : mAnimationViewGroup;
+
+ boundsTransition.addListener(new TransitionListener() {
@Override
- public void onAnimationUpdate(ValueAnimator valueAnimator) {
- int value = (Integer) valueAnimator.getAnimatedValue();
- ViewGroup.LayoutParams layoutParams = mEntriesViewGroup.getLayoutParams();
- layoutParams.height = value;
- mEntriesViewGroup.setLayoutParams(layoutParams);
+ public void onTransitionStart(Transition transition) {
+ /*
+ * onTransitionStart is called after the view hierarchy has been changed but before
+ * the animation begins.
+ */
+ int finishingHeight = mEntriesViewGroup.getMeasuredHeight();
+ mListener.onCollapse(startingHeight - finishingHeight);
+ }
+
+ @Override
+ public void onTransitionEnd(Transition transition) {
+ }
+
+ @Override
+ public void onTransitionCancel(Transition transition) {
+ }
+
+ @Override
+ public void onTransitionPause(Transition transition) {
+ }
+
+ @Override
+ public void onTransitionResume(Transition transition) {
}
});
- animator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- insertEntriesIntoViewGroup();
- // Now that the animation is done, stop using a fixed height.
- ViewGroup.LayoutParams layoutParams = mEntriesViewGroup.getLayoutParams();
- layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
- mEntriesViewGroup.setLayoutParams(layoutParams);
- }
- });
- return animator;
+
+ TransitionManager.beginDelayedTransition(transitionViewContainer, transitionSet);
+
+ insertEntriesIntoViewGroup();
}
/**
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 06622b6..669b460 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -77,6 +77,7 @@
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.Toast;
import android.widget.Toolbar;
@@ -320,6 +321,11 @@
public void onCollapse(int heightDelta) {
mScroller.prepareForShrinkingScrollChild(heightDelta);
}
+
+ @Override
+ public void onExpand(int heightDelta) {
+ mScroller.prepareForExpandingScrollChild();
+ }
};
/**
@@ -493,11 +499,12 @@
mMaterialColorMapUtils = new MaterialColorMapUtils(getResources());
+ mScroller = (MultiShrinkScroller) findViewById(R.id.multiscroller);
+
mContactCard = (ExpandingEntryCardView) findViewById(R.id.communication_card);
mNoContactDetailsCard = (ExpandingEntryCardView) findViewById(R.id.no_contact_data_card);
mRecentCard = (ExpandingEntryCardView) findViewById(R.id.recent_card);
mAboutCard = (ExpandingEntryCardView) findViewById(R.id.about_card);
- mScroller = (MultiShrinkScroller) findViewById(R.id.multiscroller);
mNoContactDetailsCard.setOnClickListener(mEntryClickHandler);
mContactCard.setOnClickListener(mEntryClickHandler);
@@ -808,7 +815,8 @@
/* numInitialVisibleEntries = */ MIN_NUM_CONTACT_ENTRIES_SHOWN,
/* isExpanded = */ mContactCard.isExpanded(),
/* isAlwaysExpanded = */ false,
- mExpandingEntryCardViewListener);
+ mExpandingEntryCardViewListener,
+ mScroller);
mContactCard.setVisibility(View.VISIBLE);
} else {
mContactCard.setVisibility(View.GONE);
@@ -840,7 +848,8 @@
/* numInitialVisibleEntries = */ 1,
/* isExpanded = */ true,
/* isAlwaysExpanded = */ true,
- mExpandingEntryCardViewListener);
+ mExpandingEntryCardViewListener,
+ mScroller);
if (contactCardEntries.size() == 0 && aboutCardEntries.size() == 0) {
initializeNoContactDetailCard();
@@ -888,7 +897,7 @@
final PorterDuffColorFilter greyColorFilter =
new PorterDuffColorFilter(subHeaderTextColor, PorterDuff.Mode.SRC_ATOP);
mNoContactDetailsCard.initialize(promptEntries, 2, /* isExpanded = */ true,
- /* isAlwaysExpanded = */ true, mExpandingEntryCardViewListener);
+ /* isAlwaysExpanded = */ true, mExpandingEntryCardViewListener, mScroller);
mNoContactDetailsCard.setVisibility(View.VISIBLE);
mNoContactDetailsCard.setEntryHeaderColor(subHeaderTextColor);
mNoContactDetailsCard.setColorAndFilter(subHeaderTextColor, greyColorFilter);
@@ -1525,7 +1534,7 @@
mRecentCard.initialize(interactionsWrapper,
/* numInitialVisibleEntries = */ MIN_NUM_COLLAPSED_RECENT_ENTRIES_SHOWN,
/* isExpanded = */ mRecentCard.isExpanded(), /* isAlwaysExpanded = */ false,
- mExpandingEntryCardViewListener);
+ mExpandingEntryCardViewListener, mScroller);
mRecentCard.setVisibility(View.VISIBLE);
}
diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java
index 23481a7..22f1a9d 100644
--- a/src/com/android/contacts/widget/MultiShrinkScroller.java
+++ b/src/com/android/contacts/widget/MultiShrinkScroller.java
@@ -1,6 +1,7 @@
package com.android.contacts.widget;
import com.android.contacts.R;
+import com.android.contacts.quickcontact.ExpandingEntryCardView;
import com.android.contacts.test.NeededForReflection;
import com.android.contacts.util.SchedulingUtils;
@@ -86,7 +87,6 @@
private MultiShrinkScrollerListener mListener;
private TextView mLargeTextView;
private View mPhotoTouchInterceptOverlay;
- private View mLeftOverSpaceView;
/** Contains desired location/size of the title, once the header is fully compressed */
private TextView mInvisiblePlaceholderTextView;
private View mTitleGradientView;
@@ -243,7 +243,6 @@
mTransparentView = findViewById(R.id.transparent_view);
mLargeTextView = (TextView) findViewById(R.id.large_title);
mInvisiblePlaceholderTextView = (TextView) findViewById(R.id.placeholder_textview);
- mLeftOverSpaceView = findViewById(R.id.card_empty_space);
mListener = listener;
mIsOpenContactSquare = isOpenContactSquare;
@@ -436,6 +435,7 @@
final ObjectAnimator animator = ObjectAnimator.ofInt(this, "headerHeight",
mMaximumHeaderHeight);
animator.addListener(mHeaderExpandAnimationListener);
+ animator.setDuration(ExpandingEntryCardView.DURATION_EXPAND_ANIMATION_CHANGE_BOUNDS);
animator.start();
// Scroll nested scroll view to its top
if (mScrollView.getScrollY() != 0) {
@@ -787,8 +787,7 @@
* Returns the amount of mScrollViewChild that doesn't fit inside its parent.
*/
private int getOverflowingChildViewSize() {
- final int usedScrollViewSpace = mScrollViewChild.getHeight()
- - mLeftOverSpaceView.getHeight();
+ final int usedScrollViewSpace = mScrollViewChild.getHeight();
return -getHeight() + usedScrollViewSpace + mToolbar.getLayoutParams().height;
}
@@ -1098,11 +1097,26 @@
* space at the bottom of this ViewGroup.
*/
public void prepareForShrinkingScrollChild(int heightDelta) {
+ // The Transition framework may suppress layout on the scene root and its children. If
+ // mScrollView has its layout suppressed, user scrolling interactions will not display
+ // correctly. By turning suppress off for mScrollView, mScrollView properly adjusts its
+ // graphics as the user scrolls during the transition.
+ mScrollView.suppressLayout(false);
+
final int newEmptyScrollViewSpace = -getOverflowingChildViewSize() + heightDelta;
if (newEmptyScrollViewSpace > 0 && !mIsTwoPanel) {
final int newDesiredToolbarHeight = Math.min(mToolbar.getLayoutParams().height
+ newEmptyScrollViewSpace, getMaximumScrollableHeaderHeight());
- ObjectAnimator.ofInt(this, "toolbarHeight", newDesiredToolbarHeight).start();
+ ObjectAnimator.ofInt(this, "toolbarHeight", newDesiredToolbarHeight).setDuration(
+ ExpandingEntryCardView.DURATION_COLLAPSE_ANIMATION_CHANGE_BOUNDS).start();
}
}
+
+ public void prepareForExpandingScrollChild() {
+ // The Transition framework may suppress layout on the scene root and its children. If
+ // mScrollView has its layout suppressed, user scrolling interactions will not display
+ // correctly. By turning suppress off for mScrollView, mScrollView properly adjusts its
+ // graphics as the user scrolls during the transition.
+ mScrollView.suppressLayout(false);
+ }
}