Skip to content

Commit

Permalink
Merge pull request #8092 from wordpress-mobile/issue/8067-missing-dis…
Browse files Browse the repository at this point in the history
…covery-site-icon

Fix missing discover site icon
  • Loading branch information
theck13 authored Jul 23, 2018
2 parents 6419762 + 96c821b commit d06c32f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

Expand All @@ -17,8 +18,12 @@
import org.wordpress.android.ui.reader.actions.ReaderBlogActions;
import org.wordpress.android.util.LocaleManager;
import org.wordpress.android.util.NetworkUtils;
import org.wordpress.android.util.PhotonUtils;
import org.wordpress.android.util.PhotonUtils.Quality;
import org.wordpress.android.util.ToastUtils;
import org.wordpress.android.util.UrlUtils;
import org.wordpress.android.util.image.ImageManager;
import org.wordpress.android.util.image.ImageType;

import javax.inject.Inject;

Expand All @@ -27,6 +32,8 @@
* count, and follow button
*/
public class ReaderSiteHeaderView extends LinearLayout {
private final int mBlavatarSz;

public interface OnBlogInfoLoadedListener {
void onBlogInfoLoaded(ReaderBlog blogInfo);
}
Expand All @@ -39,6 +46,7 @@ public interface OnBlogInfoLoadedListener {
private OnFollowListener mFollowListener;

@Inject AccountStore mAccountStore;
@Inject ImageManager mImageManager;

public ReaderSiteHeaderView(Context context) {
this(context, null);
Expand All @@ -51,6 +59,7 @@ public ReaderSiteHeaderView(Context context, AttributeSet attrs) {
public ReaderSiteHeaderView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
((WordPress) context.getApplicationContext()).component().inject(this);
mBlavatarSz = getResources().getDimensionPixelSize(R.dimen.blavatar_sz_small);
initView(context);
}

Expand Down Expand Up @@ -114,6 +123,7 @@ private void showBlogInfo(ReaderBlog blogInfo) {
TextView txtDomain = layoutInfo.findViewById(R.id.text_domain);
TextView txtDescription = layoutInfo.findViewById(R.id.text_blog_description);
TextView txtFollowCount = layoutInfo.findViewById(R.id.text_blog_follow_count);
ImageView blavatarImg = layoutInfo.findViewById(R.id.image_blavatar);

if (blogInfo.hasName()) {
txtBlogName.setText(blogInfo.getName());
Expand All @@ -135,6 +145,11 @@ private void showBlogInfo(ReaderBlog blogInfo) {
txtDescription.setVisibility(View.GONE);
}

if (blogInfo.hasImageUrl()) {
mImageManager.load(blavatarImg, ImageType.BLAVATAR,
PhotonUtils.getPhotonImageUrl(blogInfo.getImageUrl(), mBlavatarSz, mBlavatarSz, Quality.MEDIUM));
}

txtFollowCount.setText(String.format(
LocaleManager.getSafeLocale(getContext()),
getContext().getString(R.string.reader_label_follow_count),
Expand Down
5 changes: 3 additions & 2 deletions WordPress/src/main/res/layout/reader_site_header_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
android:paddingEnd="@dimen/reader_card_content_padding"
android:paddingStart="@dimen/reader_card_content_padding">

<org.wordpress.android.widgets.WPNetworkImageView
<ImageView
android:id="@+id/image_blavatar"
style="@style/ReaderImageView.Avatar"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/margin_large"
app:srcCompat="@drawable/ic_placeholder_blavatar_grey_lighten_20_40dp"
android:layout_marginEnd="@dimen/margin_large"/>
android:layout_marginEnd="@dimen/margin_large"
android:contentDescription="@null"/>

<org.wordpress.android.widgets.WPTextView
android:textAlignment="viewStart"
Expand Down

0 comments on commit d06c32f

Please sign in to comment.