use of android.annotation.TargetApi in project cw-omnibus by commonsguy.
the class MainActivity method handleRoute.
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void handleRoute(RouteInfo route) {
if (route == null) {
clearPreso();
} else {
Display display = route.getPresentationDisplay();
if (route.isEnabled() && display != null) {
if (preso == null) {
showPreso(route);
Log.d(getClass().getSimpleName(), "enabled route");
} else if (preso.getDisplay().getDisplayId() != display.getDisplayId()) {
clearPreso();
showPreso(route);
Log.d(getClass().getSimpleName(), "switched route");
} else {
// no-op: should already be set
}
} else {
clearPreso();
Log.d(getClass().getSimpleName(), "disabled route");
}
}
}
use of android.annotation.TargetApi in project cw-omnibus by commonsguy.
the class MainActivity method initPort.
@TargetApi(Build.VERSION_CODES.M)
private void initPort() {
final WebMessagePort[] channel = wv.createWebMessageChannel();
port = channel[0];
port.setWebMessageCallback(new WebMessagePort.WebMessageCallback() {
@Override
public void onMessage(WebMessagePort port, WebMessage message) {
postLux();
}
});
wv.postWebMessage(new WebMessage("", new WebMessagePort[] { channel[1] }), Uri.EMPTY);
}
use of android.annotation.TargetApi in project materialistic by hidroh.
the class ItemFragmentSinglePageTest method testReply.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testReply() {
viewHolder.itemView.findViewById(R.id.button_more).performClick();
PopupMenu popupMenu = ShadowPopupMenu.getLatestPopupMenu();
assertNotNull(popupMenu);
shadowOf(popupMenu).getOnMenuItemClickListener().onMenuItemClick(new RoboMenuItem(R.id.menu_contextual_comment));
assertThat(shadowOf(activity).getNextStartedActivity()).hasComponent(activity, ComposeActivity.class).hasExtra(ComposeActivity.EXTRA_PARENT_ID, "1");
}
use of android.annotation.TargetApi in project materialistic by hidroh.
the class ItemFragmentSinglePageTest method testVote.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testVote() {
viewHolder.itemView.findViewById(R.id.button_more).performClick();
PopupMenu popupMenu = ShadowPopupMenu.getLatestPopupMenu();
assertNotNull(popupMenu);
shadowOf(popupMenu).getOnMenuItemClickListener().onMenuItemClick(new RoboMenuItem(R.id.menu_contextual_vote));
verify(userServices).voteUp(any(Context.class), any(), voteCallback.capture());
voteCallback.getValue().onDone(true);
assertEquals(activity.getString(R.string.voted), ShadowToast.getTextOfLatestToast());
}
use of android.annotation.TargetApi in project materialistic by hidroh.
the class FavoriteActivityTest method testReply.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testReply() {
shadowAdapter.getViewHolder(0).itemView.findViewById(R.id.button_more).performClick();
PopupMenu popupMenu = ShadowPopupMenu.getLatestPopupMenu();
Assert.assertNotNull(popupMenu);
shadowOf(popupMenu).getOnMenuItemClickListener().onMenuItemClick(new RoboMenuItem(R.id.menu_contextual_comment));
assertThat(shadowOf(activity).getNextStartedActivity()).hasComponent(activity, ComposeActivity.class);
}
Aggregations