Browse Source

Post's date and index visible by default, unread posts tab minor fix

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
8b99583000
  1. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java
  2. 16
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java
  3. 152
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  4. 86
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAnimations.java
  5. 96
      app/src/main/res/layout-v21/activity_topic_post_row.xml
  6. 99
      app/src/main/res/layout/activity_topic_post_row.xml
  7. 4
      app/src/main/res/menu/topic_menu.xml
  8. 1
      app/src/main/res/values/strings.xml

6
app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java

@ -150,18 +150,20 @@ public class UnreadFragment extends BaseFragment {
Log.d("UnreadFragment", unread.html()); Log.d("UnreadFragment", unread.html());
for (Element row : unread) { for (Element row : unread) {
Elements information = row.select("td"); Elements information = row.select("td");
String link = information.get(2).select("a").first().attr("href"); String link = information.last().select("a").first().attr("href");
String title = information.get(2).select("a").first().text(); String title = information.get(2).select("a").first().text();
Element lastUserAndDate = information.get(6); Element lastUserAndDate = information.get(6);
String lastUser = lastUserAndDate.select("a").text(); String lastUser = lastUserAndDate.select("a").text();
String dateTime = lastUserAndDate.select("span").html(); String dateTime = lastUserAndDate.select("span").html();
dateTime = dateTime.substring(3, dateTime.indexOf("<br>")); //dateTime = dateTime.replace("<br>", "");
dateTime = dateTime.substring(0, dateTime.indexOf("<br>"));
dateTime = dateTime.replace("</b>", ""); dateTime = dateTime.replace("</b>", "");
topicSummaries.add(new TopicSummary(link, title, lastUser, dateTime)); topicSummaries.add(new TopicSummary(link, title, lastUser, dateTime));
} }
} else { } else {
topicSummaries.clear();
String message = document.select("table.bordercolor[cellspacing=1]").first().text(); String message = document.select("table.bordercolor[cellspacing=1]").first().text();
if (message.contains("No messages")){ //It's english if (message.contains("No messages")){ //It's english
message = "No unread posts!"; message = "No unread posts!";

16
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java

@ -5,6 +5,7 @@ import android.content.Intent;
import android.graphics.Rect; import android.graphics.Rect;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.support.design.widget.FloatingActionButton; import android.support.design.widget.FloatingActionButton;
@ -114,12 +115,12 @@ public class TopicActivity extends BaseActivity {
topicViewers = new SpannableStringBuilder("Loading..."); topicViewers = new SpannableStringBuilder("Loading...");
//Other variables //Other variables
private MaterialProgressBar progressBar; private MaterialProgressBar progressBar;
TextView toolbarTitle; private TextView toolbarTitle;
private static String base_url = ""; private static String base_url = "";
private String topicTitle; private String topicTitle;
private String parsedTitle; private String parsedTitle;
private RecyclerView recyclerView; private RecyclerView recyclerView;
String loadedPageUrl = ""; private String loadedPageUrl = "";
private boolean reloadingPage = false; private boolean reloadingPage = false;
@ -665,7 +666,13 @@ public class TopicActivity extends BaseActivity {
} }
private SpannableStringBuilder getSpannableFromHtml(String html) { private SpannableStringBuilder getSpannableFromHtml(String html) {
CharSequence sequence = Html.fromHtml(html); CharSequence sequence;
if (Build.VERSION.SDK_INT >= 24) {
sequence = Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY);
} else {
//noinspection deprecation
sequence = Html.fromHtml(html);
}
SpannableStringBuilder strBuilder = new SpannableStringBuilder(sequence); SpannableStringBuilder strBuilder = new SpannableStringBuilder(sequence);
URLSpan[] urls = strBuilder.getSpans(0, sequence.length(), URLSpan.class); URLSpan[] urls = strBuilder.getSpans(0, sequence.length(), URLSpan.class);
for (URLSpan span : urls) { for (URLSpan span : urls) {
@ -687,7 +694,7 @@ public class TopicActivity extends BaseActivity {
@Override @Override
protected Boolean doInBackground(String... message) { protected Boolean doInBackground(String... message) {
Document document; Document document;
String numReplies, seqnum, sc, subject, topic; String numReplies, seqnum, sc, topic;
Request request = new Request.Builder() Request request = new Request.Builder()
.url(replyPageUrl + ";wap2") .url(replyPageUrl + ";wap2")
@ -699,7 +706,6 @@ public class TopicActivity extends BaseActivity {
numReplies = replyPageUrl.substring(replyPageUrl.indexOf("num_replies=") + 12); numReplies = replyPageUrl.substring(replyPageUrl.indexOf("num_replies=") + 12);
seqnum = document.select("input[name=seqnum]").first().attr("value"); seqnum = document.select("input[name=seqnum]").first().attr("value");
sc = document.select("input[name=sc]").first().attr("value"); sc = document.select("input[name=sc]").first().attr("value");
//subject = document.select("input[name=subject]").first().attr("value");
topic = document.select("input[name=topic]").first().attr("value"); topic = document.select("input[name=topic]").first().attr("value");
} catch (IOException e) { } catch (IOException e) {
Timber.e(e,"Post failed."); Timber.e(e,"Post failed.");

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

@ -19,7 +19,6 @@ import android.text.Editable;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.webkit.WebResourceRequest; import android.webkit.WebResourceRequest;
@ -74,35 +73,30 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private static int THUMBNAIL_SIZE; private static int THUMBNAIL_SIZE;
private final Context context; private final Context context;
private String topicTitle; private String topicTitle;
private ArrayList<Integer> toQuoteList = new ArrayList<>(); private final ArrayList<Integer> toQuoteList = new ArrayList<>();
private final List<Post> postsList; private final List<Post> postsList;
/** /**
* Used to hold the state of visibility and other attributes for views that are animated or * Used to hold the state of visibility and other attributes for views that are animated or
* otherwise changed. Used in combination with {@link #isPostDateAndNumberVisibile}, * otherwise changed. Used in combination with {@link #isUserExtraInfoVisibile} and
* {@link #isUserExtraInfoVisibile} and {@link #isQuoteButtonChecked}. * {@link #isQuoteButtonChecked}.
*/ */
private final ArrayList<boolean[]> viewProperties = new ArrayList<>(); private final ArrayList<boolean[]> viewProperties = new ArrayList<>();
/**
* Index of state indicator in the boolean array. If true post is expanded and post's date and
* number are visible.
*/
private static final int isPostDateAndNumberVisibile = 0;
/** /**
* Index of state indicator in the boolean array. If true user's extra info are expanded and * Index of state indicator in the boolean array. If true user's extra info are expanded and
* visible. * visible.
*/ */
private static final int isUserExtraInfoVisibile = 1; private static final int isUserExtraInfoVisibile = 0;
/** /**
* Index of state indicator in the boolean array. If true quote button for this post is checked. * Index of state indicator in the boolean array. If true quote button for this post is checked.
*/ */
private static final int isQuoteButtonChecked = 2; private static final int isQuoteButtonChecked = 1;
private TopicActivity.TopicTask topicTask; private TopicActivity.TopicTask topicTask;
private TopicActivity.ReplyTask replyTask; private TopicActivity.ReplyTask replyTask;
private final int VIEW_TYPE_POST = 0; private final int VIEW_TYPE_POST = 0;
private final int VIEW_TYPE_QUICK_REPLY = 1; private final int VIEW_TYPE_QUICK_REPLY = 1;
private String[] replyDataHolder = new String[2]; private final String[] replyDataHolder = new String[2];
private int replySubject = 0, replyText = 1; private final int replySubject = 0, replyText = 1;
private String loadedPageUrl = ""; private String loadedPageUrl = "";
/** /**
@ -323,9 +317,23 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
if (!currentPost.isDeleted() && viewProperties.get(position)[isUserExtraInfoVisibile]) { if (!currentPost.isDeleted() && viewProperties.get(position)[isUserExtraInfoVisibile]) {
holder.userExtraInfo.setVisibility(View.VISIBLE); holder.userExtraInfo.setVisibility(View.VISIBLE);
holder.userExtraInfo.setAlpha(1.0f); holder.userExtraInfo.setAlpha(1.0f);
holder.username.setMaxLines(Integer.MAX_VALUE);
holder.username.setEllipsize(null);
holder.subject.setTextColor(Color.parseColor("#FFFFFF"));
holder.subject.setMaxLines(Integer.MAX_VALUE);
holder.subject.setEllipsize(null);
} else { } else {
holder.userExtraInfo.setVisibility(View.GONE); holder.userExtraInfo.setVisibility(View.GONE);
holder.userExtraInfo.setAlpha(0.0f); holder.userExtraInfo.setAlpha(0.0f);
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);
} }
if (!currentPost.isDeleted()) { if (!currentPost.isDeleted()) {
//Sets graphics behavior //Sets graphics behavior
@ -353,7 +361,9 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
boolean[] tmp = viewProperties.get(holder.getAdapterPosition()); boolean[] tmp = viewProperties.get(holder.getAdapterPosition());
tmp[isUserExtraInfoVisibile] = !tmp[isUserExtraInfoVisibile]; tmp[isUserExtraInfoVisibile] = !tmp[isUserExtraInfoVisibile];
viewProperties.set(holder.getAdapterPosition(), tmp); viewProperties.set(holder.getAdapterPosition(), tmp);
TopicAnimations.animateUserExtraInfoVisibility(holder.userExtraInfo); TopicAnimations.animateUserExtraInfoVisibility(holder.username,
holder.subject, Color.parseColor("#FFFFFF"),
Color.parseColor("#757575"), holder.userExtraInfo);
} }
}); });
//Clicking the expanded part of a header (the extra info) makes it collapse //Clicking the expanded part of a header (the extra info) makes it collapse
@ -364,7 +374,9 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
tmp[isUserExtraInfoVisibile] = false; tmp[isUserExtraInfoVisibile] = false;
viewProperties.set(holder.getAdapterPosition(), tmp); viewProperties.set(holder.getAdapterPosition(), tmp);
TopicAnimations.animateUserExtraInfoVisibility(v); TopicAnimations.animateUserExtraInfoVisibility(holder.username,
holder.subject, Color.parseColor("#FFFFFF"),
Color.parseColor("#757575"), v);
} }
}); });
} else { } else {
@ -372,30 +384,6 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
holder.userExtraInfo.setOnClickListener(null); holder.userExtraInfo.setOnClickListener(null);
} }
//Avoid's view's visibility recycling
if (viewProperties.get(position)[isPostDateAndNumberVisibile]) { //Expanded
holder.postDateAndNumberExp.setVisibility(View.VISIBLE);
holder.postDateAndNumberExp.setAlpha(1.0f);
holder.postDateAndNumberExp.setTranslationY(0);
holder.username.setMaxLines(Integer.MAX_VALUE);
holder.username.setEllipsize(null);
holder.subject.setTextColor(Color.parseColor("#FFFFFF"));
holder.subject.setMaxLines(Integer.MAX_VALUE);
holder.subject.setEllipsize(null);
} else { //Collapsed
holder.postDateAndNumberExp.setVisibility(View.GONE);
holder.postDateAndNumberExp.setAlpha(0.0f);
holder.postDateAndNumberExp.setTranslationY(holder.postDateAndNumberExp.getHeight());
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);
}
//noinspection PointlessBooleanExpression,ConstantConditions //noinspection PointlessBooleanExpression,ConstantConditions
if (!BaseActivity.getSessionManager().isLoggedIn()) if (!BaseActivity.getSessionManager().isLoggedIn())
holder.quoteToggle.setVisibility(View.GONE); holder.quoteToggle.setVisibility(View.GONE);
@ -425,23 +413,6 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
} }
}); });
} }
//Card expand/collapse when card is touched
holder.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//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("#FFFFFF")
, Color.parseColor("#757575"));
}
});
//Also when post is clicked
holder.post.setOnTouchListener(new CustomTouchListener(holder.post, holder.cardView));
} else if (currentHolder instanceof QuickReplyViewHolder) { } else if (currentHolder instanceof QuickReplyViewHolder) {
final QuickReplyViewHolder holder = (QuickReplyViewHolder) currentHolder; final QuickReplyViewHolder holder = (QuickReplyViewHolder) currentHolder;
@ -501,7 +472,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
private class PostViewHolder extends RecyclerView.ViewHolder { private class PostViewHolder extends RecyclerView.ViewHolder {
final CardView cardView; final CardView cardView;
final LinearLayout cardChildLinear; final LinearLayout cardChildLinear;
final FrameLayout postDateAndNumberExp; final FrameLayout postDateAndNumber;
final TextView postDate, postNum, username, subject; final TextView postDate, postNum, username, subject;
final ImageView thumbnail; final ImageView thumbnail;
final public WebView post; final public WebView post;
@ -519,7 +490,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
//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); cardChildLinear = (LinearLayout) view.findViewById(R.id.card_child_linear);
postDateAndNumberExp = (FrameLayout) view.findViewById(R.id.post_date_and_number_exp); postDateAndNumber = (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);
thumbnail = (ImageView) view.findViewById(R.id.thumbnail); thumbnail = (ImageView) view.findViewById(R.id.thumbnail);
@ -568,71 +539,6 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
} }
} }
/**
* This class is a gesture detector for WebViews. It handles post's clicks, long clicks and
* touch and drag.
*/
private class CustomTouchListener implements View.OnTouchListener {
//Long press handling
private float downCoordinateX;
private float downCoordinateY;
private final float SCROLL_THRESHOLD = 7;
final private WebView post;
final private CardView cardView;
//Other variables
final static int FINGER_RELEASED = 0;
final static int FINGER_TOUCHED = 1;
final static int FINGER_DRAGGING = 2;
final static int FINGER_UNDEFINED = 3;
private int fingerState = FINGER_RELEASED;
CustomTouchListener(WebView pPost, CardView pCard) {
post = pPost;
cardView = pCard;
}
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
switch (motionEvent.getAction()) {
case MotionEvent.ACTION_DOWN:
//Logs XY
downCoordinateX = motionEvent.getX();
downCoordinateY = motionEvent.getY();
if (fingerState == FINGER_RELEASED)
fingerState = FINGER_TOUCHED;
else
fingerState = FINGER_UNDEFINED;
break;
case MotionEvent.ACTION_UP:
if (fingerState != FINGER_DRAGGING) {
//Doesn't expand the card if this was a link
WebView.HitTestResult htResult = post.getHitTestResult();
if (htResult.getExtra() != null
&& htResult.getExtra() != null) {
fingerState = FINGER_RELEASED;
return false;
}
cardView.performClick();
}
fingerState = FINGER_RELEASED;
break;
case MotionEvent.ACTION_MOVE:
//Cancels long click if finger moved too much
if (((Math.abs(downCoordinateX - motionEvent.getX()) > SCROLL_THRESHOLD ||
Math.abs(downCoordinateY - motionEvent.getY()) > SCROLL_THRESHOLD))) {
fingerState = FINGER_DRAGGING;
} else fingerState = FINGER_UNDEFINED;
break;
default:
fingerState = FINGER_UNDEFINED;
}
return false;
}
}
/** /**
* This class is used to handle link clicks in WebViews. When link url is one that the app can * This class is used to handle link clicks in WebViews. When link url is one that the app can
* handle internally, it does. Otherwise user is prompt to open the link in a browser. * handle internally, it does. Otherwise user is prompt to open the link in a browser.

86
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAnimations.java

@ -7,80 +7,16 @@ import android.view.View;
import android.widget.TextView; import android.widget.TextView;
class TopicAnimations { class TopicAnimations {
//--------------------------POST'S INFO VISIBILITY CHANGE ANIMATION METHOD--------------------------
/**
* Method that animates view's visibility changes for post's extra info
*/
static void animatePostExtraInfoVisibility(final View dateAndPostNum, TextView username,
TextView subject, int expandedColor, int collapsedColor) {
//If the view is gone fade it in
if (dateAndPostNum.getVisibility() == View.GONE) {
//Show full username
username.setMaxLines(Integer.MAX_VALUE); //As in the android sourcecode
username.setEllipsize(null);
//Show full subject
subject.setTextColor(expandedColor);
subject.setMaxLines(Integer.MAX_VALUE); //As in the android sourcecode
subject.setEllipsize(null);
dateAndPostNum.clearAnimation();
// Prepare the View for the animation
dateAndPostNum.setVisibility(View.VISIBLE);
dateAndPostNum.setAlpha(0.0f);
// Start the animation
dateAndPostNum.animate()
.translationY(0)
.alpha(1.0f)
.setDuration(300)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
dateAndPostNum.setVisibility(View.VISIBLE);
}
});
}
//If the view is visible fade it out
else {
username.setMaxLines(1); //As in the android sourcecode
username.setEllipsize(TextUtils.TruncateAt.END);
subject.setTextColor(collapsedColor);
subject.setMaxLines(1); //As in the android sourcecode
subject.setEllipsize(TextUtils.TruncateAt.END);
dateAndPostNum.clearAnimation();
// Start the animation
dateAndPostNum.animate()
.translationY(dateAndPostNum.getHeight())
.alpha(0.0f)
.setDuration(300)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
dateAndPostNum.setVisibility(View.GONE);
}
});
}
}
//------------------------POST'S INFO VISIBILITY CHANGE ANIMATION METHOD END------------------------
//--------------------------USER'S INFO VISIBILITY CHANGE ANIMATION METHOD-------------------------- //--------------------------USER'S INFO VISIBILITY CHANGE ANIMATION METHOD--------------------------
/** /**
* Method that animates view's visibility changes for user's extra info * Method that animates view's visibility changes for user's extra info
*/ */
static void animateUserExtraInfoVisibility(final View userExtra) { static void animateUserExtraInfoVisibility(TextView username, TextView subject,
int expandedColor, int collapsedColor,
final View userExtra) {
//If the view is gone fade it in //If the view is gone fade it in
if (userExtra.getVisibility() == View.GONE) { if (userExtra.getVisibility() == View.GONE) {
userExtra.clearAnimation(); userExtra.clearAnimation();
userExtra.setVisibility(View.VISIBLE); userExtra.setVisibility(View.VISIBLE);
userExtra.setAlpha(0.0f); userExtra.setAlpha(0.0f);
@ -96,6 +32,15 @@ class TopicAnimations {
userExtra.setVisibility(View.VISIBLE); userExtra.setVisibility(View.VISIBLE);
} }
}); });
//Show full username
username.setMaxLines(Integer.MAX_VALUE); //As in the android sourcecode
username.setEllipsize(null);
//Show full subject
subject.setTextColor(expandedColor);
subject.setMaxLines(Integer.MAX_VALUE); //As in the android sourcecode
subject.setEllipsize(null);
} }
//If the view is visible fade it out //If the view is visible fade it out
else { else {
@ -112,6 +57,13 @@ class TopicAnimations {
userExtra.setVisibility(View.GONE); userExtra.setVisibility(View.GONE);
} }
}); });
username.setMaxLines(1); //As in the android sourcecode
username.setEllipsize(TextUtils.TruncateAt.END);
subject.setTextColor(collapsedColor);
subject.setMaxLines(1); //As in the android sourcecode
subject.setEllipsize(TextUtils.TruncateAt.END);
} }
} }
//------------------------POST'S INFO VISIBILITY CHANGE ANIMATION METHOD END------------------------ //------------------------POST'S INFO VISIBILITY CHANGE ANIMATION METHOD END------------------------

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

