pagesUrls = new SparseArray<>();
- //Page select
+ //Page select related
+ /**
+ * Used for handling bottom navigation bar's buttons long click user interactions
+ */
private final Handler repeatUpdateHandler = new Handler();
+ /**
+ * Holds the initial time delay before a click on bottom navigation bar is considered long
+ */
private final long INITIAL_DELAY = 500;
private boolean autoIncrement = false;
private boolean autoDecrement = false;
+ /**
+ * Holds the number of pages to be added or subtracted from current page on each step while a
+ * long click is held in either next or previous buttons
+ */
private static final int SMALL_STEP = 1;
+ /**
+ * Holds the number of pages to be added or subtracted from current page on each step while a
+ * long click is held in either first or last buttons
+ */
private static final int LARGE_STEP = 10;
+ /**
+ * Holds the value (index) of the page to be requested when a user interaction with bottom
+ * navigation bar occurs
+ */
private Integer pageRequestValue;
- //Bottom navigation graphics
+ //Bottom navigation bar graphics related
private LinearLayout bottomNavBar;
private ImageButton firstPage;
private ImageButton previousPage;
private TextView pageIndicator;
private ImageButton nextPage;
private ImageButton lastPage;
- //Topic's info
+ //Topic's info related
private SpannableStringBuilder topicTreeAndMods = new SpannableStringBuilder("Loading..."),
topicViewers = new SpannableStringBuilder("Loading...");
- //Other variables
- private MaterialProgressBar progressBar;
- private TextView toolbarTitle;
- private static String base_url = "";
- private String topicTitle;
- private String parsedTitle;
- private RecyclerView recyclerView;
- private String loadedPageUrl = "";
- private boolean reloadingPage = false;
@Override
@@ -464,12 +529,10 @@ public class TopicActivity extends BaseActivity {
//------------------------------------BOTTOM NAV BAR METHODS END------------------------------------
/**
- * An {@link AsyncTask} that handles asynchronous fetching of a topic page and parsing it's
- * data. {@link AsyncTask#onPostExecute(Object) OnPostExecute} method calls {@link RecyclerView#swapAdapter}
- * to build graphics.
- *
- *
Calling TopicTask's {@link AsyncTask#execute execute} method needs to have profile's url
- * as String parameter!
+ * An {@link AsyncTask} that handles asynchronous fetching of this topic page and parsing of it's
+ * data.
+ * TopicTask's {@link AsyncTask#execute execute} method needs a topic's url as String
+ * parameter.
*/
class TopicTask extends AsyncTask {
private static final int SUCCESS = 0;
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 fd95cc71..6fd1a57c 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
@@ -396,7 +396,7 @@ class TopicAdapter extends RecyclerView.Adapter {
TopicAnimations.animateUserExtraInfoVisibility(holder.username,
holder.subject, Color.parseColor("#FFFFFF"),
- Color.parseColor("#757575"), v);
+ Color.parseColor("#757575"), (LinearLayout) v);
}
});
} else {
diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAnimations.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAnimations.java
index ae4516ef..4cabbdfb 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAnimations.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAnimations.java
@@ -4,68 +4,67 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.text.TextUtils;
import android.view.View;
+import android.widget.LinearLayout;
import android.widget.TextView;
class TopicAnimations {
-//--------------------------USER'S INFO VISIBILITY CHANGE ANIMATION METHOD--------------------------
-
/**
* Method that animates view's visibility changes for user's extra info
*/
- static void animateUserExtraInfoVisibility(TextView username, TextView subject,
- int expandedColor, int collapsedColor,
- 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);
+ static void animateUserExtraInfoVisibility(final TextView username, final TextView subject,
+ int expandedColor, final int collapsedColor,
+ final LinearLayout userExtraInfo) {
+ //If the view is currently gone it fades it in
+ if (userExtraInfo.getVisibility() == View.GONE) {
+ userExtraInfo.clearAnimation();
+ userExtraInfo.setVisibility(View.VISIBLE);
+ userExtraInfo.setAlpha(0.0f);
- // Start the animation
- userExtra.animate()
+ //Animation start
+ userExtraInfo.animate()
.alpha(1.0f)
.setDuration(300)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
- userExtra.setVisibility(View.VISIBLE);
+ userExtraInfo.setVisibility(View.VISIBLE);
}
});
- //Show full username
+ //Shows full username
username.setMaxLines(Integer.MAX_VALUE); //As in the android sourcecode
username.setEllipsize(null);
- //Show full subject
+ //Shows 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 currently visible then it fades it out
else {
- userExtra.clearAnimation();
+ userExtraInfo.clearAnimation();
- // Start the animation
- userExtra.animate()
+ //Animation start
+ userExtraInfo.animate()
.alpha(0.0f)
.setDuration(300)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
- userExtra.setVisibility(View.GONE);
- }
- });
+ userExtraInfo.setVisibility(View.GONE);
- username.setMaxLines(1); //As in the android sourcecode
- username.setEllipsize(TextUtils.TruncateAt.END);
+ //Ellipsizes username
+ 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);
+ //Ellipsizes subject
+ subject.setTextColor(collapsedColor);
+ subject.setMaxLines(1); //As in the android sourcecode
+ subject.setEllipsize(TextUtils.TruncateAt.END);
+ }
+ });
}
}
-//------------------------POST'S INFO VISIBILITY CHANGE ANIMATION METHOD END------------------------
-
}