Browse Source

roz

pull/61/merge
Thodoris1999 6 years ago
parent
commit
e396d1b097
  1. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutAdapter.java
  2. 3
      app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutboxTask.java
  3. 8
      app/src/main/java/gr/thmmy/mthmmy/model/Shout.java

1
app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutAdapter.java

@ -56,6 +56,7 @@ public class ShoutAdapter extends CustomRecyclerView.Adapter<ShoutAdapter.ShoutV
public void onBindViewHolder(@NonNull ShoutViewHolder holder, int position) { public void onBindViewHolder(@NonNull ShoutViewHolder holder, int position) {
Shout currentShout = shouts[position]; Shout currentShout = shouts[position];
holder.author.setText(currentShout.getShouter()); holder.author.setText(currentShout.getShouter());
if (currentShout.isMemberOfTheMonth()) holder.author.setTextColor(context.getResources().getColor(R.color.member_of_the_month));
holder.author.setOnClickListener(view -> { holder.author.setOnClickListener(view -> {
Intent intent = new Intent(context, ProfileActivity.class); Intent intent = new Intent(context, ProfileActivity.class);
Bundle extras = new Bundle(); Bundle extras = new Bundle();

3
app/src/main/java/gr/thmmy/mthmmy/activities/main/shoutbox/ShoutboxTask.java

@ -29,6 +29,7 @@ public class ShoutboxTask extends NewParseTask<Shoutbox> {
Element link = user.select("a").first(); Element link = user.select("a").first();
String profileUrl = link.attr("href"); String profileUrl = link.attr("href");
String profileName = link.text(); String profileName = link.text();
boolean memberOfTheMonth = link.attr("style").contains("#EA00FF");
Element date = shout.child(1); Element date = shout.child(1);
String dateString = date.text(); String dateString = date.text();
@ -36,7 +37,7 @@ public class ShoutboxTask extends NewParseTask<Shoutbox> {
Element content = shout.child(2); Element content = shout.child(2);
String shoutContent = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" + String shoutContent = "<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" />" +
ParseHelpers.youtubeEmbeddedFix(content); ParseHelpers.youtubeEmbeddedFix(content);
shouts.add(new Shout(profileName, profileUrl, dateString, shoutContent)); shouts.add(new Shout(profileName, profileUrl, dateString, shoutContent, memberOfTheMonth));
} }
Element shoutboxForm = document.select("form[name=tp-shoutbox]").first(); Element shoutboxForm = document.select("form[name=tp-shoutbox]").first();

8
app/src/main/java/gr/thmmy/mthmmy/model/Shout.java

@ -2,12 +2,14 @@ package gr.thmmy.mthmmy.model;
public class Shout { public class Shout {
private final String shouter, shouterProfileURL, date, shout; private final String shouter, shouterProfileURL, date, shout;
private final boolean memberOfTheMonth;
public Shout(String shouter, String shouterProfileURL, String date, String shout) { public Shout(String shouter, String shouterProfileURL, String date, String shout, boolean memberOfTheMonth) {
this.shouter = shouter; this.shouter = shouter;
this.shouterProfileURL = shouterProfileURL; this.shouterProfileURL = shouterProfileURL;
this.date = date; this.date = date;
this.shout = shout; this.shout = shout;
this.memberOfTheMonth = memberOfTheMonth;
} }
public String getShouter() { public String getShouter() {
@ -25,4 +27,8 @@ public class Shout {
public String getShout() { public String getShout() {
return shout; return shout;
} }
public boolean isMemberOfTheMonth() {
return memberOfTheMonth;
}
} }

Loading…
Cancel
Save