remove redundant account_header background, fix weird flicker in header when opening AccountActivity

This commit is contained in:
Conny Duck 2017-05-04 18:07:59 +02:00
parent bdca1d1c94
commit b97c4e24ed
6 changed files with 57 additions and 59 deletions

View File

@ -156,9 +156,6 @@ public class AccountActivity extends BaseActivity implements SFragment.OnUserRem
// Initialise the default UI states. // Initialise the default UI states.
floatingBtn.hide(); floatingBtn.hide();
avatar.setImageResource(R.drawable.avatar_default);
header.setImageResource(R.drawable.account_header_default);
// Obtain information to fill out the profile. // Obtain information to fill out the profile.
obtainAccount(); obtainAccount();
if (!accountId.equals(loggedInAccountId)) { if (!accountId.equals(loggedInAccountId)) {
@ -266,7 +263,7 @@ public class AccountActivity extends BaseActivity implements SFragment.OnUserRem
.into(avatar); .into(avatar);
Picasso.with(this) Picasso.with(this)
.load(account.header) .load(account.header)
.placeholder(R.drawable.account_header_missing) .placeholder(R.drawable.account_header_default)
.into(header); .into(header);
NumberFormat nf = NumberFormat.getInstance(); NumberFormat nf = NumberFormat.getInstance();

View File

@ -36,7 +36,6 @@ import android.util.Base64;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
@ -178,7 +177,7 @@ public class EditProfileActivity extends BaseActivity {
.into(avatar); .into(avatar);
Picasso.with(header.getContext()) Picasso.with(header.getContext())
.load(me.header) .load(me.header)
.placeholder(R.drawable.account_header_missing) .placeholder(R.drawable.account_header_default)
.into(header); .into(header);
} }

View File

@ -476,7 +476,7 @@ public class MainActivity extends BaseActivity implements SFragment.OnUserRemove
Picasso.with(MainActivity.this) Picasso.with(MainActivity.this)
.load(me.header) .load(me.header)
.placeholder(R.drawable.account_header_missing) .placeholder(R.drawable.account_header_default)
.resize(backgroundWidth, backgroundHeight) .resize(backgroundWidth, backgroundHeight)
.centerCrop() .centerCrop()
.into(background); .into(background);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,26 +1,25 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:id="@+id/activity_account"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/activity_account" android:fitsSystemWindows="true"
android:fitsSystemWindows="true"> android:orientation="vertical">
<android.support.design.widget.AppBarLayout <android.support.design.widget.AppBarLayout
android:id="@+id/account_app_bar_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="@style/AppTheme.Account.AppBarLayout" android:theme="@style/AppTheme.Account.AppBarLayout">
android:id="@+id/account_app_bar_layout">
<android.support.design.widget.CollapsingToolbarLayout <android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar" android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:contentScrim="?attr/toolbar_background_color"
android:fitsSystemWindows="true" android:fitsSystemWindows="true"
app:contentScrim="?attr/toolbar_background_color"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
app:titleEnabled="false"> app:titleEnabled="false">
<RelativeLayout <RelativeLayout
@ -29,93 +28,96 @@
android:background="?attr/account_header_background_color"> android:background="?attr/account_header_background_color">
<ImageView <ImageView
android:id="@+id/account_header"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/account_header" android:layout_alignBottom="@+id/account_header_info"
android:scaleType="centerCrop"
app:layout_collapseMode="pin"
android:fitsSystemWindows="true"
android:layout_alignTop="@+id/account_header_info" android:layout_alignTop="@+id/account_header_info"
android:layout_alignBottom="@id/account_header_info" android:background="@drawable/account_header_default"
android:contentDescription="@null" /> android:contentDescription="@null"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="pin" />
<LinearLayout <LinearLayout
android:orientation="vertical"
android:id="@+id/account_header_info" android:id="@+id/account_header_info"
android:paddingTop="?attr/actionBarSize"
android:background="@drawable/account_header_gradient"
android:layout_width="match_parent" android:layout_width="match_parent"
app:layout_collapseMode="parallax" android:layout_height="wrap_content"
android:layout_height="wrap_content"> android:background="@drawable/account_header_gradient"
android:orientation="vertical"
android:paddingTop="?attr/actionBarSize"
app:layout_collapseMode="parallax">
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="16dp" android:paddingRight="16dp"
android:paddingTop="16dp" android:paddingTop="16dp">
android:layout_height="wrap_content">
<com.pkmmte.view.CircularImageView <com.pkmmte.view.CircularImageView
android:id="@+id/account_avatar"
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
app:shadow="true" android:src="@drawable/avatar_default"
android:id="@+id/account_avatar" /> app:shadow="true" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_alignParentRight="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_toRightOf="@id/account_avatar" android:layout_toRightOf="@id/account_avatar"
android:layout_alignParentRight="true"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/account_display_name"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/account_display_name"
android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textStyle="normal|bold" android:maxLines="1"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="18sp" /> android:textSize="18sp"
android:textStyle="normal|bold" />
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/account_username"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textColor="?android:textColorSecondary" android:maxLines="1"
android:id="@+id/account_username" /> android:textColor="?android:textColorSecondary" />
<ImageView <ImageView
android:id="@+id/account_locked" android:id="@+id/account_locked"
android:visibility="gone"
android:layout_centerVertical="true"
android:layout_width="16sp" android:layout_width="16sp"
android:layout_height="16sp" android:layout_height="16sp"
android:layout_centerVertical="true"
android:layout_marginLeft="4dp" android:layout_marginLeft="4dp"
android:layout_marginStart="4dp" android:layout_marginStart="4dp"
android:layout_toEndOf="@id/account_username" android:layout_toEndOf="@id/account_username"
app:srcCompat="@drawable/reblog_disabled_light"
android:tint="?android:textColorSecondary"
android:layout_toRightOf="@id/account_username" android:layout_toRightOf="@id/account_username"
android:contentDescription="@string/description_account_locked" /> android:contentDescription="@string/description_account_locked"
android:tint="?android:textColorSecondary"
android:visibility="gone"
app:srcCompat="@drawable/reblog_disabled_light" />
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
<TextView <TextView
android:id="@+id/account_note"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/account_note"
android:textColor="?android:textColorTertiary"
android:padding="16dp" android:padding="16dp"
android:paddingTop="10dp" /> android:paddingTop="10dp"
android:textColor="?android:textColorTertiary" />
</LinearLayout> </LinearLayout>
@ -125,9 +127,9 @@
android:id="@+id/toolbar" android:id="@+id/toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" android:layout_height="?attr/actionBarSize"
android:background="@android:color/transparent"
android:layout_gravity="top"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_gravity="top"
android:background="@android:color/transparent"
app:layout_collapseMode="pin" app:layout_collapseMode="pin"
app:popupTheme="?attr/account_toolbar_popup_theme" /> app:popupTheme="?attr/account_toolbar_popup_theme" />
@ -136,16 +138,16 @@
</android.support.design.widget.AppBarLayout> </android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/pager"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.design.widget.TabLayout <android.support.design.widget.TabLayout
android:id="@+id/tab_layout" android:id="@+id/tab_layout"
app:tabBackground="?android:colorBackground"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
app:tabBackground="?android:colorBackground">
<android.support.design.widget.TabItem <android.support.design.widget.TabItem
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -172,18 +174,18 @@
android:id="@+id/tab_bottom_shadow" android:id="@+id/tab_bottom_shadow"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="2dp" android:layout_height="2dp"
app:layout_anchor="@id/tab_layout"
app:layout_anchorGravity="bottom"
android:background="@drawable/material_drawer_shadow_bottom" android:background="@drawable/material_drawer_shadow_bottom"
android:visibility="visible" /> android:visibility="visible"
app:layout_anchor="@id/tab_layout"
app:layout_anchorGravity="bottom" />
<android.support.design.widget.FloatingActionButton <android.support.design.widget.FloatingActionButton
android:id="@+id/floating_btn" android:id="@+id/floating_btn"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:layout_height="wrap_content" android:contentDescription="@string/action_follow"
app:srcCompat="@drawable/ic_person_add_24dp" app:srcCompat="@drawable/ic_person_add_24dp" />
android:contentDescription="@string/action_follow" />
</android.support.design.widget.CoordinatorLayout> </android.support.design.widget.CoordinatorLayout>