下面列出了怎么用android.widget.QuickContactBadge的API类实例代码及写法,或者点击链接到github查看源代码。
private CharSequence getFallbackText(
Context context,
AccessibilityNodeInfoCompat node) {
// Order is important below because of class inheritance.
if (matchesAny(context, node, Button.class, ImageButton.class)) {
return context.getString(R.string.type_button);
}
if (matchesAny(context, node, QuickContactBadge.class)) {
return context.getString(R.string.type_quickcontact);
}
if (matchesAny(context, node, ImageView.class)) {
return context.getString(R.string.type_image);
}
if (matchesAny(context, node, EditText.class)) {
return context.getString(R.string.type_edittext);
}
if (matchesAny(context, node, AbsSeekBar.class)) {
return context.getString(R.string.type_seekbar);
}
return "";
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View result = inflater.inflate(R.layout.buttons, null);
View coloredButton = result.findViewById(R.id.coloredButton);
coloredButton.setLongClickable(true);
// registerForContextMenu(coloredButton);
// mListPopupButton = result.findViewById(R.id.listPopupButton);
// mListPopupButton.setOnLongClickListener(mPopupListener);
QuickContactBadge badge = (QuickContactBadge)result.findViewById(R.id.badge);
badge.assignContactFromEmail("[email protected]", false);
return result;
}
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = super.newView(context, cursor, parent);
ContactListItemCache cache = new ContactListItemCache();
cache.nameView = (TextView) view.findViewById(R.id.name);
cache.photoView = (QuickContactBadge) view.findViewById(R.id.badge);
view.setTag(cache);
return view;
}
public ContactBadge5(Context context, AttributeSet attrs, int defStyle, com.csipsimple.widgets.contactbadge.QuickContactBadge topBadge) {
super(context, attrs, defStyle, topBadge);
badge = new OverlayedQuickContactBadge(context, attrs, defStyle, topBadge);
}
public static BaseDSL.ViewClassResult quickContactBadge() {
return BaseDSL.v(QuickContactBadge.class);
}
public static Void quickContactBadge(Anvil.Renderable r) {
return BaseDSL.v(QuickContactBadge.class, r);
}
public static BaseDSL.ViewClassResult quickContactBadge() {
return BaseDSL.v(QuickContactBadge.class);
}