From 4ed367894eed7c297be484d981a1b09b5a43dd4a Mon Sep 17 00:00:00 2001 From: Thomas Gaudin Date: Sun, 6 Dec 2015 22:30:16 +0100 Subject: [PATCH] Fixed weird behaviour if scroll was too fast (description text was messed) Signed-off-by: Thomas Gaudin --- .../wikijourney/wikijourney/functions/PoiListAdapter.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/wikijourney/wikijourney/functions/PoiListAdapter.java b/app/src/main/java/com/wikijourney/wikijourney/functions/PoiListAdapter.java index 6fc190a..ebc6534 100644 --- a/app/src/main/java/com/wikijourney/wikijourney/functions/PoiListAdapter.java +++ b/app/src/main/java/com/wikijourney/wikijourney/functions/PoiListAdapter.java @@ -102,7 +102,7 @@ public void onBindViewHolder(ViewHolder holder, int position) { String mPoiDescription = mPoiList.get(position).getDescription(); // We add a Listener, so that a tap on the card opens a WebView to the WP page - if (mPoiSitelink != null) { + if (mPoiSitelink != null && !"".equals(mPoiSitelink)) { holder.mReadMoreButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -124,7 +124,9 @@ public void onClick(View view) { if (mPoiDescription == null) { downloadWikipediaExtract(holder, poiName, position); - } else if(!"".equals(mPoiDescription)){ + } else if ("".equals(mPoiDescription)) { + holder.mPoiDescription.setVisibility(View.GONE); + } else { holder.mPoiDescription.setVisibility(View.VISIBLE); holder.mPoiDescription.setText(mPoiDescription); } @@ -132,7 +134,7 @@ public void onClick(View view) { holder.mPoiPicture.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.logo_cut)); // We use Picasso to download the Wikipedia article image - if (mPoiImageUrl != null && !mPoiImageUrl.equals("")) { + if (mPoiImageUrl != null && !"".equals(mPoiImageUrl)) { displayArticleImage(holder, mPoiImageUrl); }