本文整理了Java中android.app.AlarmManager.setTimeZone()
方法的一些代码示例,展示了AlarmManager.setTimeZone()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AlarmManager.setTimeZone()
方法的具体详情如下:
包路径:android.app.AlarmManager
类名称:AlarmManager
方法名:setTimeZone
暂无
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void setTimeZone(String timeZone) {
// Do the real check first
Shadow.directlyOn(realObject, AlarmManager.class).setTimeZone(timeZone);
// Then do the right side effect
TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
}
代码示例来源:origin: robolectric/robolectric
@Test
public void setTimeZone_OlsonTimeZone_acceptAlways() {
alarmManager.setTimeZone("America/Sao_Paulo");
assertThat(TimeZone.getDefault().getID()).isEqualTo("America/Sao_Paulo");
}
代码示例来源:origin: robolectric/robolectric
@Test
@Config(maxSdk = VERSION_CODES.LOLLIPOP_MR1)
public void setTimeZone_abbreviateTimezoneId_accept() {
alarmManager.setTimeZone("PST");
assertThat(TimeZone.getDefault().getID()).isEqualTo("PST");
}
代码示例来源:origin: robolectric/robolectric
@Test
@Config(maxSdk = VERSION_CODES.LOLLIPOP_MR1)
public void setTimeZone_invalidTimeZone_fallbackToGMT() {
alarmManager.setTimeZone("-07:00");
assertThat(TimeZone.getDefault().getID()).isEqualTo("GMT");
}
代码示例来源:origin: robolectric/robolectric
@Test
public void setTimeZone_UTC_acceptAlways() {
alarmManager.setTimeZone("UTC");
assertThat(TimeZone.getDefault().getID()).isEqualTo("UTC");
}
代码示例来源:origin: robolectric/robolectric
@Test
@Config(minSdk = VERSION_CODES.M)
public void setTimeZone_abbreviateTimeZone_ignore() {
try {
alarmManager.setTimeZone("PST");
fail("IllegalArgumentException not thrown");
} catch (IllegalArgumentException e) {
// expected
}
assertThat(TimeZone.getDefault().getID()).isEqualTo("America/Los_Angeles");
}
代码示例来源:origin: robolectric/robolectric
@Test
@Config(minSdk = VERSION_CODES.M)
public void setTimeZone_invalidTimeZone_ignore() {
try {
alarmManager.setTimeZone("-07:00");
fail("IllegalArgumentException not thrown");
} catch (IllegalArgumentException e) {
// expected
}
assertThat(TimeZone.getDefault().getID()).isEqualTo("America/Los_Angeles");
}
代码示例来源:origin: org.robolectric/shadows-framework
@Implementation
protected void setTimeZone(String timeZone) {
// Do the real check first
Shadow.directlyOn(realObject, AlarmManager.class).setTimeZone(timeZone);
// Then do the right side effect
TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
}
内容来源于网络,如有侵权,请联系作者删除!