Search in sources :

Example 6 with RoundedTransformation

use of com.keylesspalace.tusky.view.RoundedTransformation in project Tusky by tuskyapp.

the class MentionAutoCompleteAdapter method getView.

@Override
@NonNull
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
    View view = convertView;
    Context context = getContext();
    if (convertView == null) {
        LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        // noinspection ConstantConditions
        view = layoutInflater.inflate(layoutId, parent, false);
    }
    Account account = getItem(position);
    if (account != null) {
        TextView username = view.findViewById(R.id.username);
        TextView displayName = view.findViewById(R.id.display_name);
        ImageView avatar = view.findViewById(R.id.avatar);
        String format = getContext().getString(R.string.status_username_format);
        String formattedUsername = String.format(format, account.getUsername());
        username.setText(formattedUsername);
        displayName.setText(account.getName());
        if (!account.getAvatar().isEmpty()) {
            Picasso.with(context).load(account.getAvatar()).placeholder(R.drawable.avatar_default).transform(new RoundedTransformation(25)).into(avatar);
        }
    }
    return view;
}
Also used : Context(android.content.Context) Account(com.keylesspalace.tusky.entity.Account) LayoutInflater(android.view.LayoutInflater) RoundedTransformation(com.keylesspalace.tusky.view.RoundedTransformation) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) NonNull(android.support.annotation.NonNull)

Aggregations

RoundedTransformation (com.keylesspalace.tusky.view.RoundedTransformation)6 Context (android.content.Context)3 Intent (android.content.Intent)3 Bitmap (android.graphics.Bitmap)3 NotificationManager (android.app.NotificationManager)2 PendingIntent (android.app.PendingIntent)2 SharedPreferences (android.content.SharedPreferences)2 Drawable (android.graphics.drawable.Drawable)2 NotificationCompat (android.support.v4.app.NotificationCompat)2 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)2 ImageView (android.widget.ImageView)2 JSONArray (org.json.JSONArray)2 JSONException (org.json.JSONException)2 SuppressLint (android.annotation.SuppressLint)1 Uri (android.net.Uri)1 NonNull (android.support.annotation.NonNull)1 InputContentInfoCompat (android.support.v13.view.inputmethod.InputContentInfoCompat)1 ActionBar (android.support.v7.app.ActionBar)1 Toolbar (android.support.v7.widget.Toolbar)1 Editable (android.text.Editable)1