From 24f5682bf800d1fcd71e65f827e619ea89d1bf0c Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Wed, 10 Nov 2021 21:25:32 +0800 Subject: [PATCH] Some UI tweaks. --- app/src/main/AndroidManifest.xml | 3 +- .../activities/EditProfileActivity.java | 30 +++++-- .../activities/PostGalleryActivity.java | 17 ++-- .../activities/PostImageActivity.java | 17 ++-- .../activities/PostLinkActivity.java | 15 ++-- .../activities/PostTextActivity.java | 17 ++-- .../activities/PostVideoActivity.java | 23 +++--- .../main/res/layout/activity_edit_profile.xml | 80 +++++++++---------- .../main/res/layout/activity_post_gallery.xml | 22 ++--- .../main/res/layout/activity_post_image.xml | 22 ++--- .../main/res/layout/activity_post_link.xml | 22 ++--- .../main/res/layout/activity_post_text.xml | 22 ++--- .../main/res/layout/activity_post_video.xml | 32 +++----- .../main/res/menu/edit_profile_activity.xml | 2 +- app/src/main/res/values/strings.xml | 5 +- 15 files changed, 132 insertions(+), 197 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 51a0ca10..14b7f150 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -394,8 +394,9 @@ android:theme="@style/AppTheme.SlidableWithTranslucentWindow" /> = Build.VERSION_CODES.M && isChangeStatusBarIconColor()) { + addOnOffsetChangedListener(appBarLayout); + } + setSupportActionBar(toolbar); if (mSharedPreferences.getBoolean(SharedPreferencesUtils.SWIPE_RIGHT_TO_GO_BACK, true)) { @@ -328,8 +341,9 @@ public class EditProfileActivity extends BaseActivity { @Override protected void applyCustomTheme() { - applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, collapsingToolbarLayout, toolbar); root.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); + changeColorTextView(content, mCustomThemeWrapper.getPrimaryTextColor()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java index 3dcb726e..a3c12c29 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java @@ -35,6 +35,7 @@ import com.bumptech.glide.request.RequestOptions; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.divider.MaterialDivider; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.gson.Gson; @@ -110,27 +111,23 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee @BindView(R.id.rules_button_post_gallery_activity) MaterialButton rulesButton; @BindView(R.id.divider_1_post_gallery_activity) - View divider1; + MaterialDivider divider1; @BindView(R.id.flair_custom_text_view_post_gallery_activity) CustomTextView flairTextView; @BindView(R.id.spoiler_custom_text_view_post_gallery_activity) CustomTextView spoilerTextView; @BindView(R.id.nsfw_custom_text_view_post_gallery_activity) CustomTextView nsfwTextView; - @BindView(R.id.divider_2_post_gallery_activity) - View divider2; @BindView(R.id.receive_post_reply_notifications_linear_layout_post_gallery_activity) LinearLayout receivePostReplyNotificationsLinearLayout; @BindView(R.id.receive_post_reply_notifications_text_view_post_gallery_activity) TextView receivePostReplyNotificationsTextView; @BindView(R.id.receive_post_reply_notifications_switch_material_post_gallery_activity) SwitchMaterial receivePostReplyNotificationsSwitchMaterial; - @BindView(R.id.divider_3_post_gallery_activity) - View divider3; + @BindView(R.id.divider_2_post_gallery_activity) + MaterialDivider divider2; @BindView(R.id.post_title_edit_text_post_gallery_activity) EditText titleEditText; - @BindView(R.id.divider_4_post_gallery_activity) - View divider4; @BindView(R.id.images_recycler_view_post_gallery_activity) RecyclerView imagesRecyclerView; @Inject @@ -415,10 +412,8 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); int dividerColor = mCustomThemeWrapper.getDividerColor(); - divider1.setBackgroundColor(dividerColor); - divider2.setBackgroundColor(dividerColor); - divider3.setBackgroundColor(dividerColor); - divider4.setBackgroundColor(dividerColor); + divider1.setDividerColor(dividerColor); + divider2.setDividerColor(dividerColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); flairTextColor = mCustomThemeWrapper.getFlairTextColor(); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java index cf6c7664..759f4911 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java @@ -32,6 +32,7 @@ import com.bumptech.glide.request.RequestOptions; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.divider.MaterialDivider; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.switchmaterial.SwitchMaterial; @@ -97,27 +98,23 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF @BindView(R.id.rules_button_post_image_activity) MaterialButton rulesButton; @BindView(R.id.divider_1_post_image_activity) - View divider1; + MaterialDivider divider1; @BindView(R.id.flair_custom_text_view_post_image_activity) CustomTextView flairTextView; @BindView(R.id.spoiler_custom_text_view_post_image_activity) CustomTextView spoilerTextView; @BindView(R.id.nsfw_custom_text_view_post_image_activity) CustomTextView nsfwTextView; - @BindView(R.id.divider_2_post_image_activity) - View divider2; @BindView(R.id.receive_post_reply_notifications_linear_layout_post_image_activity) LinearLayout receivePostReplyNotificationsLinearLayout; @BindView(R.id.receive_post_reply_notifications_text_view_post_image_activity) TextView receivePostReplyNotificationsTextView; @BindView(R.id.receive_post_reply_notifications_switch_material_post_image_activity) SwitchMaterial receivePostReplyNotificationsSwitchMaterial; - @BindView(R.id.divider_3_post_image_activity) - View divider3; + @BindView(R.id.divider_2_post_image_activity) + MaterialDivider divider2; @BindView(R.id.post_title_edit_text_post_image_activity) EditText titleEditText; - @BindView(R.id.divider_4_post_image_activity) - View divider4; @BindView(R.id.select_image_constraint_layout_post_image_activity) ConstraintLayout constraintLayout; @BindView(R.id.capture_fab_post_image_activity) @@ -396,10 +393,8 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); int dividerColor = mCustomThemeWrapper.getDividerColor(); - divider1.setBackgroundColor(dividerColor); - divider2.setBackgroundColor(dividerColor); - divider3.setBackgroundColor(dividerColor); - divider4.setBackgroundColor(dividerColor); + divider1.setDividerColor(dividerColor); + divider2.setDividerColor(dividerColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); flairTextColor = mCustomThemeWrapper.getFlairTextColor(); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java index eecefa75..a24ece41 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java @@ -26,6 +26,7 @@ import com.bumptech.glide.request.RequestOptions; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.divider.MaterialDivider; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.switchmaterial.SwitchMaterial; import com.libRG.CustomTextView; @@ -91,11 +92,9 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr @BindView(R.id.rules_button_post_link_activity) MaterialButton rulesButton; @BindView(R.id.divider_1_post_link_activity) - View divider1; + MaterialDivider divider1; @BindView(R.id.divider_2_post_link_activity) - View divider2; - @BindView(R.id.divider_4_post_link_activity) - View divider4; + MaterialDivider divider2; @BindView(R.id.flair_custom_text_view_post_link_activity) CustomTextView flairTextView; @BindView(R.id.spoiler_custom_text_view_post_link_activity) @@ -108,8 +107,6 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr TextView receivePostReplyNotificationsTextView; @BindView(R.id.receive_post_reply_notifications_switch_material_post_link_activity) SwitchMaterial receivePostReplyNotificationsSwitchMaterial; - @BindView(R.id.divider_3_post_link_activity) - View divider3; @BindView(R.id.post_title_edit_text_post_link_activity) EditText titleEditText; @BindView(R.id.suggest_title_button_post_link_activity) @@ -370,10 +367,8 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); int dividerColor = mCustomThemeWrapper.getDividerColor(); - divider1.setBackgroundColor(dividerColor); - divider2.setBackgroundColor(dividerColor); - divider3.setBackgroundColor(dividerColor); - divider4.setBackgroundColor(dividerColor); + divider1.setDividerColor(dividerColor); + divider2.setDividerColor(dividerColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); flairTextColor = mCustomThemeWrapper.getFlairTextColor(); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java index 5336051c..b54e56af 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java @@ -33,6 +33,7 @@ import com.bumptech.glide.request.RequestOptions; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.divider.MaterialDivider; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.switchmaterial.SwitchMaterial; import com.libRG.CustomTextView; @@ -107,27 +108,23 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr @BindView(R.id.rules_button_post_text_activity) MaterialButton rulesButton; @BindView(R.id.divider_1_post_text_activity) - View divider1; + MaterialDivider divider1; @BindView(R.id.flair_custom_text_view_post_text_activity) CustomTextView flairTextView; @BindView(R.id.spoiler_custom_text_view_post_text_activity) CustomTextView spoilerTextView; @BindView(R.id.nsfw_custom_text_view_post_text_activity) CustomTextView nsfwTextView; - @BindView(R.id.divider_2_post_text_activity) - View divider2; @BindView(R.id.receive_post_reply_notifications_linear_layout_post_text_activity) LinearLayout receivePostReplyNotificationsLinearLayout; @BindView(R.id.receive_post_reply_notifications_text_view_post_text_activity) TextView receivePostReplyNotificationsTextView; @BindView(R.id.receive_post_reply_notifications_switch_material_post_text_activity) SwitchMaterial receivePostReplyNotificationsSwitchMaterial; - @BindView(R.id.divider_3_post_text_activity) - View divider3; + @BindView(R.id.divider_2_post_text_activity) + MaterialDivider divider2; @BindView(R.id.post_title_edit_text_post_text_activity) EditText titleEditText; - @BindView(R.id.divider_4_post_text_activity) - View divider4; @BindView(R.id.post_text_content_edit_text_post_text_activity) EditText contentEditText; @BindView(R.id.markdown_bottom_bar_recycler_view_post_text_activity) @@ -394,10 +391,8 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); int dividerColor = mCustomThemeWrapper.getDividerColor(); - divider1.setBackgroundColor(dividerColor); - divider2.setBackgroundColor(dividerColor); - divider3.setBackgroundColor(dividerColor); - divider4.setBackgroundColor(dividerColor); + divider1.setDividerColor(dividerColor); + divider2.setDividerColor(dividerColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); flairTextColor = mCustomThemeWrapper.getFlairTextColor(); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java index f80b5e94..d1d09ddc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java @@ -1,5 +1,6 @@ package ml.docilealligator.infinityforreddit.activities; +import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Resources; @@ -14,6 +15,7 @@ import android.view.View; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; +import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -36,6 +38,7 @@ import com.google.android.exoplayer2.util.Util; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.button.MaterialButton; import com.google.android.material.dialog.MaterialAlertDialogBuilder; +import com.google.android.material.divider.MaterialDivider; import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.switchmaterial.SwitchMaterial; @@ -98,27 +101,23 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF @BindView(R.id.rules_button_post_video_activity) MaterialButton rulesButton; @BindView(R.id.divider_1_post_video_activity) - View divider1; + MaterialDivider divider1; @BindView(R.id.flair_custom_text_view_post_video_activity) CustomTextView flairTextView; @BindView(R.id.spoiler_custom_text_view_post_video_activity) CustomTextView spoilerTextView; @BindView(R.id.nsfw_custom_text_view_post_video_activity) CustomTextView nsfwTextView; - @BindView(R.id.divider_2_post_video_activity) - View divider2; @BindView(R.id.receive_post_reply_notifications_linear_layout_post_video_activity) LinearLayout receivePostReplyNotificationsLinearLayout; @BindView(R.id.receive_post_reply_notifications_text_view_post_video_activity) TextView receivePostReplyNotificationsTextView; @BindView(R.id.receive_post_reply_notifications_switch_material_post_video_activity) SwitchMaterial receivePostReplyNotificationsSwitchMaterial; - @BindView(R.id.divider_3_post_video_activity) - View divider3; + @BindView(R.id.divider_2_post_video_activity) + MaterialDivider divider2; @BindView(R.id.post_title_edit_text_post_video_activity) EditText titleEditText; - @BindView(R.id.divider_4_post_video_activity) - View divider4; @BindView(R.id.select_video_constraint_layout_post_video_activity) ConstraintLayout constraintLayout; @BindView(R.id.capture_fab_post_video_activity) @@ -364,8 +363,10 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF captureFab.setOnClickListener(view -> { Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); - if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { + try { startActivityForResult(takeVideoIntent, CAPTURE_VIDEO_REQUEST_CODE); + } catch (ActivityNotFoundException e) { + Toast.makeText(this, R.string.no_camera_available, Toast.LENGTH_SHORT).show(); } }); @@ -407,10 +408,8 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF primaryTextColor = mCustomThemeWrapper.getPrimaryTextColor(); receivePostReplyNotificationsTextView.setTextColor(primaryTextColor); int dividerColor = mCustomThemeWrapper.getDividerColor(); - divider1.setBackgroundColor(dividerColor); - divider2.setBackgroundColor(dividerColor); - divider3.setBackgroundColor(dividerColor); - divider4.setBackgroundColor(dividerColor); + divider1.setDividerColor(dividerColor); + divider2.setDividerColor(dividerColor); flairBackgroundColor = mCustomThemeWrapper.getFlairBackgroundColor(); flairTextColor = mCustomThemeWrapper.getFlairTextColor(); spoilerBackgroundColor = mCustomThemeWrapper.getSpoilerBackgroundColor(); diff --git a/app/src/main/res/layout/activity_edit_profile.xml b/app/src/main/res/layout/activity_edit_profile.xml index 453ad5c4..47d6aba3 100644 --- a/app/src/main/res/layout/activity_edit_profile.xml +++ b/app/src/main/res/layout/activity_edit_profile.xml @@ -13,14 +13,23 @@ android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> - + android:layout_height="match_parent" + app:layout_scrollFlags="scroll|enterAlways" + app:titleEnabled="false" + app:toolbarId="@+id/toolbar_post_text_activity"> + + + + @@ -42,14 +51,12 @@ + android:layout_height="wrap_content"> - @@ -68,17 +75,16 @@ - - - + android:orientation="vertical"> @@ -120,20 +121,19 @@ android:id="@+id/edit_text_display_name_edit_profile_activity" android:layout_width="match_parent" android:layout_height="wrap_content" + android:padding="16dp" android:gravity="top" + android:background="#00000000" android:hint="@string/display_name_hint" android:importantForAutofill="no" android:inputType="textCapSentences" - android:lines="1" - android:maxLength="30" - android:maxLines="1" - android:paddingStart="16dp" - android:paddingEnd="16dp" - android:paddingBottom="16dp" /> + android:maxLength="30" /> @@ -141,13 +141,14 @@ + android:orientation="vertical"> @@ -156,16 +157,13 @@ android:id="@+id/edit_text_about_you_edit_profile_activity" android:layout_width="match_parent" android:layout_height="wrap_content" + android:padding="16dp" android:gravity="top" + android:background="#00000000" android:hint="@string/about_you_hint" android:importantForAutofill="no" android:inputType="textCapSentences|textMultiLine" - android:lines="4" - android:maxLength="200" - android:maxLines="4" - android:paddingStart="16dp" - android:paddingEnd="16dp" - android:paddingBottom="16dp" /> + android:maxLength="200" /> diff --git a/app/src/main/res/layout/activity_post_gallery.xml b/app/src/main/res/layout/activity_post_gallery.xml index b66d0c34..66fd39ac 100644 --- a/app/src/main/res/layout/activity_post_gallery.xml +++ b/app/src/main/res/layout/activity_post_gallery.xml @@ -73,10 +73,10 @@ - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - - + android:layout_height="wrap_content" /> - - + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" /> diff --git a/app/src/main/res/menu/edit_profile_activity.xml b/app/src/main/res/menu/edit_profile_activity.xml index fe96ba20..4d5ec31d 100644 --- a/app/src/main/res/menu/edit_profile_activity.xml +++ b/app/src/main/res/menu/edit_profile_activity.xml @@ -6,6 +6,6 @@ android:id="@+id/action_save_edit_profile_activity" android:orderInCategory="1" android:title="@string/action_save" - android:icon="@drawable/ic_save_to_database_24dp" + android:icon="@drawable/ic_check_circle_toolbar_24dp" app:showAsAction="ifRoom" /> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3b8753e8..9d2f509e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -43,6 +43,7 @@ Gallery Post Trending Wiki + Edit Profile Open navigation drawer Close navigation drawer @@ -1226,9 +1227,9 @@ Remove Banner Display Name Show on your profile page - This will be displayed to viewer of your profile page and does not change your username + This will be displayed to viewers of your profile page and does not change your username. About You - A little description of your self + A little description of yourself Success remove Avatar Failed remove Avatar %s Success remove Banner