2014-07-19 02:31:03 +00:00
|
|
|
package org.thoughtcrime.securesms;
|
|
|
|
|
2015-07-01 00:45:39 +00:00
|
|
|
import android.support.annotation.DrawableRes;
|
|
|
|
|
2015-02-16 10:38:09 +00:00
|
|
|
import org.thoughtcrime.securesms.util.CharacterCalculator;
|
|
|
|
import org.thoughtcrime.securesms.util.CharacterCalculator.CharacterState;
|
|
|
|
|
2014-07-19 02:31:03 +00:00
|
|
|
public class TransportOption {
|
2015-03-11 21:23:45 +00:00
|
|
|
|
|
|
|
public enum Type {
|
|
|
|
SMS,
|
|
|
|
TEXTSECURE
|
|
|
|
}
|
|
|
|
|
|
|
|
private int drawable;
|
2015-07-01 00:45:39 +00:00
|
|
|
private int backgroundColor;
|
2015-03-11 21:23:45 +00:00
|
|
|
private String text;
|
|
|
|
private Type type;
|
|
|
|
private String composeHint;
|
|
|
|
private CharacterCalculator characterCalculator;
|
|
|
|
|
|
|
|
public TransportOption(Type type,
|
2015-07-01 00:45:39 +00:00
|
|
|
@DrawableRes int drawable,
|
|
|
|
int backgroundColor,
|
2015-03-11 21:23:45 +00:00
|
|
|
String text,
|
|
|
|
String composeHint,
|
|
|
|
CharacterCalculator characterCalculator)
|
|
|
|
{
|
|
|
|
this.type = type;
|
|
|
|
this.drawable = drawable;
|
2015-07-01 00:45:39 +00:00
|
|
|
this.backgroundColor = backgroundColor;
|
2015-03-11 21:23:45 +00:00
|
|
|
this.text = text;
|
|
|
|
this.composeHint = composeHint;
|
|
|
|
this.characterCalculator = characterCalculator;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Type getType() {
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean isType(Type type) {
|
|
|
|
return this.type == type;
|
2014-07-19 02:31:03 +00:00
|
|
|
}
|
|
|
|
|
2015-02-16 10:38:09 +00:00
|
|
|
public boolean isSms() {
|
2015-03-11 21:23:45 +00:00
|
|
|
return type == Type.SMS;
|
2014-07-19 02:31:03 +00:00
|
|
|
}
|
|
|
|
|
2015-02-16 10:38:09 +00:00
|
|
|
public CharacterState calculateCharacters(int charactersSpent) {
|
|
|
|
return characterCalculator.calculateCharacters(charactersSpent);
|
|
|
|
}
|
2015-03-11 21:23:45 +00:00
|
|
|
|
2015-07-01 00:45:39 +00:00
|
|
|
public @DrawableRes int getDrawable() {
|
2015-03-11 21:23:45 +00:00
|
|
|
return drawable;
|
|
|
|
}
|
|
|
|
|
2015-07-01 00:45:39 +00:00
|
|
|
public int getBackgroundColor() {
|
|
|
|
return backgroundColor;
|
|
|
|
}
|
|
|
|
|
2015-03-11 21:23:45 +00:00
|
|
|
public String getComposeHint() {
|
|
|
|
return composeHint;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
return text;
|
|
|
|
}
|
2015-02-16 10:38:09 +00:00
|
|
|
}
|