From b717fde7b80f7cbd448cddde1d25da8be3378ece Mon Sep 17 00:00:00 2001 From: Ezerous Date: Sun, 7 Jun 2020 23:58:57 +0300 Subject: [PATCH] ProfileActivity improvements --- app/src/main/assets/style.css | 16 ++++++------- .../mthmmy/activities/board/BoardAdapter.java | 4 ++-- .../latestPosts/LatestPostsAdapter.java | 4 ++-- .../latestPosts/LatestPostsFragment.java | 2 +- .../profile/stats/StatsFragment.java | 9 ++++++- .../profile/summary/SummaryFragment.java | 6 ++--- .../res/drawable/member_of_the_month_card.xml | 2 +- app/src/main/res/drawable/mention_card.xml | 2 +- .../layout-v21/activity_topic_post_row.xml | 8 +++---- .../layout/activity_board_sub_board_row.xml | 2 +- .../res/layout/activity_downloads_row.xml | 2 +- .../res/layout/activity_topic_edit_row.xml | 4 ++-- .../res/layout/activity_topic_post_row.xml | 8 +++---- .../layout/activity_topic_quick_reply_row.xml | 4 ++-- .../res/layout/editor_view_color_picker.xml | 2 +- ....xml => fragment_profile_latest_posts.xml} | 0 ...nt_profile_latest_posts_empty_message.xml} | 0 ... => fragment_profile_latest_posts_row.xml} | 4 ++-- ...t_stats.xml => fragment_profile_stats.xml} | 24 ++++++++++--------- ...mmary.xml => fragment_profile_summary.xml} | 2 +- .../layout/fragment_shoutbox_shout_row.xml | 4 ++-- app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/dimens.xml | 1 + app/src/main/res/values/styles.xml | 2 +- 24 files changed, 62 insertions(+), 52 deletions(-) rename app/src/main/res/layout/{fragment_latest_posts.xml => fragment_profile_latest_posts.xml} (100%) rename app/src/main/res/layout/{fragment_latest_posts_empty_message.xml => fragment_profile_latest_posts_empty_message.xml} (100%) rename app/src/main/res/layout/{fragment_latest_posts_row.xml => fragment_profile_latest_posts_row.xml} (94%) rename app/src/main/res/layout/{fragment_stats.xml => fragment_profile_stats.xml} (83%) rename app/src/main/res/layout/{fragment_summary.xml => fragment_profile_summary.xml} (87%) diff --git a/app/src/main/assets/style.css b/app/src/main/assets/style.css index f2b8c557..4a9fc801 100644 --- a/app/src/main/assets/style.css +++ b/app/src/main/assets/style.css @@ -156,7 +156,7 @@ a img } /* A quote, perhaps from another post. */ .quote -{ +{ font-family: tahoma, sans-serif; color: #FFFFFF; background-color: #404D50; @@ -420,16 +420,16 @@ ul#menubox li.m5 margin-bottom: 1em; padding-bottom: 1em; } -.clearfix:after +.clearfix:after { - content: "."; - display: block; - height: 0; - clear: both; + content: "."; + display: block; + height: 0; + clear: both; visibility: hidden; } -.clearfix +.clearfix { display: inline-block; } @@ -519,7 +519,7 @@ img } .customSignature{ - background: #323232; + background: #3C3F41; } [style="color: blue;"] diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java index f9093cf8..c508fdc2 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/board/BoardAdapter.java @@ -77,11 +77,11 @@ class BoardAdapter extends RecyclerView.Adapter { subBoardTitle.setText(context.getString(R.string.child_board_title)); subBoardTitle.setTypeface(subBoardTitle.getTypeface(), Typeface.BOLD); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { - subBoardTitle.setBackgroundColor(context.getColor(R.color.card_background)); + subBoardTitle.setBackgroundColor(context.getColor(R.color.background_light)); subBoardTitle.setTextColor(context.getColor(R.color.accent)); } else { //noinspection deprecation - subBoardTitle.setBackgroundColor(context.getResources().getColor(R.color.card_background)); + subBoardTitle.setBackgroundColor(context.getResources().getColor(R.color.background_light)); //noinspection deprecation subBoardTitle.setTextColor(context.getResources().getColor(R.color.accent)); } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java index fbfb9300..2b5febed 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsAdapter.java @@ -53,12 +53,12 @@ class LatestPostsAdapter extends RecyclerView.Adapter { public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == VIEW_TYPE_EMPTY) { View view = LayoutInflater.from(parent.getContext()). - inflate(R.layout.fragment_latest_posts_empty_message, parent, false); + inflate(R.layout.fragment_profile_latest_posts_empty_message, parent, false); return new RecyclerView.ViewHolder(view){}; } if (viewType == VIEW_TYPE_ITEM) { View view = LayoutInflater.from(parent.getContext()). - inflate(R.layout.fragment_latest_posts_row, parent, false); + inflate(R.layout.fragment_profile_latest_posts_row, parent, false); return new LatestPostViewHolder(view); } else if (viewType == VIEW_TYPE_LOADING) { View view = LayoutInflater.from(parent.getContext()). diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java index b23cc601..c89234ec 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/latestPosts/LatestPostsFragment.java @@ -84,7 +84,7 @@ public class LatestPostsFragment extends BaseFragment implements LatestPostsAdap @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View rootView = inflater.inflate(R.layout.fragment_latest_posts, container, false); + final View rootView = inflater.inflate(R.layout.fragment_profile_latest_posts, container, false); latestPostsAdapter = new LatestPostsAdapter(this.getContext(), fragmentInteractionListener, parsedTopicSummaries); RecyclerView mainContent = rootView.findViewById(R.id.profile_latest_posts_recycler); mainContent.setAdapter(latestPostsAdapter); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java index 7f517f1e..3c084dd5 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/stats/StatsFragment.java @@ -36,6 +36,8 @@ import org.jsoup.select.Elements; import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.net.ssl.SSLHandshakeException; @@ -90,7 +92,7 @@ public class StatsFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View rootView = inflater.inflate(R.layout.fragment_stats, container, false); + final View rootView = inflater.inflate(R.layout.fragment_profile_stats, container, false); mainContent = rootView.findViewById(R.id.main_content); progressBar = rootView.findViewById(R.id.progressBar); if (profileStatsTask!=null && profileStatsTask.getStatus() == AsyncTask.Status.FINISHED) @@ -172,6 +174,11 @@ public class StatsFragment extends Fragment { { Elements titleRows = statsPage.select("table.bordercolor[align]>tbody>tr.titlebg"); generalStatisticsTitle = titleRows.first().text(); + Pattern pattern = Pattern.compile("(.+)\\s-"); + Matcher matcher = pattern.matcher(generalStatisticsTitle); + if (matcher.find()) + generalStatisticsTitle = matcher.group(1); + if (userHasPosts) { postingActivityByTimeTitle = titleRows.get(1).text(); mostPopularBoardsByPostsTitle = titleRows.last().select("td").first().text(); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java index c035ca26..cf41e751 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/profile/summary/SummaryFragment.java @@ -9,7 +9,6 @@ import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.webkit.WebView; import android.widget.LinearLayout; import android.widget.TextView; @@ -25,6 +24,7 @@ import java.util.Objects; import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.utils.parsing.ParseHelpers; +import gr.thmmy.mthmmy.views.ReactiveWebView; import timber.log.Timber; /** @@ -76,7 +76,7 @@ public class SummaryFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - final View rootView = inflater.inflate(R.layout.fragment_summary, container, false); + final View rootView = inflater.inflate(R.layout.fragment_profile_summary, container, false); mainContent = rootView.findViewById(R.id.profile_activity_content); if (!parsedProfileSummaryData.isEmpty() && isAdded()) populateLayout(); @@ -169,7 +169,7 @@ public class SummaryFragment extends Fragment { for (String profileSummaryRow : parsedProfileSummaryData) { if (profileSummaryRow.contains("Signature") || profileSummaryRow.contains("Υπογραφή")) { //This may contain css - WebView signatureEntry = new WebView(this.getContext()); + ReactiveWebView signatureEntry = new ReactiveWebView(this.getContext()); signatureEntry.setBackgroundColor(Color.argb(1, 255, 255, 255)); signatureEntry.loadDataWithBaseURL("file:///android_asset/", profileSummaryRow, "text/html", "UTF-8", null); diff --git a/app/src/main/res/drawable/member_of_the_month_card.xml b/app/src/main/res/drawable/member_of_the_month_card.xml index 2e277278..fe5d8369 100644 --- a/app/src/main/res/drawable/member_of_the_month_card.xml +++ b/app/src/main/res/drawable/member_of_the_month_card.xml @@ -1,6 +1,6 @@ - + diff --git a/app/src/main/res/drawable/mention_card.xml b/app/src/main/res/drawable/mention_card.xml index 974d3d67..b983dca6 100644 --- a/app/src/main/res/drawable/mention_card.xml +++ b/app/src/main/res/drawable/mention_card.xml @@ -1,6 +1,6 @@ - + diff --git a/app/src/main/res/layout-v21/activity_topic_post_row.xml b/app/src/main/res/layout-v21/activity_topic_post_row.xml index e51a2887..6d27a5a9 100644 --- a/app/src/main/res/layout-v21/activity_topic_post_row.xml +++ b/app/src/main/res/layout-v21/activity_topic_post_row.xml @@ -15,7 +15,7 @@ android:layout_height="match_parent" android:layout_gravity="center" android:foreground="?android:attr/selectableItemBackground" - card_view:cardBackgroundColor="@color/card_background" + card_view:cardBackgroundColor="@color/background_light" card_view:cardCornerRadius="5dp" card_view:cardElevation="2dp" card_view:cardPreventCornerOverlap="false" @@ -89,7 +89,7 @@ android:layout_width="@dimen/post_image_button" android:layout_height="@dimen/post_image_button" android:layout_marginTop="9dp" - android:background="@color/card_background" + android:background="@color/background_light" android:clickable="true" android:contentDescription="@string/post_quote_button" android:focusable="true" @@ -111,7 +111,7 @@ android:layout_height="@dimen/post_image_button" android:layout_marginTop="9dp" android:layout_marginEnd="9dp" - android:background="@color/card_background" + android:background="@color/background_light" android:clickable="true" android:contentDescription="@string/post_overflow_menu_button" android:focusable="true" @@ -232,7 +232,7 @@ android:layout_gravity="center" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" - android:background="@color/card_background" + android:background="@color/background_light" android:clickable="true" android:focusable="true" android:text="@string/post" /> diff --git a/app/src/main/res/layout/activity_board_sub_board_row.xml b/app/src/main/res/layout/activity_board_sub_board_row.xml index bcbe3ec7..97335218 100644 --- a/app/src/main/res/layout/activity_board_sub_board_row.xml +++ b/app/src/main/res/layout/activity_board_sub_board_row.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/card_background"> + android:background="@color/background_light"> diff --git a/app/src/main/res/layout/activity_topic_post_row.xml b/app/src/main/res/layout/activity_topic_post_row.xml index cda15474..a0df17df 100644 --- a/app/src/main/res/layout/activity_topic_post_row.xml +++ b/app/src/main/res/layout/activity_topic_post_row.xml @@ -15,7 +15,7 @@ android:layout_height="match_parent" android:layout_gravity="center" android:foreground="?android:attr/selectableItemBackground" - card_view:cardBackgroundColor="@color/card_background" + card_view:cardBackgroundColor="@color/background_light" card_view:cardCornerRadius="5dp" card_view:cardElevation="2dp" card_view:cardPreventCornerOverlap="false" @@ -88,7 +88,7 @@ android:layout_width="@dimen/post_image_button" android:layout_height="@dimen/post_image_button" android:layout_marginTop="9dp" - android:background="@color/card_background" + android:background="@color/background_light" android:clickable="true" android:contentDescription="@string/post_quote_button" android:focusable="true" @@ -110,7 +110,7 @@ android:layout_height="@dimen/post_image_button" android:layout_marginTop="9dp" android:layout_marginEnd="9dp" - android:background="@color/card_background" + android:background="@color/background_light" android:clickable="true" android:contentDescription="@string/post_overflow_menu_button" android:focusable="true" @@ -232,7 +232,7 @@ android:layout_gravity="center" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" - android:background="@color/card_background" + android:background="@color/background_light" android:clickable="true" android:focusable="true" android:text="@string/post" /> diff --git a/app/src/main/res/layout/activity_topic_quick_reply_row.xml b/app/src/main/res/layout/activity_topic_quick_reply_row.xml index 328aa9b8..0e7e34a3 100644 --- a/app/src/main/res/layout/activity_topic_quick_reply_row.xml +++ b/app/src/main/res/layout/activity_topic_quick_reply_row.xml @@ -13,7 +13,7 @@ android:layout_height="match_parent" android:layout_gravity="center" android:foreground="?android:attr/selectableItemBackground" - card_view:cardBackgroundColor="@color/card_background" + card_view:cardBackgroundColor="@color/background_light" card_view:cardCornerRadius="5dp" card_view:cardElevation="2dp" card_view:cardPreventCornerOverlap="false" @@ -82,7 +82,7 @@ android:layout_height="wrap_content" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" - android:background="@color/card_background" + android:background="@color/background_light" card_view:hint="Post message" /> diff --git a/app/src/main/res/layout/editor_view_color_picker.xml b/app/src/main/res/layout/editor_view_color_picker.xml index be1ce295..83f67237 100644 --- a/app/src/main/res/layout/editor_view_color_picker.xml +++ b/app/src/main/res/layout/editor_view_color_picker.xml @@ -2,7 +2,7 @@ + android:background="@color/background_light"> + android:background="@color/background_light"> diff --git a/app/src/main/res/layout/fragment_stats.xml b/app/src/main/res/layout/fragment_profile_stats.xml similarity index 83% rename from app/src/main/res/layout/fragment_stats.xml rename to app/src/main/res/layout/fragment_profile_stats.xml index 7b5edb41..cf7eefe1 100644 --- a/app/src/main/res/layout/fragment_stats.xml +++ b/app/src/main/res/layout/fragment_profile_stats.xml @@ -3,7 +3,8 @@ xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:background="@color/background_light"> + android:background="@color/background_light"> + android:layout_marginBottom="14dp"/> diff --git a/app/src/main/res/layout/fragment_summary.xml b/app/src/main/res/layout/fragment_profile_summary.xml similarity index 87% rename from app/src/main/res/layout/fragment_summary.xml rename to app/src/main/res/layout/fragment_profile_summary.xml index 9673cf08..67aaaeb8 100644 --- a/app/src/main/res/layout/fragment_summary.xml +++ b/app/src/main/res/layout/fragment_profile_summary.xml @@ -4,7 +4,7 @@ android:id="@+id/nested_scroll" android:layout_width="match_parent" android:layout_height="match_parent" - android:background="@color/background" + android:background="@color/background_light" android:paddingEnd="16dp" android:paddingStart="16dp" android:scrollbars="none"> diff --git a/app/src/main/res/layout/fragment_shoutbox_shout_row.xml b/app/src/main/res/layout/fragment_shoutbox_shout_row.xml index fb677f04..0bf57058 100644 --- a/app/src/main/res/layout/fragment_shoutbox_shout_row.xml +++ b/app/src/main/res/layout/fragment_shoutbox_shout_row.xml @@ -8,7 +8,7 @@ android:layout_marginEnd="8dp" android:foreground="?android:attr/selectableItemBackground" android:orientation="vertical" - card_view:cardBackgroundColor="@color/card_background" + card_view:cardBackgroundColor="@color/background_light" card_view:cardCornerRadius="5dp" card_view:cardElevation="2dp" card_view:cardPreventCornerOverlap="false" @@ -57,7 +57,7 @@ android:layout_gravity="center" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" - android:background="@color/card_background" + android:background="@color/background_light" android:clickable="true" android:focusable="true" android:scrollbars="none" diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 6a76e274..d5ca2020 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -14,7 +14,7 @@ #E7E7E7 #757575 #323232 - #3C3F41 + #3C3F41 #8B8B8B #FF9800 #FAA61A diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 1811d29e..bbec2bb1 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -14,4 +14,5 @@ 12dp 16sp 90dp + 28dp diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 2c0687b1..59bbc0c4 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -7,7 +7,7 @@ @color/primary_text @color/secondary_text @color/primary - @color/card_background + @color/background_light @color/iron @color/white