@ -8,41 +8,7 @@
android:paddingStart="4dp" android:paddingStart="4dp"
tools:ignore="SmallSp"> tools:ignore="SmallSp">
<FrameLayout <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/post_date_and_number_exp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:animateLayoutChanges="true"
android:visibility="gone">
<TextView
android:id="@+id/post_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp"
/>
<TextView
android:id="@+id/post_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp"
/>
</FrameLayout>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -93,7 +59,7 @@
android:maxHeight="@dimen/thumbnail_size" android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size"
android:src="@drawable/ic_default_user_thumbnail" android:src="@drawable/ic_default_user_thumbnail"
android:transitionName="user_thumbnail"/> android:transitionName="user_thumbnail" />
</FrameLayout> </FrameLayout>
<TextView <TextView
@ -106,7 +72,7 @@
android:maxLines="1" android:maxLines="1"
android:text="@string/post_author" android:text="@string/post_author"
android:textColor="@color/primary_text" android:textColor="@color/primary_text"
android:textStyle="bold"/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/subject" android:id="@+id/subject"
@ -116,8 +82,7 @@
android:layout_toEndOf="@+id/thumbnail_holder" android:layout_toEndOf="@+id/thumbnail_holder"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="@string/post_subject" android:text="@string/post_subject" />
/>
</RelativeLayout> </RelativeLayout>
<ImageButton <ImageButton
@ -129,7 +94,7 @@
android:background="@color/card_background" android:background="@color/card_background"
android:clickable="true" android:clickable="true"
android:contentDescription="@string/post_quote_button" android:contentDescription="@string/post_quote_button"
android:src="@drawable/ic_format_quote_unchecked"/> android:src="@drawable/ic_format_quote_unchecked" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -150,7 +115,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/rank" android:id="@+id/rank"
@ -158,7 +123,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/stars" android:id="@+id/stars"
@ -166,8 +131,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"> android:visibility="gone" />
</TextView>
<TextView <TextView
android:id="@+id/gender" android:id="@+id/gender"
@ -175,7 +139,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/number_of_posts" android:id="@+id/number_of_posts"
@ -183,7 +147,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/personal_text" android:id="@+id/personal_text"
@ -192,10 +156,36 @@
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:textStyle="italic" android:textStyle="italic"
android:visibility="gone"/> android:visibility="gone" />
</LinearLayout> </LinearLayout>
<FrameLayout
android:id="@+id/post_date_and_number_exp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp">
<TextView
android:id="@+id/post_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp" />
<TextView
android:id="@+id/post_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp" />
</FrameLayout>
<View <View
android:id="@+id/header_body_devider" android:id="@+id/header_body_devider"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -203,8 +193,8 @@
android:layout_marginBottom="9dp" android:layout_marginBottom="9dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="5dp"
android:background="@color/divider"/> android:background="@color/divider" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -220,8 +210,7 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:background="@color/card_background" android:background="@color/card_background"
android:clickable="true" android:clickable="true"
android:text="@string/post" android:text="@string/post" />
/>
</FrameLayout> </FrameLayout>
<View <View
@ -233,7 +222,7 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginTop="9dp" android:layout_marginTop="9dp"
android:background="@color/divider" android:background="@color/divider"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/post_footer" android:id="@+id/post_footer"
@ -242,8 +231,7 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="9dp" android:paddingBottom="9dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>

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

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -9,40 +8,7 @@
android:paddingStart="4dp" android:paddingStart="4dp"
tools:ignore="SmallSp"> tools:ignore="SmallSp">
<FrameLayout <android.support.v7.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/post_date_and_number_exp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:animateLayoutChanges="true"
android:visibility="gone">
<TextView
android:id="@+id/post_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp"/>
<TextView
android:id="@+id/post_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingEnd="5dp"
android:paddingStart="5dp"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp"
/>
</FrameLayout>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view" android:id="@+id/card_view"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -92,7 +58,7 @@
android:contentDescription="@string/post_thumbnail" android:contentDescription="@string/post_thumbnail"
android:maxHeight="@dimen/thumbnail_size" android:maxHeight="@dimen/thumbnail_size"
android:maxWidth="@dimen/thumbnail_size" android:maxWidth="@dimen/thumbnail_size"
android:src="@drawable/ic_default_user_thumbnail"/> android:src="@drawable/ic_default_user_thumbnail" />
</FrameLayout> </FrameLayout>
<TextView <TextView
@ -105,7 +71,7 @@
android:maxLines="1" android:maxLines="1"
android:text="@string/post_author" android:text="@string/post_author"
android:textColor="@color/primary_text" android:textColor="@color/primary_text"
android:textStyle="bold"/> android:textStyle="bold" />
<TextView <TextView
android:id="@+id/subject" android:id="@+id/subject"
@ -115,7 +81,7 @@
android:layout_toEndOf="@+id/thumbnail_holder" android:layout_toEndOf="@+id/thumbnail_holder"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="@string/post_subject"/> android:text="@string/post_subject" />
</RelativeLayout> </RelativeLayout>
<ImageButton <ImageButton
@ -127,7 +93,7 @@
android:background="@color/card_background" android:background="@color/card_background"
android:clickable="true" android:clickable="true"
android:contentDescription="@string/post_quote_button" android:contentDescription="@string/post_quote_button"
android:src="@drawable/ic_format_quote_unchecked"/> android:src="@drawable/ic_format_quote_unchecked" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@ -148,7 +114,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/rank" android:id="@+id/rank"
@ -156,7 +122,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/stars" android:id="@+id/stars"
@ -164,8 +130,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="2dp" android:layout_marginTop="2dp"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"> android:visibility="gone" />
</TextView>
<TextView <TextView
android:id="@+id/gender" android:id="@+id/gender"
@ -173,7 +138,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/number_of_posts" android:id="@+id/number_of_posts"
@ -181,7 +146,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:visibility="gone"/> android:visibility="gone" />
<TextView <TextView
android:id="@+id/personal_text" android:id="@+id/personal_text"
@ -190,10 +155,38 @@
android:textColor="@color/card_expand_text_color" android:textColor="@color/card_expand_text_color"
android:textSize="10sp" android:textSize="10sp"
android:textStyle="italic" android:textStyle="italic"
android:visibility="gone"/> android:visibility="gone" />
</LinearLayout> </LinearLayout>
<FrameLayout
android:id="@+id/post_date_and_number_exp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp">
<TextView
android:id="@+id/post_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp" />
<TextView
android:id="@+id/post_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:text=""
android:textColor="@color/card_expand_text_color"
android:textSize="8sp" />
</FrameLayout>
<View <View
android:id="@+id/header_body_devider" android:id="@+id/header_body_devider"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -201,8 +194,8 @@
android:layout_marginBottom="9dp" android:layout_marginBottom="9dp"
android:layout_marginLeft="16dp" android:layout_marginLeft="16dp"
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginTop="16dp" android:layout_marginTop="5dp"
android:background="@color/divider"/> android:background="@color/divider" />
<FrameLayout <FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -218,8 +211,7 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:background="@color/card_background" android:background="@color/card_background"
android:clickable="true" android:clickable="true"
android:text="@string/post" android:text="@string/post" />
/>
</FrameLayout> </FrameLayout>
<View <View
@ -231,7 +223,7 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginTop="9dp" android:layout_marginTop="9dp"
android:background="@color/divider" android:background="@color/divider"
android:visibility="gone"/> android:visibility="gone" />
<LinearLayout <LinearLayout
android:id="@+id/post_footer" android:id="@+id/post_footer"
@ -240,8 +232,7 @@
android:orientation="vertical" android:orientation="vertical"
android:paddingBottom="9dp" android:paddingBottom="9dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp"> android:paddingRight="16dp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</android.support.v7.widget.CardView> </android.support.v7.widget.CardView>
</LinearLayout> </LinearLayout>

4
app/src/main/res/menu/topic_menu.xml

@ -5,12 +5,12 @@
android:id="@+id/menu_bookmark" android:id="@+id/menu_bookmark"
android:icon="@drawable/ic_bookmark_false" android:icon="@drawable/ic_bookmark_false"
app:showAsAction="ifRoom" app:showAsAction="ifRoom"
android:title="Bookmark"> android:title="@string/bookmark">
</item> </item>
<item <item
android:id="@+id/menu_info" android:id="@+id/menu_info"
android:icon="@drawable/ic_info" android:icon="@drawable/ic_info"
app:showAsAction="ifRoom|withText" app:showAsAction="ifRoom|withText"
android:title="Info"> android:title="@string/info">
</item> </item>
</menu> </menu>

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

@ -9,6 +9,7 @@
<string name="about">About</string> <string name="about">About</string>
<string name="home">Home</string> <string name="home">Home</string>
<string name="bookmark">Bookmarks</string> <string name="bookmark">Bookmarks</string>
<string name="info">Info</string>
<!--Login Activity--> <!--Login Activity-->
<string name="thmmy_img_description">thmmy.gr</string> <string name="thmmy_img_description">thmmy.gr</string>

Loading…
Cancel
Save