From db280ae488cae4718c3dd3767dec665f2c29ae27 Mon Sep 17 00:00:00 2001
From: Janne Koschinski <janne@kuschku.de>
Date: Tue, 23 Feb 2016 23:38:35 +0100
Subject: [PATCH] =?UTF-8?q?Fixed=20several=20issues:=20-=20Fixed=20an=20is?=
 =?UTF-8?q?sue=20where=20backlog=20for=20some=20buffers=20could=20not=20be?=
 =?UTF-8?q?=20loaded=20-=20Fixed=20an=20issue=20where=20chat=20list=20filt?=
 =?UTF-8?q?ers=20didn=E2=80=99t=20work=20properly?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/build.gradle                              |  5 ++-
 .../kuschku/libquassel/message/Message.java   | 10 +++---
 .../serializers/MessageSerializer.java        |  4 ---
 .../syncables/types/impl/BacklogManager.java  |  2 +-
 .../syncables/types/impl/BufferSyncer.java    |  2 --
 .../types/impl/BufferViewConfig.java          | 19 +++++++++++
 .../types/interfaces/QBufferViewConfig.java   | 10 ++++++
 .../quasseldroid_ng/ui/LoginActivity.java     |  4 +--
 .../ui/chat/drawer/NetworkItem.java           |  4 +--
 .../ui/chat/util/ServiceHelper.java           | 12 ++++---
 .../ui/settings/SettingsActivity.java         |  4 +--
 .../quasseldroid_ng/ui/theme/AppContext.java  | 10 ++++++
 .../de/kuschku/util/niohelpers/Helper.java    | 25 ++++++++------
 .../util/observables/ContentComparable.java   |  6 ++--
 .../util/servicebound/BoundActivity.java      |  2 +-
 .../util/servicebound/BoundFragment.java      |  2 +-
 .../main/res/layout-sw600dp-land/slide.xml    | 31 +++++++++--------
 app/src/main/res/layout-sw600dp/slide.xml     | 34 +++++++++----------
 app/src/main/res/layout/slide.xml             |  6 ++--
 app/src/main/res/values-w720dp/styles.xml     | 26 --------------
 app/src/main/res/values/styles.xml            | 15 ++++----
 21 files changed, 123 insertions(+), 110 deletions(-)
 delete mode 100644 app/src/main/res/values-w720dp/styles.xml

