Add a tinted background image to the drawer account header
... using the configured account color as tint color. Thanks @ByteHamster
This commit is contained in:
parent
269656dbe3
commit
e9d3c14ff8
3 changed files with 15 additions and 2 deletions
|
@ -5,6 +5,7 @@ import android.arch.lifecycle.Observer;
|
|||
import android.arch.lifecycle.ViewModelProvider;
|
||||
import android.arch.lifecycle.ViewModelProviders;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
@ -94,6 +95,7 @@ public class K9Drawer {
|
|||
private AccountHeader buildAccountHeader() {
|
||||
AccountHeaderBuilder headerBuilder = new AccountHeaderBuilder()
|
||||
.withActivity(parent)
|
||||
.withHeaderBackground(R.drawable.drawer_header_background)
|
||||
.withTranslucentStatusBar(false);
|
||||
|
||||
if (!K9.isHideSpecialAccounts()) {
|
||||
|
@ -207,6 +209,7 @@ public class K9Drawer {
|
|||
} else {
|
||||
unifiedInboxSelected = false;
|
||||
accountHeader.setActiveProfile((account.getAccountNumber()+1) << DRAWER_ACCOUNT_SHIFT);
|
||||
accountHeader.getHeaderBackgroundView().setColorFilter(account.getChipColor(), PorterDuff.Mode.OVERLAY);
|
||||
ViewModelProvider viewModelProvider = ViewModelProviders.of(parent, new MessageListViewModelFactory());
|
||||
MessageListViewModel viewModel = viewModelProvider.get(MessageListViewModel.class);
|
||||
viewModel.getFolders(account).observe(parent, new Observer<List<Folder>>() {
|
||||
|
@ -288,6 +291,7 @@ public class K9Drawer {
|
|||
unifiedInboxSelected = true;
|
||||
openedFolderServerId = null;
|
||||
accountHeader.setActiveProfile(DRAWER_ID_UNIFIED_INBOX);
|
||||
accountHeader.getHeaderBackgroundView().setColorFilter(0xFFFFFFFF, PorterDuff.Mode.MULTIPLY);
|
||||
clearUserFolders();
|
||||
}
|
||||
|
||||
|
|
11
app/ui/src/main/res/drawable/drawer_header_background.xml
Normal file
11
app/ui/src/main/res/drawable/drawer_header_background.xml
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<gradient
|
||||
android:angle="45"
|
||||
android:centerColor="#777"
|
||||
android:endColor="#444"
|
||||
android:startColor="#555"
|
||||
android:type="linear" />
|
||||
<corners
|
||||
android:radius="0dp"/>
|
||||
</shape>
|
|
@ -9,6 +9,4 @@
|
|||
<color name="status_ok_checkmark">#7bad45</color>
|
||||
|
||||
<color name="drawer_background">#666666</color>
|
||||
|
||||
<color name="material_drawer_header_selection_text">@color/material_drawer_primary_text</color>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue