android.app.AlarmManager.setTimeZone()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(297)

本文整理了Java中android.app.AlarmManager.setTimeZone()方法的一些代码示例,展示了AlarmManager.setTimeZone()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AlarmManager.setTimeZone()方法的具体详情如下:
包路径:android.app.AlarmManager
类名称:AlarmManager
方法名:setTimeZone

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));
}

相关文章