summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorerfanian <erfanian@google.com>2017-10-02 14:28:41 -0700
committerEric Erfanian <erfanian@google.com>2017-10-03 10:40:26 -0700
commitdf3893d3ea8206a2d21c2a271a7f2ea2da681775 (patch)
tree9160ceb0e2c255c8b4ab461392a0c2254b80b886 /java
parent259c569c371f6b24ab940a90a9a4c504f0b6fe3b (diff)
Fix issue that the connection icon is placed a little left from center
When status text is empty, VoWiFi icon is placed a bit left from center because the view of connection icon is containing margin between the tatus text. Fix to remove margin from the icon when the text is empty. Public-Origin-Change-Id: Ic302104d85fa9114bebb5688f3e8028d398d1921 Signed-off-by: Eric Erfanian <erfanian@google.com> Author: Kousuke Kitahara <kousuke.kitahara@sony.com> Bug: 66075997 Test: scuba tests PiperOrigin-RevId: 170753786 Change-Id: Ifde98a8c04ba3dc2233439957a74fc4f54b444fa
Diffstat (limited to 'java')
-rw-r--r--java/com/android/incallui/contactgrid/ContactGridManager.java10
-rw-r--r--java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml21
-rw-r--r--java/com/android/incallui/contactgrid/res/values/dimens.xml22
-rw-r--r--java/com/android/incallui/contactgrid/res/values/ids.xml1
4 files changed, 53 insertions, 1 deletions
diff --git a/java/com/android/incallui/contactgrid/ContactGridManager.java b/java/com/android/incallui/contactgrid/ContactGridManager.java
index 18bab6ab3..c0ab9609f 100644
--- a/java/com/android/incallui/contactgrid/ContactGridManager.java
+++ b/java/com/android/incallui/contactgrid/ContactGridManager.java
@@ -27,6 +27,7 @@ import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Chronometer;
import android.widget.ImageView;
+import android.widget.Space;
import android.widget.TextView;
import android.widget.ViewAnimator;
import com.android.contacts.common.compat.PhoneNumberUtilsCompat;
@@ -74,6 +75,7 @@ public class ContactGridManager {
private final ViewAnimator bottomTextSwitcher;
private final TextView bottomTextView;
private final Chronometer bottomTimerView;
+ private final Space topRowSpace;
private int avatarSize;
private boolean hideAvatar;
private boolean showAnonymousAvatar;
@@ -104,6 +106,7 @@ public class ContactGridManager {
bottomTextSwitcher = view.findViewById(R.id.contactgrid_bottom_text_switcher);
bottomTextView = view.findViewById(R.id.contactgrid_bottom_text);
bottomTimerView = view.findViewById(R.id.contactgrid_bottom_timer);
+ topRowSpace = view.findViewById(R.id.contactgrid_top_row_space);
contactGridLayout = (View) contactNameTextView.getParent();
letterTile = new LetterTileDrawable(context.getResources());
@@ -229,9 +232,16 @@ public class ContactGridManager {
if (info.icon == null) {
connectionIconImageView.setVisibility(View.GONE);
+ topRowSpace.setVisibility(View.GONE);
} else {
connectionIconImageView.setVisibility(View.VISIBLE);
connectionIconImageView.setImageDrawable(info.icon);
+ if (statusTextView.getVisibility() == View.VISIBLE
+ && !TextUtils.isEmpty(statusTextView.getText())) {
+ topRowSpace.setVisibility(View.VISIBLE);
+ } else {
+ topRowSpace.setVisibility(View.GONE);
+ }
}
}
diff --git a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml
index 59359c9c1..42066f286 100644
--- a/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml
+++ b/java/com/android/incallui/contactgrid/res/layout/incall_contactgrid_top_row.xml
@@ -1,4 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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
+ -->
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
@@ -11,11 +26,15 @@
android:id="@id/contactgrid_connection_icon"
android:layout_width="24dp"
android:layout_height="24dp"
- android:layout_marginEnd="10dp"
android:scaleType="fitCenter"
tools:src="@android:drawable/sym_def_app_icon"
tools:visibility="visible"
/>
+ <Space
+ android:id="@id/contactgrid_top_row_space"
+ android:layout_height="match_parent"
+ android:layout_width="@dimen/contactgrid_connection_icon_margin_end"
+ />
<TextView
android:id="@id/contactgrid_status_text"
android:layout_width="wrap_content"
diff --git a/java/com/android/incallui/contactgrid/res/values/dimens.xml b/java/com/android/incallui/contactgrid/res/values/dimens.xml
new file mode 100644
index 000000000..82bae43b0
--- /dev/null
+++ b/java/com/android/incallui/contactgrid/res/values/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 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
+ -->
+
+<resources>
+
+ <!-- Dimensions for connection icons -->
+ <dimen name="contactgrid_connection_icon_margin_end">10dp</dimen>
+</resources> \ No newline at end of file
diff --git a/java/com/android/incallui/contactgrid/res/values/ids.xml b/java/com/android/incallui/contactgrid/res/values/ids.xml
index 821dc9d98..f3b111a16 100644
--- a/java/com/android/incallui/contactgrid/res/values/ids.xml
+++ b/java/com/android/incallui/contactgrid/res/values/ids.xml
@@ -28,4 +28,5 @@
<item name="contactgrid_avatar" type="id"/>
<item name="contactgrid_top_row" type="id"/>
<item name="contactgrid_bottom_row" type="id"/>
+ <item name="contactgrid_top_row_space" type="id"/>
</resources>