summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/drawable-hdpi/ic_person_add_24dp.pngbin0 -> 374 bytes
-rw-r--r--res/drawable-hdpi/profile_ic_fab_yellow.pngbin0 -> 3932 bytes
-rw-r--r--res/drawable-mdpi/ic_person_add_24dp.pngbin0 -> 283 bytes
-rw-r--r--res/drawable-mdpi/profile_ic_fab_yellow.pngbin0 -> 2213 bytes
-rw-r--r--res/drawable-xhdpi/ic_person_add_24dp.pngbin0 -> 422 bytes
-rw-r--r--res/drawable-xhdpi/profile_ic_fab_yellow.pngbin0 -> 6280 bytes
-rw-r--r--res/drawable-xxhdpi/ic_person_add_24dp.pngbin0 -> 574 bytes
-rw-r--r--res/drawable-xxhdpi/profile_ic_fab_yellow.pngbin0 -> 18501 bytes
-rw-r--r--res/drawable/floating_action_button.xml22
-rw-r--r--res/layout/people_activity.xml22
-rw-r--r--res/values/colors.xml2
-rw-r--r--res/values/strings.xml4
-rw-r--r--src/com/android/contacts/activities/PeopleActivity.java36
13 files changed, 81 insertions, 5 deletions
diff --git a/res/drawable-hdpi/ic_person_add_24dp.png b/res/drawable-hdpi/ic_person_add_24dp.png
new file mode 100644
index 000000000..1b71ff146
--- /dev/null
+++ b/res/drawable-hdpi/ic_person_add_24dp.png
Binary files differ
diff --git a/res/drawable-hdpi/profile_ic_fab_yellow.png b/res/drawable-hdpi/profile_ic_fab_yellow.png
new file mode 100644
index 000000000..9287aa5dd
--- /dev/null
+++ b/res/drawable-hdpi/profile_ic_fab_yellow.png
Binary files differ
diff --git a/res/drawable-mdpi/ic_person_add_24dp.png b/res/drawable-mdpi/ic_person_add_24dp.png
new file mode 100644
index 000000000..b6cf02df3
--- /dev/null
+++ b/res/drawable-mdpi/ic_person_add_24dp.png
Binary files differ
diff --git a/res/drawable-mdpi/profile_ic_fab_yellow.png b/res/drawable-mdpi/profile_ic_fab_yellow.png
new file mode 100644
index 000000000..257be13d2
--- /dev/null
+++ b/res/drawable-mdpi/profile_ic_fab_yellow.png
Binary files differ
diff --git a/res/drawable-xhdpi/ic_person_add_24dp.png b/res/drawable-xhdpi/ic_person_add_24dp.png
new file mode 100644
index 000000000..2d265e10b
--- /dev/null
+++ b/res/drawable-xhdpi/ic_person_add_24dp.png
Binary files differ
diff --git a/res/drawable-xhdpi/profile_ic_fab_yellow.png b/res/drawable-xhdpi/profile_ic_fab_yellow.png
new file mode 100644
index 000000000..a6e183bea
--- /dev/null
+++ b/res/drawable-xhdpi/profile_ic_fab_yellow.png
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_person_add_24dp.png b/res/drawable-xxhdpi/ic_person_add_24dp.png
new file mode 100644
index 000000000..6091312b9
--- /dev/null
+++ b/res/drawable-xxhdpi/ic_person_add_24dp.png
Binary files differ
diff --git a/res/drawable-xxhdpi/profile_ic_fab_yellow.png b/res/drawable-xxhdpi/profile_ic_fab_yellow.png
new file mode 100644
index 000000000..3e4b89834
--- /dev/null
+++ b/res/drawable-xxhdpi/profile_ic_fab_yellow.png
Binary files differ
diff --git a/res/drawable/floating_action_button.xml b/res/drawable/floating_action_button.xml
new file mode 100644
index 000000000..96748e636
--- /dev/null
+++ b/res/drawable/floating_action_button.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.
+-->
+
+<ripple xmlns:android="http://schemas.android.com/apk/res/android"
+ android:tint="@color/contacts_accent_color"
+ android:pinned="true">
+ <item android:drawable="@drawable/profile_ic_fab_yellow" />
+</ripple>
diff --git a/res/layout/people_activity.xml b/res/layout/people_activity.xml
index 589e4a950..bcdf08f25 100644
--- a/res/layout/people_activity.xml
+++ b/res/layout/people_activity.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -42,4 +42,22 @@
android:layout_height="match_parent"
android:layout_width="match_parent" />
</FrameLayout>
-</FrameLayout>
+
+ <FrameLayout
+ android:id="@+id/floating_action_button_container"
+ android:layout_width="@dimen/floating_action_button_width"
+ android:layout_height="@dimen/floating_action_button_height"
+ android:layout_marginRight="@dimen/floating_action_button_margin_right"
+ android:layout_marginBottom="@dimen/floating_action_button_margin_bottom"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentBottom="true">
+
+ <ImageButton
+ android:id="@+id/floating_action_button"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:background="@drawable/floating_action_button"
+ android:contentDescription="@string/action_menu_add_new_contact_button"
+ android:src="@drawable/ic_person_add_24dp"/>
+ </FrameLayout>
+</RelativeLayout>
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 51dbd716f..d1ea3b06b 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -41,4 +41,6 @@
<!-- Color of the selected tab underline (overriding value in ContactsCommon) -->
<color name="tab_selected_color">#ffeeff41</color>
+ <color name="contacts_accent_color">#00acc1</color>
+
</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 305a6482c..f40dbb0c6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -644,4 +644,8 @@
<!-- Description when picture in the contact detail view is selected. [CHAR LIMIT=NONE] -->
<string name="contact_detail_picture_description">Picture. Select to change</string>
+
+ <!-- Content description for the button that adds a new contact
+ [CHAR LIMIT=NONE] -->
+ <string name="action_menu_add_new_contact_button">add new contact</string>
</resources>
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 0a49f4c55..8a22b98ac 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -47,6 +47,7 @@ import android.view.MenuItem;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.ImageButton;
import android.widget.Toast;
import com.android.contacts.ContactSaveService;
@@ -82,6 +83,7 @@ import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.preference.ContactsPreferenceActivity;
import com.android.contacts.preference.DisplayOptionsPreferenceFragment;
import com.android.contacts.common.util.AccountFilterUtil;
+import com.android.contacts.common.util.ViewUtil;
import com.android.contacts.util.AccountPromptUtils;
import com.android.contacts.common.util.Constants;
import com.android.contacts.util.DialogManager;
@@ -98,10 +100,13 @@ import java.util.concurrent.atomic.AtomicInteger;
* Displays a list to browse contacts. For xlarge screens, this also displays a detail-pane on
* the right.
*/
-public class PeopleActivity extends ContactsActivity
- implements View.OnCreateContextMenuListener, ActionBarAdapter.Listener,
+public class PeopleActivity extends ContactsActivity implements
+ View.OnCreateContextMenuListener,
+ View.OnClickListener,
+ ActionBarAdapter.Listener,
DialogManager.DialogShowingViewActivity,
- ContactListFilterController.ContactListFilterListener, ProviderStatusListener {
+ ContactListFilterController.ContactListFilterListener,
+ ProviderStatusListener {
private static final String TAG = "PeopleActivity";
@@ -150,6 +155,9 @@ public class PeopleActivity extends ContactsActivity
private TransitionAnimationView mPeopleActivityView;
private TransitionAnimationView mContactDetailsView;
+ private View mFloatingActionButtonContainer;
+ private ImageButton mFloatingActionButton;
+
/** ViewPager for swipe, used only on the phone (i.e. one-pane mode) */
private ViewPager mTabPager;
private TabPagerAdapter mTabPagerAdapter;
@@ -422,6 +430,12 @@ public class PeopleActivity extends ContactsActivity
mActionBarAdapter = new ActionBarAdapter(this, this, getActionBar(), isUsingTwoPanes);
mActionBarAdapter.initialize(savedState, mRequest);
+ // Configure action button
+ mFloatingActionButtonContainer = findViewById(R.id.floating_action_button_container);
+ ViewUtil.setupFloatingActionButton(mFloatingActionButtonContainer, getResources());
+ mFloatingActionButton = (ImageButton) findViewById(R.id.floating_action_button);
+ mFloatingActionButton.setOnClickListener(this);
+
invalidateOptionsMenuIfNeeded();
}
@@ -1582,4 +1596,20 @@ public class PeopleActivity extends ContactsActivity
public ContactDetailFragment getDetailFragment() {
return mContactDetailFragment;
}
+
+ @Override
+ public void onClick(View view) {
+ switch (view.getId()) {
+ case R.id.floating_action_button:
+ Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
+ Bundle extras = getIntent().getExtras();
+ if (extras != null) {
+ intent.putExtras(extras);
+ }
+ startActivity(intent);
+ break;
+ default:
+ Log.wtf(TAG, "Unexpected onClick event from " + view);
+ }
+ }
}