Issue #564 - Background header for light theme

This commit is contained in:
stom79 2018-11-14 14:34:08 +01:00
parent 03017d090a
commit ec680e5a47
2 changed files with 26 additions and 9 deletions

View File

@ -1489,9 +1489,17 @@ public class Helper {
if( urlHeader.startsWith("/") ){ if( urlHeader.startsWith("/") ){
urlHeader = Helper.getLiveInstanceWithProtocol(activity) + account.getHeader(); urlHeader = Helper.getLiveInstanceWithProtocol(activity) + account.getHeader();
} }
LinearLayout main_header_container = headerLayout.findViewById(R.id.main_header_container); ImageView owner_accounts = headerLayout.findViewById(R.id.owner_accounts);
if( theme == Helper.THEME_LIGHT){ ImageView header_option_info = headerLayout.findViewById(R.id.header_option_info);
main_header_container.setBackgroundDrawable( activity.getResources().getDrawable(R.drawable.side_nav_bar_dark)); ImageView header_option_menu = headerLayout.findViewById(R.id.header_option_menu);
if( theme == Helper.THEME_DARK || theme == Helper.THEME_BLACK){
changeDrawableColor(activity, owner_accounts,R.color.dark_text);
changeDrawableColor(activity, header_option_info,R.color.dark_text);
changeDrawableColor(activity, header_option_menu,R.color.dark_text);
}else {
changeDrawableColor(activity, owner_accounts,R.color.light_black);
changeDrawableColor(activity, header_option_info,R.color.light_black);
changeDrawableColor(activity, header_option_menu,R.color.light_black);
} }
if (!urlHeader.contains("missing.png")) { if (!urlHeader.contains("missing.png")) {
Glide.with(activity.getApplicationContext()) Glide.with(activity.getApplicationContext())
@ -1502,11 +1510,20 @@ public class Helper {
public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) { public void onResourceReady(@NonNull Bitmap resource, Transition<? super Bitmap> transition) {
ImageView backgroundImage = headerLayout.findViewById(R.id.back_ground_image); ImageView backgroundImage = headerLayout.findViewById(R.id.back_ground_image);
backgroundImage.setImageBitmap(resource); backgroundImage.setImageBitmap(resource);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { if( theme == THEME_LIGHT){
backgroundImage.setImageAlpha(60); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
}else { backgroundImage.setImageAlpha(80);
backgroundImage.setAlpha(60); }else {
backgroundImage.setAlpha(80);
}
}else{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
backgroundImage.setImageAlpha(60);
}else {
backgroundImage.setAlpha(60);
}
} }
} }
}); });
} }

View File

@ -74,7 +74,7 @@
<TextView <TextView
android:gravity="center_vertical" android:gravity="center_vertical"
android:id="@+id/displayedName" android:id="@+id/displayedName"
android:textColor="@color/dark_text" android:textColor="?attr/textColor"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1" android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -92,7 +92,7 @@
</LinearLayout> </LinearLayout>
<TextView <TextView
android:id="@+id/username" android:id="@+id/username"
android:textColor="@color/dark_text" android:textColor="?attr/textColor"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:textSize="12sp" android:textSize="12sp"
android:maxLines="1" android:maxLines="1"