カラム背景色の指定をプロフ画像背景にも反映させる

This commit is contained in:
tateisu 2017-06-03 07:48:09 +09:00
parent 7cdf582439
commit 5821b5b906
3 changed files with 24 additions and 1 deletions

View File

@ -365,6 +365,10 @@ class ColumnViewHolder
loadBackgroundImage( ivColumnBackgroundImage, column.column_bg_image ); loadBackgroundImage( ivColumnBackgroundImage, column.column_bg_image );
if( status_adapter != null && status_adapter.header != null ){
status_adapter.header.showColor();
}
} }

View File

@ -1,5 +1,6 @@
package jp.juggler.subwaytooter; package jp.juggler.subwaytooter;
import android.support.v4.view.ViewCompat;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.ImageButton; import android.widget.ImageButton;
@ -34,6 +35,8 @@ class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener
private final TextView tvNote; private final TextView tvNote;
private final ImageButton btnFollow; private final ImageButton btnFollow;
private final ImageView ivFollowedBy; private final ImageView ivFollowedBy;
private final View llProfile;
private TootAccount who; private TootAccount who;
@ -62,6 +65,7 @@ class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener
ivBackground = (MyNetworkImageView) viewRoot.findViewById( R.id.ivBackground ); ivBackground = (MyNetworkImageView) viewRoot.findViewById( R.id.ivBackground );
llProfile = viewRoot.findViewById( R.id.llProfile );
tvCreated = (TextView) viewRoot.findViewById( R.id.tvCreated ); tvCreated = (TextView) viewRoot.findViewById( R.id.tvCreated );
ivAvatar = (MyNetworkImageView) viewRoot.findViewById( R.id.ivAvatar ); ivAvatar = (MyNetworkImageView) viewRoot.findViewById( R.id.ivAvatar );
tvDisplayName = (TextView) viewRoot.findViewById( R.id.tvDisplayName ); tvDisplayName = (TextView) viewRoot.findViewById( R.id.tvDisplayName );
@ -73,6 +77,8 @@ class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener
View btnMore = viewRoot.findViewById( R.id.btnMore ); View btnMore = viewRoot.findViewById( R.id.btnMore );
btnFollow = (ImageButton) viewRoot.findViewById( R.id.btnFollow ); btnFollow = (ImageButton) viewRoot.findViewById( R.id.btnFollow );
ivFollowedBy = (ImageView) viewRoot.findViewById( R.id.ivFollowedBy ); ivFollowedBy = (ImageView) viewRoot.findViewById( R.id.ivFollowedBy );
ivBackground.setOnClickListener( this ); ivBackground.setOnClickListener( this );
btnFollowing.setOnClickListener( this ); btnFollowing.setOnClickListener( this );
btnFollowers.setOnClickListener( this ); btnFollowers.setOnClickListener( this );
@ -85,8 +91,20 @@ class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener
tvNote.setMovementMethod( MyLinkMovementMethod.getInstance() ); tvNote.setMovementMethod( MyLinkMovementMethod.getInstance() );
} }
void showColor(){
int c = column.column_bg_color;
if( c == 0 ){
c = Styler.getAttributeColor( activity, R.attr. colorProfileBackgroundMask);
}else{
c = 0xc0000000 | (0x00ffffff & c);
}
llProfile.setBackgroundColor( c );
}
void bind( TootAccount who ){ void bind( TootAccount who ){
this.who = who; this.who = who;
showColor();
if( who == null ){ if( who == null ){
tvCreated.setText( "" ); tvCreated.setText( "" );
@ -176,4 +194,5 @@ class HeaderViewHolder implements View.OnClickListener, View.OnLongClickListener
return false; return false;
} }
} }

View File

@ -33,10 +33,10 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorProfileBackgroundMask"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical" android:orientation="vertical"
android:padding="12dp" android:padding="12dp"
android:id="@+id/llProfile"
> >
<jp.juggler.subwaytooter.view.MyNetworkImageView <jp.juggler.subwaytooter.view.MyNetworkImageView