diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 45de250a..c4189aa8 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -4,6 +4,8 @@ + + { private static final String TAG = "TopicAdapter"; @@ -54,7 +52,7 @@ class TopicAdapter extends RecyclerView.Adapter { private final Context context; private final List postsList; private boolean foundPostFocus = false; - private ArrayList viewProperties = new ArrayList<>(); + private final ArrayList viewProperties = new ArrayList<>(); private static final int isPostDateAndNumberVisibile = 0; private static final int isUserExtraInfoVisibile = 1; private static final int isQuoteButtonChecked = 2; @@ -195,13 +193,29 @@ class TopicAdapter extends RecyclerView.Adapter { if (currentPost.getAttachedFiles().size() != 0) { holder.bodyFooterDivider.setVisibility(View.VISIBLE); - for (String attachedFile : currentPost.getAttachedFiles()) { - TextView attached = new TextView(context); + String faFile = context.getResources().getString(R.string.fa_file); + int filesTextColor = context.getResources().getColor(R.color.accent); + + for (final String[] attachedFile : currentPost.getAttachedFiles()) { + final TextView attached = new TextView(context); attached.setTextSize(10f); attached.setClickable(true); - attached.setMovementMethod(LinkMovementMethod.getInstance()); - - attached.setText(Html.fromHtml(attachedFile)); + attached.setTypeface(Typeface.createFromAsset(context.getAssets() + , "fonts/fontawesome-webfont.ttf")); + attached.setText(faFile + " " + attachedFile[1] + attachedFile[2]); + attached.setTextColor(filesTextColor); + attached.setPadding(0, 3, 0, 3); + + attached.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + try { + downloadFileAsync(attachedFile[0], attachedFile[1], context); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); holder.postFooter.addView(attached); } @@ -243,7 +257,8 @@ class TopicAdapter extends RecyclerView.Adapter { holder.personalText.setVisibility(View.GONE); if (c_numberOfStars != 0) { - holder.stars.setTypeface(FontManager.getTypeface(context, FONTAWESOME)); + holder.stars.setTypeface(Typeface.createFromAsset(context.getAssets() + , "fonts/fontawesome-webfont.ttf")); String aStar = context.getResources().getString(R.string.fa_icon_star); String usersStars = ""; diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java index eb5b128e..93c7da7c 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicParser.java @@ -1,7 +1,6 @@ package gr.thmmy.mthmmy.activities.topic; import android.graphics.Color; -import android.util.Log; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; @@ -92,7 +91,7 @@ class TopicParser { p_specialRank, p_gender, p_personalText, p_numberOfPosts; int p_postNum, p_postIndex, p_numberOfStars, p_userColor; boolean p_isDeleted = false; - ArrayList p_attachedFiles; + ArrayList p_attachedFiles; //Initialize variables p_rank = "Rank"; @@ -185,17 +184,24 @@ class TopicParser { //Find attached file's urls, names and info, if present Elements postAttachments = item.select("div:containsOwn(downloaded)"); if (postAttachments != null) { - for (Element attached : postAttachments) { + Elements attachedFiles = postAttachments.select("a"); + String postAttachmentsText = postAttachments.text(); + + for(int i = 0; i attachedFiles; + private final ArrayList attachedFiles; public Post(String thumbnailUrl, String author, String subject, String content , int postIndex, int postNumber, String postDate, String rank , String special_rank, String gender, String numberOfPosts , String personalText, int numberOfStars, int userColor - , ArrayList attachedFiles) { + , ArrayList attachedFiles) { this.thumbnailUrl = thumbnailUrl; this.author = author; this.subject = subject; @@ -48,7 +48,7 @@ public class Post { public Post(String thumbnailUrl, String author, String subject, String content , int postIndex, int postNumber, String postDate, int userColor - , ArrayList attachedFiles) { + , ArrayList attachedFiles) { this.thumbnailUrl = thumbnailUrl; this.author = author; this.subject = subject; @@ -128,7 +128,7 @@ public class Post { return userColor; } - public ArrayList getAttachedFiles() { + public ArrayList getAttachedFiles() { return attachedFiles; } } diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/FontManager.java b/app/src/main/java/gr/thmmy/mthmmy/utils/FontManager.java deleted file mode 100644 index 72286ca3..00000000 --- a/app/src/main/java/gr/thmmy/mthmmy/utils/FontManager.java +++ /dev/null @@ -1,14 +0,0 @@ -package gr.thmmy.mthmmy.utils; - -import android.content.Context; -import android.graphics.Typeface; - -public class FontManager { - - public static final String ROOT = "fonts/", - FONTAWESOME = ROOT + "fontawesome-webfont.ttf"; - - public static Typeface getTypeface(Context context, String font) { - return Typeface.createFromAsset(context.getAssets(), font); - } -} \ No newline at end of file diff --git a/app/src/main/res/drawable/logo_animated.gif b/app/src/main/res/drawable/logo_animated.gif index b1fb737b..5242fa70 100644 Binary files a/app/src/main/res/drawable/logo_animated.gif and b/app/src/main/res/drawable/logo_animated.gif differ diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 9c3a94ff..2da9c607 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -3,8 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:fitsSystemWindows="true" - android:background="@color/background"> + android:background="@color/background" + android:fitsSystemWindows="true"> - - +