diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-11-02 14:39:08 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-11-02 14:39:08 +0000 |
commit | 8716eefb47ebab3a75d184041a92e27aeae0eab2 (patch) | |
tree | 108dc62375bfa5a7ecd246edd9348c3127a988f7 /app | |
parent | 3a8c6b0a286cf73eafa580366a6af58697b3cb55 (diff) | |
download | infinity-for-reddit-8716eefb47ebab3a75d184041a92e27aeae0eab2.tar infinity-for-reddit-8716eefb47ebab3a75d184041a92e27aeae0eab2.tar.gz infinity-for-reddit-8716eefb47ebab3a75d184041a92e27aeae0eab2.tar.bz2 infinity-for-reddit-8716eefb47ebab3a75d184041a92e27aeae0eab2.tar.lz infinity-for-reddit-8716eefb47ebab3a75d184041a92e27aeae0eab2.tar.xz infinity-for-reddit-8716eefb47ebab3a75d184041a92e27aeae0eab2.tar.zst infinity-for-reddit-8716eefb47ebab3a75d184041a92e27aeae0eab2.zip |
Minor changes in EditProfileActivity.
Diffstat (limited to 'app')
3 files changed, 31 insertions, 19 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<String>() { + userInfo.enqueue(new Callback<>() { @Override public void onResponse(@NonNull Call<String> call, @NonNull retrofit2.Response<String> 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 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" +<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/root_layout_view_edit_profile_activity" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" tools:context=".activities.EditProfileActivity"> <com.google.android.material.appbar.AppBarLayout @@ -22,11 +21,13 @@ app:navigationIcon="?attr/homeAsUpIndicator" app:popupTheme="@style/AppTheme.PopupOverlay" app:title="@string/action_edit_profile" /> + </com.google.android.material.appbar.AppBarLayout> - <ScrollView + <androidx.core.widget.NestedScrollView android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:id="@+id/content_view_edit_profile_activity" @@ -62,6 +63,7 @@ android:contentDescription="@null" android:padding="4dp" app:srcCompat="@drawable/ic_outline_add_a_photo_day_night_24dp" /> + </FrameLayout> <FrameLayout @@ -89,7 +91,9 @@ android:contentDescription="@null" android:padding="4dp" app:srcCompat="@drawable/ic_outline_add_a_photo_day_night_24dp" /> + </FrameLayout> + </FrameLayout> <View @@ -131,6 +135,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/display_name_description" /> + </LinearLayout> <LinearLayout @@ -163,7 +168,9 @@ android:paddingBottom="16dp" /> </LinearLayout> + </LinearLayout> - </ScrollView> -</LinearLayout>
\ No newline at end of file + </androidx.core.widget.NestedScrollView> + +</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file |