Show sync-off alert
In all contacts list:
alert user when global sync is off if user never dismissed before,
until sync setting is toggled on then off again.
In account view:
when global sync is off, show alert with the same logic for all
contacts list;
when global sync is on, alert user when contacts sync for this account
is off if user never dismissed before, until contacts sync is toggled
on then off again.
Bug: 31755559
Test: Manually tested the scenarios:
1) Add/remove account,
2) switch between all contacts list, account view, and label views,
3) update contacts information,
3) turn on sync/dismiss from alert,
when global sync is on/off, contacts syncs are all on/off, contacts
sync is on/off for a particular account.
Change-Id: Id5001847270d5a984942c63a42edb5f9401bc2c2
diff --git a/res/layout/contact_list_content.xml b/res/layout/contact_list_content.xml
index 8420b26..39f669f 100644
--- a/res/layout/contact_list_content.xml
+++ b/res/layout/contact_list_content.xml
@@ -28,6 +28,37 @@
android:visibility="gone"
android:background="?attr/contact_browser_background" >
+ <LinearLayout
+ android:id="@+id/alert_container"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal"
+ android:background="@color/alert_background"
+ android:paddingStart="20dp"
+ android:visibility="gone">
+
+ <TextView
+ android:id="@+id/alert_text"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:paddingTop="16dp"
+ android:paddingBottom="16dp"
+ android:layout_weight="1"
+ android:textColor="@android:color/black"
+ android:textSize="16sp"/>
+
+ <ImageView
+ android:id="@+id/alert_dismiss_icon"
+ android:layout_width="56dp"
+ android:layout_height="match_parent"
+ android:layout_gravity="center_vertical"
+ android:contentDescription="@string/dismiss_sync_alert"
+ android:background="?android:attr/selectableItemBackground"
+ android:scaleType="center"
+ android:src="@drawable/ic_cancel_black_24dp" />
+ </LinearLayout>
+
<!-- Shown only when an Account filter is set.
- paddingTop should be here to show "shade" effect correctly. -->
<include layout="@layout/account_filter_header" />