mirror of
https://github.com/deltachat/deltachat-android.git
synced 2025-10-04 10:19:15 +02:00
remove Android-specific DcContact.getArgbColor() from bindings
This commit is contained in:
parent
113a6c8f75
commit
23dedb5a24
4 changed files with 12 additions and 10 deletions
|
@ -1,7 +1,5 @@
|
||||||
package com.b44t.messenger;
|
package com.b44t.messenger;
|
||||||
|
|
||||||
import android.graphics.Color;
|
|
||||||
|
|
||||||
public class DcContact {
|
public class DcContact {
|
||||||
|
|
||||||
public final static int DC_CONTACT_ID_SELF = 1;
|
public final static int DC_CONTACT_ID_SELF = 1;
|
||||||
|
@ -59,9 +57,4 @@ public class DcContact {
|
||||||
// working with raw c-data
|
// working with raw c-data
|
||||||
private long contactCPtr; // CAVE: the name is referenced in the JNI
|
private long contactCPtr; // CAVE: the name is referenced in the JNI
|
||||||
private native void unrefContactCPtr();
|
private native void unrefContactCPtr();
|
||||||
|
|
||||||
public int getArgbColor() {
|
|
||||||
int rgb = getColor();
|
|
||||||
return Color.argb(0xFF, Color.red(rgb), Color.green(rgb), Color.blue(rgb));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ import org.thoughtcrime.securesms.util.LongClickCopySpan;
|
||||||
import org.thoughtcrime.securesms.util.LongClickMovementMethod;
|
import org.thoughtcrime.securesms.util.LongClickMovementMethod;
|
||||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||||
import org.thoughtcrime.securesms.util.Prefs;
|
import org.thoughtcrime.securesms.util.Prefs;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
import org.thoughtcrime.securesms.util.views.Stub;
|
import org.thoughtcrime.securesms.util.views.Stub;
|
||||||
|
|
||||||
|
@ -663,7 +664,7 @@ public class ConversationItem extends LinearLayout
|
||||||
}
|
}
|
||||||
else if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
else if (groupThread && !messageRecord.isOutgoing() && dcContact !=null) {
|
||||||
this.groupSender.setText(messageRecord.getSenderName(dcContact, true));
|
this.groupSender.setText(messageRecord.getSenderName(dcContact, true));
|
||||||
this.groupSender.setTextColor(dcContact.getArgbColor());
|
this.groupSender.setTextColor(Util.rgbToArgbColor(dcContact.getColor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientForeverObserver;
|
import org.thoughtcrime.securesms.recipients.RecipientForeverObserver;
|
||||||
import org.thoughtcrime.securesms.util.MediaUtil;
|
import org.thoughtcrime.securesms.util.MediaUtil;
|
||||||
import org.thoughtcrime.securesms.util.ThemeUtil;
|
import org.thoughtcrime.securesms.util.ThemeUtil;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -160,8 +161,8 @@ public class QuoteView extends FrameLayout implements RecipientForeverObserver {
|
||||||
} else {
|
} else {
|
||||||
authorView.setVisibility(VISIBLE);
|
authorView.setVisibility(VISIBLE);
|
||||||
authorView.setText(quotedMsg.getSenderName(contact, false));
|
authorView.setText(quotedMsg.getSenderName(contact, false));
|
||||||
authorView.setTextColor(contact.getArgbColor());
|
authorView.setTextColor(Util.rgbToArgbColor(contact.getColor()));
|
||||||
quoteBarView.setBackgroundColor(contact.getArgbColor());
|
quoteBarView.setBackgroundColor(Util.rgbToArgbColor(contact.getColor()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
@ -322,4 +323,10 @@ public class Util {
|
||||||
throw new AssertionError(e);
|
throw new AssertionError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Converts a rgb-color as returned eg. by DcContact.getColor()
|
||||||
|
/// to argb-color as used by Android.
|
||||||
|
public static int rgbToArgbColor(int rgb) {
|
||||||
|
return Color.argb(0xFF, Color.red(rgb), Color.green(rgb), Color.blue(rgb));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue