diff --git a/app/src/main/assets/style.css b/app/src/main/assets/style.css index 9681d64c..885c4397 100644 --- a/app/src/main/assets/style.css +++ b/app/src/main/assets/style.css @@ -319,8 +319,8 @@ a img width: 100%; overflow: auto; line-height: 1.3em; - /*color: white; - background: #333333 !important;*/ + color: white; + background: #3C3F41 !important; } /* All the signatures used in the forum. If your forum users use Mozilla, Opera, or Safari, you might add max-height here ;). */ diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index 327fa266..138319ea 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -11,6 +11,7 @@ import android.os.Handler; import android.support.v4.content.res.ResourcesCompat; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; +import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; @@ -28,6 +29,7 @@ import android.widget.TextView; import com.squareup.picasso.Picasso; +import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -50,6 +52,10 @@ class TopicAdapter extends RecyclerView.Adapter { private final Context context; private final List postsList; private boolean foundPostFocus = false; + private ArrayList viewProperties = new ArrayList<>(); + private static final int isPostDateAndNumberVisibile = 0; + private static final int isUserExtraInfoVisibile = 1; + private static final int isQuoteButtonChecked = 2; class MyViewHolder extends RecyclerView.ViewHolder { final CardView cardView; @@ -102,6 +108,10 @@ class TopicAdapter extends RecyclerView.Adapter { this.postsList = postsList; THUMBNAIL_SIZE = (int) context.getResources().getDimension(R.dimen.thumbnail_size); + for (int i = 0; i < postsList.size(); ++i) { + //Initialize properties, array's values will be false by default + viewProperties.add(new boolean[3]); + } } @Override @@ -132,7 +142,7 @@ class TopicAdapter extends RecyclerView.Adapter { //noinspection ConstantConditions Picasso.with(context) .load(currentPost.getThumbnailUrl()) - .resize(THUMBNAIL_SIZE,THUMBNAIL_SIZE) + .resize(THUMBNAIL_SIZE, THUMBNAIL_SIZE) .centerCrop() .error(ResourcesCompat.getDrawable(context.getResources() , R.drawable.ic_default_user_thumbnail, null)) @@ -180,46 +190,36 @@ class TopicAdapter extends RecyclerView.Adapter { //If user is not deleted then we have more to do if (!currentPost.isDeleted()) { //Set extra info //Variables with content - String c_specialRank = currentPost.getSpecialRank() - , c_rank = currentPost.getRank() - , c_gender = currentPost.getGender() - , c_numberOfPosts = currentPost.getNumberOfPosts() - , c_personalText = currentPost.getPersonalText(); - int c_numberOfStars = currentPost.getNumberOfStars() - ,c_userColor = currentPost.getUserColor(); + String c_specialRank = currentPost.getSpecialRank(), c_rank = currentPost.getRank(), c_gender = currentPost.getGender(), c_numberOfPosts = currentPost.getNumberOfPosts(), c_personalText = currentPost.getPersonalText(); + int c_numberOfStars = currentPost.getNumberOfStars(), c_userColor = currentPost.getUserColor(); if (!Objects.equals(c_specialRank, "") && c_specialRank != null) { holder.specialRank.setText(c_specialRank); holder.specialRank.setVisibility(View.VISIBLE); - } - else + } else holder.specialRank.setVisibility(View.GONE); if (!Objects.equals(c_rank, "") && c_rank != null) { holder.rank.setText(c_rank); holder.rank.setVisibility(View.VISIBLE); - } - else + } else holder.rank.setVisibility(View.GONE); if (!Objects.equals(c_gender, "") && c_gender != null) { holder.gender.setText(c_gender); holder.gender.setVisibility(View.VISIBLE); - } - else + } else holder.gender.setVisibility(View.GONE); if (!Objects.equals(c_numberOfPosts, "") && c_numberOfPosts != null) { holder.numberOfPosts.setText(c_numberOfPosts); holder.numberOfPosts.setVisibility(View.VISIBLE); - } - else + } else holder.numberOfPosts.setVisibility(View.GONE); if (!Objects.equals(c_personalText, "") && c_personalText != null) { holder.personalText.setText("\"" + c_personalText + "\""); holder.personalText.setVisibility(View.VISIBLE); - } - else + } else holder.personalText.setVisibility(View.GONE); - if(c_numberOfStars != 0) { + if (c_numberOfStars != 0) { holder.stars.setTypeface(FontManager.getTypeface(context, FONTAWESOME)); String aStar = context.getResources().getString(R.string.fa_icon_star); @@ -230,15 +230,25 @@ class TopicAdapter extends RecyclerView.Adapter { holder.stars.setText(usersStars); holder.stars.setTextColor(c_userColor); holder.stars.setVisibility(View.VISIBLE); - } - else + } else holder.stars.setVisibility(View.GONE); - /* --Header expand/collapse functionality-- */ + /* --Header expand/collapse functionality-- */ + + //Check if current post's header is expanded + if (viewProperties.get(position)[isUserExtraInfoVisibile]) //Expanded + holder.userExtraInfo.setVisibility(View.VISIBLE); + else //Collapsed + holder.userExtraInfo.setVisibility(View.GONE); holder.header.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + //Change post's viewProperties accordingly + boolean[] tmp = viewProperties.get(holder.getAdapterPosition()); + tmp[isUserExtraInfoVisibile] = !tmp[isUserExtraInfoVisibile]; + viewProperties.set(holder.getAdapterPosition(), tmp); + TopicAnimations.animateUserExtraInfoVisibility(holder.userExtraInfo); } }); @@ -247,18 +257,49 @@ class TopicAdapter extends RecyclerView.Adapter { holder.userExtraInfo.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + //Change post's viewProperties accordingly + boolean[] tmp = viewProperties.get(holder.getAdapterPosition()); + tmp[1] = false; + viewProperties.set(holder.getAdapterPosition(), tmp); + TopicAnimations.animateUserExtraInfoVisibility(v); } }); - /* --Header expand/collapse functionality end-- */ + /* --Header expand/collapse functionality end-- */ } /* --Card expand/collapse functionality-- */ + //Check if current post is expanded + if (viewProperties.get(position)[isPostDateAndNumberVisibile]) { //Expanded + holder.postDateAndNumberExp.setVisibility(View.VISIBLE); + + holder.username.setMaxLines(Integer.MAX_VALUE); + holder.username.setEllipsize(null); + + holder.subject.setTextColor(Color.parseColor("#000000")); + holder.subject.setMaxLines(Integer.MAX_VALUE); + holder.subject.setEllipsize(null); + } else { //Collapsed + holder.postDateAndNumberExp.setVisibility(View.GONE); + + holder.username.setMaxLines(1); + holder.username.setEllipsize(TextUtils.TruncateAt.END); + + holder.subject.setTextColor(Color.parseColor("#757575")); + holder.subject.setMaxLines(1); + holder.subject.setEllipsize(TextUtils.TruncateAt.END); + } + //Should expand/collapse when card is touched holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { + //Change post's viewProperties accordingly + boolean[] tmp = viewProperties.get(holder.getAdapterPosition()); + tmp[isPostDateAndNumberVisibile] = !tmp[isPostDateAndNumberVisibile]; + viewProperties.set(holder.getAdapterPosition(), tmp); + TopicAnimations.animatePostExtraInfoVisibility(holder.postDateAndNumberExp , holder.username, holder.subject , Color.parseColor("#000000") diff --git a/app/src/main/res/layout/activity_topic_post_row.xml b/app/src/main/res/layout/activity_topic_post_row.xml index 16413efe..dc9fcc6a 100644 --- a/app/src/main/res/layout/activity_topic_post_row.xml +++ b/app/src/main/res/layout/activity_topic_post_row.xml @@ -36,7 +36,6 @@ android:text="" android:textColor="@color/card_expand_text_color" android:textSize="8sp" - /> @@ -47,7 +46,7 @@ android:layout_height="match_parent" android:layout_gravity="center" android:foreground="?android:attr/selectableItemBackground" - card_view:cardBackgroundColor="@color/white" + card_view:cardBackgroundColor="@color/card_background" card_view:cardCornerRadius="0dp" card_view:cardElevation="2dp" card_view:cardPreventCornerOverlap="true" @@ -102,7 +101,7 @@ android:ellipsize="end" android:maxLines="1" android:text="@string/username" - android:textColor="@color/black" + android:textColor="@color/primary_text" android:textStyle="bold"/> diff --git a/app/src/main/res/layout/fragment_recent.xml b/app/src/main/res/layout/fragment_recent.xml index 63eb4ff2..68a56f3f 100644 --- a/app/src/main/res/layout/fragment_recent.xml +++ b/app/src/main/res/layout/fragment_recent.xml @@ -17,7 +17,7 @@ class="gr.thmmy.mthmmy.utils.CustomRecyclerView" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/white" + android:background="@color/background" android:clipToPadding="false" android:paddingBottom="4dp" android:paddingTop="4dp" diff --git a/app/src/main/res/layout/fragment_recent_row.xml b/app/src/main/res/layout/fragment_recent_row.xml index 2d61f25c..583da21a 100644 --- a/app/src/main/res/layout/fragment_recent_row.xml +++ b/app/src/main/res/layout/fragment_recent_row.xml @@ -34,7 +34,7 @@ android:layout_alignParentStart="true" android:layout_alignParentTop="true" android:textAppearance="?attr/textAppearanceListItem" - android:textColor="@color/md_grey_850"/> + android:textColor="@color/primary_text"/> + android:layout_below="@+id/spacer" + android:textColor="@color/secondary_text"/> diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 761900f9..d132c800 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,11 +1,16 @@ + + - #3F51B5 + + + + #2B2B2B + #333333 + #3C3F41 + #BF4040 + + #E7E7E7 + #757575 + #303234 + #3C3F41 + #8B8B8B + + #00000000 + #FFFFFF + #000000 + #CCCCCC + #E7E7E7 + #80BF4040