From 8716eefb47ebab3a75d184041a92e27aeae0eab2 Mon Sep 17 00:00:00 2001 From: Alex Ning Date: Tue, 2 Nov 2021 22:39:08 +0800 Subject: [PATCH] Minor changes in EditProfileActivity. --- .../activities/EditProfileActivity.java | 29 +++++++++++-------- .../infinityforreddit/user/FetchUserData.java | 2 +- .../main/res/layout/activity_edit_profile.xml | 21 +++++++++----- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java index fadef9b8..f267e9f4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/EditProfileActivity.java @@ -14,13 +14,14 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.widget.Toolbar; +import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.content.ContextCompat; import androidx.lifecycle.ViewModelProvider; -import butterknife.BindView; -import butterknife.ButterKnife; + import com.bumptech.glide.Glide; import com.bumptech.glide.RequestManager; import com.bumptech.glide.request.RequestOptions; @@ -28,6 +29,15 @@ import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.r0adkll.slidr.Slidr; import com.r0adkll.slidr.model.SlidrInterface; + +import org.greenrobot.eventbus.EventBus; +import org.greenrobot.eventbus.Subscribe; + +import javax.inject.Inject; +import javax.inject.Named; + +import butterknife.BindView; +import butterknife.ButterKnife; import jp.wasabeef.glide.transformations.RoundedCornersTransformation; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.R; @@ -40,26 +50,21 @@ import ml.docilealligator.infinityforreddit.services.EditProfileService; import ml.docilealligator.infinityforreddit.user.UserViewModel; import ml.docilealligator.infinityforreddit.utils.EditProfileUtils; import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils; -import org.greenrobot.eventbus.EventBus; -import org.greenrobot.eventbus.Subscribe; import retrofit2.Retrofit; -import javax.inject.Inject; -import javax.inject.Named; - public class EditProfileActivity extends BaseActivity { private static final int PICK_IMAGE_BANNER_REQUEST_CODE = 0x401; private static final int PICK_IMAGE_AVATAR_REQUEST_CODE = 0x402; @BindView(R.id.root_layout_view_edit_profile_activity) - LinearLayout root; + CoordinatorLayout root; @BindView(R.id.content_view_edit_profile_activity) LinearLayout content; - @BindView(R.id.toolbar_view_edit_profile_activity) - Toolbar toolbar; @BindView(R.id.appbar_layout_view_edit_profile_activity) AppBarLayout appBarLayout; + @BindView(R.id.toolbar_view_edit_profile_activity) + Toolbar toolbar; @BindView(R.id.image_view_banner_edit_profile_activity) ImageView bannerImageView; @BindView(R.id.image_view_avatar_edit_profile_activity) @@ -322,8 +327,8 @@ public class EditProfileActivity extends BaseActivity { } @Override - protected void applyCustomTheme() { // - applyAppBarLayoutAndToolbarTheme(appBarLayout, toolbar); + protected void applyCustomTheme() { + applyAppBarLayoutAndCollapsingToolbarLayoutAndToolbarTheme(appBarLayout, null, toolbar); root.setBackgroundColor(mCustomThemeWrapper.getBackgroundColor()); changeColorTextView(content, mCustomThemeWrapper.getPrimaryTextColor()); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java b/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java index 3c5280a7..fc3da19d 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/user/FetchUserData.java @@ -26,7 +26,7 @@ public class FetchUserData { } else { userInfo = api.getUserDataOauth(APIUtils.getOAuthHeader(accessToken), userName); } - userInfo.enqueue(new Callback() { + userInfo.enqueue(new Callback<>() { @Override public void onResponse(@NonNull Call call, @NonNull retrofit2.Response response) { if (response.isSuccessful()) { diff --git a/app/src/main/res/layout/activity_edit_profile.xml b/app/src/main/res/layout/activity_edit_profile.xml index 6f472c9b..453ad5c4 100644 --- a/app/src/main/res/layout/activity_edit_profile.xml +++ b/app/src/main/res/layout/activity_edit_profile.xml @@ -1,11 +1,10 @@ - + - + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> + + + + - - - \ No newline at end of file + + + + + \ No newline at end of file