diff --git a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java index 313086b3..1161bbff 100644 --- a/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/AccountActivity.java @@ -205,7 +205,7 @@ public class AccountActivity extends BaseActivity { if (!account.header.isEmpty()) { Picasso.with(this) .load(account.header) - .placeholder(R.drawable.account_header_default) + .placeholder(R.drawable.account_header_missing) .into(header); } diff --git a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java index 53aa5da3..aa33b4c1 100644 --- a/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java +++ b/app/src/main/java/com/keylesspalace/tusky/NotificationsAdapter.java @@ -16,8 +16,13 @@ package com.keylesspalace.tusky; import android.content.Context; +import android.graphics.Typeface; +import android.media.Image; import android.support.annotation.Nullable; +import android.support.v4.content.ContextCompat; import android.support.v7.widget.RecyclerView; +import android.text.SpannableStringBuilder; +import android.text.Spanned; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -26,6 +31,7 @@ import android.widget.ImageView; import android.widget.TextView; import com.android.volley.toolbox.NetworkImageView; +import com.squareup.picasso.Picasso; import java.util.ArrayList; import java.util.Date; @@ -190,18 +196,14 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe private TextView message; private TextView usernameView; private TextView displayNameView; - private NetworkImageView avatar; - private Button follow; + private ImageView avatar; FollowViewHolder(View itemView) { super(itemView); message = (TextView) itemView.findViewById(R.id.notification_text); usernameView = (TextView) itemView.findViewById(R.id.notification_username); displayNameView = (TextView) itemView.findViewById(R.id.notification_display_name); - avatar = (NetworkImageView) itemView.findViewById(R.id.notification_avatar); - avatar.setDefaultImageResId(R.drawable.avatar_default); - avatar.setErrorImageResId(R.drawable.avatar_error); - follow = (Button) itemView.findViewById(R.id.notification_follow_button); + avatar = (ImageView) itemView.findViewById(R.id.notification_avatar); } void setMessage(String displayName, String username, String avatarUrl) { @@ -217,7 +219,11 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe displayNameView.setText(displayName); - avatar.setImageUrl(avatarUrl, VolleySingleton.getInstance(context).getImageLoader()); + Picasso.with(context) + .load(avatarUrl) + .placeholder(R.drawable.avatar_default) + .error(R.drawable.avatar_error) + .into(avatar); } void setupButtons(final FollowListener listener, final String accountId) { @@ -227,12 +233,6 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe listener.onViewAccount(accountId); } }); - follow.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - listener.onFollow(accountId); - } - }); } } @@ -254,22 +254,22 @@ class NotificationsAdapter extends RecyclerView.Adapter implements AdapterItemRe switch (type) { default: case FAVOURITE: { - icon.setImageResource(R.drawable.ic_favourited); + icon.setImageResource(R.drawable.ic_star_24dp); + icon.setColorFilter(ContextCompat.getColor(context, R.color.status_favourite_button_marked_dark)); format = context.getString(R.string.notification_favourite_format); break; } case REBLOG: { - icon.setImageResource(R.drawable.ic_reblogged); + icon.setImageResource(R.drawable.ic_repeat_24dp); + icon.setColorFilter(ContextCompat.getColor(context, R.color.color_accent_dark)); format = context.getString(R.string.notification_reblog_format); break; } } String wholeMessage = String.format(format, displayName); - message.setText(wholeMessage); - String timestamp = DateUtils.getRelativeTimeSpanString( - status.getCreatedAt().getTime(), - new Date().getTime()); - statusContent.setText(String.format("%s: ", timestamp)); + final SpannableStringBuilder str = new SpannableStringBuilder(wholeMessage); + str.setSpan(new android.text.style.StyleSpan(Typeface.BOLD), 0, displayName.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); + message.setText(str); statusContent.append(status.getContent()); } } diff --git a/app/src/main/res/drawable/account_header_gradient.xml b/app/src/main/res/drawable/account_header_gradient.xml index f1ae0bab..9a66c8e5 100644 --- a/app/src/main/res/drawable/account_header_gradient.xml +++ b/app/src/main/res/drawable/account_header_gradient.xml @@ -4,8 +4,8 @@ diff --git a/app/src/main/res/drawable/account_header_missing.xml b/app/src/main/res/drawable/account_header_missing.xml new file mode 100644 index 00000000..0567c24b --- /dev/null +++ b/app/src/main/res/drawable/account_header_missing.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_account.xml b/app/src/main/res/layout/activity_account.xml index 3ffb121d..f50c046e 100644 --- a/app/src/main/res/layout/activity_account.xml +++ b/app/src/main/res/layout/activity_account.xml @@ -70,6 +70,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/account_display_name" + android:maxLines="1" + android:ellipsize="end" android:textStyle="normal|bold" android:textColor="?android:textColorPrimary" android:textSize="18sp" /> @@ -77,6 +79,8 @@ diff --git a/app/src/main/res/layout/item_follow.xml b/app/src/main/res/layout/item_follow.xml index 7844731d..f1da62b7 100644 --- a/app/src/main/res/layout/item_follow.xml +++ b/app/src/main/res/layout/item_follow.xml @@ -7,89 +7,69 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:paddingBottom="10dp" android:orientation="vertical"> + app:srcCompat="@drawable/ic_person_add_24dp" + android:paddingRight="10dp" + android:paddingLeft="24dp" + android:tint="?attr/colorAccent" /> - -