From 1a13406c05584d2590ac8e7637a353d2cf01e171 Mon Sep 17 00:00:00 2001 From: Sereri Date: Fri, 30 Oct 2020 23:20:03 +0100 Subject: [PATCH] 3.7.4 (#721) * 3.7.2 adds userid to copied thread urls. I think its all of them Upped targetSdkVersion so the play store stops complaining * Adds search option to in-thread menu * Differentiates handling of user roles * 3.7.3 and notes * added additional bookmark colors * 3.7.4 and log --- Awful.apk/build.gradle | 4 +-- Awful.apk/src/main/AndroidManifest.xml | 4 +-- Awful.apk/src/main/assets/changelog.html | 15 ++++++-- .../{ic_star_red.png => ic_star_admin.png} | Bin .../src/main/assets/images/ic_star_coder.png | Bin 0 -> 530 bytes .../src/main/assets/images/ic_star_ik.png | Bin 0 -> 370 bytes .../{ic_star_blue.png => ic_star_mod.png} | Bin .../main/assets/images/ic_star_supermod.png | Bin 0 -> 583 bytes .../src/main/assets/javascript/thread.js | 2 +- .../src/main/assets/mustache/post.mustache | 12 +++---- .../ferg/awfulapp/ForumDisplayFragment.java | 4 +-- .../ferg/awfulapp/ThreadDisplayFragment.java | 23 ++++++++---- .../awfulapp/popupmenu/PostContextMenu.java | 13 +++++-- .../ferg/awfulapp/provider/AwfulProvider.java | 3 +- .../awfulapp/provider/DatabaseHelper.java | 9 ++--- .../ferg/awfulapp/thread/AwfulHtmlPage.java | 28 +++++++++++++-- .../com/ferg/awfulapp/thread/AwfulPost.java | 33 +++++------------- .../com/ferg/awfulapp/thread/ForumParsing.kt | 9 +++-- Awful.apk/src/main/res/menu/post_menu.xml | 10 ++++-- Awful.apk/src/main/res/values/colors.xml | 12 +++++++ 20 files changed, 119 insertions(+), 62 deletions(-) rename Awful.apk/src/main/assets/images/{ic_star_red.png => ic_star_admin.png} (100%) create mode 100644 Awful.apk/src/main/assets/images/ic_star_coder.png create mode 100644 Awful.apk/src/main/assets/images/ic_star_ik.png rename Awful.apk/src/main/assets/images/{ic_star_blue.png => ic_star_mod.png} (100%) create mode 100644 Awful.apk/src/main/assets/images/ic_star_supermod.png diff --git a/Awful.apk/build.gradle b/Awful.apk/build.gradle index 095517ea3..9a9512acb 100644 --- a/Awful.apk/build.gradle +++ b/Awful.apk/build.gradle @@ -34,7 +34,7 @@ android { defaultConfig { applicationId = "com.ferg.awfulapp" minSdkVersion 21 - targetSdkVersion 28 + targetSdkVersion 29 resConfigs "en" // Stops the Gradle plugin’s automatic rasterization of vectors @@ -162,5 +162,5 @@ dependencies { testImplementation 'junit:junit:4.12' testImplementation 'org.hamcrest:hamcrest-library:1.3' - implementation 'androidx.constraintlayout:constraintlayout:2.0.2' + implementation 'androidx.constraintlayout:constraintlayout:2.0.3' } diff --git a/Awful.apk/src/main/AndroidManifest.xml b/Awful.apk/src/main/AndroidManifest.xml index 03889b0cd..0a0f75a6d 100644 --- a/Awful.apk/src/main/AndroidManifest.xml +++ b/Awful.apk/src/main/AndroidManifest.xml @@ -7,8 +7,8 @@ -->
-

3.7.1

+

3.7.4

    +
  • The 3 new bookmark colors are now also available in this app. How much more colors can there be, like 2?
  • +
  • You can now zoom gifs via the "display image" function. Truly we are living in the future.
  • New button in threads to find you are posts.
  • -
  • IK and super-mods are now marked as mods.
  • +
  • Searching a thread is now also available inside that thread via the menu. Makes slightly more sense than in the thread longpress-menu, I GUESS
  • +
  • Added stars for supermods and IKs. And for coders? Whatever that is.
  • +
  • Fixed probation time parsing. Probably. Look, just don't get probated ok?
  • +
  • Fixed gfycat display. Turns out trying to fix a correct url is bad?
  • +
  • Fixed video auto-play function. Though I guess nobody used that anyway
  • +
  • Recipient is now above subject in the PM view. Hope this doesn't break your very important workflow.
  • +
  • Copying thread urls will now respect filtering for a user's post. Opening such a thread url still does not. *sets status to "it's complicated"*
  • Some "new" thread tags for QCS.
  • -
  • Fixed imgur upload again.
  • +
  • Updated some libraries which probably does something. Is the app faster now? Is me telling you a placebo effect? You decide!
  • +
  • Oh wow you are still reading this. Hi!
diff --git a/Awful.apk/src/main/assets/images/ic_star_red.png b/Awful.apk/src/main/assets/images/ic_star_admin.png similarity index 100% rename from Awful.apk/src/main/assets/images/ic_star_red.png rename to Awful.apk/src/main/assets/images/ic_star_admin.png diff --git a/Awful.apk/src/main/assets/images/ic_star_coder.png b/Awful.apk/src/main/assets/images/ic_star_coder.png new file mode 100644 index 0000000000000000000000000000000000000000..71887b53c6f22644c04c3118813ae51283532794 GIT binary patch literal 530 zcmV+t0`2{YP)pgjPm$40-9jZ1jAdv6^fP#EE8CTqTQST6Z8`SCg?W> zS12k?ass!Sq*W-Y%?N0MvvYf^NLWp9-UQrWQ@Y@;ZBmkqaPWa^l9mw;FDIZ01|NYj z4X-Upjr+z0^hN^rO%})%cOQ(hz8M@QwPO-p==Sqez`!KB`*$}VHKVMrxchhjWD*?{ z;9rhIVGr&5-Yxc!NpyumQMm-BL+;@a(EaCId0z2>ckLKUD;Ncz(=}4=y8t14C|QF| zxfGaJm?k){>V@*C+`2=5be7*~lJRQkcDfjFABpAO(;ZWxXf;U_8;O;undEjoR)`7R zDk3c=yG!x~PAO4f0?QXTWq}t(QSd?|f+W8E<@O&0o-VbC=+D=u%>zeS$Ch63Cq!B2 z5I8=g30}(?+j%~C`iS(QGmfPXtZoS|QZTD+g`!n~vrJ%;z!i$h8}bXBd|Ga>DczEt zMJz=NJhNXP<7gDGd0J9tMW-_+N$J>6%q?XJBfBOTLg9{GQ(BUSRqyQCod5s;07*qoM6N<$g3`6&uK)l5 literal 0 HcmV?d00001 diff --git a/Awful.apk/src/main/assets/images/ic_star_ik.png b/Awful.apk/src/main/assets/images/ic_star_ik.png new file mode 100644 index 0000000000000000000000000000000000000000..a93712953744fd58f4aab9ab579cff743a45702c GIT binary patch literal 370 zcmV-&0ge8NP)gW5Jiy?36+2ZBvb+taFF8w2}nRfBp?9^NN9gH(@Yv(SqM9mzi{tK!ak}>5r6@V zMne@yJP9xZ^Hb)nwf1AJ{Q&I~04@M%oc9|WlVEtrxJ zVs7H6FsTA_gZZ#oFYbgmTrI;+ccFQEI2Anvuv}ogWVdU{kZcGs*L6vtR{-=Xa{;M1& literal 0 HcmV?d00001 diff --git a/Awful.apk/src/main/assets/images/ic_star_blue.png b/Awful.apk/src/main/assets/images/ic_star_mod.png similarity index 100% rename from Awful.apk/src/main/assets/images/ic_star_blue.png rename to Awful.apk/src/main/assets/images/ic_star_mod.png diff --git a/Awful.apk/src/main/assets/images/ic_star_supermod.png b/Awful.apk/src/main/assets/images/ic_star_supermod.png new file mode 100644 index 0000000000000000000000000000000000000000..8ab47edbed94529dd5a137fc925b681f645a988e GIT binary patch literal 583 zcmV-N0=WH&P)>O^j8;fjT+B)2|U=po%3{zXEQ74i2bxK(z%rY)-&Q zD((bwDmDdYpv;5&`5$z)B>};pZs1rupqhciCg4Wsv;kE0FbkVVlBGHhf&JuM9e{dpVI{t<0x{R?&Rx{rUDUowH=deFnk81@^kX*@ zl>^fLKhD+B$1~UKZUpFnG=nOq>e>cYHHQIv>)O)bY&-{8Iw0*eU54s9waY1jk2W#r znUaAT@3=`Tn1y*#Qv@IWQ;sBSgiaYqEKJ{%P?Gm`Vvl(!F%}vP8Wf|A_ZpEbwr=h<}r@z5pP! Vhf^cG4^#jE002ovPDHLkV1jXB4BP+! literal 0 HcmV?d00001 diff --git a/Awful.apk/src/main/assets/javascript/thread.js b/Awful.apk/src/main/assets/javascript/thread.js index e650e6afa..cbe242346 100644 --- a/Awful.apk/src/main/assets/javascript/thread.js +++ b/Awful.apk/src/main/assets/javascript/thread.js @@ -486,7 +486,7 @@ function showPostMenu(postMenu) { postMenu.getAttribute('userid'), postMenu.getAttribute('lastreadurl'), postMenu.hasAttribute('editable'), - postMenu.hasAttribute('isMod') || postMenu.hasAttribute('isAdmin'), + postMenu.hasAttribute('has-role'), postMenu.hasAttribute('isPlat') ); } diff --git a/Awful.apk/src/main/assets/mustache/post.mustache b/Awful.apk/src/main/assets/mustache/post.mustache index 083f06bf1..bdf808261 100644 --- a/Awful.apk/src/main/assets/mustache/post.mustache +++ b/Awful.apk/src/main/assets/mustache/post.mustache @@ -1,20 +1,20 @@ -
+
- {{# avatarURL }} + {{#avatarURL}} {{/avatarURL }}
- +
-
+
{{{postcontent}}}
\ No newline at end of file diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/ForumDisplayFragment.java b/Awful.apk/src/main/java/com/ferg/awfulapp/ForumDisplayFragment.java index bcda6fa8e..638bc5c78 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/ForumDisplayFragment.java +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/ForumDisplayFragment.java @@ -523,7 +523,7 @@ public void failure(VolleyError error) { */ private void toggleBookmarkColor(final int id, final int bookmarkStatus) { final ContentResolver cr = this.getAwfulApplication().getContentResolver(); - if(bookmarkStatus==3){ + if(bookmarkStatus==6){ queueRequest(new BookmarkColorRequest(getActivity(), id).build(this, new AwfulRequest.AwfulResultCallback() { @Override @@ -537,7 +537,7 @@ public void failure(VolleyError error) {} @Override public void success(Void result) { ContentValues cv = new ContentValues(); - cv.put(AwfulThread.BOOKMARKED, ((bookmarkStatus==3)?bookmarkStatus+2:bookmarkStatus+1)%4); + cv.put(AwfulThread.BOOKMARKED, ((bookmarkStatus==6)?bookmarkStatus+2:bookmarkStatus+1)%7); cr.update(AwfulThread.CONTENT_URI, cv, AwfulThread.ID+"=?", AwfulProvider.int2StrArray(id)); refreshInfo(); } diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/ThreadDisplayFragment.java b/Awful.apk/src/main/java/com/ferg/awfulapp/ThreadDisplayFragment.java index 7d8a07598..565e316db 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/ThreadDisplayFragment.java +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/ThreadDisplayFragment.java @@ -48,6 +48,8 @@ import android.os.Handler; import androidx.annotation.NonNull; import androidx.annotation.Nullable; + +import com.ferg.awfulapp.search.SearchFilter; import com.google.android.material.floatingactionbutton.FloatingActionButton; import androidx.fragment.app.FragmentManager; import androidx.loader.app.LoaderManager; @@ -547,7 +549,7 @@ public boolean onOptionsItemSelected(MenuItem item) { rateThread(); break; case R.id.copy_url: - copyThreadURL(null); + copyThreadURL(null, postFilterUserId); break; case R.id.find: ((WebViewSearchBar) item.getActionView()).setWebView(mThreadView); @@ -565,6 +567,10 @@ public boolean onOptionsItemSelected(MenuItem item) { case R.id.show_self: showUsersPosts(getPrefs().userId, getPrefs().username); break; + case R.id.search_this_thread: + SearchFilter threadFilter = new SearchFilter(SearchFilter.FilterType.ThreadId, Integer.toString(currentThreadId)); + navigate(new NavigationEvent.SearchForums(threadFilter)); + return true; default: return super.onOptionsItemSelected(item); } @@ -577,14 +583,18 @@ public boolean onOptionsItemSelected(MenuItem item) { * Get a URL that links to a particular thread. * * @param postId An optional post ID, appended as the URL's fragment + * @param userId An optional user ID, appended as a query parameter * @return the full URL */ @NonNull - private String generateThreadUrl(@Nullable Integer postId) { + private String generateThreadUrl(@Nullable Integer postId, @Nullable Integer userId) { Uri.Builder builder = Uri.parse(Constants.FUNCTION_THREAD).buildUpon() .appendQueryParameter(Constants.PARAM_THREAD_ID, String.valueOf(getThreadId())) .appendQueryParameter(Constants.PARAM_PAGE, String.valueOf(getPageNumber())) .appendQueryParameter(Constants.PARAM_PER_PAGE, String.valueOf(getPrefs().postPerPage)); + if (userId != null) { + builder.appendQueryParameter(Constants.PARAM_USER_ID, String.valueOf(userId)); + } if (postId != null) { builder.fragment("post" + postId); } @@ -620,7 +630,7 @@ public Intent createShareIntent(@Nullable String url) { if (url == null) { // we're sharing the current thread - we can add the title in here intent.putExtra(Intent.EXTRA_SUBJECT, mTitle); - url = generateThreadUrl(null); + url = generateThreadUrl(null, postFilterUserId); } return intent.putExtra(Intent.EXTRA_TEXT, url); } @@ -630,10 +640,11 @@ public Intent createShareIntent(@Nullable String url) { /** * Copy a thread's URL to the clipboard * @param postId An optional post ID, used as the url's fragment + * @param userId An optional user ID, appended to the url as a parameter */ - public void copyThreadURL(@Nullable Integer postId) { + public void copyThreadURL(@Nullable Integer postId, @Nullable Integer userId) { String clipLabel = getString(R.string.copy_url) + getPageNumber(); - String clipText = generateThreadUrl(postId); + String clipText = generateThreadUrl(postId, userId); safeCopyToClipboard(clipLabel, clipText, R.string.copy_url_success); } @@ -1091,7 +1102,7 @@ private class ClickInterface extends WebViewJsInterface { @JavascriptInterface public void onMoreClick(final String aPostId, final String aUsername, final String aUserId, final String lastReadUrl, final boolean editable, final boolean isAdminOrMod, final boolean isPlat) { PostContextMenu postActions = PostContextMenu.newInstance(getThreadId(), Integer.parseInt(aPostId), - Integer.parseInt(lastReadUrl), editable, aUsername, Integer.parseInt(aUserId), isPlat, isAdminOrMod); + Integer.parseInt(lastReadUrl), editable, aUsername, Integer.parseInt(aUserId), isPlat, isAdminOrMod, postFilterUserId); postActions.setTargetFragment(ThreadDisplayFragment.this, -1); postActions.show(mSelf.getFragmentManager(), "Post Actions"); } diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/popupmenu/PostContextMenu.java b/Awful.apk/src/main/java/com/ferg/awfulapp/popupmenu/PostContextMenu.java index b40255182..a5f68420c 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/popupmenu/PostContextMenu.java +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/popupmenu/PostContextMenu.java @@ -44,6 +44,7 @@ public class PostContextMenu extends BasePopupMenu generateMenuItems() { } awfulActions.add(COPY_URL); awfulActions.add(RAP_SHEET); - if (!ownPost) { + if (!ownPost && !posterIsAdminOrMod) { awfulActions.add(IGNORE_USER); } return awfulActions; @@ -162,7 +169,7 @@ void onActionClicked(@NonNull PostMenuAction action) { parent.markLastRead(lastReadCode); break; case COPY_URL: - parent.copyThreadURL(postId); + parent.copyThreadURL(postId, postFilterUserId); break; case YOUR_POSTS: case USER_POSTS: diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/provider/AwfulProvider.java b/Awful.apk/src/main/java/com/ferg/awfulapp/provider/AwfulProvider.java index 4f6466466..202d1c5bc 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/provider/AwfulProvider.java +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/provider/AwfulProvider.java @@ -182,9 +182,8 @@ private static String[] arrayOfKeys(@NonNull Map map) { sPostProjectionMap.put(AwfulPost.PREVIOUSLY_READ, AwfulPost.PREVIOUSLY_READ); sPostProjectionMap.put(AwfulPost.EDITABLE, AwfulPost.EDITABLE); sPostProjectionMap.put(AwfulPost.IS_OP, AwfulPost.IS_OP); - sPostProjectionMap.put(AwfulPost.IS_ADMIN, AwfulPost.IS_ADMIN); - sPostProjectionMap.put(AwfulPost.IS_MOD, AwfulPost.IS_MOD); sPostProjectionMap.put(AwfulPost.IS_PLAT, AwfulPost.IS_PLAT); + sPostProjectionMap.put(AwfulPost.ROLE, AwfulPost.ROLE); sPostProjectionMap.put(AwfulPost.AVATAR, AwfulPost.AVATAR); sPostProjectionMap.put(AwfulPost.AVATAR_TEXT, AwfulPost.AVATAR_TEXT); sPostProjectionMap.put(AwfulPost.CONTENT, AwfulPost.CONTENT); diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/provider/DatabaseHelper.java b/Awful.apk/src/main/java/com/ferg/awfulapp/provider/DatabaseHelper.java index 27baf7db3..a171452c1 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/provider/DatabaseHelper.java +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/provider/DatabaseHelper.java @@ -20,7 +20,7 @@ public class DatabaseHelper extends SQLiteOpenHelper { private static final String DATABASE_NAME = "awful.db"; - private static final int DATABASE_VERSION = 33; + private static final int DATABASE_VERSION = 34; static final String TABLE_FORUM = "forum"; static final String TABLE_THREADS = "threads"; @@ -106,9 +106,8 @@ private void createPostTable(SQLiteDatabase aDb) { AwfulPost.PREVIOUSLY_READ + " INTEGER," + AwfulPost.EDITABLE + " INTEGER," + AwfulPost.IS_OP + " INTEGER," + - AwfulPost.IS_ADMIN + " INTEGER," + - AwfulPost.IS_MOD + " INTEGER," + AwfulPost.IS_PLAT + " INTEGER," + + AwfulPost.ROLE + " VARCHAR," + AwfulPost.AVATAR + " VARCHAR," + AwfulPost.AVATAR_TEXT + " VARCHAR," + AwfulPost.CONTENT + " VARCHAR," + @@ -179,10 +178,12 @@ public void onUpgrade(SQLiteDatabase aDb, int aOldVersion, int aNewVersion) { case 31: dropTables(aDb, TABLE_THREADS); createThreadTable(aDb); - break;//make sure to keep this break statement on the last case of this switch case 32: dropTables(aDb, TABLE_DRAFTS); createDraftTable(aDb); + case 33: + dropTables(aDb, TABLE_POSTS); + createPostTable(aDb); break;//make sure to keep this break statement on the last case of this switch default: wipeRecreateTables(aDb); diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulHtmlPage.java b/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulHtmlPage.java index 4bcc649ce..2aaf99c06 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulHtmlPage.java +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulHtmlPage.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -62,6 +63,30 @@ public abstract class AwfulHtmlPage { "thread.js" }; + /** + * All user roles we have icons for + */ + static final String[] ROLES = { + "admin", + "supermod", + "mod", + "coder", + "ik" + }; + + /** + * parses the user role and returns it if it is a known role. Null otherwise + * @param role the user role + * @return the role as a string or null + */ + private static String parseRole(String role) { + if (role.length() > 0 && Arrays.asList(ROLES).contains(role)) { + return role; + } + + return null; + } + /** * Get the main HTML for the containing page. *

@@ -191,8 +216,7 @@ private static String getPostsHtml(List aPosts, AwfulPreferences aPre postData.put("userID", post.getUserId()); postData.put("postDate", post.getDate()); postData.put("regDate", post.getRegDate()); - postData.put("mod", post.isMod() ? "mod" : null); - postData.put("admin", post.isAdmin() ? "admin" : null); + postData.put("role", parseRole(post.getRole())); postData.put("plat", post.isPlat() ? "plat" : null); postData.put("avatarText", "" + post.getAvatarText()); postData.put("lastReadUrl", post.getLastReadUrl()); diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulPost.java b/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulPost.java index cc0055dfc..596de5df3 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulPost.java +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/thread/AwfulPost.java @@ -82,9 +82,8 @@ public class AwfulPost { public static final String PREVIOUSLY_READ = "previously_read"; public static final String EDITABLE = "editable"; public static final String IS_OP = "is_op"; - public static final String IS_ADMIN = "is_admin"; - public static final String IS_MOD = "is_mod"; public static final String IS_PLAT = "is_plat"; + public static final String ROLE = "role"; public static final String AVATAR = "avatar"; public static final String AVATAR_TEXT = "avatar_text"; public static final String CONTENT = "content"; @@ -117,9 +116,8 @@ public class AwfulPost { private String mLastReadUrl = ""; private boolean mEditable; private boolean isOp = false; - private boolean isAdmin = false; - private boolean isMod = false; private boolean isPlat = false; + private String mRole = ""; public JSONObject toJSON() throws JSONException { @@ -134,6 +132,7 @@ public JSONObject toJSON() throws JSONException { result.put("previouslyRead", Boolean.toString(mPreviouslyRead)); result.put("lastReadUrl", mLastReadUrl); result.put("editable", Boolean.toString(mEditable)); + result.put("role", mRole); result.put("isOp", Boolean.toString(isOp())); result.put("isPlat", Boolean.toString(isPlat())); @@ -144,14 +143,6 @@ public boolean isOp() { return isOp; } - public boolean isAdmin() { - return isAdmin; - } - - public boolean isMod() { - return isMod; - } - public boolean isPlat() { return isPlat; } @@ -208,17 +199,11 @@ public void setIsOp(boolean aIsOp) { isOp = aIsOp; } - public void setIsAdmin(boolean aIsAdmin) { - isAdmin = aIsAdmin; - } + public void setIsPlat(boolean plat) { isPlat = plat;} - public void setIsMod(boolean aIsMod) { - isMod = aIsMod; - } + public String getRole() { return mRole; } - public void setIsPlat(boolean plat) { - isPlat = plat; - } + public void setRole(String role) { mRole = role; } public String getAvatar() { return mAvatar; @@ -250,9 +235,8 @@ public static ArrayList fromCursor(Context aContext, Cursor aCursor) int previouslyReadIndex = aCursor.getColumnIndex(PREVIOUSLY_READ); int editableIndex = aCursor.getColumnIndex(EDITABLE); int isOpIndex = aCursor.getColumnIndex(IS_OP); - int isAdminIndex = aCursor.getColumnIndex(IS_ADMIN); - int isModIndex = aCursor.getColumnIndex(IS_MOD); int isPlatIndex = aCursor.getColumnIndex(IS_PLAT); + int roleIndex = aCursor.getColumnIndex(ROLE); int avatarIndex = aCursor.getColumnIndex(AVATAR); int avatarTextIndex = aCursor.getColumnIndex(AVATAR_TEXT); int contentIndex = aCursor.getColumnIndex(CONTENT); @@ -272,9 +256,8 @@ public static ArrayList fromCursor(Context aContext, Cursor aCursor) current.setLastReadUrl(aCursor.getInt(postIndexIndex)+""); current.setEditable(aCursor.getInt(editableIndex) == 1); current.setIsOp(aCursor.getInt(isOpIndex) == 1); - current.setIsAdmin(aCursor.getInt(isAdminIndex) > 0); - current.setIsMod(aCursor.getInt(isModIndex) > 0); current.setIsPlat(aCursor.getInt(isPlatIndex) > 0); + current.setRole(aCursor.getString(roleIndex)); current.setAvatar(aCursor.getString(avatarIndex)); current.setAvatarText(aCursor.getString(avatarTextIndex)); current.setContent(aCursor.getString(contentIndex)); diff --git a/Awful.apk/src/main/java/com/ferg/awfulapp/thread/ForumParsing.kt b/Awful.apk/src/main/java/com/ferg/awfulapp/thread/ForumParsing.kt index 52646a6df..991314448 100644 --- a/Awful.apk/src/main/java/com/ferg/awfulapp/thread/ForumParsing.kt +++ b/Awful.apk/src/main/java/com/ferg/awfulapp/thread/ForumParsing.kt @@ -119,8 +119,7 @@ class PostParseTask( put(USERNAME, textForClass("author")) put(REGDATE, textForClass("registered")) put(IS_PLAT, postData.hasDescendantWithClass("platinum").sqlBool) - put(IS_MOD, postData.hasDescendantWithClass("role-mod, .role-supermod, .role-ik").sqlBool) - put(IS_ADMIN, postData.hasDescendantWithClass("role-admin").sqlBool) + put(ROLE, getRole()) // grab the custom title, and also the avatar if there is one postData.selectFirst(".title")!! @@ -191,6 +190,9 @@ class PostParseTask( private fun textForClass(cssClass: String): String = postData.selectFirst(".$cssClass")?.text() ?: "data missing" + private fun getRole(): String = + postData.selectFirst(".author")?.classNames()?.find { it.startsWith("role-") }?.substring(5) ?: "" + private fun Element.hasDescendantWithClass(cssClass: String): Boolean = this.selectFirst(".$cssClass") != null } @@ -297,6 +299,9 @@ class ForumParseTask( star.hasClass("bm0") -> 1 star.hasClass("bm1") -> 2 star.hasClass("bm2") -> 3 + star.hasClass("bm3") -> 4 + star.hasClass("bm4") -> 5 + star.hasClass("bm5") -> 6 else -> 0 } } diff --git a/Awful.apk/src/main/res/menu/post_menu.xml b/Awful.apk/src/main/res/menu/post_menu.xml index 26b5f8438..0a9b6d159 100644 --- a/Awful.apk/src/main/res/menu/post_menu.xml +++ b/Awful.apk/src/main/res/menu/post_menu.xml @@ -34,7 +34,7 @@ @@ -47,10 +47,16 @@ /> + #e28d00 #b4171f #dfdd6d + #2ab8ce + #67ae35 + #7553a3 #7f356693 #7fe28d00 #7fb4171f #7fdfdd6d + #7f2ab8ce + #7f67ae35 + #7f7553a3 #FFFAFAFA @@ -54,6 +60,9 @@ @color/bookmark_orange @color/bookmark_red @color/bookmark_yellow + @color/bookmark_cyan + @color/bookmark_green + @color/bookmark_purple @@ -61,6 +70,9 @@ @color/bookmark_orange_dim @color/bookmark_red_dim @color/bookmark_yellow_dim + @color/bookmark_cyan_dim + @color/bookmark_green_dim + @color/bookmark_purple_dim