Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing discover site icon #8092

Merged
merged 1 commit into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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