add possibility to change profile fields, refactor (#751)
* refactor EditProfileActivity, add profile fields * preserve transparency when cropping profile images * dont validate profile fields on client side * revert unintentional change in card_frame_dark.xml * improve activity_edit_profile layout for tablets * Revert "improve activity_edit_profile layout for tablets" This reverts commit 20ff3d167c39b15566e017108b33fe58690a8482. * improve activity_edit_profile layout for tablets * fix bug in EditProfileActivity, add snackbar * improve EditProfileActivity code * use events instead of shared prefs to communicate profile update
This commit is contained in:
parent
418c76d677
commit
f022944e90
16 changed files with 727 additions and 395 deletions
|
@ -8,7 +8,8 @@
|
|||
|
||||
<include layout="@layout/toolbar_basic" />
|
||||
|
||||
<ScrollView
|
||||
<android.support.v4.widget.NestedScrollView
|
||||
android:id="@+id/scrollView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
@ -47,98 +48,130 @@
|
|||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="@dimen/timeline_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="-40dp">
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="-40dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.keylesspalace.tusky.view.RoundedImageView
|
||||
android:id="@+id/avatarPreview"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/avatarButton"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/round_button"
|
||||
android:contentDescription="@string/label_avatar"
|
||||
android:elevation="4dp"
|
||||
app:srcCompat="@drawable/ic_add_a_photo_32dp" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/avatarProgressBar"
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone" />
|
||||
android:layout_marginStart="16dp">
|
||||
|
||||
</RelativeLayout>
|
||||
<com.keylesspalace.tusky.view.RoundedImageView
|
||||
android:id="@+id/avatarPreview"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/layout_edit_profile_display_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp">
|
||||
<ImageButton
|
||||
android:id="@+id/avatarButton"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="80dp"
|
||||
android:background="@drawable/round_button"
|
||||
android:contentDescription="@string/label_avatar"
|
||||
android:elevation="4dp"
|
||||
app:srcCompat="@drawable/ic_add_a_photo_32dp" />
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/displayNameEditText"
|
||||
<ProgressBar
|
||||
android:id="@+id/avatarProgressBar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/displayNameEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:hint="@string/hint_display_name"
|
||||
android:importantForAutofill="no" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/noteEditText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:hint="@string/hint_note"
|
||||
android:importantForAutofill="no" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatCheckBox
|
||||
android:id="@+id/lockedCheckBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:hint="@string/hint_display_name"
|
||||
android:importantForAutofill="no"
|
||||
android:maxLength="30" />
|
||||
android:layout_marginTop="30dp"
|
||||
android:paddingStart="8dp"
|
||||
android:text="@string/lock_account_label"
|
||||
android:textSize="?attr/status_text_medium" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:id="@+id/layout_edit_profile_note"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="30dp">
|
||||
|
||||
<android.support.design.widget.TextInputEditText
|
||||
android:id="@+id/noteEditText"
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:paddingStart="40dp"
|
||||
android:text="@string/lock_account_label_description"
|
||||
android:textSize="?attr/status_text_small" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@string/profile_metadata_label"
|
||||
android:textSize="?attr/status_text_small" />
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/fieldList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:nestedScrollingEnabled="false" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/addFieldButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:hint="@string/hint_note"
|
||||
android:importantForAutofill="no"
|
||||
android:maxLength="160" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
|
||||
<android.support.v7.widget.AppCompatCheckBox
|
||||
android:id="@+id/lockedCheckBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="30dp"
|
||||
android:paddingStart="8dp"
|
||||
android:text="@string/lock_account_label"
|
||||
android:textSize="?attr/status_text_medium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:paddingStart="40dp"
|
||||
android:text="@string/lock_account_label_description"
|
||||
android:textSize="?attr/status_text_small" />
|
||||
android:drawablePadding="6dp"
|
||||
android:text="@string/profile_metadata_add"
|
||||
android:textColor="#fff" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
</android.support.v4.widget.NestedScrollView>
|
||||
|
||||
<include layout="@layout/toolbar_shadow_shim" />
|
||||
|
||||
|
|
36
app/src/main/res/layout/item_edit_field.xml
Normal file
36
app/src/main/res/layout/item_edit_field.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp">
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:colorBackground"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.text.emoji.widget.EmojiEditText
|
||||
android:id="@+id/accountFieldName"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:textSize="?attr/status_text_medium"
|
||||
android:hint="@string/profile_metadata_label_label" />
|
||||
|
||||
<android.support.text.emoji.widget.EmojiEditText
|
||||
android:id="@+id/accountFieldValue"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:lineSpacingMultiplier="1.1"
|
||||
android:textSize="?attr/status_text_medium"
|
||||
android:hint="@string/profile_metadata_content_label" />
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
Loading…
Add table
Add a link
Reference in a new issue