|
@ -24,6 +24,7 @@ import android.widget.FrameLayout; |
|
|
import android.widget.ImageButton; |
|
|
import android.widget.ImageButton; |
|
|
import android.widget.LinearLayout; |
|
|
import android.widget.LinearLayout; |
|
|
import android.widget.ProgressBar; |
|
|
import android.widget.ProgressBar; |
|
|
|
|
|
import android.widget.RelativeLayout; |
|
|
import android.widget.TextView; |
|
|
import android.widget.TextView; |
|
|
import android.widget.Toast; |
|
|
import android.widget.Toast; |
|
|
|
|
|
|
|
@ -35,6 +36,7 @@ import org.jsoup.nodes.Element; |
|
|
import org.jsoup.select.Elements; |
|
|
import org.jsoup.select.Elements; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
|
|
|
import java.util.Arrays; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
@ -74,6 +76,7 @@ public class TopicActivity extends BaseActivity { |
|
|
/* --Topic's pages end-- */ |
|
|
/* --Topic's pages end-- */ |
|
|
/* --Thumbnail-- */ |
|
|
/* --Thumbnail-- */ |
|
|
private static final int THUMBNAIL_SIZE = 80; |
|
|
private static final int THUMBNAIL_SIZE = 80; |
|
|
|
|
|
private static final int THUMBNAIL_PADDING = 16; |
|
|
private ImageLoader imageLoader = ImageController.getInstance().getImageLoader(); |
|
|
private ImageLoader imageLoader = ImageController.getInstance().getImageLoader(); |
|
|
/* --Thumbnail end-- */ |
|
|
/* --Thumbnail end-- */ |
|
|
|
|
|
|
|
@ -343,12 +346,24 @@ public class TopicActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
for (Element item : rows) { //For every post
|
|
|
for (Element item : rows) { //For every post
|
|
|
//Variables to pass
|
|
|
//Variables to pass
|
|
|
String p_userName, p_thumbnailUrl, p_subject, p_post, p_postDate; |
|
|
String p_userName, p_thumbnailUrl, p_subject, p_post, p_postDate, p_rank, |
|
|
int p_postNum, p_postIndex; |
|
|
p_specialRank, p_gender, p_personalText, p_numberOfPosts, p_urlOfStars; |
|
|
|
|
|
int p_postNum, p_postIndex, p_numberOfStars; |
|
|
|
|
|
boolean p_isDeleted = false; |
|
|
|
|
|
|
|
|
|
|
|
//Initialize variables
|
|
|
|
|
|
p_rank = "Rank"; |
|
|
|
|
|
p_specialRank = "Special rank"; |
|
|
|
|
|
p_gender = ""; |
|
|
|
|
|
p_personalText = ""; |
|
|
|
|
|
p_numberOfPosts = ""; |
|
|
|
|
|
p_urlOfStars = ""; |
|
|
|
|
|
p_numberOfStars = 0; |
|
|
|
|
|
|
|
|
//Find the Username
|
|
|
//Find the Username
|
|
|
Element userName = item.select("a[title^=View the profile of]").first(); |
|
|
Element userName = item.select("a[title^=View the profile of]").first(); |
|
|
if (userName == null) { //Deleted profile
|
|
|
if (userName == null) { //Deleted profile
|
|
|
|
|
|
p_isDeleted = true; |
|
|
p_userName = item |
|
|
p_userName = item |
|
|
.select("td:has(div.smalltext:containsOwn(Guest))[style^=overflow]") |
|
|
.select("td:has(div.smalltext:containsOwn(Guest))[style^=overflow]") |
|
|
.first().text(); |
|
|
.first().text(); |
|
@ -376,7 +391,7 @@ public class TopicActivity extends BaseActivity { |
|
|
Element postDate = item.select("div.smalltext:matches(on:)").first(); |
|
|
Element postDate = item.select("div.smalltext:matches(on:)").first(); |
|
|
p_postDate = postDate.text(); |
|
|
p_postDate = postDate.text(); |
|
|
p_postDate = p_postDate.substring(p_postDate.indexOf("on:") + 4 |
|
|
p_postDate = p_postDate.substring(p_postDate.indexOf("on:") + 4 |
|
|
,p_postDate.indexOf(" »")); |
|
|
, p_postDate.indexOf(" »")); |
|
|
|
|
|
|
|
|
//Find post's number
|
|
|
//Find post's number
|
|
|
Element postNum = item.select("div.smalltext:matches(Reply #)").first(); |
|
|
Element postNum = item.select("div.smalltext:matches(Reply #)").first(); |
|
@ -389,16 +404,79 @@ public class TopicActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
//Find post's index
|
|
|
//Find post's index
|
|
|
Element postIndex = item.select("a[name^=msg]").first(); |
|
|
Element postIndex = item.select("a[name^=msg]").first(); |
|
|
if(postIndex == null) |
|
|
if (postIndex == null) |
|
|
p_postIndex = NO_INDEX; |
|
|
p_postIndex = NO_INDEX; |
|
|
else { |
|
|
else { |
|
|
String tmp = postIndex.attr("name"); |
|
|
String tmp = postIndex.attr("name"); |
|
|
p_postIndex = Integer.parseInt(tmp.substring(tmp.indexOf("msg") + 3)); |
|
|
p_postIndex = Integer.parseInt(tmp.substring(tmp.indexOf("msg") + 3)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//Add new post in postsList
|
|
|
if (!p_isDeleted) { //Active user
|
|
|
postsList.add(new Post(p_thumbnailUrl, p_userName, p_subject |
|
|
//Get extra info
|
|
|
, p_post, p_postDate, p_postNum, p_postIndex)); |
|
|
int postsLineIndex = -1; |
|
|
|
|
|
int starsLineIndex = -1; |
|
|
|
|
|
|
|
|
|
|
|
Element info = userName.parent().nextElementSibling(); //Get sibling "div"
|
|
|
|
|
|
List<String> infoList = Arrays.asList(info.html().split("<br>")); |
|
|
|
|
|
|
|
|
|
|
|
for (String line : infoList) { |
|
|
|
|
|
Log.i(TAG, line); |
|
|
|
|
|
if (line.contains("Posts:")) { |
|
|
|
|
|
postsLineIndex = infoList.indexOf(line); |
|
|
|
|
|
//Remove any line breaks and spaces on the start and end
|
|
|
|
|
|
p_numberOfPosts = p_personalText.replace("\n", "") |
|
|
|
|
|
.replace("\r", "").trim(); |
|
|
|
|
|
} |
|
|
|
|
|
if (line.contains("Gender:")) { |
|
|
|
|
|
if (line.contains("alt=\"Male\"")) |
|
|
|
|
|
p_gender = "Gender: Male"; |
|
|
|
|
|
else |
|
|
|
|
|
p_gender = "Gender: Female"; |
|
|
|
|
|
} |
|
|
|
|
|
if (line.contains("alt=\"*\"")) { |
|
|
|
|
|
starsLineIndex = infoList.indexOf(line); |
|
|
|
|
|
Document starsHtml = Jsoup.parse(line); |
|
|
|
|
|
p_numberOfStars = starsHtml.select("img[alt]").size(); |
|
|
|
|
|
p_urlOfStars = starsHtml.select("img[alt]").first().attr("abs:src"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//If this member has no stars yet ==> New member,
|
|
|
|
|
|
//or is just a member
|
|
|
|
|
|
if (starsLineIndex == -1 || starsLineIndex == 1) { |
|
|
|
|
|
//In this case:
|
|
|
|
|
|
p_rank = infoList.get(0).trim(); //First line has the rank
|
|
|
|
|
|
p_specialRank = null; //They don't have a special rank
|
|
|
|
|
|
} else if (starsLineIndex == 2) { //This member has a special rank
|
|
|
|
|
|
p_specialRank = infoList.get(0).trim(); //First line has the special rank
|
|
|
|
|
|
p_rank = infoList.get(1).trim(); //Second line has the rank
|
|
|
|
|
|
} |
|
|
|
|
|
for (int i = postsLineIndex + 1; i < infoList.size() - 1; ++i) { |
|
|
|
|
|
//Search under "Posts:"
|
|
|
|
|
|
//and above "Personal Message", "View Profile" etc buttons
|
|
|
|
|
|
|
|
|
|
|
|
String thisLine = infoList.get(i); |
|
|
|
|
|
//If this line isn't empty and doesn't contain user's avatar
|
|
|
|
|
|
if (!Objects.equals(thisLine, "") && thisLine != null |
|
|
|
|
|
&& !Objects.equals(thisLine, " \n") |
|
|
|
|
|
&& !thisLine.contains("avatar")) { |
|
|
|
|
|
p_personalText = thisLine; //Then this line has user's personal text
|
|
|
|
|
|
//Remove any line breaks and spaces on the start and end
|
|
|
|
|
|
p_personalText = p_personalText.replace("\n", "") |
|
|
|
|
|
.replace("\r", "").trim(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//Add new post in postsList, extended information needed
|
|
|
|
|
|
postsList.add(new Post(p_thumbnailUrl, p_userName, p_subject, p_post |
|
|
|
|
|
, p_postIndex, p_postNum, p_postDate, p_isDeleted, p_rank |
|
|
|
|
|
, p_specialRank, p_gender, p_numberOfPosts, p_personalText |
|
|
|
|
|
, p_urlOfStars, p_numberOfStars)); |
|
|
|
|
|
|
|
|
|
|
|
} else{ //Deleted user
|
|
|
|
|
|
//Add new post in postsList, only standard information needed
|
|
|
|
|
|
postsList.add(new Post(p_thumbnailUrl, p_userName, p_subject |
|
|
|
|
|
, p_post, p_postIndex, p_postNum, p_postDate, p_isDeleted)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
/* Parse method end */ |
|
|
/* Parse method end */ |
|
@ -435,7 +513,9 @@ public class TopicActivity extends BaseActivity { |
|
|
TextView username = (TextView) convertView.findViewById(R.id.username); |
|
|
TextView username = (TextView) convertView.findViewById(R.id.username); |
|
|
TextView subject = (TextView) convertView.findViewById(R.id.subject); |
|
|
TextView subject = (TextView) convertView.findViewById(R.id.subject); |
|
|
final WebView post = (WebView) convertView.findViewById(R.id.post); |
|
|
final WebView post = (WebView) convertView.findViewById(R.id.post); |
|
|
CardView cardView = (CardView) convertView.findViewById(R.id.card_view); |
|
|
final CardView cardView = (CardView) convertView.findViewById(R.id.card_view); |
|
|
|
|
|
RelativeLayout header = (RelativeLayout) convertView.findViewById(R.id.header); |
|
|
|
|
|
final LinearLayout userExtraInfo = (LinearLayout) convertView.findViewById(R.id.user_extra_info); |
|
|
|
|
|
|
|
|
//Post's WebView parameters set
|
|
|
//Post's WebView parameters set
|
|
|
post.setClickable(true); |
|
|
post.setClickable(true); |
|
@ -462,6 +542,8 @@ public class TopicActivity extends BaseActivity { |
|
|
//Post's index number set
|
|
|
//Post's index number set
|
|
|
if (item.getPostNumber() != 0) |
|
|
if (item.getPostNumber() != 0) |
|
|
postNum.setText("#" + item.getPostNumber()); |
|
|
postNum.setText("#" + item.getPostNumber()); |
|
|
|
|
|
else |
|
|
|
|
|
postNum.setText(""); |
|
|
|
|
|
|
|
|
//Subject set
|
|
|
//Subject set
|
|
|
subject.setText(item.getSubject()); |
|
|
subject.setText(item.getSubject()); |
|
@ -469,64 +551,131 @@ public class TopicActivity extends BaseActivity { |
|
|
//Post's text set
|
|
|
//Post's text set
|
|
|
post.loadDataWithBaseURL("file:///android_asset/", item.getContent(), "text/html", "UTF-8", null); |
|
|
post.loadDataWithBaseURL("file:///android_asset/", item.getContent(), "text/html", "UTF-8", null); |
|
|
|
|
|
|
|
|
/* --"Card expand/collapse"-like functionality-- */ |
|
|
if(!item.isDeleted()) { //Set extra info
|
|
|
if (item.getPostNumber() != 0) { |
|
|
//Variables for Graphics
|
|
|
//Should expand/collapse when card is touched
|
|
|
TextView g_specialRank, g_rank, g_gender, g_numberOfPosts, g_personalText; |
|
|
cardView.setOnClickListener(new View.OnClickListener() { |
|
|
LinearLayout g_stars_holder = (LinearLayout) convertView.findViewById(R.id.stars); |
|
|
|
|
|
|
|
|
|
|
|
//Variables for content
|
|
|
|
|
|
String c_specialRank = item.getSpecialRank() |
|
|
|
|
|
, c_rank = item.getRank() |
|
|
|
|
|
, c_gender = item.getGender() |
|
|
|
|
|
, c_numberOfPosts = item.getNumberOfPosts() |
|
|
|
|
|
, c_personalText = item.getPersonalText() |
|
|
|
|
|
, c_urlOfStars = item.getUrlOfStars(); |
|
|
|
|
|
int c_numberOfStars = item.getNumberOfStars(); |
|
|
|
|
|
|
|
|
|
|
|
if(!Objects.equals(c_specialRank, "") && c_specialRank != null){ |
|
|
|
|
|
g_specialRank = (TextView) convertView.findViewById(R.id.special_rank); |
|
|
|
|
|
g_specialRank.setText(c_specialRank); |
|
|
|
|
|
g_specialRank.setVisibility(View.VISIBLE); |
|
|
|
|
|
} |
|
|
|
|
|
if(!Objects.equals(c_rank, "") && c_rank != null){ |
|
|
|
|
|
g_rank = (TextView) convertView.findViewById(R.id.rank); |
|
|
|
|
|
g_rank.setText(c_rank); |
|
|
|
|
|
g_rank.setVisibility(View.VISIBLE); |
|
|
|
|
|
} |
|
|
|
|
|
if(!Objects.equals(c_gender, "") && c_gender != null){ |
|
|
|
|
|
g_gender = (TextView) convertView.findViewById(R.id.gender); |
|
|
|
|
|
g_gender.setText(c_gender); |
|
|
|
|
|
g_gender.setVisibility(View.VISIBLE); |
|
|
|
|
|
} |
|
|
|
|
|
if(!Objects.equals(c_numberOfPosts, "") && c_numberOfPosts != null){ |
|
|
|
|
|
g_numberOfPosts = (TextView) convertView.findViewById(R.id.number_of_posts); |
|
|
|
|
|
g_numberOfPosts.setText(c_numberOfPosts); |
|
|
|
|
|
g_numberOfPosts.setVisibility(View.VISIBLE); |
|
|
|
|
|
} |
|
|
|
|
|
if(!Objects.equals(c_personalText, "") && c_personalText != null){ |
|
|
|
|
|
g_personalText = (TextView) convertView.findViewById(R.id.personal_text); |
|
|
|
|
|
g_personalText.setText("\"" + c_personalText + "\""); |
|
|
|
|
|
g_personalText.setVisibility(View.VISIBLE); |
|
|
|
|
|
} |
|
|
|
|
|
for(int i=0; i<c_numberOfStars; ++i){ |
|
|
|
|
|
CircularNetworkImageView star = new CircularNetworkImageView(this); |
|
|
|
|
|
star.setImageUrl(c_urlOfStars, imageLoader); |
|
|
|
|
|
|
|
|
|
|
|
//Remove spacing between stars...
|
|
|
|
|
|
//Don't know why this is happening in the first place
|
|
|
|
|
|
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams( |
|
|
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT, |
|
|
|
|
|
LinearLayout.LayoutParams.WRAP_CONTENT |
|
|
|
|
|
); |
|
|
|
|
|
params.setMargins(-30, 0, -30, 0); |
|
|
|
|
|
star.setLayoutParams(params); |
|
|
|
|
|
|
|
|
|
|
|
g_stars_holder.addView(star, 0); |
|
|
|
|
|
g_stars_holder.setVisibility(View.VISIBLE); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* --Header expand/collapse"-like functionality-- */ |
|
|
|
|
|
|
|
|
|
|
|
header.setOnClickListener(new View.OnClickListener(){ |
|
|
@Override |
|
|
@Override |
|
|
public void onClick(View v) { |
|
|
public void onClick(View v){ |
|
|
visibilityChangeAnimate(cardExpandable); |
|
|
animateUserExtraInfoVisibility(userExtraInfo); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//Also when post is clicked
|
|
|
/* --"Card expand/collapse"-like functionality-- */ |
|
|
post.setOnTouchListener(new View.OnTouchListener() { |
|
|
|
|
|
|
|
|
|
|
|
final static int FINGER_RELEASED = 0; |
|
|
//Should expand/collapse when card is touched
|
|
|
final static int FINGER_TOUCHED = 1; |
|
|
cardView.setOnClickListener(new View.OnClickListener() { |
|
|
final static int FINGER_DRAGGING = 2; |
|
|
@Override |
|
|
final static int FINGER_UNDEFINED = 3; |
|
|
public void onClick(View v) { |
|
|
|
|
|
animatePostExtraInfoVisibility(cardExpandable); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
private int fingerState = FINGER_RELEASED; |
|
|
//Also when post is clicked
|
|
|
|
|
|
post.setOnTouchListener(new View.OnTouchListener() { |
|
|
|
|
|
|
|
|
@Override |
|
|
final static int FINGER_RELEASED = 0; |
|
|
public boolean onTouch(View view, MotionEvent motionEvent) { |
|
|
final static int FINGER_TOUCHED = 1; |
|
|
|
|
|
final static int FINGER_DRAGGING = 2; |
|
|
|
|
|
final static int FINGER_UNDEFINED = 3; |
|
|
|
|
|
|
|
|
switch (motionEvent.getAction()) { |
|
|
private int fingerState = FINGER_RELEASED; |
|
|
|
|
|
|
|
|
case MotionEvent.ACTION_DOWN: |
|
|
@Override |
|
|
if (fingerState == FINGER_RELEASED) |
|
|
public boolean onTouch(View view, MotionEvent motionEvent) { |
|
|
fingerState = FINGER_TOUCHED; |
|
|
|
|
|
else |
|
|
|
|
|
fingerState = FINGER_UNDEFINED; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case MotionEvent.ACTION_UP: |
|
|
switch (motionEvent.getAction()) { |
|
|
fingerState = FINGER_RELEASED; |
|
|
|
|
|
|
|
|
|
|
|
//If this was a link don't expand the card
|
|
|
case MotionEvent.ACTION_DOWN: |
|
|
WebView.HitTestResult htResult = post.getHitTestResult(); |
|
|
if (fingerState == FINGER_RELEASED) |
|
|
if (htResult.getExtra() != null |
|
|
fingerState = FINGER_TOUCHED; |
|
|
&& htResult.getExtra() != null) |
|
|
else |
|
|
return false; |
|
|
fingerState = FINGER_UNDEFINED; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
//Expand/Collapse card
|
|
|
case MotionEvent.ACTION_UP: |
|
|
visibilityChangeAnimate(cardExpandable); |
|
|
fingerState = FINGER_RELEASED; |
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case MotionEvent.ACTION_MOVE: |
|
|
//If this was a link don't expand the card
|
|
|
if (fingerState == FINGER_TOUCHED || fingerState == FINGER_DRAGGING) fingerState = FINGER_DRAGGING; |
|
|
WebView.HitTestResult htResult = post.getHitTestResult(); |
|
|
else fingerState = FINGER_UNDEFINED; |
|
|
if (htResult.getExtra() != null |
|
|
break; |
|
|
&& htResult.getExtra() != null) |
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
default: |
|
|
//Expand/Collapse card
|
|
|
fingerState = FINGER_UNDEFINED; |
|
|
animatePostExtraInfoVisibility(cardExpandable); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case MotionEvent.ACTION_MOVE: |
|
|
|
|
|
if (fingerState == FINGER_TOUCHED || fingerState == FINGER_DRAGGING) |
|
|
|
|
|
fingerState = FINGER_DRAGGING; |
|
|
|
|
|
else fingerState = FINGER_UNDEFINED; |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
|
fingerState = FINGER_UNDEFINED; |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
/* --"Card expand/collapse"-like functionality end-- */ |
|
|
/* --"Card expand/collapse"-like functionality end-- */ |
|
|
|
|
|
|
|
|
//Add view to the linear layout that holds all posts
|
|
|
//Add view to the linear layout that holds all posts
|
|
@ -542,18 +691,60 @@ public class TopicActivity extends BaseActivity { |
|
|
} |
|
|
} |
|
|
//--------------------------------------POPULATE UI METHOD END--------------------------------------
|
|
|
//--------------------------------------POPULATE UI METHOD END--------------------------------------
|
|
|
|
|
|
|
|
|
//---------------------------------VISIBILITY CHANGE ANIMATE METHOD---------------------------------
|
|
|
//--------------------------POST'S INFO VISIBILITY CHANGE ANIMATION METHOD--------------------------
|
|
|
//Method that animates views visibility changes
|
|
|
//Method that animates views visibility changes
|
|
|
private void visibilityChangeAnimate(final View mCard){ |
|
|
private void animatePostExtraInfoVisibility(final View dateAndPostNum){ |
|
|
//If the view is gone fade it in
|
|
|
//If the view is gone fade it in
|
|
|
if (mCard.getVisibility() == View.GONE) { |
|
|
if (dateAndPostNum.getVisibility() == View.GONE) { |
|
|
mCard.clearAnimation(); |
|
|
dateAndPostNum.clearAnimation(); |
|
|
// Prepare the View for the animation
|
|
|
// Prepare the View for the animation
|
|
|
mCard.setVisibility(View.VISIBLE); |
|
|
dateAndPostNum.setVisibility(View.VISIBLE); |
|
|
mCard.setAlpha(0.0f); |
|
|
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 { |
|
|
|
|
|
dateAndPostNum.clearAnimation(); |
|
|
|
|
|
|
|
|
// Start the animation
|
|
|
// Start the animation
|
|
|
mCard.animate() |
|
|
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--------------------------
|
|
|
|
|
|
//Method that animates views visibility changes
|
|
|
|
|
|
private void animateUserExtraInfoVisibility(final View userExtra){ |
|
|
|
|
|
//If the view is gone fade it in
|
|
|
|
|
|
if (userExtra.getVisibility() == View.GONE) { |
|
|
|
|
|
|
|
|
|
|
|
userExtra.clearAnimation(); |
|
|
|
|
|
userExtra.setVisibility(View.VISIBLE); |
|
|
|
|
|
userExtra.setAlpha(0.0f); |
|
|
|
|
|
|
|
|
|
|
|
userExtra.animate() |
|
|
.translationY(0) |
|
|
.translationY(0) |
|
|
.alpha(1.0f) |
|
|
.alpha(1.0f) |
|
|
.setDuration(300) |
|
|
.setDuration(300) |
|
@ -561,29 +752,29 @@ public class TopicActivity extends BaseActivity { |
|
|
@Override |
|
|
@Override |
|
|
public void onAnimationEnd(Animator animation) { |
|
|
public void onAnimationEnd(Animator animation) { |
|
|
super.onAnimationEnd(animation); |
|
|
super.onAnimationEnd(animation); |
|
|
mCard.setVisibility(View.VISIBLE); |
|
|
userExtra.setVisibility(View.VISIBLE); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
//If the view is visible fade it out
|
|
|
//If the view is visible fade it out
|
|
|
else { |
|
|
else { |
|
|
mCard.clearAnimation(); |
|
|
userExtra.clearAnimation(); |
|
|
|
|
|
|
|
|
// Start the animation
|
|
|
// Start the animation
|
|
|
mCard.animate() |
|
|
userExtra.animate() |
|
|
.translationY(mCard.getHeight()) |
|
|
.translationY(userExtra.getHeight()) |
|
|
.alpha(0.0f) |
|
|
.alpha(0.0f) |
|
|
.setDuration(300) |
|
|
.setDuration(300) |
|
|
.setListener(new AnimatorListenerAdapter() { |
|
|
.setListener(new AnimatorListenerAdapter() { |
|
|
@Override |
|
|
@Override |
|
|
public void onAnimationEnd(Animator animation) { |
|
|
public void onAnimationEnd(Animator animation) { |
|
|
super.onAnimationEnd(animation); |
|
|
super.onAnimationEnd(animation); |
|
|
mCard.setVisibility(View.GONE); |
|
|
userExtra.setVisibility(View.GONE); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
//-------------------------------VISIBILITY CHANGE ANIMATE METHOD END-------------------------------
|
|
|
//------------------------POST'S INFO VISIBILITY CHANGE ANIMATION METHOD END------------------------
|
|
|
|
|
|
|
|
|
//--------------------------------------CUSTOM WEBVIEW CLIENT---------------------------------------
|
|
|
//--------------------------------------CUSTOM WEBVIEW CLIENT---------------------------------------
|
|
|
private class LinkLauncher extends WebViewClient { |
|
|
private class LinkLauncher extends WebViewClient { |
|
|