more headlines/imagepager tweaks

This commit is contained in:
Andrew Dolgov 2014-11-29 11:31:45 +03:00
parent accfa1c672
commit 49f5b1826b
3 changed files with 4 additions and 36 deletions

View File

@ -116,7 +116,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
ImageViewTouch imgView = (ImageViewTouch) view.findViewById(R.id.flavor_image);
imgView.setFitToScreen(true);
imgView.setFitToWidth(true);
//imgView.setFitToWidth(true);
imgView.setOnTouchListener(new View.OnTouchListener() {
@Override
@ -126,6 +126,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
});
registerForContextMenu(imgView);
getSupportActionBar().hide();
DisplayImageOptions options = new DisplayImageOptions.Builder()
.cacheInMemory(true)

View File

@ -30,7 +30,7 @@ public class CommonActivity extends ActionBarActivity {
public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT;
public static final int EXCERPT_MAX_LENGTH = 256;
public static final int EXCERPT_MAX_QUERY_LENGTH = 1024;
public static final int EXCERPT_MAX_QUERY_LENGTH = 512;
private SQLiteDatabase m_readableDb;
private SQLiteDatabase m_writableDb;

View File

@ -828,20 +828,11 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
});
}
boolean showFlavorImage = "HL_DEFAULT".equals(m_prefs.getString("headline_mode", "HL_DEFAULT"));
String articleContent = article.content != null ? article.content : "";
String articleContentReduced = articleContent.length() > CommonActivity.EXCERPT_MAX_QUERY_LENGTH ?
articleContent.substring(0, CommonActivity.EXCERPT_MAX_QUERY_LENGTH) : articleContent;
/* if (m_compactLayoutMode || !showFlavorImage) {
if (articleContent.length() > CommonActivity.EXCERPT_MAX_QUERY_LENGTH) {
articleContent = articleContent.substring(0, CommonActivity.EXCERPT_MAX_QUERY_LENGTH);
}
} */
Document articleDoc = Jsoup.parse(articleContentReduced);
if (holder.excerptView != null) {
@ -859,17 +850,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
}
if (!m_compactLayoutMode) {
boolean showFlavorImage = "HL_DEFAULT".equals(m_prefs.getString("headline_mode", "HL_DEFAULT"));
if (holder.flavorImageView != null && showFlavorImage) {
holder.flavorImageArrow.setVisibility(View.GONE);
//Document doc = Jsoup.parse(articleContent);
boolean loadableImageFound = false;
if (articleDoc != null) {
//Element img = doc.select("img").first();
final Elements imgs = articleDoc.select("img");
Element img = null;
@ -904,34 +892,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
holder.flavorImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
/* ArrayList<String> imgsList = new ArrayList<String>();
boolean firstFound = false;
for (Element img : imgs) {
String imgSrc = img.attr("src");
if (imgSrcFirst.equals(imgSrc))
firstFound = true;
if (firstFound) {
if (imgSrc.indexOf("//") == 0)
imgSrc = "http:" + imgSrc;
imgsList.add(imgSrc);
}
} */
Intent intent = new Intent(m_activity, ArticleImagesPagerActivity.class);
//intent.putExtra("urls", imgsList);
intent.putExtra("firstSrc", imgSrcFirst);
intent.putExtra("title", article.title);
intent.putExtra("content", article.content);
startActivityForResult(intent, 0);
//m_activity.overridePendingTransition(android.R.anim.fade_in, 0);
}
});