Browse Source

Member of the month cardView pink border

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
87646f7eb1
  1. 12
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  2. 2
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java
  3. 13
      app/src/main/res/drawable/member_of_the_month_card.xml
  4. 5
      app/src/main/res/layout-v21/activity_topic_post_row.xml
  5. 5
      app/src/main/res/layout/activity_topic_post_row.xml
  6. 1
      app/src/main/res/values/colors.xml

12
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -99,6 +99,7 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
*/ */
class MyViewHolder extends RecyclerView.ViewHolder { class MyViewHolder extends RecyclerView.ViewHolder {
final CardView cardView; final CardView cardView;
final LinearLayout cardChildLinear;
final FrameLayout postDateAndNumberExp; final FrameLayout postDateAndNumberExp;
final TextView postDate, postNum, username, subject; final TextView postDate, postNum, username, subject;
final ImageView thumbnail; final ImageView thumbnail;
@ -116,6 +117,7 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
//Initializes layout's graphic elements //Initializes layout's graphic elements
//Standard stuff //Standard stuff
cardView = (CardView) view.findViewById(R.id.card_view); cardView = (CardView) view.findViewById(R.id.card_view);
cardChildLinear = (LinearLayout) view.findViewById(R.id.card_child_linear);
postDateAndNumberExp = (FrameLayout) view.findViewById(R.id.post_date_and_number_exp); postDateAndNumberExp = (FrameLayout) view.findViewById(R.id.post_date_and_number_exp);
postDate = (TextView) view.findViewById(R.id.post_date); postDate = (TextView) view.findViewById(R.id.post_date);
postNum = (TextView) view.findViewById(R.id.post_number); postNum = (TextView) view.findViewById(R.id.post_number);
@ -220,7 +222,7 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
if (currentPost.getAttachedFiles().size() != 0) { if (currentPost.getAttachedFiles().size() != 0) {
holder.bodyFooterDivider.setVisibility(View.VISIBLE); holder.bodyFooterDivider.setVisibility(View.VISIBLE);
int filesTextColor; int filesTextColor;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
filesTextColor = context.getResources().getColor(R.color.accent, null); filesTextColor = context.getResources().getColor(R.color.accent, null);
} else //noinspection deprecation } else //noinspection deprecation
filesTextColor = context.getResources().getColor(R.color.accent); filesTextColor = context.getResources().getColor(R.color.accent);
@ -294,6 +296,14 @@ class TopicAdapter extends RecyclerView.Adapter<TopicAdapter.MyViewHolder> {
holder.stars.setVisibility(View.VISIBLE); holder.stars.setVisibility(View.VISIBLE);
} else } else
holder.stars.setVisibility(View.GONE); holder.stars.setVisibility(View.GONE);
if (mUserColor == TopicParser.USER_COLOR_PINK) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
holder.cardChildLinear.setBackground(context.getResources().
getDrawable(R.drawable.member_of_the_month_card, null));
} else //noinspection deprecation
holder.cardChildLinear.setBackground(context.getResources().
getDrawable(R.drawable.member_of_the_month_card));
} else holder.cardChildLinear.setBackground(null);
//Avoid's view's visibility recycling //Avoid's view's visibility recycling
if (viewProperties.get(position)[isUserExtraInfoVisibile]) { if (viewProperties.get(position)[isUserExtraInfoVisibile]) {

2
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java

@ -42,7 +42,7 @@ class TopicParser {
private static final int USER_COLOR_RED = Color.parseColor("#F44336"); private static final int USER_COLOR_RED = Color.parseColor("#F44336");
private static final int USER_COLOR_GREEN = Color.parseColor("#4CAF50"); private static final int USER_COLOR_GREEN = Color.parseColor("#4CAF50");
private static final int USER_COLOR_BLUE = Color.parseColor("#536DFE"); private static final int USER_COLOR_BLUE = Color.parseColor("#536DFE");
private static final int USER_COLOR_PINK = Color.parseColor("#FF4081"); static final int USER_COLOR_PINK = Color.parseColor("#FF4081");
private static final int USER_COLOR_YELLOW = Color.parseColor("#FFEB3B"); private static final int USER_COLOR_YELLOW = Color.parseColor("#FFEB3B");
/** /**

13
app/src/main/res/drawable/member_of_the_month_card.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/card_background"/>
<stroke
android:width="1dip"
android:color="@color/member_of_the_month"/>
<corners android:radius="5dip"/>
<padding
android:bottom="0dip"
android:left="0dip"
android:right="0dip"
android:top="0dip"/>
</shape>

5
app/src/main/res/layout-v21/activity_topic_post_row.xml

@ -49,12 +49,13 @@
android:layout_gravity="center" android:layout_gravity="center"
android:foreground="?android:attr/selectableItemBackground" android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@color/card_background" card_view:cardBackgroundColor="@color/card_background"
card_view:cardCornerRadius="0dp" card_view:cardCornerRadius="5dp"
card_view:cardElevation="2dp" card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="true" card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true"> card_view:cardUseCompatPadding="true">
<LinearLayout <LinearLayout
android:id="@+id/card_child_linear"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">

5
app/src/main/res/layout/activity_topic_post_row.xml

@ -48,12 +48,13 @@
android:layout_gravity="center" android:layout_gravity="center"
android:foreground="?android:attr/selectableItemBackground" android:foreground="?android:attr/selectableItemBackground"
card_view:cardBackgroundColor="@color/card_background" card_view:cardBackgroundColor="@color/card_background"
card_view:cardCornerRadius="0dp" card_view:cardCornerRadius="5dp"
card_view:cardElevation="2dp" card_view:cardElevation="2dp"
card_view:cardPreventCornerOverlap="true" card_view:cardPreventCornerOverlap="false"
card_view:cardUseCompatPadding="true"> card_view:cardUseCompatPadding="true">
<LinearLayout <LinearLayout
android:id="@+id/card_child_linear"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">

1
app/src/main/res/values/colors.xml

@ -21,4 +21,5 @@
<color name="iron">#CCCCCC</color> <color name="iron">#CCCCCC</color>
<color name="card_expand_text_color">#E7E7E7</color> <color name="card_expand_text_color">#E7E7E7</color>
<color name="dialog_bg_semi_transparent">#D926A69A</color> <color name="dialog_bg_semi_transparent">#D926A69A</color>
<color name="member_of_the_month">#E91E63</color>
</resources> </resources>

Loading…
Cancel
Save