2014-07-19 02:31:03 +00:00
|
|
|
package org.thoughtcrime.securesms;
|
|
|
|
|
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;
|
|
|
|
private String text;
|
|
|
|
private Type type;
|
|
|
|
private String composeHint;
|
|
|
|
private CharacterCalculator characterCalculator;
|
|
|
|
|
|
|
|
public TransportOption(Type type,
|
|
|
|
int drawable,
|
|
|
|
String text,
|
|
|
|
String composeHint,
|
|
|
|
CharacterCalculator characterCalculator)
|
|
|
|
{
|
|
|
|
this.type = type;
|
|
|
|
this.drawable = drawable;
|
|
|
|
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 isPlaintext() {
|
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 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
|
|
|
|
|
|
|
public int getDrawable() {
|
|
|
|
return drawable;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getComposeHint() {
|
|
|
|
return composeHint;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
|
|
|
return text;
|
|
|
|
}
|
2015-02-16 10:38:09 +00:00
|
|
|
}
|