aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-10-13 23:57:19 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-10-13 23:57:19 +0000
commit24ae2d85a256164d19d3903bc851dc2ed2d7c8f1 (patch)
tree7e7f33560aef38a29b7ff1be63f8a1d7486badb7 /app
parentd6d4e230a9697da259a638df56615bc5f4f312d3 (diff)
downloadinfinity-for-reddit-24ae2d85a256164d19d3903bc851dc2ed2d7c8f1.tar
infinity-for-reddit-24ae2d85a256164d19d3903bc851dc2ed2d7c8f1.tar.gz
infinity-for-reddit-24ae2d85a256164d19d3903bc851dc2ed2d7c8f1.tar.bz2
infinity-for-reddit-24ae2d85a256164d19d3903bc851dc2ed2d7c8f1.tar.lz
infinity-for-reddit-24ae2d85a256164d19d3903bc851dc2ed2d7c8f1.tar.xz
infinity-for-reddit-24ae2d85a256164d19d3903bc851dc2ed2d7c8f1.tar.zst
infinity-for-reddit-24ae2d85a256164d19d3903bc851dc2ed2d7c8f1.zip
Show correct karma in the navigation drawer in MainActivity.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java1
2 files changed, 2 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java
index 1bf1b8a8..739cea6f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/FetchMyInfo.java
@@ -76,9 +76,7 @@ public class FetchMyInfo {
if (!jsonResponse.isNull(JSONUtils.SUBREDDIT_KEY)) {
bannerImageUrl = Html.fromHtml(jsonResponse.getJSONObject(JSONUtils.SUBREDDIT_KEY).getString(JSONUtils.BANNER_IMG_KEY)).toString();
}
- int linkKarma = jsonResponse.getInt(JSONUtils.LINK_KARMA_KEY);
- int commentKarma = jsonResponse.getInt(JSONUtils.COMMENT_KARMA_KEY);
- karma = linkKarma + commentKarma;
+ karma = jsonResponse.getInt(JSONUtils.TOTAL_KARMA_KEY);
redditDataRoomDatabase.accountDao().updateAccountInfo(name, profileImageUrl, bannerImageUrl, karma);
} catch (JSONException e) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java
index 51c9fbbc..50c8e0bd 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/JSONUtils.java
@@ -127,4 +127,5 @@ public class JSONUtils {
public static final String RICHTEXT_KEY = "richtext";
public static final String SUGGESTED_COMMENT_SORT_KEY = "suggested_comment_sort";
public static final String OVER18_KEY = "over18";
+ public static final String TOTAL_KARMA_KEY = "total_karma";
}