- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
private void setUpdateTime(String time) {
if (time.equals("15m")) {
updateTimePediodInMills = 15 * 60 * 1000;
} else if (time.equals("30m")) {
updateTimePediodInMills = 30 * 60 * 1000;
} else if (time.equals("1h")) {
updateTimePediodInMills = 60 * 60 * 1000;
} else if (time.equals("2h")) {
updateTimePediodInMills = 2 * 60 * 60 * 1000;
} else if (time.equals("1d")) {
updateTimePediodInMills = 24 * 60 * 60 * 1000;
}
SpannableString sb = new SpannableString(
getString(R.string.update_time) + "\n" + getLocolizedUpdateTime(time));
sb.setSpan(new TextAppearanceSpan("sans-serif", 0, 42,
getResources().getColorStateList(R.color.description_color),
getResources().getColorStateList(R.color.description_color)),
getString(R.string.update_time).length() + 1, sb.length(),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
mUpdateTime.setText(sb);
}
private String getLocolizedUpdateTime(String time) {
if (time.equals("15m")) {
return "15" + getString(R.string.m);
} else if (time.equals("30m")) {
return "30" + getString(R.string.m);
} else if (time.equals("1h")) {
return "1" + getString(R.string.h);
} else if (time.equals("2h")) {
return "2" + getString(R.string.h);
} else if (time.equals("1d")) {
return "1" + getString(R.string.d);
}
return "";
}
Комментарии (1) RSS
Добавить комментарий