add overflow icon to flavor image
This commit is contained in:
parent
7c0b223f6d
commit
13472a2a2e
|
@ -747,6 +747,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
public ImageView textChecked;
|
public ImageView textChecked;
|
||||||
public View headlineHeader;
|
public View headlineHeader;
|
||||||
public View topChangedMessage;
|
public View topChangedMessage;
|
||||||
|
public View flavorImageOverflow;
|
||||||
public int position;
|
public int position;
|
||||||
public boolean flavorImageEmbedded;
|
public boolean flavorImageEmbedded;
|
||||||
}
|
}
|
||||||
|
@ -829,7 +830,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTextCheckedState(final HeadlineViewHolder holder, final Article article, int position) {
|
private void updateTextCheckedState(final HeadlineViewHolder holder, final Article article, final int position) {
|
||||||
String tmp = article.title.length() > 0 ? article.title.substring(0, 1).toUpperCase() : "?";
|
String tmp = article.title.length() > 0 ? article.title.substring(0, 1).toUpperCase() : "?";
|
||||||
|
|
||||||
if (article.selected) {
|
if (article.selected) {
|
||||||
|
@ -851,7 +852,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
} else {
|
} else {
|
||||||
if (!article.flavorImageUri.equals(holder.textImage.getTag())) {
|
if (!article.flavorImageUri.equals(holder.textImage.getTag())) {
|
||||||
|
|
||||||
final int loadingPosition = position;
|
|
||||||
ImageAware imageAware = new ImageViewAware(holder.textImage, false);
|
ImageAware imageAware = new ImageViewAware(holder.textImage, false);
|
||||||
|
|
||||||
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
DisplayImageOptions options = new DisplayImageOptions.Builder()
|
||||||
|
@ -877,7 +877,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
|
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
|
||||||
if (loadingPosition == holder.position && bitmap != null) {
|
if (position == holder.position && bitmap != null) {
|
||||||
holder.textImage.setTag(article.flavorImageUri);
|
holder.textImage.setTag(article.flavorImageUri);
|
||||||
|
|
||||||
if (bitmap.getWidth() < THUMB_IMG_MIN_SIZE || bitmap.getHeight() < THUMB_IMG_MIN_SIZE) {
|
if (bitmap.getWidth() < THUMB_IMG_MIN_SIZE || bitmap.getHeight() < THUMB_IMG_MIN_SIZE) {
|
||||||
|
@ -955,6 +955,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
holder.textChecked = (ImageView) v.findViewById(R.id.text_checked);
|
holder.textChecked = (ImageView) v.findViewById(R.id.text_checked);
|
||||||
holder.headlineHeader = v.findViewById(R.id.headline_header);
|
holder.headlineHeader = v.findViewById(R.id.headline_header);
|
||||||
holder.topChangedMessage = v.findViewById(R.id.headlines_row_top_changed);
|
holder.topChangedMessage = v.findViewById(R.id.headlines_row_top_changed);
|
||||||
|
holder.flavorImageOverflow = v.findViewById(R.id.flavor_image_overflow);
|
||||||
|
|
||||||
v.setTag(holder);
|
v.setTag(holder);
|
||||||
|
|
||||||
|
@ -1135,48 +1136,46 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (showFlavorImage && article.flavorImageUri != null && holder.flavorImageView != null) {
|
if (showFlavorImage && article.flavorImageUri != null && holder.flavorImageView != null) {
|
||||||
holder.flavorImageView.setOnLongClickListener(new View.OnLongClickListener() {
|
if (holder.flavorImageOverflow != null) {
|
||||||
@Override
|
holder.flavorImageOverflow.setOnClickListener(new View.OnClickListener() {
|
||||||
public boolean onLongClick(View v) {
|
@Override
|
||||||
PopupMenu popup = new PopupMenu(getActivity(), holder.titleView);
|
public void onClick(View v) {
|
||||||
MenuInflater inflater = popup.getMenuInflater();
|
PopupMenu popup = new PopupMenu(getActivity(), holder.flavorImageOverflow);
|
||||||
inflater.inflate(R.menu.context_article_content_img, popup.getMenu());
|
MenuInflater inflater = popup.getMenuInflater();
|
||||||
|
inflater.inflate(R.menu.context_article_content_img, popup.getMenu());
|
||||||
|
|
||||||
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
switch (item.getItemId()) {
|
switch (item.getItemId()) {
|
||||||
case R.id.article_img_open:
|
case R.id.article_img_open:
|
||||||
m_activity.openUri(Uri.parse(article.flavorImageUri));
|
m_activity.openUri(Uri.parse(article.flavorImageUri));
|
||||||
return true;
|
return true;
|
||||||
case R.id.article_img_copy:
|
case R.id.article_img_copy:
|
||||||
m_activity.copyToClipboard(article.flavorImageUri);
|
m_activity.copyToClipboard(article.flavorImageUri);
|
||||||
return true;
|
return true;
|
||||||
case R.id.article_img_share:
|
case R.id.article_img_share:
|
||||||
m_activity.shareText(article.flavorImageUri);
|
m_activity.shareText(article.flavorImageUri);
|
||||||
return true;
|
return true;
|
||||||
case R.id.article_img_view_caption:
|
case R.id.article_img_view_caption:
|
||||||
m_activity.displayImageCaption(article.flavorImageUri, article.content);
|
m_activity.displayImageCaption(article.flavorImageUri, article.content);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
popup.show();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
popup.show();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!article.flavorImageUri.equals(holder.flavorImageView.getTag())) {
|
if (!article.flavorImageUri.equals(holder.flavorImageView.getTag())) {
|
||||||
|
|
||||||
//Log.d(TAG, "IMG: " + article.flavorImageUri + " STREAM: " + article.flavorStreamUri);
|
//Log.d(TAG, "IMG: " + article.flavorImageUri + " STREAM: " + article.flavorStreamUri);
|
||||||
|
|
||||||
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
ImageAware imageAware = new ImageViewAware(holder.flavorImageView, false);
|
||||||
final int loadingPosition = position;
|
|
||||||
|
|
||||||
m_imageLoader.displayImage(article.flavorImageUri, imageAware, displayImageOptions, new ImageLoadingListener() {
|
m_imageLoader.displayImage(article.flavorImageUri, imageAware, displayImageOptions, new ImageLoadingListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1193,7 +1192,7 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
|
public void onLoadingComplete(String imageUri, View view, Bitmap bitmap) {
|
||||||
if (loadingPosition == holder.position && bitmap != null) {
|
if (position == holder.position && bitmap != null) {
|
||||||
|
|
||||||
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
holder.flavorImageLoadingBar.setVisibility(View.GONE);
|
||||||
holder.flavorImageView.setTag(article.flavorImageUri);
|
holder.flavorImageView.setTag(article.flavorImageUri);
|
||||||
|
|
|
@ -120,15 +120,28 @@
|
||||||
android:id="@+id/flavor_video_kind"
|
android:id="@+id/flavor_video_kind"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|right"
|
android:layout_gravity="left|bottom"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/ic_play_circle"
|
android:src="@drawable/ic_play_circle"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_below="@+id/headline_header"
|
android:layout_below="@+id/headline_header"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:layout_marginBottom="8dp" />
|
android:layout_marginLeft="8dp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/flavor_image_overflow"
|
||||||
|
android:clickable="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:background="@drawable/ripple"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:paddingRight="4dp"
|
||||||
|
android:src="@drawable/ic_dots_vertical"
|
||||||
|
android:layout_gravity="bottom|right"
|
||||||
|
android:layout_marginBottom="10dp" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
|
@ -121,16 +121,29 @@
|
||||||
android:id="@+id/flavor_video_kind"
|
android:id="@+id/flavor_video_kind"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom|right"
|
android:layout_gravity="bottom|left"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/ic_play_circle"
|
android:src="@drawable/ic_play_circle"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:layout_below="@+id/headline_header"
|
android:layout_below="@+id/headline_header"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_marginRight="8dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginBottom="8dp" />
|
android:layout_marginBottom="8dp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/flavor_image_overflow"
|
||||||
|
android:clickable="true"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_weight="0"
|
||||||
|
android:background="@drawable/ripple"
|
||||||
|
android:paddingLeft="4dp"
|
||||||
|
android:paddingRight="4dp"
|
||||||
|
android:src="@drawable/ic_dots_vertical"
|
||||||
|
android:layout_gravity="bottom|right"
|
||||||
|
android:layout_marginBottom="10dp" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user