Fix wrong subreddit creation time. Swap sort and search icons in several activities. Fix crashing when comparing exclude domains with posts.

This commit is contained in:
Alex Ning 2021-03-31 00:18:31 +08:00
parent 57a8e69eb1
commit 5976999131
5 changed files with 22 additions and 20 deletions

View File

@ -99,7 +99,7 @@ class ParseSubscribedThing {
String description = data.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim(); String description = data.getString(JSONUtils.PUBLIC_DESCRIPTION_KEY).trim();
String sidebarDescription = data.getString(JSONUtils.DESCRIPTION_KEY); String sidebarDescription = data.getString(JSONUtils.DESCRIPTION_KEY);
int nSubscribers = data.getInt(JSONUtils.SUBSCRIBERS_KEY); int nSubscribers = data.getInt(JSONUtils.SUBSCRIBERS_KEY);
long createdUTC = data.getLong(JSONUtils.CREATED_UTC_KEY); long createdUTC = data.getLong(JSONUtils.CREATED_UTC_KEY) * 1000;
String suggestedCommentSort = data.getString(JSONUtils.SUGGESTED_COMMENT_SORT_KEY); String suggestedCommentSort = data.getString(JSONUtils.SUGGESTED_COMMENT_SORT_KEY);
boolean isNSFW = data.getBoolean(JSONUtils.OVER18_KEY); boolean isNSFW = data.getBoolean(JSONUtils.OVER18_KEY);
newSubscribedSubredditData.add(new SubscribedSubredditData(id, name, iconUrl, accountName, isFavorite)); newSubscribedSubredditData.add(new SubscribedSubredditData(id, name, iconUrl, accountName, isFavorite));

View File

@ -202,10 +202,11 @@ public class PostFilter implements Parcelable {
} }
} }
} }
if (postFilter.excludeDomains != null && !postFilter.excludeDomains.equals("")) { if (post.getUrl() != null && postFilter.excludeDomains != null && !postFilter.excludeDomains.equals("")) {
String[] domains = postFilter.excludeDomains.split(",", 0); String[] domains = postFilter.excludeDomains.split(",", 0);
String url = post.getUrl().toLowerCase();
for (String f : domains) { for (String f : domains) {
if (!f.trim().equals("") && post.getUrl().toLowerCase().contains(f.trim().toLowerCase())) { if (!f.trim().equals("") && url.contains(f.trim().toLowerCase())) {
return false; return false;
} }
} }

View File

@ -2,17 +2,17 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" <menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<item <item
android:id="@+id/action_sort_search_result_activity" android:id="@+id/action_search_search_result_activity"
android:orderInCategory="1" android:orderInCategory="1"
android:title="@string/action_sort" android:title="@string/action_search"
android:icon="@drawable/ic_sort_toolbar_24dp" android:icon="@drawable/ic_search_toolbar_24dp"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_search_search_result_activity" android:id="@+id/action_sort_search_result_activity"
android:orderInCategory="2" android:orderInCategory="2"
android:title="@string/action_search" android:title="@string/action_sort"
android:icon="@drawable/ic_search_toolbar_24dp" android:icon="@drawable/ic_sort_toolbar_24dp"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item

View File

@ -4,18 +4,19 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:application="ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity"> tools:application="ml.docilealligator.infinityforreddit.activities.ViewSubredditDetailActivity">
<item <item
android:id="@+id/action_sort_view_subreddit_detail_activity" android:id="@+id/action_search_view_subreddit_detail_activity"
android:orderInCategory="1" android:orderInCategory="1"
android:title="@string/action_search"
android:icon="@drawable/ic_search_toolbar_24dp"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_sort_view_subreddit_detail_activity"
android:orderInCategory="2"
android:title="@string/action_sort" android:title="@string/action_sort"
android:icon="@drawable/ic_sort_toolbar_24dp" android:icon="@drawable/ic_sort_toolbar_24dp"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item
android:id="@+id/action_search_view_subreddit_detail_activity"
android:orderInCategory="2"
android:title="@string/action_search"
android:icon="@drawable/ic_search_toolbar_24dp"
app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_refresh_view_subreddit_detail_activity" android:id="@+id/action_refresh_view_subreddit_detail_activity"
android:orderInCategory="3" android:orderInCategory="3"

View File

@ -3,16 +3,16 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
tools:application="ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity"> tools:application="ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity">
<item <item
android:id="@+id/action_sort_view_user_detail_activity" android:id="@+id/action_search_view_user_detail_activity"
android:orderInCategory="1" android:orderInCategory="1"
android:title="@string/action_search" android:title="@string/action_search"
android:icon="@drawable/ic_sort_toolbar_24dp" android:icon="@drawable/ic_search_toolbar_24dp"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_search_view_user_detail_activity" android:id="@+id/action_sort_view_user_detail_activity"
android:orderInCategory="2" android:orderInCategory="2"
android:title="@string/action_search" android:title="@string/action_search"
android:icon="@drawable/ic_search_toolbar_24dp" android:icon="@drawable/ic_sort_toolbar_24dp"
app:showAsAction="ifRoom" /> app:showAsAction="ifRoom" />
<item <item
android:id="@+id/action_refresh_view_user_detail_activity" android:id="@+id/action_refresh_view_user_detail_activity"