Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9d3c14f authored by Marc K's avatar Marc K Committed by morckx
Browse files

Add a tinted background image to the drawer account header

... using the configured account color as tint color.

Thanks @ByteHamster
parent 269656db
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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 −0
Original line number Diff line number Diff line
<?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>
 No newline at end of file
+0 −2
Original line number Diff line number Diff line
@@ -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>