|
@ -11,7 +11,6 @@ import android.os.Handler; |
|
|
import android.support.design.widget.FloatingActionButton; |
|
|
import android.support.design.widget.FloatingActionButton; |
|
|
import android.support.v7.app.AlertDialog; |
|
|
import android.support.v7.app.AlertDialog; |
|
|
import android.support.v7.widget.RecyclerView; |
|
|
import android.support.v7.widget.RecyclerView; |
|
|
import android.support.v7.widget.Toolbar; |
|
|
|
|
|
import android.text.Html; |
|
|
import android.text.Html; |
|
|
import android.text.SpannableStringBuilder; |
|
|
import android.text.SpannableStringBuilder; |
|
|
import android.text.TextUtils; |
|
|
import android.text.TextUtils; |
|
@ -143,8 +142,8 @@ public class TopicActivity extends BaseActivity { |
|
|
thisPageBookmark = new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl)); |
|
|
thisPageBookmark = new Bookmark(topicTitle, ThmmyPage.getTopicId(topicPageUrl)); |
|
|
|
|
|
|
|
|
//Initializes graphics
|
|
|
//Initializes graphics
|
|
|
toolbar = (Toolbar) findViewById(R.id.toolbar); |
|
|
toolbar = findViewById(R.id.toolbar); |
|
|
toolbarTitle = (TextView) toolbar.findViewById(R.id.toolbar_title); |
|
|
toolbarTitle = toolbar.findViewById(R.id.toolbar_title); |
|
|
toolbarTitle.setSingleLine(true); |
|
|
toolbarTitle.setSingleLine(true); |
|
|
toolbarTitle.setEllipsize(TextUtils.TruncateAt.MARQUEE); |
|
|
toolbarTitle.setEllipsize(TextUtils.TruncateAt.MARQUEE); |
|
|
toolbarTitle.setMarqueeRepeatLimit(-1); |
|
|
toolbarTitle.setMarqueeRepeatLimit(-1); |
|
@ -162,11 +161,11 @@ public class TopicActivity extends BaseActivity { |
|
|
|
|
|
|
|
|
createDrawer(); |
|
|
createDrawer(); |
|
|
|
|
|
|
|
|
progressBar = (MaterialProgressBar) findViewById(R.id.progressBar); |
|
|
progressBar = findViewById(R.id.progressBar); |
|
|
|
|
|
|
|
|
postsList = new ArrayList<>(); |
|
|
postsList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
recyclerView = (RecyclerView) findViewById(R.id.topic_recycler_view); |
|
|
recyclerView = findViewById(R.id.topic_recycler_view); |
|
|
recyclerView.setHasFixedSize(true); |
|
|
recyclerView.setHasFixedSize(true); |
|
|
recyclerView.setOnTouchListener( |
|
|
recyclerView.setOnTouchListener( |
|
|
new View.OnTouchListener() { |
|
|
new View.OnTouchListener() { |
|
@ -183,9 +182,9 @@ public class TopicActivity extends BaseActivity { |
|
|
topicAdapter = new TopicAdapter(this, postsList, topicTask); |
|
|
topicAdapter = new TopicAdapter(this, postsList, topicTask); |
|
|
recyclerView.setAdapter(topicAdapter); |
|
|
recyclerView.setAdapter(topicAdapter); |
|
|
|
|
|
|
|
|
replyFAB = (FloatingActionButton) findViewById(R.id.topic_fab); |
|
|
replyFAB = findViewById(R.id.topic_fab); |
|
|
replyFAB.setEnabled(false); |
|
|
replyFAB.setEnabled(false); |
|
|
bottomNavBar = (LinearLayout) findViewById(R.id.bottom_navigation_bar); |
|
|
bottomNavBar = findViewById(R.id.bottom_navigation_bar); |
|
|
if (!sessionManager.isLoggedIn()) replyFAB.hide(); |
|
|
if (!sessionManager.isLoggedIn()) replyFAB.hide(); |
|
|
else { |
|
|
else { |
|
|
replyFAB.setOnClickListener(new View.OnClickListener() { |
|
|
replyFAB.setOnClickListener(new View.OnClickListener() { |
|
@ -204,11 +203,11 @@ public class TopicActivity extends BaseActivity { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//Sets bottom navigation bar
|
|
|
//Sets bottom navigation bar
|
|
|
firstPage = (ImageButton) findViewById(R.id.page_first_button); |
|
|
firstPage = findViewById(R.id.page_first_button); |
|
|
previousPage = (ImageButton) findViewById(R.id.page_previous_button); |
|
|
previousPage = findViewById(R.id.page_previous_button); |
|
|
pageIndicator = (TextView) findViewById(R.id.page_indicator); |
|
|
pageIndicator = findViewById(R.id.page_indicator); |
|
|
nextPage = (ImageButton) findViewById(R.id.page_next_button); |
|
|
nextPage = findViewById(R.id.page_next_button); |
|
|
lastPage = (ImageButton) findViewById(R.id.page_last_button); |
|
|
lastPage = findViewById(R.id.page_last_button); |
|
|
|
|
|
|
|
|
initDecrementButton(firstPage, LARGE_STEP); |
|
|
initDecrementButton(firstPage, LARGE_STEP); |
|
|
initDecrementButton(previousPage, SMALL_STEP); |
|
|
initDecrementButton(previousPage, SMALL_STEP); |
|
@ -242,11 +241,10 @@ public class TopicActivity extends BaseActivity { |
|
|
LayoutInflater inflater = this.getLayoutInflater(); |
|
|
LayoutInflater inflater = this.getLayoutInflater(); |
|
|
LinearLayout infoDialog = (LinearLayout) inflater.inflate(R.layout.dialog_topic_info |
|
|
LinearLayout infoDialog = (LinearLayout) inflater.inflate(R.layout.dialog_topic_info |
|
|
, null); |
|
|
, null); |
|
|
((TextView) infoDialog.findViewById(R.id.dialog_title)).setText("Info"); |
|
|
TextView treeAndMods = infoDialog.findViewById(R.id.topic_tree_and_mods); |
|
|
TextView treeAndMods = (TextView) infoDialog.findViewById(R.id.topic_tree_and_mods); |
|
|
|
|
|
treeAndMods.setText(topicTreeAndMods); |
|
|
treeAndMods.setText(topicTreeAndMods); |
|
|
treeAndMods.setMovementMethod(LinkMovementMethod.getInstance()); |
|
|
treeAndMods.setMovementMethod(LinkMovementMethod.getInstance()); |
|
|
TextView usersViewing = (TextView) infoDialog.findViewById(R.id.users_viewing); |
|
|
TextView usersViewing = infoDialog.findViewById(R.id.users_viewing); |
|
|
usersViewing.setText(topicViewers); |
|
|
usersViewing.setText(topicViewers); |
|
|
usersViewing.setMovementMethod(LinkMovementMethod.getInstance()); |
|
|
usersViewing.setMovementMethod(LinkMovementMethod.getInstance()); |
|
|
|
|
|
|
|
@ -318,25 +316,25 @@ public class TopicActivity extends BaseActivity { |
|
|
lastPage.setEnabled(enabled); |
|
|
lastPage.setEnabled(enabled); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void paginationEnabledExcept(boolean enabled, View exception) { |
|
|
private void paginationDisable(View exception) { |
|
|
if (exception == firstPage) { |
|
|
if (exception == firstPage) { |
|
|
previousPage.setEnabled(enabled); |
|
|
previousPage.setEnabled(false); |
|
|
nextPage.setEnabled(enabled); |
|
|
nextPage.setEnabled(false); |
|
|
lastPage.setEnabled(enabled); |
|
|
lastPage.setEnabled(false); |
|
|
} else if (exception == previousPage) { |
|
|
} else if (exception == previousPage) { |
|
|
firstPage.setEnabled(enabled); |
|
|
firstPage.setEnabled(false); |
|
|
nextPage.setEnabled(enabled); |
|
|
nextPage.setEnabled(false); |
|
|
lastPage.setEnabled(enabled); |
|
|
lastPage.setEnabled(false); |
|
|
} else if (exception == nextPage) { |
|
|
} else if (exception == nextPage) { |
|
|
firstPage.setEnabled(enabled); |
|
|
firstPage.setEnabled(false); |
|
|
previousPage.setEnabled(enabled); |
|
|
previousPage.setEnabled(false); |
|
|
lastPage.setEnabled(enabled); |
|
|
lastPage.setEnabled(false); |
|
|
} else if (exception == lastPage) { |
|
|
} else if (exception == lastPage) { |
|
|
firstPage.setEnabled(enabled); |
|
|
firstPage.setEnabled(false); |
|
|
previousPage.setEnabled(enabled); |
|
|
previousPage.setEnabled(false); |
|
|
nextPage.setEnabled(enabled); |
|
|
nextPage.setEnabled(false); |
|
|
} else { |
|
|
} else { |
|
|
paginationEnabled(enabled); |
|
|
paginationEnabled(false); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -357,7 +355,7 @@ public class TopicActivity extends BaseActivity { |
|
|
increment.setOnLongClickListener( |
|
|
increment.setOnLongClickListener( |
|
|
new View.OnLongClickListener() { |
|
|
new View.OnLongClickListener() { |
|
|
public boolean onLongClick(View arg0) { |
|
|
public boolean onLongClick(View arg0) { |
|
|
paginationEnabledExcept(false, arg0); |
|
|
paginationDisable(arg0); |
|
|
autoIncrement = true; |
|
|
autoIncrement = true; |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), INITIAL_DELAY); |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), INITIAL_DELAY); |
|
|
return false; |
|
|
return false; |
|
@ -405,7 +403,7 @@ public class TopicActivity extends BaseActivity { |
|
|
decrement.setOnLongClickListener( |
|
|
decrement.setOnLongClickListener( |
|
|
new View.OnLongClickListener() { |
|
|
new View.OnLongClickListener() { |
|
|
public boolean onLongClick(View arg0) { |
|
|
public boolean onLongClick(View arg0) { |
|
|
paginationEnabledExcept(false, arg0); |
|
|
paginationDisable(arg0); |
|
|
autoDecrement = true; |
|
|
autoDecrement = true; |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), INITIAL_DELAY); |
|
|
repeatUpdateHandler.postDelayed(new RepetitiveUpdater(step), INITIAL_DELAY); |
|
|
return false; |
|
|
return false; |
|
|