headline layout tweaks
This commit is contained in:
parent
a0118d6832
commit
b218b743bf
@ -42,6 +42,7 @@ import android.widget.CheckBox;
|
|||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.amulyakhare.textdrawable.TextDrawable;
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
@ -1095,6 +1096,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
holder.flavorImageView.setTag(posterUri);
|
holder.flavorImageView.setTag(posterUri);
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
maybeRepositionFlavorImage(view, bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1174,6 +1177,8 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
holder.flavorImageView.setTag(thumbUri);
|
holder.flavorImageView.setTag(thumbUri);
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
holder.flavorVideoPlayView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
maybeRepositionFlavorImage(view, bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1214,10 +1219,6 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
if (imgSrc.indexOf("//") == 0)
|
if (imgSrc.indexOf("//") == 0)
|
||||||
imgSrc = "http:" + imgSrc;
|
imgSrc = "http:" + imgSrc;
|
||||||
|
|
||||||
if (article.flavorImageCount > 1) {
|
|
||||||
holder.flavorImagePrompt.setVisibility(View.VISIBLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
ViewCompat.setTransitionName(holder.flavorImageView, "TRANSITION:ARTICLE_IMAGES_PAGER");
|
ViewCompat.setTransitionName(holder.flavorImageView, "TRANSITION:ARTICLE_IMAGES_PAGER");
|
||||||
|
|
||||||
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
holder.flavorImageView.setOnClickListener(new OnClickListener() {
|
||||||
@ -1264,6 +1265,12 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
|
|
||||||
if (bitmap.getWidth() > FLAVOR_IMG_MIN_SIZE && bitmap.getHeight() > FLAVOR_IMG_MIN_SIZE) {
|
if (bitmap.getWidth() > FLAVOR_IMG_MIN_SIZE && bitmap.getHeight() > FLAVOR_IMG_MIN_SIZE) {
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (article.flavorImageCount > 1) {
|
||||||
|
holder.flavorImagePrompt.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
maybeRepositionFlavorImage(view, bitmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1286,12 +1293,15 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
} else {
|
} else {
|
||||||
holder.flavorImageView.setVisibility(View.VISIBLE);
|
holder.flavorImageView.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
if (article.flavorImageCount > 1) {
|
||||||
|
holder.flavorImagePrompt.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String articleAuthor = article.author != null ? article.author : "";
|
String articleAuthor = article.author != null ? article.author : "";
|
||||||
|
|
||||||
@ -1360,6 +1370,32 @@ public class HeadlinesFragment extends Fragment implements OnItemClickListener,
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int pxToDp(int px) {
|
||||||
|
DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
|
||||||
|
int dp = Math.round(px / (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT));
|
||||||
|
return dp;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maybeRepositionFlavorImage(View view, Bitmap bitmap) {
|
||||||
|
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) view.getLayoutParams();
|
||||||
|
|
||||||
|
int w = bitmap.getWidth();
|
||||||
|
int h = bitmap.getHeight();
|
||||||
|
float r = h != 0 ? (float)w/h : 0;
|
||||||
|
|
||||||
|
//Log.d(TAG, "XYR: " + pxToDp(w) + " " + pxToDp(h) + " " + r);
|
||||||
|
|
||||||
|
if (pxToDp(bitmap.getHeight()) < 300 || r >= 1.2) {
|
||||||
|
|
||||||
|
lp.addRule(RelativeLayout.BELOW, R.id.headline_header);
|
||||||
|
} else {
|
||||||
|
lp.addRule(RelativeLayout.BELOW, 0);
|
||||||
|
//lp.removeRule(RelativeLayout.BELOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
view.setLayoutParams(lp);
|
||||||
|
}
|
||||||
|
|
||||||
private void adjustTitleTextView(int score, TextView tv, int position) {
|
private void adjustTitleTextView(int score, TextView tv, int position) {
|
||||||
int viewType = getItemViewType(position);
|
int viewType = getItemViewType(position);
|
||||||
if (origTitleColors[viewType] == null)
|
if (origTitleColors[viewType] == null)
|
||||||
|
@ -28,40 +28,33 @@
|
|||||||
android:id="@+id/flavorImageLoadingBar"
|
android:id="@+id/flavorImageLoadingBar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center" />
|
|
||||||
|
|
||||||
<org.fox.ttrss.util.EnlargingImageView
|
|
||||||
android:id="@+id/flavor_image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@+id/headline_header"
|
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:cropToPadding="true"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/drawer_header"
|
|
||||||
android:visibility="visible" />
|
android:visibility="visible" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/flavor_video_play"
|
android:id="@+id/flavor_video_play"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:scaleType="fitXY"
|
android:scaleType="fitXY"
|
||||||
android:src="@drawable/flavor_video_play"
|
android:src="@drawable/flavor_video_play"
|
||||||
android:visibility="gone" />
|
android:visibility="visible" />
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/flavor_image_prompt"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<org.fox.ttrss.util.EnlargingImageView
|
||||||
|
android:id="@+id/flavor_image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="center"
|
||||||
android:background="#90000000"
|
android:adjustViewBounds="true"
|
||||||
android:gravity="center"
|
android:cropToPadding="true"
|
||||||
android:text="@string/flavor_image_prompt"
|
android:scaleType="fitCenter"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:src="@drawable/drawer_header"
|
||||||
android:textColor="@android:color/primary_text_dark"
|
android:visibility="visible"
|
||||||
android:visibility="gone" />
|
android:layout_centerHorizontal="true" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/headline_header"
|
android:id="@+id/headline_header"
|
||||||
@ -117,6 +110,19 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/flavor_image_prompt"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="#90000000"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/flavor_image_prompt"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@android:color/primary_text_dark"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
@ -31,17 +31,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center" />
|
android:layout_gravity="center" />
|
||||||
|
|
||||||
<org.fox.ttrss.util.EnlargingImageView
|
|
||||||
android:id="@+id/flavor_image"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:cropToPadding="true"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:src="@drawable/drawer_header"
|
|
||||||
android:visibility="visible" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/flavor_video_play"
|
android:id="@+id/flavor_video_play"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@ -51,17 +40,22 @@
|
|||||||
android:src="@drawable/flavor_video_play"
|
android:src="@drawable/flavor_video_play"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
<RelativeLayout
|
||||||
android:id="@+id/flavor_image_prompt"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<org.fox.ttrss.util.EnlargingImageView
|
||||||
|
android:id="@+id/flavor_image"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="center"
|
||||||
android:background="#90000000"
|
android:adjustViewBounds="true"
|
||||||
android:gravity="center"
|
android:cropToPadding="true"
|
||||||
android:text="@string/flavor_image_prompt"
|
android:scaleType="fitCenter"
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
android:src="@drawable/drawer_header"
|
||||||
android:textColor="@android:color/primary_text_dark"
|
android:visibility="visible"
|
||||||
android:visibility="gone" />
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/headline_header"
|
android:id="@+id/headline_header"
|
||||||
@ -117,6 +111,20 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/flavor_image_prompt"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="#90000000"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="@string/flavor_image_prompt"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||||
|
android:textColor="@android:color/primary_text_dark"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user