aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java21
2 files changed, 32 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
index d83ba1ee..f22b6361 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java
@@ -41,6 +41,9 @@ import com.google.android.material.tabs.TabLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
import javax.inject.Inject;
import javax.inject.Named;
@@ -119,6 +122,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
TextView nSubscribersTextView;
@BindView(R.id.online_subscriber_count_text_view_view_subreddit_detail_activity)
TextView nOnlineSubscribersTextView;
+ @BindView(R.id.since_text_view_view_subreddit_detail_activity)
+ TextView sinceTextView;
+ @BindView(R.id.creation_time_text_view_view_subreddit_detail_activity)
+ TextView creationTimeTextView;
@BindView(R.id.description_text_view_view_subreddit_detail_activity)
TextView descriptionTextView;
@BindView(R.id.bottom_navigation_view_subreddit_detail_activity)
@@ -322,6 +329,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
setSupportActionBar(toolbar);
glide = Glide.with(this);
+ Locale locale = getResources().getConfiguration().locale;
mSubredditViewModel = new ViewModelProvider(this,
new SubredditViewModel.Factory(getApplication(), mRedditDataRoomDatabase, subredditName))
@@ -370,6 +378,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
subredditNameTextView.setText(subredditFullName);
String nSubscribers = getString(R.string.subscribers_number_detail, subredditData.getNSubscribers());
nSubscribersTextView.setText(nSubscribers);
+ creationTimeTextView.setText(new SimpleDateFormat("MMM d, yyyy",
+ locale).format(subredditData.getCreatedUTC()));
if (subredditData.getDescription().equals("")) {
descriptionTextView.setVisibility(View.GONE);
} else {
@@ -416,6 +426,8 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
int primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor();
nSubscribersTextView.setTextColor(primaryTextColor);
nOnlineSubscribersTextView.setTextColor(primaryTextColor);
+ sinceTextView.setTextColor(primaryTextColor);
+ creationTimeTextView.setTextColor(primaryTextColor);
descriptionTextView.setTextColor(primaryTextColor);
bottomNavigationView.setBackgroundTint(ColorStateList.valueOf(mCustomThemeWrapper.getBottomAppBarBackgroundColor()));
int bottomAppBarIconColor = mCustomThemeWrapper.getBottomAppBarIconColor();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
index 82acead4..c6bda8bd 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java
@@ -40,6 +40,9 @@ import com.google.android.material.tabs.TabLayout;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
+import java.text.SimpleDateFormat;
+import java.util.Locale;
+
import javax.inject.Inject;
import javax.inject.Named;
@@ -116,6 +119,10 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
Chip subscribeUserChip;
@BindView(R.id.karma_text_view_view_user_detail_activity)
TextView karmaTextView;
+ @BindView(R.id.cakeday_text_view_view_user_detail_activity)
+ TextView cakedayTextView;
+ @BindView(R.id.description_text_view_view_user_detail_activity)
+ TextView descriptionTextView;
@Inject
@Named("no_oauth")
Retrofit mRetrofit;
@@ -274,6 +281,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
subscribedUserDao = mRedditDataRoomDatabase.subscribedUserDao();
glide = Glide.with(this);
+ Locale locale = getResources().getConfiguration().locale;
userViewModel = new ViewModelProvider(this, new UserViewModel.Factory(getApplication(), mRedditDataRoomDatabase, username))
.get(UserViewModel.class);
@@ -383,8 +391,17 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
if (!title.equals(userFullName)) {
getSupportActionBar().setTitle(userFullName);
}
- String karma = getString(R.string.karma_info, userData.getKarma());
+ String karma = getString(R.string.karma_info_user_detail, userData.getKarma(), userData.getLinkKarma(), userData.getCommentKarma());
karmaTextView.setText(karma);
+ cakedayTextView.setText(getString(R.string.cakeday_info, new SimpleDateFormat("MMM d, yyyy",
+ locale).format(userData.getCakeday())));
+
+ if (userData.getDescription() == null || userData.getDescription().equals("")) {
+ descriptionTextView.setVisibility(View.GONE);
+ } else {
+ descriptionTextView.setVisibility(View.VISIBLE);
+ descriptionTextView.setText(userData.getDescription());
+ }
}
});
@@ -428,6 +445,8 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
subscribedColor = mCustomThemeWrapper.getSubscribed();
userNameTextView.setTextColor(mCustomThemeWrapper.getUsername());
karmaTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
+ cakedayTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
+ descriptionTextView.setTextColor(mCustomThemeWrapper.getPrimaryTextColor());
subscribeUserChip.setTextColor(mCustomThemeWrapper.getChipTextColor());
applyTabLayoutTheme(tabLayout);
}