Skip to content
Snippets Groups Projects
Commit cd083d09 authored by Janne Mareike Koschinski's avatar Janne Mareike Koschinski
Browse files

Fixed two minor bugs

parent 917e1d7c
Branches
Tags
No related merge requests found
...@@ -162,12 +162,14 @@ public class BufferViewConfig extends ABufferViewConfig { ...@@ -162,12 +162,14 @@ public class BufferViewConfig extends ABufferViewConfig {
List<String> infos = new ArrayList<>(); List<String> infos = new ArrayList<>();
for (int bufferId : bufferList()) { for (int bufferId : bufferList()) {
Buffer buffer = client.bufferManager().buffer(bufferId); Buffer buffer = client.bufferManager().buffer(bufferId);
if (buffer == null) if (buffer == null) {
Log.w("libquassel", "Buffer is null: " + bufferId + " while adding buffer " + info); Log.w("libquassel", "Buffer is null: " + bufferId + " while adding buffer " + info);
} else {
BufferInfo info1 = buffer.getInfo(); BufferInfo info1 = buffer.getInfo();
if (info1.networkId == info.networkId) if (info1.networkId == info.networkId)
infos.add(info1.name); infos.add(info1.name);
} }
}
infos.add(info.name); infos.add(info.name);
Collections.sort(infos); Collections.sort(infos);
pos = infos.indexOf(info.name); pos = infos.indexOf(info.name);
......
...@@ -29,7 +29,6 @@ import android.text.style.ForegroundColorSpan; ...@@ -29,7 +29,6 @@ import android.text.style.ForegroundColorSpan;
import android.text.style.UnderlineSpan; import android.text.style.UnderlineSpan;
import android.util.Log; import android.util.Log;
import java.util.Arrays;
import java.util.Locale; import java.util.Locale;
import de.kuschku.quasseldroid_ng.ui.theme.AppContext; import de.kuschku.quasseldroid_ng.ui.theme.AppContext;
...@@ -74,10 +73,6 @@ public class IrcFormatSerializer { ...@@ -74,10 +73,6 @@ public class IrcFormatSerializer {
next = text.nextSpanTransition(i, end, CharacterStyle.class); next = text.nextSpanTransition(i, end, CharacterStyle.class);
CharacterStyle[] style = text.getSpans(i, next, CharacterStyle.class); CharacterStyle[] style = text.getSpans(i, next, CharacterStyle.class);
Log.d("IrcFormat", "i is " + i);
Log.d("IrcFormat", "Next is " + next);
Log.d("IrcFormat", "Spans inbetween: " + Arrays.toString(style));
int afterForeground = -1; int afterForeground = -1;
int afterBackground = -1; int afterBackground = -1;
boolean afterBold = false; boolean afterBold = false;
...@@ -106,48 +101,41 @@ public class IrcFormatSerializer { ...@@ -106,48 +101,41 @@ public class IrcFormatSerializer {
} }
if (afterBold != bold) { if (afterBold != bold) {
Log.d("IrcFormat", "Changing bold from " + bold + " to " + afterBold);
out.append(CODE_BOLD); out.append(CODE_BOLD);
} }
if (afterUnderline != underline) { if (afterUnderline != underline) {
Log.d("IrcFormat", "Changing underline from " + underline + " to " + afterUnderline);
out.append(CODE_UNDERLINE); out.append(CODE_UNDERLINE);
} }
if (afterItalic != italic) { if (afterItalic != italic) {
Log.d("IrcFormat", "Changing italic from " + italic + " to " + afterItalic);
out.append(CODE_ITALIC); out.append(CODE_ITALIC);
} }
if (afterForeground != foreground || afterBackground != background) { if (afterForeground != foreground || afterBackground != background) {
Log.d("IrcFormat", "Changing foreground from " + foreground + " to " + afterForeground);
Log.d("IrcFormat", "Changing background from " + background + " to " + afterBackground);
if (afterForeground == background && afterBackground == foreground) { if (afterForeground == background && afterBackground == foreground) {
out.append(CODE_SWAP); out.append(CODE_SWAP);
} else { } else {
out.append(CODE_COLOR); out.append(CODE_COLOR);
if (background == afterBackground) {
if (afterForeground != -1) {
out.append(String.format(Locale.US, "%02d", afterForeground));
} else {
out.append(String.format(Locale.US, "%02d", context.themeUtil().res.colorForegroundMirc));
}
} else {
if (afterBackground == -1) { if (afterBackground == -1) {
if (afterForeground != -1) { if (afterForeground == -1) {
out.append(CODE_COLOR);
out.append(String.format(Locale.US, "%02d", afterForeground));
} else {
// Foreground changed from a value to null, we don’t set any new foreground // Foreground changed from a value to null, we don’t set any new foreground
// Background changed from a value to null, we don’t set any new background // Background changed from a value to null, we don’t set any new background
} else {
out.append(CODE_COLOR);
out.append(String.format(Locale.US, "%02d", afterForeground));
} }
} else if (background == afterBackground) {
if (afterForeground == -1) {
out.append(String.format(Locale.US, "%02d", context.themeUtil().res.colorForegroundMirc));
} else { } else {
if (afterForeground != -1) { out.append(String.format(Locale.US, "%02d", afterForeground));
out.append(String.format(Locale.US, "%02d,%02d", afterForeground, afterBackground)); }
} else { } else {
if (afterForeground == -1) {
out.append(String.format(Locale.US, "%02d,%02d", context.themeUtil().res.colorForegroundMirc, afterBackground)); out.append(String.format(Locale.US, "%02d,%02d", context.themeUtil().res.colorForegroundMirc, afterBackground));
} } else {
out.append(String.format(Locale.US, "%02d,%02d", afterForeground, afterBackground));
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment