diff options
Diffstat (limited to 'app/src')
5 files changed, 106 insertions, 19 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); } diff --git a/app/src/main/res/layout/activity_view_subreddit_detail.xml b/app/src/main/res/layout/activity_view_subreddit_detail.xml index da17e978..ee3f0357 100644 --- a/app/src/main/res/layout/activity_view_subreddit_detail.xml +++ b/app/src/main/res/layout/activity_view_subreddit_detail.xml @@ -74,7 +74,7 @@ android:textColor="@android:color/white" android:layout_gravity="center_horizontal"/> - <RelativeLayout + <androidx.constraintlayout.widget.ConstraintLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="16dp" @@ -84,20 +84,51 @@ android:id="@+id/subscriber_count_text_view_view_subreddit_detail_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:textColor="?attr/primaryTextColor" android:textSize="?attr/font_default" - android:layout_alignParentStart="true" - android:layout_toStartOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity" /> + app:layout_constraintBottom_toTopOf="@id/online_subscriber_count_text_view_view_subreddit_detail_activity" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/barrier" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintHorizontal_bias="0" /> <TextView android:id="@+id/online_subscriber_count_text_view_view_subreddit_detail_activity" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:textColor="?attr/primaryTextColor" - android:textSize="?attr/font_default" /> + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toStartOf="@id/barrier" + app:layout_constraintTop_toBottomOf="@id/subscriber_count_text_view_view_subreddit_detail_activity" + app:layout_constraintHorizontal_bias="0" /> + + <TextView + android:id="@+id/since_text_view_view_subreddit_detail_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="@string/since" + app:layout_constraintBottom_toTopOf="@id/creation_time_text_view_view_subreddit_detail_activity" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent" /> + + <TextView + android:id="@+id/creation_time_text_view_view_subreddit_detail_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="end" + android:textSize="?attr/font_default" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/since_text_view_view_subreddit_detail_activity" /> + + <androidx.constraintlayout.widget.Barrier + android:id="@+id/barrier" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + app:barrierDirection="start" + app:constraint_referenced_ids="creation_time_text_view_view_subreddit_detail_activity, since_text_view_view_subreddit_detail_activity" /> - </RelativeLayout> + </androidx.constraintlayout.widget.ConstraintLayout> <TextView android:id="@+id/description_text_view_view_subreddit_detail_activity" diff --git a/app/src/main/res/layout/activity_view_user_detail.xml b/app/src/main/res/layout/activity_view_user_detail.xml index 4539f50a..3499823e 100644 --- a/app/src/main/res/layout/activity_view_user_detail.xml +++ b/app/src/main/res/layout/activity_view_user_detail.xml @@ -62,16 +62,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:textSize="?attr/font_18" - android:layout_gravity="center_horizontal"/> - - <TextView - android:id="@+id/karma_text_view_view_user_detail_activity" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="16dp" android:layout_marginBottom="16dp" - android:textSize="?attr/font_default" + android:textSize="?attr/font_18" android:layout_gravity="center_horizontal"/> <com.google.android.material.chip.Chip @@ -79,10 +71,40 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" - android:textColor="@android:color/white" android:layout_gravity="center_horizontal" android:visibility="gone"/> + <RelativeLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp"> + + <TextView + android:id="@+id/karma_text_view_view_user_detail_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentStart="true" + android:layout_toStartOf="@id/cakeday_text_view_view_user_detail_activity" + android:textSize="?attr/font_default" /> + + <TextView + android:id="@+id/cakeday_text_view_view_user_detail_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="end" + android:layout_alignParentEnd="true" + android:textSize="?attr/font_default" /> + + </RelativeLayout> + + <TextView + android:id="@+id/description_text_view_view_user_detail_activity" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="16dp" + android:textSize="?attr/font_default" + android:visibility="gone" /> + </LinearLayout> </RelativeLayout> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 945805f1..2bd237f9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -90,6 +90,9 @@ <string name="nsfw">NSFW</string> <string name="karma_info">Karma: %1$d</string> + <string name="karma_info_user_detail">Karma:\n%1$d (%2$d + %3$d)</string> + <string name="cakeday_info">Cakeday:\n%1$s</string> + <string name="since">Since:</string> <string name="profile">Profile</string> <string name="following">Following</string> |