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

Commit 2e13dae8 authored by Daniel Lehmann's avatar Daniel Lehmann Committed by Android (Google) Code Review
Browse files

Merge "Allow sync adapter to rename the "View Updates" button"

parents e62c2dcf d7dfdee0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -29,12 +29,12 @@
    android:padding="10dip" >

    <TextView
        android:id="@android:id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:duplicateParentState="true"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/view_updates_from_group"/>
        android:textAppearance="?android:attr/textAppearanceMedium"/>

    <ImageView
        android:id="@android:id/icon"
+1 −1
Original line number Diff line number Diff line
@@ -34,12 +34,12 @@
        android:orientation="horizontal">

        <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:textColor="@color/action_bar_button_text_color"
            android:text="@string/view_updates_from_group"
            style="@android:style/Widget.Holo.ActionBar.TabText"/>

        <ImageView
+1 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
    android:paddingRight="16dip" >

    <TextView
        android:id="@android:id/title"
        android:layout_width="0dip"
        android:layout_height="wrap_content"
        android:layout_weight="1"
@@ -37,7 +38,6 @@
        android:duplicateParentState="true"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="@color/action_bar_button_text_color"
        android:text="@string/view_updates_from_group"
        style="@android:style/Widget.Holo.ActionBar.TabText"/>

    <FrameLayout
+12 −3
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class GroupDetailDisplayUtils {

@@ -39,13 +40,21 @@ public class GroupDetailDisplayUtils {

    public static void bindGroupSourceView(Context context, View view, String accountTypeString,
            String dataSet) {
        AccountTypeManager accountTypeManager = AccountTypeManager.getInstance(context);
        AccountType accountType = accountTypeManager.getAccountType(accountTypeString, dataSet);

        TextView label = (TextView) view.findViewById(android.R.id.title);
        if (label == null) {
            throw new IllegalStateException("Group source view must contain a TextView with id"
                    + "android.R.id.label");
        }
        label.setText(accountType.getViewGroupLabel(context));

        ImageView accountIcon = (ImageView) view.findViewById(android.R.id.icon);
        if (accountIcon == null) {
            throw new IllegalStateException("Group source view must contain view with id"
            throw new IllegalStateException("Group source view must contain an ImageView with id"
                    + "android.R.id.icon");
        }
        AccountTypeManager accountTypeManager = AccountTypeManager.getInstance(context);
        AccountType accountType = accountTypeManager.getAccountType(accountTypeString, dataSet);
        accountIcon.setImageDrawable(accountType.getDisplayIcon(context));
    }
}
 No newline at end of file
+23 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.contacts.model;

import com.android.contacts.R;
import com.google.android.collect.Lists;
import com.google.android.collect.Maps;
import com.google.common.annotations.VisibleForTesting;
@@ -148,7 +149,14 @@ public abstract class AccountType {
    /**
     * @return resource ID for the "invite contact" action label, or -1 if not defined.
     */
    protected int getInviteContactActionResId(Context context) {
    protected int getInviteContactActionResId() {
        return -1;
    }

    /**
     * @return resource ID for the "view group" label, or -1 if not defined.
     */
    protected int getViewGroupLabelResId() {
        return -1;
    }

@@ -174,8 +182,20 @@ public abstract class AccountType {
     * the contact card.  (If not defined, returns null.)
     */
    public CharSequence getInviteContactActionLabel(Context context) {
        return getResourceText(context, summaryResPackageName, getInviteContactActionResId(context),
                "");
        return getResourceText(context, summaryResPackageName, getInviteContactActionResId(), "");
    }

    /**
     * Returns a label for the "view group" action. If not defined, this falls back to our
     * own "View Updates" string
     */
    public CharSequence getViewGroupLabel(Context context) {
        final CharSequence customTitle =
                getResourceText(context, summaryResPackageName, getViewGroupLabelResId(), null);

        return customTitle == null
                ? context.getText(R.string.view_updates_from_group)
                : customTitle;
    }

    /**
Loading