This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = new Intent(context, DetailActivity.class); | |
intent.putExtra(EXTRA_ITEM_ID, selectedItem.id); | |
intent.putExtra(EXTRA_SHOW_MAP, true); | |
startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DetailActivity extends Activity { | |
public static final String EXTRA_ITEM_ID = "extra.item_id"; | |
public static final String EXTRA_SHOW_MAP = "extra.show_map"; | |
private String itemId; | |
private boolean shouldShowMap; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IntentFactory { | |
public Intent newDetailActivityIntent(Context context, String itemId, boolean showMap) { | |
Intent intent = new Intent(context, DetailActivity.class); | |
intent.putExtra(EXTRA_ITEM_ID, itemId); | |
intent.putExtra(EXTRA_SHOW_MAP, showMap); | |
return intent; | |
} | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DetailActivity extends Activity { | |
@InjectExtra String itemId; | |
@Nullable @InjectExtra boolean shouldShowMap; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
Dart.inject(this); | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Intent intent = Henson.with(context) | |
.gotoDetailActivity() | |
.itemId(selectedItem.id) | |
.shouldShowMap(true) | |
.build(); | |
startActivity(intent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SmoothieMaker { | |
@Inject Blender blender; | |
@Inject Freezer freezer; | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SmoothieShop { | |
@Inject SmoothieMaker smoothieMaker1; | |
@Inject SmoothieMaker smoothieMaker2; | |
public SmoothieShop() { | |
Scope scope = Toothpick.openScope("SmoothieShop"); | |
Toothpick.inject(this, scope); | |
... | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bind(Blender.class).to(JarBlender.class); // Blender -> JarBlender | |
bind(Freezer.class).to(new Freezer()); // Freezer -> Freezer instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SmoothieShopModule extends Module { | |
public SmoothieShopModule() { | |
bind(Blender.class).to(JarBlender.class); // Blender -> JarBlender | |
bind(Freezer.class).to(new Freezer()); // Freezer -> Freezer instance | |
} | |
} | |
class SmoothieShop { | |
@Inject SmoothieMaker smoothieMaker1; | |
@Inject SmoothieMaker smoothieMaker2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Inject Lazy<SmoothieMaker> smoothieMaker; | |
smoothieMaker.get().makeSmoothie(); |
OlderNewer