diff --git a/app/build.gradle b/app/build.gradle
index ca930cc2c..89d0b1465 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -148,10 +148,9 @@ dependencies {
 
     // UI Libs
     compile 'com.bignerdranch.android:expandablerecyclerview:2.0.4'
-    compile 'com.fnp:material-preferences:0.1.4'
-    compile 'com.pavelsikun:material-seekbar-preference:0.12.1+'
     compile(name:'library-release', ext:'aar')
-    compile('com.mikepenz:materialdrawer:5.0.0.b27-SNAPSHOT@aar') { transitive = true }
+    // This dependency can be removed as soon as the requires ressources are copied over.
+    compile('com.mikepenz:materialdrawer:5.0.3@aar') { transitive = true }
     compile('com.github.afollestad.material-dialogs:core:0.8.5.3@aar') { transitive = true }
     compile('com.github.afollestad.material-dialogs:commons:0.8.5.3@aar') { transitive = true }
 
diff --git a/app/src/main/java/de/kuschku/libquassel/message/Message.java b/app/src/main/java/de/kuschku/libquassel/message/Message.java
index e038f960a..487c8b0dd 100644
--- a/app/src/main/java/de/kuschku/libquassel/message/Message.java
+++ b/app/src/main/java/de/kuschku/libquassel/message/Message.java
@@ -42,13 +42,13 @@ public class Message implements ContentComparable<Message> {
     public final Flags flags;
     @NonNull
     public final BufferInfo bufferInfo;
-    @NonNull
+    @Nullable
     public final String sender;
-    @NonNull
+    @Nullable
     public final String content;
 
-    public Message(int messageId, @NonNull DateTime time, @NonNull Type type, @NonNull Flags flags, @NonNull BufferInfo bufferInfo, @NonNull String sender,
-                   @NonNull String content) {
+    public Message(int messageId, @NonNull DateTime time, @NonNull Type type, @NonNull Flags flags, @NonNull BufferInfo bufferInfo, @Nullable String sender,
+                   @Nullable String content) {
         this.messageId = messageId;
         this.time = time;
         this.type = type;
@@ -73,7 +73,7 @@ public class Message implements ContentComparable<Message> {
     }
 
     @Override
-    public boolean areContentsTheSame(@NonNull Message message) {
+    public boolean areContentsTheSame(@Nullable Message message) {
         return this == message;
     }
 
diff --git a/app/src/main/java/de/kuschku/libquassel/primitives/serializers/MessageSerializer.java b/app/src/main/java/de/kuschku/libquassel/primitives/serializers/MessageSerializer.java
index a9b442408..e552ee77c 100644
--- a/app/src/main/java/de/kuschku/libquassel/primitives/serializers/MessageSerializer.java
+++ b/app/src/main/java/de/kuschku/libquassel/primitives/serializers/MessageSerializer.java
@@ -33,8 +33,6 @@ import java.nio.channels.ByteChannel;
 import de.kuschku.libquassel.message.Message;
 import de.kuschku.libquassel.primitives.types.BufferInfo;
 
-import static de.kuschku.util.AndroidAssert.assertNotNull;
-
 public class MessageSerializer implements PrimitiveSerializer<Message> {
     @NonNull
     private static final MessageSerializer serializer = new MessageSerializer();
@@ -69,8 +67,6 @@ public class MessageSerializer implements PrimitiveSerializer<Message> {
         String sender = ByteArraySerializer.get().deserialize(buffer);
         String message = ByteArraySerializer.get().deserialize(buffer);
 
-        assertNotNull(sender);
-        assertNotNull(message);
         return new Message(
                 messageId,
                 time,
diff --git a/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BacklogManager.java b/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BacklogManager.java
index c52f6d537..605b2f9d6 100644
--- a/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BacklogManager.java
+++ b/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BacklogManager.java
@@ -132,7 +132,7 @@ public class BacklogManager extends ABacklogManager<BacklogManager> {
             provider.sendEvent(new BacklogReceivedEvent(id));
             if (id == openBuffer && openBuffer != -1)
                 client.bufferSyncer().requestMarkBufferAsRead(openBuffer);
-            waiting.remove(id);
+            removeWaiting(id);
             initialized.add(id);
         }
         checkWaiting();
diff --git a/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferSyncer.java b/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferSyncer.java
index f7e1a99fe..1b6c15ec4 100644
--- a/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferSyncer.java
+++ b/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferSyncer.java
@@ -23,7 +23,6 @@ package de.kuschku.libquassel.syncables.types.impl;
 
 import android.databinding.ObservableInt;
 import android.support.annotation.NonNull;
-import android.util.Log;
 import android.util.SparseArray;
 import android.util.SparseIntArray;
 
@@ -236,7 +235,6 @@ public class BufferSyncer extends ABufferSyncer<BufferSyncer> {
         int lastSeenMsg = lastSeenMsg(message.bufferInfo.id());
         if (message.messageId > lastSeenMsg) {
             addActivity(message.bufferInfo.id(), message.type);
-            Log.d("libquassel", "Unread: " + lastSeenMsg + "/" + message);
         }
     }
 }
diff --git a/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferViewConfig.java b/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferViewConfig.java
index 2c5f8ae23..507797837 100644
--- a/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferViewConfig.java
+++ b/app/src/main/java/de/kuschku/libquassel/syncables/types/impl/BufferViewConfig.java
@@ -29,6 +29,7 @@ import java.util.Map;
 
 import de.kuschku.libquassel.BusProvider;
 import de.kuschku.libquassel.client.Client;
+import de.kuschku.libquassel.localtypes.buffers.Buffer;
 import de.kuschku.libquassel.primitives.types.QVariant;
 import de.kuschku.libquassel.syncables.serializers.BufferViewConfigSerializer;
 import de.kuschku.libquassel.syncables.types.abstracts.ABufferViewConfig;
@@ -137,6 +138,24 @@ public class BufferViewConfig extends ABufferViewConfig<BufferViewConfig> {
         }
     }
 
+    @Override
+    public DisplayType mayDisplay(Buffer buffer) {
+        if (buffer != null &&
+                (allowedBufferTypes == 0 || (0 != (buffer.getInfo().type().id & allowedBufferTypes()))) &&
+                (networkId == 0 || (networkId == buffer.getInfo().networkId()))
+                ) {
+            int bufferid = buffer.getInfo().id();
+            if (bufferIds.contains(bufferid) && !temporarilyRemovedBuffers.contains(bufferid) && !removedBuffers.contains(bufferid))
+                return DisplayType.ALWAYS;
+            else if (temporarilyRemovedBuffers.contains(bufferid) && !removedBuffers.contains(bufferid))
+                return DisplayType.TEMP_HIDDEN;
+            else
+                return DisplayType.PERM_HIDDEN;
+        } else {
+            return DisplayType.NONE;
+        }
+    }
+
     @Override
     public boolean addNewBuffersAutomatically() {
         return addNewBuffersAutomatically;
diff --git a/app/src/main/java/de/kuschku/libquassel/syncables/types/interfaces/QBufferViewConfig.java b/app/src/main/java/de/kuschku/libquassel/syncables/types/interfaces/QBufferViewConfig.java
index f73fe9ea1..36eec92cf 100644
--- a/app/src/main/java/de/kuschku/libquassel/syncables/types/interfaces/QBufferViewConfig.java
+++ b/app/src/main/java/de/kuschku/libquassel/syncables/types/interfaces/QBufferViewConfig.java
@@ -23,6 +23,7 @@ package de.kuschku.libquassel.syncables.types.interfaces;
 
 import android.support.annotation.NonNull;
 
+import de.kuschku.libquassel.localtypes.buffers.Buffer;
 import de.kuschku.libquassel.syncables.Synced;
 import de.kuschku.util.observables.lists.ObservableList;
 import de.kuschku.util.observables.lists.ObservableSet;
@@ -156,4 +157,13 @@ public interface QBufferViewConfig extends QObservable {
     ObservableSet<QNetwork> networkList();
 
     void updateNetworks();
+
+    DisplayType mayDisplay(Buffer buffer);
+
+    enum DisplayType {
+        NONE,
+        ALWAYS,
+        TEMP_HIDDEN,
+        PERM_HIDDEN
+    }
 }
diff --git a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/LoginActivity.java b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/LoginActivity.java
index 94900ce8f..6e5c5e9f2 100644
--- a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/LoginActivity.java
+++ b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/LoginActivity.java
@@ -28,7 +28,6 @@ import android.support.v7.app.AppCompatActivity;
 
 import de.kuschku.quasseldroid_ng.ui.chat.MainActivity;
 import de.kuschku.quasseldroid_ng.ui.chat.util.ServiceHelper;
-import de.kuschku.quasseldroid_ng.ui.settings.Settings;
 import de.kuschku.quasseldroid_ng.ui.setup.AccountSelectActivity;
 import de.kuschku.quasseldroid_ng.ui.theme.AppContext;
 
@@ -41,8 +40,7 @@ public class LoginActivity extends AppCompatActivity {
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        ServiceHelper.initTheme(context, this);
-        context.withSettings(new Settings(this));
+        ServiceHelper.initContext(context, this);
     }
 
     @Override
diff --git a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/drawer/NetworkItem.java b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/drawer/NetworkItem.java
index 3b989be83..2220c55db 100644
--- a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/drawer/NetworkItem.java
+++ b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/drawer/NetworkItem.java
@@ -74,14 +74,14 @@ public class NetworkItem implements ParentListItem {
         this.network = network;
         for (int id : config.bufferList()) {
             Buffer buffer = context.client().bufferManager().buffer(id);
-            if (buffer != null && buffer.getInfo().networkId() == network.networkId())
+            if (context.bufferDisplayTypes().contains(config.mayDisplay(buffer)) && buffer.getInfo().networkId() == network.networkId())
                 buffers.add(buffer);
         }
         config.bufferIds().addCallback(new ElementCallback<Integer>() {
             @Override
             public void notifyItemInserted(Integer id) {
                 Buffer buffer = context.client().bufferManager().buffer(id);
-                if (buffer != null && buffer.getInfo().networkId() == network.networkId())
+                if (context.bufferDisplayTypes().contains(config.mayDisplay(buffer)) && buffer.getInfo().networkId() == network.networkId())
                     buffers.add(buffer);
             }
 
diff --git a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/util/ServiceHelper.java b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/util/ServiceHelper.java
index 24a4901c4..4f1f8ea06 100644
--- a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/util/ServiceHelper.java
+++ b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/chat/util/ServiceHelper.java
@@ -26,6 +26,7 @@ import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
 
+import de.kuschku.libquassel.syncables.types.interfaces.QBufferViewConfig;
 import de.kuschku.quasseldroid_ng.service.QuasselService;
 import de.kuschku.quasseldroid_ng.ui.settings.Settings;
 import de.kuschku.quasseldroid_ng.ui.theme.AppContext;
@@ -64,12 +65,15 @@ public class ServiceHelper {
         context.startService(intent);
     }
 
+    public static int initContext(AppContext context, Activity activity) {
+        context.setSettings(new Settings(activity));
+        context.bufferDisplayTypes().add(QBufferViewConfig.DisplayType.ALWAYS);
+        return initTheme(context, activity);
+    }
+
     public static int initTheme(AppContext context, Activity activity) {
-        // Init SharedPreferences
-        Settings settings = new Settings(activity);
-        context.setSettings(settings);
         // Load Theme from Preferences
-        AppTheme theme = AppTheme.themeFromString(settings.preferenceTheme.get());
+        AppTheme theme = AppTheme.themeFromString(context.settings().preferenceTheme.get());
         activity.setTheme(theme.themeId);
         context.setThemeUtil(new ThemeUtil(activity, theme));
         return theme.themeId;
diff --git a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/settings/SettingsActivity.java b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/settings/SettingsActivity.java
index 7b27c3baf..132908a90 100644
--- a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/settings/SettingsActivity.java
+++ b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/settings/SettingsActivity.java
@@ -45,7 +45,7 @@ public class SettingsActivity extends AppCompatActivity {
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
-        themeid = ServiceHelper.initTheme(context, this);
+        themeid = ServiceHelper.initContext(context, this);
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_settings);
         ButterKnife.bind(this);
@@ -87,7 +87,7 @@ public class SettingsActivity extends AppCompatActivity {
 
         @Override
         public void onCreate(Bundle savedInstanceState) {
-            ServiceHelper.initTheme(context, getActivity());
+            ServiceHelper.initContext(context, getActivity());
             super.onCreate(savedInstanceState);
             addPreferencesFromResource(R.xml.pref_appearance);
         }
diff --git a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/theme/AppContext.java b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/theme/AppContext.java
index 28e4161f7..08c921c5f 100644
--- a/app/src/main/java/de/kuschku/quasseldroid_ng/ui/theme/AppContext.java
+++ b/app/src/main/java/de/kuschku/quasseldroid_ng/ui/theme/AppContext.java
@@ -23,8 +23,12 @@ package de.kuschku.quasseldroid_ng.ui.theme;
 
 import android.support.annotation.NonNull;
 
+import java.util.HashSet;
+import java.util.Set;
+
 import de.kuschku.libquassel.BusProvider;
 import de.kuschku.libquassel.client.Client;
+import de.kuschku.libquassel.syncables.types.interfaces.QBufferViewConfig;
 import de.kuschku.quasseldroid_ng.ui.settings.Settings;
 import de.kuschku.util.irc.format.IrcFormatDeserializer;
 import de.kuschku.util.irc.format.IrcFormatSerializer;
@@ -36,6 +40,8 @@ public class AppContext {
     private BusProvider provider;
     private IrcFormatDeserializer deserializer;
     private IrcFormatSerializer serializer;
+    private QBufferViewConfig.DisplayType bufferDisplayType;
+    private Set<QBufferViewConfig.DisplayType> bufferDisplayTypes = new HashSet<>();
 
     public ThemeUtil themeUtil() {
         return themeUtil;
@@ -103,4 +109,8 @@ public class AppContext {
     public IrcFormatSerializer serializer() {
         return serializer;
     }
+
+    public Set<QBufferViewConfig.DisplayType> bufferDisplayTypes() {
+        return bufferDisplayTypes;
+    }
 }
diff --git a/app/src/main/java/de/kuschku/util/niohelpers/Helper.java b/app/src/main/java/de/kuschku/util/niohelpers/Helper.java
index dff643fac..7ce8bbe04 100644
--- a/app/src/main/java/de/kuschku/util/niohelpers/Helper.java
+++ b/app/src/main/java/de/kuschku/util/niohelpers/Helper.java
@@ -24,31 +24,34 @@ package de.kuschku.util.niohelpers;
 import android.support.annotation.NonNull;
 import android.util.Log;
 
+import java.util.LinkedList;
+import java.util.List;
+
 public class Helper {
     // Making default constructor invisible
     private Helper() {
 
     }
 
-    public static void printHexDump(@NonNull byte[] data) {
-        Log.e("HexDump", "Hexdump following: ");
+    public static void printHexDump(String prefix, @NonNull byte[] data) {
+        List<String> strs = new LinkedList<>();
+        Log.e("HexDump" + prefix, "========");
         String bytes = "";
-        String text = "";
         int i;
         for (i = 0; i < data.length; i++) {
             bytes += String.format("%02x ", data[i]);
-            text += encodeChar(data[1]);
-            if (i > 0 && (i + 1) % 8 == 0) {
-                Log.e("HexDump", String.format("%08x ", i - 7) + bytes + text);
+            if (i > 0 && (i + 1) % 32 == 0) {
+                strs.add(bytes);
                 bytes = "";
-                text = "";
             }
         }
-        Log.e("HexDump", String.format("%08x ", i - 7) + bytes + text);
+        strs.add(bytes);
+        for (int j = 0; j < strs.size(); j++) {
+            Log.e("HexDump" + prefix + ":" + j, strs.get(j));
+        }
     }
 
-    private static char encodeChar(byte data) {
-        if (data < 127 && data > 32) return (char) data;
-        else return '.';
+    public static void printHexDump(@NonNull byte[] data) {
+        printHexDump("", data);
     }
 }
diff --git a/app/src/main/java/de/kuschku/util/observables/ContentComparable.java b/app/src/main/java/de/kuschku/util/observables/ContentComparable.java
index b7daab0df..8ad75c784 100644
--- a/app/src/main/java/de/kuschku/util/observables/ContentComparable.java
+++ b/app/src/main/java/de/kuschku/util/observables/ContentComparable.java
@@ -21,8 +21,10 @@
 
 package de.kuschku.util.observables;
 
+import android.support.annotation.NonNull;
+
 public interface ContentComparable<T extends ContentComparable<T>> extends Comparable<T> {
-    boolean areItemsTheSame(T other);
+    boolean areItemsTheSame(@NonNull T other);
 
-    boolean areContentsTheSame(T other);
+    boolean areContentsTheSame(@NonNull T other);
 }
diff --git a/app/src/main/java/de/kuschku/util/servicebound/BoundActivity.java b/app/src/main/java/de/kuschku/util/servicebound/BoundActivity.java
index 04165be39..17a70f76d 100644
--- a/app/src/main/java/de/kuschku/util/servicebound/BoundActivity.java
+++ b/app/src/main/java/de/kuschku/util/servicebound/BoundActivity.java
@@ -61,7 +61,7 @@ public abstract class BoundActivity extends AppCompatActivity {
 
     @Override
     protected void onCreate(@Nullable Bundle savedInstanceState) {
-        themeId = ServiceHelper.initTheme(context, this);
+        themeId = ServiceHelper.initContext(context, this);
         super.onCreate(savedInstanceState);
         context.settings().preferenceTheme.addChangeListener(s -> recreate());
         ServiceHelper.startServiceIfNotRunning(this);
diff --git a/app/src/main/java/de/kuschku/util/servicebound/BoundFragment.java b/app/src/main/java/de/kuschku/util/servicebound/BoundFragment.java
index 7ad88b903..006e05240 100644
--- a/app/src/main/java/de/kuschku/util/servicebound/BoundFragment.java
+++ b/app/src/main/java/de/kuschku/util/servicebound/BoundFragment.java
@@ -57,7 +57,7 @@ public abstract class BoundFragment extends Fragment {
 
     @Override
     public void onCreate(@Nullable Bundle savedInstanceState) {
-        ServiceHelper.initTheme(context, getActivity());
+        ServiceHelper.initContext(context, getActivity());
         super.onCreate(savedInstanceState);
         ServiceHelper.startServiceIfNotRunning(getContext());
     }
diff --git a/app/src/main/res/layout-sw600dp-land/slide.xml b/app/src/main/res/layout-sw600dp-land/slide.xml
index 27cd43569..811bd333d 100644
--- a/app/src/main/res/layout-sw600dp-land/slide.xml
+++ b/app/src/main/res/layout-sw600dp-land/slide.xml
@@ -18,6 +18,7 @@
   ~ You should have received a copy of the GNU General Public License along
   ~ with this program.  If not, see <http://www.gnu.org/licenses/>.
   -->
+
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
@@ -28,53 +29,53 @@
         android:id="@+id/title"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:text="@string/slideAccountcoreTitle"
-        android:textColor="@android:color/white"
-        android:textSize="28sp"
-        android:textStyle="bold"
         android:layout_above="@+id/view"
         android:layout_toLeftOf="@+id/scrollView2"
         android:layout_toStartOf="@+id/scrollView2"
         android:gravity="end"
+        android:paddingEnd="64dp"
         android:paddingRight="64dp"
-        android:paddingEnd="64dp" />
+        android:text="@string/slideAccountcoreTitle"
+        android:textColor="@android:color/white"
+        android:textSize="28sp"
+        android:textStyle="bold" />
 
     <android.support.v4.widget.Space
+        android:id="@+id/view"
         android:layout_width="match_parent"
         android:layout_height="32dp"
         android:layout_centerVertical="true"
         android:layout_toLeftOf="@+id/scrollView2"
-        android:layout_toStartOf="@+id/scrollView2"
-        android:id="@+id/view" />
+        android:layout_toStartOf="@+id/scrollView2" />
 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/description"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:text="@string/slideAccountcoreDescription"
-        android:textColor="@android:color/white"
-        android:textSize="16sp"
         android:layout_below="@+id/view"
         android:layout_toLeftOf="@+id/scrollView2"
         android:layout_toStartOf="@+id/scrollView2"
         android:gravity="end"
+        android:paddingEnd="64dp"
         android:paddingRight="64dp"
-        android:paddingEnd="64dp" />
+        android:text="@string/slideAccountcoreDescription"
+        android:textColor="@android:color/white"
+        android:textSize="16sp" />
 
     <ScrollView
         android:id="@+id/scrollView2"
         android:layout_width="400dp"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentEnd="true">
+        android:layout_alignParentEnd="true"
+        android:layout_alignParentRight="true">
 
         <android.support.v7.widget.CardView
             android:id="@+id/content_host"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:minHeight="400dp"
-            android:background="@color/md_light_background" />
+            android:background="@color/md_light_cards"
+            android:minHeight="400dp" />
 
     </ScrollView>
 
diff --git a/app/src/main/res/layout-sw600dp/slide.xml b/app/src/main/res/layout-sw600dp/slide.xml
index e23f40b38..a20bf7a99 100644
--- a/app/src/main/res/layout-sw600dp/slide.xml
+++ b/app/src/main/res/layout-sw600dp/slide.xml
@@ -22,55 +22,55 @@
 
 <FrameLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_height="match_parent"
-    android:layout_width="match_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <ScrollView
-        android:layout_height="wrap_content"
         android:layout_width="match_parent"
+        android:layout_height="wrap_content"
         android:layout_gravity="bottom">
 
         <LinearLayout
-            android:orientation="vertical"
             android:layout_width="400dp"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_horizontal">
+            android:layout_gravity="center_horizontal"
+            android:orientation="vertical">
 
             <LinearLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_marginTop="64dp"
-                android:padding="32dp"
-                android:orientation="vertical">
+                android:orientation="vertical"
+                android:padding="32dp">
 
                 <TextView
                     xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:id="@+id/title"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:textStyle="bold"
-                    android:textColor="@android:color/white"
-                    android:textSize="28sp"
                     android:layout_marginBottom="32dp"
                     android:text="@string/slideAccountcoreTitle"
-                    android:id="@+id/title" />
+                    android:textColor="@android:color/white"
+                    android:textSize="28sp"
+                    android:textStyle="bold" />
 
                 <TextView
                     xmlns:android="http://schemas.android.com/apk/res/android"
+                    android:id="@+id/description"
                     android:layout_width="match_parent"
                     android:layout_height="wrap_content"
-                    android:textColor="@android:color/white"
-                    android:textSize="16sp"
                     android:text="@string/slideAccountcoreDescription"
-                    android:id="@+id/description" />
+                    android:textColor="@android:color/white"
+                    android:textSize="16sp" />
 
             </LinearLayout>
 
             <android.support.v7.widget.CardView
                 android:id="@+id/content_host"
-                android:minHeight="400dp"
-                android:background="@color/md_light_background"
                 android:layout_width="match_parent"
-                android:layout_height="wrap_content" />
+                android:layout_height="wrap_content"
+                android:background="@color/md_light_cards"
+                android:minHeight="400dp" />
 
         </LinearLayout>
 
diff --git a/app/src/main/res/layout/slide.xml b/app/src/main/res/layout/slide.xml
index d33fdc12e..ec0910331 100644
--- a/app/src/main/res/layout/slide.xml
+++ b/app/src/main/res/layout/slide.xml
@@ -23,8 +23,7 @@
 <ScrollView
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:background="@color/md_light_background">
+    android:layout_height="wrap_content">
 
     <LinearLayout
         android:layout_width="match_parent"
@@ -61,7 +60,8 @@
         <FrameLayout
             android:id="@+id/content_host"
             android:layout_width="match_parent"
-            android:layout_height="wrap_content" />
+            android:layout_height="wrap_content"
+            android:background="@color/md_light_cards" />
 
     </LinearLayout>
 
diff --git a/app/src/main/res/values-w720dp/styles.xml b/app/src/main/res/values-w720dp/styles.xml
deleted file mode 100644
index e822c3c73..000000000
--- a/app/src/main/res/values-w720dp/styles.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ QuasselDroid - Quassel client for Android
-  ~ Copyright (C) 2016 Janne Koschinski
-  ~ Copyright (C) 2016 Ken Børge Viktil
-  ~ Copyright (C) 2016 Magnus Fjell
-  ~ Copyright (C) 2016 Martin Sandsmark <martin.sandsmark@kde.org>
-  ~
-  ~ This program is free software: you can redistribute it and/or modify it
-  ~ under the terms of the GNU General Public License as published by the Free
-  ~ Software Foundation, either version 3 of the License, or (at your option)
-  ~ any later version.
-  ~
-  ~ This program is distributed in the hope that it will be useful,
-  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
-  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  ~ GNU General Public License for more details.
-  ~
-  ~ You should have received a copy of the GNU General Public License along
-  ~ with this program.  If not, see <http://www.gnu.org/licenses/>.
-  -->
-
-<resources>
-    <style name="BaseTheme" parent="MaterialDrawerTheme" />
-    <style name="BaseTheme.Light" parent="MaterialDrawerTheme.Light.DarkToolbar" />
-</resources>
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 5c37a0c00..09c7e6f85 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -20,11 +20,8 @@
   -->
 
 <resources>
-    <style name="BaseTheme" parent="MaterialDrawerTheme" />
-    <style name="BaseTheme.Light" parent="MaterialDrawerTheme.Light.DarkToolbar" />
-
     <!-- Base application theme. -->
-    <style name="AppTheme" parent="BaseTheme">
+    <style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
         <!-- Customize your theme here. -->
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@@ -36,10 +33,13 @@
         <item name="windowActionModeOverlay">true</item>
         <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
 
+        <!--
         <item name="material_drawer_background">?attr/colorBackground</item>
         <item name="material_drawer_primary_text">?attr/colorForeground</item>
         <item name="material_drawer_primary_icon">?attr/colorForeground</item>
         <item name="material_drawer_secondary_text">?attr/colorForegroundSecondary</item>
+        <item name="material_drawer_selected">#26ffffff</item>
+        -->
 
         <item name="iconFormatBold">@drawable/ic_format_bold_dark</item>
         <item name="iconFormatItalic">@drawable/ic_format_italic_dark</item>
@@ -47,12 +47,11 @@
         <item name="iconFormatPaint">@drawable/ic_format_paint_dark</item>
         <item name="iconFormatFill">@drawable/ic_format_fill_dark</item>
         <item name="iconHistory">@drawable/ic_history_dark</item>
-        <item name="material_drawer_selected">#26ffffff</item>
 
         <item name="cardStyle">@style/CardView.Dark</item>
     </style>
 
-    <style name="AppTheme.Light" parent="BaseTheme.Light">
+    <style name="AppTheme.Light" parent="Theme.AppCompat.Light.NoActionBar">
         <!-- Customize your theme here. -->
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@@ -64,11 +63,13 @@
         <item name="windowActionModeOverlay">true</item>
         <item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
 
+        <!--
         <item name="material_drawer_background">?attr/colorBackground</item>
         <item name="material_drawer_primary_text">?attr/colorForeground</item>
         <item name="material_drawer_primary_icon">?attr/colorForeground</item>
         <item name="material_drawer_secondary_text">?attr/colorForegroundSecondary</item>
         <item name="material_drawer_selected">#26000000</item>
+        -->
 
         <item name="iconFormatBold">@drawable/ic_format_bold_light</item>
         <item name="iconFormatItalic">@drawable/ic_format_italic_light</item>
@@ -80,8 +81,6 @@
         <item name="cardStyle">@style/CardView.Light</item>
     </style>
 
-    <style name="Base.SetupTheme" parent="Theme.AppCompat.Light.NoActionBar" />
-
     <style name="SetupTheme" parent="Theme.AppCompat.Light.NoActionBar">
         <!-- Customize your theme here. -->
         <item name="colorPrimary">@color/colorPrimary</item>
-- 
GitLab