Minor changes in EditProfileActivity.

This commit is contained in:
Alex Ning 2021-11-02 22:39:08 +08:00
parent 3a8c6b0a28
commit 8716eefb47
3 changed files with 32 additions and 20 deletions

View File

@ -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());
}

View File

@ -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()) {

View File

@ -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>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>