Browse Source

Minor fixes

pull/24/head
Apostolos Fanakis 8 years ago
parent
commit
b3d17994c3
  1. 8
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java
  2. 27
      app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java

8
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardActivity.java

@ -218,14 +218,18 @@ public class BoardActivity extends BaseActivity implements BoardAdapter.OnLoadMo
pLastPost.substring(pLastPost.indexOf(" in ") + 1, pLastPost.indexOf(" by ")) + pLastPost.substring(pLastPost.indexOf(" in ") + 1, pLastPost.indexOf(" by ")) +
"\n" + "\n" +
pLastPost.substring(pLastPost.lastIndexOf(" by ") + 1); pLastPost.substring(pLastPost.lastIndexOf(" by ") + 1);
} else { pLastPostUrl = subBoardCol.select("a").first().attr("href");
} else if (pLastPost.contains(" σε ")) {
pLastPost = pLastPost.substring(0, pLastPost.indexOf(" σε ")) + pLastPost = pLastPost.substring(0, pLastPost.indexOf(" σε ")) +
"\n" + "\n" +
pLastPost.substring(pLastPost.indexOf(" σε ") + 1, pLastPost.indexOf(" από ")) + pLastPost.substring(pLastPost.indexOf(" σε ") + 1, pLastPost.indexOf(" από ")) +
"\n" + "\n" +
pLastPost.substring(pLastPost.lastIndexOf(" από ") + 1); pLastPost.substring(pLastPost.lastIndexOf(" από ") + 1);
pLastPostUrl = subBoardCol.select("a").first().attr("href");
} else {
pLastPost = "No posts yet.";
pLastPostUrl = "";
} }
pLastPostUrl = subBoardCol.select("a").first().attr("href");
} else { } else {
pUrl = subBoardCol.select("a").first().attr("href"); pUrl = subBoardCol.select("a").first().attr("href");
pTitle = subBoardCol.select("a").first().text(); pTitle = subBoardCol.select("a").first().text();

27
app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java

@ -14,6 +14,7 @@ import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects;
import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.R;
import gr.thmmy.mthmmy.activities.topic.TopicActivity; import gr.thmmy.mthmmy.activities.topic.TopicActivity;
@ -164,18 +165,20 @@ class BoardAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
subBoardViewHolder.boardMods.setText(subBoard.getMods()); subBoardViewHolder.boardMods.setText(subBoard.getMods());
subBoardViewHolder.boardStats.setText(subBoard.getStats()); subBoardViewHolder.boardStats.setText(subBoard.getStats());
subBoardViewHolder.boardLastPost.setText(subBoard.getLastPost()); subBoardViewHolder.boardLastPost.setText(subBoard.getLastPost());
subBoardViewHolder.boardLastPost.setOnClickListener(new View.OnClickListener() { if (!Objects.equals(subBoard.getLastPostUrl(), "")) {
@Override subBoardViewHolder.boardLastPost.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) { @Override
Intent intent = new Intent(context, TopicActivity.class); public void onClick(View view) {
Bundle extras = new Bundle(); Intent intent = new Intent(context, TopicActivity.class);
extras.putString(BUNDLE_TOPIC_URL, subBoard.getLastPostUrl()); Bundle extras = new Bundle();
//Doesn't put an already ellipsized topic title in Bundle extras.putString(BUNDLE_TOPIC_URL, subBoard.getLastPostUrl());
intent.putExtras(extras); //Doesn't put an already ellipsized topic title in Bundle
intent.setFlags(FLAG_ACTIVITY_NEW_TASK); intent.putExtras(extras);
context.startActivity(intent); intent.setFlags(FLAG_ACTIVITY_NEW_TASK);
} context.startActivity(intent);
}); }
});
}
} else if (holder instanceof TopicViewHolder) { } else if (holder instanceof TopicViewHolder) {
final Topic topic = parsedTopics.get(position - parsedSubBoards.size() - 1 - 1); final Topic topic = parsedTopics.get(position - parsedSubBoards.size() - 1 - 1);
final TopicViewHolder topicViewHolder = (TopicViewHolder) holder; final TopicViewHolder topicViewHolder = (TopicViewHolder) holder;

Loading…
Cancel
Save