more headlines/imagepager tweaks
This commit is contained in:
parent
accfa1c672
commit
49f5b1826b
@ -116,7 +116,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
|||||||
ImageViewTouch imgView = (ImageViewTouch) view.findViewById(R.id.flavor_image);
|
ImageViewTouch imgView = (ImageViewTouch) view.findViewById(R.id.flavor_image);
|
||||||
|
|
||||||
imgView.setFitToScreen(true);
|
imgView.setFitToScreen(true);
|
||||||
imgView.setFitToWidth(true);
|
//imgView.setFitToWidth(true);
|
||||||
|
|
||||||
imgView.setOnTouchListener(new View.OnTouchListener() {
|
imgView.setOnTouchListener(new View.OnTouchListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -126,6 +126,7 @@ public class ArticleImagesPagerActivity extends CommonActivity implements Gestur
|
|||||||
});
|
});
|
||||||
|
|
||||||
registerForContextMenu(imgView);
|
registerForContextMenu(imgView);
|
||||||
|
getSupportActionBar().hide();
|
||||||
|
|
||||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||||
.cacheInMemory(true)
|
.cacheInMemory(true)
|
||||||
|
@ -30,7 +30,7 @@ public class CommonActivity extends ActionBarActivity {
|
|||||||
public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT;
|
public final static String THEME_DEFAULT = CommonActivity.THEME_LIGHT;
|
||||||
|
|
||||||
public static final int EXCERPT_MAX_LENGTH = 256;
|
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_readableDb;
|
||||||
private SQLiteDatabase m_writableDb;
|
private SQLiteDatabase m_writableDb;
|
||||||
|
@ -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 articleContent = article.content != null ? article.content : "";
|
||||||
|
|
||||||
|
|
||||||
String articleContentReduced = articleContent.length() > CommonActivity.EXCERPT_MAX_QUERY_LENGTH ?
|
String articleContentReduced = articleContent.length() > CommonActivity.EXCERPT_MAX_QUERY_LENGTH ?
|
||||||
articleContent.substring(0, CommonActivity.EXCERPT_MAX_QUERY_LENGTH) : articleContent;
|
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);
|
Document articleDoc = Jsoup.parse(articleContentReduced);
|
||||||
|
|
||||||
if (holder.excerptView != null) {
|
if (holder.excerptView != null) {
|
||||||
@ -859,17 +850,14 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!m_compactLayoutMode) {
|
if (!m_compactLayoutMode) {
|
||||||
|
boolean showFlavorImage = "HL_DEFAULT".equals(m_prefs.getString("headline_mode", "HL_DEFAULT"));
|
||||||
|
|
||||||
if (holder.flavorImageView != null && showFlavorImage) {
|
if (holder.flavorImageView != null && showFlavorImage) {
|
||||||
holder.flavorImageArrow.setVisibility(View.GONE);
|
holder.flavorImageArrow.setVisibility(View.GONE);
|
||||||
|
|
||||||
//Document doc = Jsoup.parse(articleContent);
|
|
||||||
|
|
||||||
boolean loadableImageFound = false;
|
boolean loadableImageFound = false;
|
||||||
|
|
||||||
if (articleDoc != null) {
|
if (articleDoc != null) {
|
||||||
//Element img = doc.select("img").first();
|
|
||||||
|
|
||||||
final Elements imgs = articleDoc.select("img");
|
final Elements imgs = articleDoc.select("img");
|
||||||
Element img = null;
|
Element img = null;
|
||||||
|
|
||||||
@ -904,34 +892,13 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
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 intent = new Intent(m_activity, ArticleImagesPagerActivity.class);
|
||||||
//intent.putExtra("urls", imgsList);
|
|
||||||
intent.putExtra("firstSrc", imgSrcFirst);
|
intent.putExtra("firstSrc", imgSrcFirst);
|
||||||
intent.putExtra("title", article.title);
|
intent.putExtra("title", article.title);
|
||||||
intent.putExtra("content", article.content);
|
intent.putExtra("content", article.content);
|
||||||
|
|
||||||
startActivityForResult(intent, 0);
|
startActivityForResult(intent, 0);
|
||||||
//m_activity.overridePendingTransition(android.R.anim.fade_in, 0);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user