Browse Source

Fixed Guest names not displaying

Sanitized titles of recent posts
Up few libs
pull/24/head
Ezerous 7 years ago
parent
commit
c267814a14
  1. 14
      app/build.gradle
  2. 1
      app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java
  3. 4
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java
  4. 6
      app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java
  5. 2
      build.gradle

14
app/build.gradle

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 27 compileSdkVersion 27
buildToolsVersion "27.0.1" buildToolsVersion "27.0.3"
defaultConfig { defaultConfig {
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
@ -28,12 +28,12 @@ android {
dependencies { dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar']) implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.1' implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.0.1' implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:support-v4:27.0.1' implementation 'com.android.support:support-v4:27.1.0'
implementation 'com.android.support:cardview-v7:27.0.1' implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.0.1' implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.google.firebase:firebase-crash:11.6.0' implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.squareup.okhttp3:okhttp:3.9.0' implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation 'com.squareup.picasso:picasso:2.5.2' implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0' implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'

1
app/src/main/java/gr/thmmy/mthmmy/activities/main/recent/RecentFragment.java

@ -153,6 +153,7 @@ public class RecentFragment extends BaseFragment {
for (int i = 0; i < recent.size(); i += 3) { for (int i = 0; i < recent.size(); i += 3) {
String link = recent.get(i).child(0).attr("href"); String link = recent.get(i).child(0).attr("href");
String title = recent.get(i).child(0).attr("title"); String title = recent.get(i).child(0).attr("title");
title = title.trim();
String lastUser = recent.get(i + 1).text(); String lastUser = recent.get(i + 1).text();
Pattern pattern = Pattern.compile("\\b (.*)"); Pattern pattern = Pattern.compile("\\b (.*)");

4
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java

@ -203,6 +203,7 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
.into(holder.thumbnail); .into(holder.thumbnail);
//Sets username,submit date, index number, subject, post's and attached files texts //Sets username,submit date, index number, subject, post's and attached files texts
Timber.i("ASDF " + currentPost.getAuthor());
holder.username.setText(currentPost.getAuthor()); holder.username.setText(currentPost.getAuthor());
holder.postDate.setText(currentPost.getPostDate()); holder.postDate.setText(currentPost.getPostDate());
if (currentPost.getPostNumber() != 0) if (currentPost.getPostNumber() != 0)
@ -274,7 +275,6 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
mNumberOfPosts = currentPost.getNumberOfPosts(); mNumberOfPosts = currentPost.getNumberOfPosts();
mPersonalText = currentPost.getPersonalText(); mPersonalText = currentPost.getPersonalText();
mNumberOfStars = currentPost.getNumberOfStars(); mNumberOfStars = currentPost.getNumberOfStars();
mUserColor = currentPost.getUserColor();
} else { } else {
mSpecialRank = null; mSpecialRank = null;
mRank = null; mRank = null;
@ -282,8 +282,8 @@ class TopicAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
mNumberOfPosts = null; mNumberOfPosts = null;
mPersonalText = null; mPersonalText = null;
mNumberOfStars = 0; mNumberOfStars = 0;
mUserColor = 0;
} }
mUserColor = currentPost.getUserColor();
if (!Objects.equals(mSpecialRank, "") && mSpecialRank != null) { if (!Objects.equals(mSpecialRank, "") && mSpecialRank != null) {
holder.specialRank.setText(mSpecialRank); holder.specialRank.setText(mSpecialRank);

6
app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java

@ -223,7 +223,7 @@ class TopicParser {
.select("td:has(div.smalltext:containsOwn(Επισκέπτης))[style^=overflow]") .select("td:has(div.smalltext:containsOwn(Επισκέπτης))[style^=overflow]")
.first().text(); .first().text();
p_userName = p_userName.substring(0, p_userName.indexOf(" Επισκέπτης")); p_userName = p_userName.substring(0, p_userName.indexOf(" Επισκέπτης"));
p_userColor = USER_COLOR_BLACK; p_userColor = USER_COLOR_YELLOW;
} else { } else {
p_userName = userName.html(); p_userName = userName.html();
p_profileURL = userName.attr("href"); p_profileURL = userName.attr("href");
@ -283,7 +283,7 @@ class TopicParser {
.select("td:has(div.smalltext:containsOwn(Guest))[style^=overflow]") .select("td:has(div.smalltext:containsOwn(Guest))[style^=overflow]")
.first().text(); .first().text();
p_userName = p_userName.substring(0, p_userName.indexOf(" Guest")); p_userName = p_userName.substring(0, p_userName.indexOf(" Guest"));
p_userColor = USER_COLOR_BLACK; p_userColor = USER_COLOR_YELLOW;
} else { } else {
p_userName = userName.html(); p_userName = userName.html();
p_profileURL = userName.attr("href"); p_profileURL = userName.attr("href");
@ -319,7 +319,7 @@ class TopicParser {
try { try {
attachedUrl = new URL(tmpAttachedFileUrlAndName.attr("href")); attachedUrl = new URL(tmpAttachedFileUrlAndName.attr("href"));
} catch (MalformedURLException e) { } catch (MalformedURLException e) {
Timber.e("Attached file malformed url", e); Timber.e(e, "Attached file malformed url");
break; break;
} }
String attachedFileName = tmpAttachedFileUrlAndName.text().substring(1); String attachedFileName = tmpAttachedFileUrlAndName.text().substring(1);

2
build.gradle

@ -7,7 +7,7 @@ buildscript {
maven { url "https://maven.google.com" } maven { url "https://maven.google.com" }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.0.0' classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.0' classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files

Loading…
Cancel
Save