mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-24 16:00:02 +00:00
committed by
Moxie Marlinspike
parent
a4e18c515c
commit
4185006147
168
src/org/thoughtcrime/securesms/components/BubbleContainer.java
Normal file
168
src/org/thoughtcrime/securesms/components/BubbleContainer.java
Normal file
@@ -0,0 +1,168 @@
|
||||
/**
|
||||
* Copyright (C) 2015 Open Whisper Systems
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.support.annotation.IntDef;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.ResUtil;
|
||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
|
||||
public abstract class BubbleContainer extends RelativeLayout {
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = BubbleContainer.class.getSimpleName();
|
||||
|
||||
public static final int TRANSPORT_STATE_PUSH_SENT = 0;
|
||||
public static final int TRANSPORT_STATE_SMS_SENT = 1;
|
||||
public static final int TRANSPORT_STATE_SMS_PENDING = 2;
|
||||
public static final int TRANSPORT_STATE_PUSH_PENDING = 3;
|
||||
|
||||
public static final int MEDIA_STATE_NO_MEDIA = 0;
|
||||
public static final int MEDIA_STATE_CAPTIONLESS = 1;
|
||||
public static final int MEDIA_STATE_CAPTIONED = 2;
|
||||
|
||||
@IntDef({TRANSPORT_STATE_PUSH_SENT, TRANSPORT_STATE_PUSH_PENDING, TRANSPORT_STATE_SMS_SENT, TRANSPORT_STATE_SMS_PENDING})
|
||||
public @interface TransportState {}
|
||||
|
||||
@IntDef({MEDIA_STATE_NO_MEDIA, MEDIA_STATE_CAPTIONLESS, MEDIA_STATE_CAPTIONED})
|
||||
public @interface MediaState {}
|
||||
|
||||
private View bodyBubble;
|
||||
private View triangleTick;
|
||||
private ForegroundImageView media;
|
||||
private int shadowColor;
|
||||
private int mmsPendingOverlayColor;
|
||||
|
||||
public BubbleContainer(Context context) {
|
||||
super(context);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public BubbleContainer(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
initialize();
|
||||
}
|
||||
|
||||
public BubbleContainer(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initialize();
|
||||
}
|
||||
|
||||
@TargetApi(VERSION_CODES.LOLLIPOP)
|
||||
public BubbleContainer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
initialize();
|
||||
}
|
||||
|
||||
protected abstract void onCreateView();
|
||||
protected abstract int getForegroundColor(@TransportState int transportState);
|
||||
protected abstract boolean[] getMessageCorners(@MediaState int mediaState);
|
||||
protected abstract boolean[] getMediaCorners(@MediaState int mediaState);
|
||||
protected abstract int getTriangleTickRes(@TransportState int transportState);
|
||||
|
||||
protected void initialize() {
|
||||
onCreateView();
|
||||
this.bodyBubble = findViewById(R.id.body_bubble );
|
||||
this.triangleTick = findViewById(R.id.triangle_tick);
|
||||
this.media = (ForegroundImageView) findViewById(R.id.image_view);
|
||||
|
||||
this.shadowColor = ResUtil.getColor(getContext(), R.attr.conversation_item_shadow);
|
||||
this.mmsPendingOverlayColor = ResUtil.getColor(getContext(), R.attr.conversation_item_mms_pending_mask);
|
||||
}
|
||||
|
||||
public void setState(@TransportState int transportState, @MediaState int mediaState) {
|
||||
updateBodyBubble(transportState, mediaState);
|
||||
if (isMediaPresent(mediaState)) {
|
||||
updateMediaBubble(transportState, mediaState);
|
||||
}
|
||||
setMediaVisibility(mediaState);
|
||||
setAlignment(mediaState);
|
||||
setMediaPendingMask(transportState);
|
||||
}
|
||||
|
||||
private void updateBodyBubble(@TransportState int transportState, @MediaState int mediaState) {
|
||||
final boolean hasShadow = mediaState == MEDIA_STATE_CAPTIONED || mediaState == MEDIA_STATE_NO_MEDIA;
|
||||
final BubbleDrawableBuilder builder = new BubbleDrawableBuilder();
|
||||
final int color = getForegroundColor(transportState);
|
||||
|
||||
final Drawable bodyDrawable = builder.setColor(color)
|
||||
.setShadowColor(shadowColor)
|
||||
.setCorners(getMessageCorners(mediaState))
|
||||
.setHasShadow(hasShadow)
|
||||
.create(getContext());
|
||||
ViewUtil.setBackgroundSavingPadding(triangleTick, getTriangleTickRes(transportState));
|
||||
ViewUtil.setBackgroundSavingPadding(bodyBubble, bodyDrawable);
|
||||
}
|
||||
|
||||
private void updateMediaBubble(@TransportState int transportState, @MediaState int mediaState) {
|
||||
final int foregroundColor = getForegroundColor(transportState);
|
||||
final BubbleDrawableBuilder builder = new BubbleDrawableBuilder();
|
||||
|
||||
final Drawable mediaDrawable = builder.setColor(foregroundColor)
|
||||
.setShadowColor(shadowColor)
|
||||
.setCorners(getMediaCorners(mediaState))
|
||||
.setHasShadow(false)
|
||||
.create(getContext());
|
||||
ViewUtil.setBackgroundSavingPadding(media, mediaDrawable);
|
||||
media.setBorderColor(foregroundColor);
|
||||
}
|
||||
|
||||
private void setMediaVisibility(@MediaState int mediaState) {
|
||||
media.reset();
|
||||
if (!isMediaPresent(mediaState)) {
|
||||
media.hide();
|
||||
}
|
||||
}
|
||||
|
||||
private void setMediaPendingMask(@TransportState int transportState) {
|
||||
if (isPending(transportState)) {
|
||||
media.setForeground(new ColorDrawable(mmsPendingOverlayColor));
|
||||
} else {
|
||||
media.setForeground(new ColorDrawable(Color.TRANSPARENT));
|
||||
}
|
||||
}
|
||||
|
||||
private void setAlignment(@MediaState int mediaState) {
|
||||
RelativeLayout.LayoutParams parentParams = (RelativeLayout.LayoutParams) bodyBubble.getLayoutParams();
|
||||
if (mediaState != MEDIA_STATE_CAPTIONED) {
|
||||
parentParams.addRule(RelativeLayout.BELOW, 0);
|
||||
parentParams.addRule(RelativeLayout.ALIGN_BOTTOM, R.id.image_view);
|
||||
} else {
|
||||
parentParams.addRule(RelativeLayout.BELOW, R.id.image_view);
|
||||
parentParams.addRule(RelativeLayout.ALIGN_BOTTOM, 0);
|
||||
}
|
||||
bodyBubble.setLayoutParams(parentParams);
|
||||
}
|
||||
|
||||
private boolean isMediaPresent(@MediaState int mediaState) {
|
||||
return mediaState != MEDIA_STATE_NO_MEDIA;
|
||||
}
|
||||
|
||||
private boolean isPending(@TransportState int transportState) {
|
||||
return transportState == TRANSPORT_STATE_PUSH_PENDING || transportState == TRANSPORT_STATE_SMS_PENDING;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.LayerDrawable;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class BubbleDrawableBuilder {
|
||||
private int color;
|
||||
private int shadowColor;
|
||||
private boolean hasShadow = true;
|
||||
private boolean[] corners = new boolean[]{true,true,true,true};
|
||||
|
||||
protected BubbleDrawableBuilder() { }
|
||||
|
||||
public BubbleDrawableBuilder setColor(int color) {
|
||||
this.color = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BubbleDrawableBuilder setShadowColor(int shadowColor) {
|
||||
this.shadowColor = shadowColor;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BubbleDrawableBuilder setHasShadow(boolean hasShadow) {
|
||||
this.hasShadow = hasShadow;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BubbleDrawableBuilder setCorners(boolean[] corners) {
|
||||
this.corners = corners;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Drawable create(Context context) {
|
||||
final GradientDrawable bubble = new GradientDrawable();
|
||||
final int radius = context.getResources().getDimensionPixelSize(R.dimen.message_bubble_corner_radius);
|
||||
final float[] radii = cornerBooleansToRadii(corners, radius);
|
||||
|
||||
bubble.setColor(color);
|
||||
bubble.setCornerRadii(radii);
|
||||
|
||||
if (!hasShadow) {
|
||||
return bubble;
|
||||
} else {
|
||||
final GradientDrawable shadow = new GradientDrawable();
|
||||
final int distance = context.getResources().getDimensionPixelSize(R.dimen.message_bubble_shadow_distance);
|
||||
|
||||
shadow.setColor(shadowColor);
|
||||
shadow.setCornerRadii(radii);
|
||||
|
||||
final LayerDrawable layers = new LayerDrawable(new Drawable[]{shadow, bubble});
|
||||
layers.setLayerInset(1, 0, 0, 0, distance);
|
||||
return layers;
|
||||
}
|
||||
}
|
||||
|
||||
private float[] cornerBooleansToRadii(boolean[] corners, int radius) {
|
||||
if (corners == null || corners.length != 4) {
|
||||
throw new AssertionError("there are four corners in a rectangle, silly");
|
||||
}
|
||||
|
||||
float[] radii = new float[8];
|
||||
int i = 0;
|
||||
for (boolean corner : corners) {
|
||||
radii[i] = radii[i+1] = corner ? radius : 0;
|
||||
i += 2;
|
||||
}
|
||||
|
||||
return radii;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,21 +16,28 @@
|
||||
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build.VERSION;
|
||||
import android.os.Build.VERSION_CODES;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.widget.ImageView;
|
||||
import android.view.View;
|
||||
import android.view.animation.AlphaAnimation;
|
||||
|
||||
import com.makeramen.RoundedImageView;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
/**
|
||||
* https://gist.github.com/chrisbanes/9091754
|
||||
*/
|
||||
public class ForegroundImageView extends ImageView {
|
||||
public class ForegroundImageView extends RoundedImageView {
|
||||
|
||||
private Drawable mForeground;
|
||||
|
||||
@@ -111,12 +118,66 @@ public class ForegroundImageView extends ImageView {
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(VERSION_CODES.JELLY_BEAN)
|
||||
public ActivityOptions getThumbnailTransition() {
|
||||
return ActivityOptions.makeScaleUpAnimation(this, 0, 0, getWidth(), getHeight());
|
||||
}
|
||||
|
||||
public void show(Drawable drawable, boolean instantaneous) {
|
||||
setImageDrawable(drawable);
|
||||
if (drawable.getIntrinsicHeight() < (getHeight() * 0.75f) &&
|
||||
drawable.getIntrinsicWidth() < (getHeight() * 0.75f))
|
||||
{
|
||||
setScaleType(ScaleType.CENTER_INSIDE);
|
||||
} else {
|
||||
setScaleType(ScaleType.CENTER_CROP);
|
||||
}
|
||||
fadeIn(instantaneous ? 0 : 200);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
cancelAnimations();
|
||||
setImageDrawable(null);
|
||||
setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void fadeIn(final long millis) {
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) fadeInModern(millis);
|
||||
else fadeInLegacy(millis);
|
||||
setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
private void fadeInLegacy(final long millis) {
|
||||
final AlphaAnimation alpha = new AlphaAnimation(0f, 1f);
|
||||
alpha.setDuration(millis);
|
||||
alpha.setFillAfter(true);
|
||||
startAnimation(alpha);
|
||||
}
|
||||
|
||||
@TargetApi(VERSION_CODES.JELLY_BEAN)
|
||||
private void fadeInModern(final long millis) {
|
||||
setAlpha(0f);
|
||||
animate().alpha(1f).setDuration(millis);
|
||||
}
|
||||
|
||||
private void cancelAnimations() {
|
||||
if (getAnimation() != null) {
|
||||
getAnimation().cancel();
|
||||
clearAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean verifyDrawable(Drawable who) {
|
||||
return super.verifyDrawable(who) || (who == mForeground);
|
||||
}
|
||||
|
||||
@Override
|
||||
@TargetApi(VERSION_CODES.HONEYCOMB)
|
||||
public void jumpDrawablesToCurrentState() {
|
||||
super.jumpDrawablesToCurrentState();
|
||||
if (mForeground != null) mForeground.jumpToCurrentState();
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/**
|
||||
* Copyright (C) 2015 Open Whisper Systems
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.util.ResUtil;
|
||||
|
||||
public class IncomingBubbleContainer extends BubbleContainer {
|
||||
private static final String TAG = IncomingBubbleContainer.class.getSimpleName();
|
||||
|
||||
private static final boolean[] CORNERS_MESSAGE_CAPTIONED = new boolean[]{false, true, true, true };
|
||||
private static final boolean[] CORNERS_MEDIA_CAPTIONED = new boolean[]{true, true, true, false};
|
||||
private static final boolean[] CORNERS_ROUNDED = new boolean[]{true, true, true, true };
|
||||
|
||||
private int foregroundColor;
|
||||
private int triangleTickRes;
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public IncomingBubbleContainer(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public IncomingBubbleContainer(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public IncomingBubbleContainer(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public IncomingBubbleContainer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateView() {
|
||||
Log.w(TAG, "onCreateView()");
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
inflater.inflate(R.layout.conversation_bubble_incoming, this, true);
|
||||
|
||||
this.foregroundColor = ResUtil.getColor(getContext(), R.attr.conversation_item_received_background);
|
||||
this.triangleTickRes = ResUtil.getDrawableRes(getContext(), R.attr.triangle_tick_incoming);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getForegroundColor(@TransportState int transportState) {
|
||||
return foregroundColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean[] getMessageCorners(@MediaState int mediaState) {
|
||||
return mediaState == MEDIA_STATE_CAPTIONED ? CORNERS_MESSAGE_CAPTIONED : CORNERS_ROUNDED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean[] getMediaCorners(@MediaState int mediaState) {
|
||||
return mediaState == MEDIA_STATE_CAPTIONED ? CORNERS_MEDIA_CAPTIONED : CORNERS_ROUNDED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTriangleTickRes(@TransportState int transportState) {
|
||||
return triangleTickRes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/**
|
||||
* Copyright (C) 2015 Open Whisper Systems
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.support.annotation.DrawableRes;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.SparseIntArray;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class OutgoingBubbleContainer extends BubbleContainer {
|
||||
private static final boolean[] CORNERS_MESSAGE_CAPTIONED = new boolean[]{true, false, true, true};
|
||||
private static final boolean[] CORNERS_MEDIA_CAPTIONED = new boolean[]{true, true, false, true};
|
||||
private static final boolean[] CORNERS_ROUNDED = new boolean[]{true, true, true, true};
|
||||
|
||||
private static final int[] TRANSPORT_STYLE_ATTRIBUTES = new int[]{R.attr.conversation_item_sent_push_background,
|
||||
R.attr.conversation_item_sent_background,
|
||||
R.attr.conversation_item_sent_pending_background,
|
||||
R.attr.conversation_item_sent_push_pending_background};
|
||||
|
||||
private static final int[] TRIANGLE_TICK_ATTRIBUTES = new int[]{R.attr.triangle_tick_outgoing_sent_push,
|
||||
R.attr.triangle_tick_outgoing_sent_sms,
|
||||
R.attr.triangle_tick_outgoing_pending_sms,
|
||||
R.attr.triangle_tick_outgoing_pending_push};
|
||||
|
||||
private static final SparseIntArray TRANSPORT_STYLE_MAP = new SparseIntArray(TRANSPORT_STYLE_ATTRIBUTES.length) {{
|
||||
put(TRANSPORT_STATE_PUSH_SENT, 0);
|
||||
put(TRANSPORT_STATE_SMS_SENT, 1);
|
||||
put(TRANSPORT_STATE_SMS_PENDING, 2);
|
||||
put(TRANSPORT_STATE_PUSH_PENDING, 3);
|
||||
}};
|
||||
|
||||
private TypedArray styledDrawables;
|
||||
private TypedArray triangleDrawables;
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public OutgoingBubbleContainer(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public OutgoingBubbleContainer(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public OutgoingBubbleContainer(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public OutgoingBubbleContainer(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||
super(context, attrs, defStyleAttr, defStyleRes);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreateView() {
|
||||
LayoutInflater inflater = LayoutInflater.from(getContext());
|
||||
inflater.inflate(R.layout.conversation_bubble_outgoing, this, true);
|
||||
|
||||
this.styledDrawables = getContext().obtainStyledAttributes(TRANSPORT_STYLE_ATTRIBUTES);
|
||||
this.triangleDrawables = getContext().obtainStyledAttributes(TRIANGLE_TICK_ATTRIBUTES );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getForegroundColor(@TransportState int transportState) {
|
||||
return styledDrawables.getColor(TRANSPORT_STYLE_MAP.get(transportState), -1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean[] getMessageCorners(@MediaState int mediaState) {
|
||||
return mediaState == MEDIA_STATE_CAPTIONED ? CORNERS_MESSAGE_CAPTIONED : CORNERS_ROUNDED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean[] getMediaCorners(@MediaState int mediaState) {
|
||||
return mediaState == MEDIA_STATE_CAPTIONED ? CORNERS_MEDIA_CAPTIONED : CORNERS_ROUNDED;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTriangleTickRes(@TransportState int transportState) {
|
||||
return triangleDrawables.getResourceId(TRANSPORT_STYLE_MAP.get(transportState), -1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user