dagger.multibindings.IntoMap Java Examples

The following examples show how to use dagger.multibindings.IntoMap. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InflaterConfigModule.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
@Provides
@IntoMap
@StringKey(LayoutConfigKey.CARD_PORTRAIT)
public InAppMessageLayoutConfig providesCardPortraitConfig(DisplayMetrics displayMetrics) {
  return InAppMessageLayoutConfig.builder()
      .setMaxDialogHeightPx((int) (0.8 * displayMetrics.heightPixels))
      .setMaxDialogWidthPx((int) (0.7f * displayMetrics.widthPixels))
      .setMaxImageHeightWeight(0.6f)
      .setMaxImageWidthWeight(1f) // entire dialog width
      .setMaxBodyHeightWeight(0.1f)
      .setMaxBodyWidthWeight(0.9f) // entire dialog width
      .setViewWindowGravity(Gravity.CENTER)
      .setWindowFlag(DISMISSIBLE_DIALOG_FLAG)
      .setWindowWidth(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setWindowHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setBackgroundEnabled(false)
      .setAnimate(false)
      .setAutoDismiss(false)
      .build();
}
 
Example #2
Source File: InflaterConfigModule.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
@Provides
@IntoMap
@StringKey(LayoutConfigKey.CARD_LANDSCAPE)
public InAppMessageLayoutConfig providesCardLandscapeConfig(DisplayMetrics displayMetrics) {
  return InAppMessageLayoutConfig.builder()
      .setMaxDialogHeightPx((int) (0.8 * displayMetrics.heightPixels))
      .setMaxDialogWidthPx(displayMetrics.widthPixels)
      .setMaxImageHeightWeight(1f) // entire dialog height
      .setMaxImageWidthWeight(0.5f)
      .setViewWindowGravity(Gravity.CENTER)
      .setWindowFlag(DISMISSIBLE_DIALOG_FLAG)
      .setWindowWidth(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setWindowHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setBackgroundEnabled(false)
      .setAnimate(false)
      .setAutoDismiss(false)
      .build();
}
 
Example #3
Source File: InflaterConfigModule.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
@Provides
@IntoMap
@StringKey(LayoutConfigKey.MODAL_PORTRAIT)
public InAppMessageLayoutConfig providesModalPortraitConfig(DisplayMetrics displayMetrics) {
  return InAppMessageLayoutConfig.builder()
      .setMaxDialogHeightPx((int) (0.8 * displayMetrics.heightPixels))
      .setMaxDialogWidthPx((int) (0.7f * displayMetrics.widthPixels))
      .setMaxImageHeightWeight(0.6f)
      .setMaxBodyHeightWeight(0.1f)
      .setMaxImageWidthWeight(0.9f) // entire dialog width
      .setMaxBodyWidthWeight(0.9f) // entire dialog width
      .setViewWindowGravity(Gravity.CENTER)
      .setWindowFlag(DISABLED_BG_FLAG)
      .setWindowWidth(ViewGroup.LayoutParams.MATCH_PARENT)
      .setWindowHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setBackgroundEnabled(false)
      .setAnimate(false)
      .setAutoDismiss(false)
      .build();
}
 
Example #4
Source File: InflaterConfigModule.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
@Provides
@IntoMap
@StringKey(LayoutConfigKey.BANNER_LANDSCAPE)
public InAppMessageLayoutConfig providesBannerLandscapeLayoutConfig(
    DisplayMetrics displayMetrics) {
  return InAppMessageLayoutConfig.builder()
      .setMaxImageHeightWeight(0.3f)
      .setMaxImageWidthWeight(0.3f)
      .setMaxDialogHeightPx((int) (0.5f * displayMetrics.heightPixels))
      .setMaxDialogWidthPx((int) (0.9f * displayMetrics.widthPixels))
      .setViewWindowGravity(Gravity.TOP)
      .setWindowFlag(ENABLED_BG_FLAG)
      .setWindowWidth(ViewGroup.LayoutParams.MATCH_PARENT)
      .setWindowHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setBackgroundEnabled(true)
      .setAnimate(true)
      .setAutoDismiss(true)
      .build();
}
 
Example #5
Source File: InflaterConfigModule.java    From firebase-android-sdk with Apache License 2.0 6 votes vote down vote up
@Provides
@IntoMap
@StringKey(LayoutConfigKey.IMAGE_ONLY_PORTRAIT)
public InAppMessageLayoutConfig providesPortraitImageLayoutConfig(DisplayMetrics displayMetrics) {
  return InAppMessageLayoutConfig.builder()
      .setMaxDialogHeightPx((int) (0.9f * displayMetrics.heightPixels))
      .setMaxDialogWidthPx((int) (0.9f * displayMetrics.widthPixels))
      .setMaxImageWidthWeight(0.8f)
      .setMaxImageHeightWeight(0.8f)
      .setViewWindowGravity(Gravity.CENTER)
      .setWindowFlag(DISABLED_BG_FLAG)
      .setWindowWidth(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setWindowHeight(ViewGroup.LayoutParams.WRAP_CONTENT)
      .setBackgroundEnabled(false)
      .setAnimate(false)
      .setAutoDismiss(false)
      .build();
}
 
Example #6
Source File: TestPushNotificationModule.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@IntoMap
@SupportedPushNotificationFacadeTypeKey(SupportedPushNotificationFacadeType.DISABLED)
@Singleton
@Provides
public static PushNotificationServiceFacade provideDisabledFacade() {
    return mock(DisabledNotificationServiceFacade.class);
}
 
Example #7
Source File: ItemBinderModule.java    From Graywater with Apache License 2.0 5 votes vote down vote up
@PerActivity
@Binds
@IntoMap
@PrimitiveItemBinderKey(ColorNamePrimitive.class)
abstract GraywaterAdapter.ItemBinder<
		? extends Primitive,
		? extends PrimitiveViewHolder,
		? extends GraywaterAdapter.Binder<? extends Primitive, PrimitiveViewHolder, ? extends PrimitiveViewHolder>>
bindsColorNamePrimitiveItemBinder(ColorNamePrimitiveItemBinder colorNamePrimitiveItemBinder);
 
Example #8
Source File: ItemBinderModule.java    From Graywater with Apache License 2.0 5 votes vote down vote up
@PerActivity
@Binds
@IntoMap
@PrimitiveItemBinderKey(Primitive.Header.class)
abstract GraywaterAdapter.ItemBinder<
		? extends Primitive,
		? extends PrimitiveViewHolder,
		? extends GraywaterAdapter.Binder<? extends Primitive, PrimitiveViewHolder, ? extends PrimitiveViewHolder>>
bindsHeaderPrimitiveItemBinder(HeaderPrimitiveItemBinder headerPrimitiveItemBinder);
 
Example #9
Source File: PresenterModule.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
@PerFragment
@Provides
@IntoMap
@PresenterSelectorKey(ListRow.class)
public Presenter provideListRowPresenter() {
    return new ListRowPresenter();
}
 
Example #10
Source File: ReflectiveModuleParser.java    From dagger-reflect with Apache License 2.0 5 votes vote down vote up
private static void addBinding(
    Scope.Builder scopeBuilder, Key key, Binding binding, Annotation[] annotations) {
  Annotation scope = findScope(annotations);
  if (scope != null) {
    if (!scopeBuilder.annotations.contains(scope)) {
      throw new IllegalStateException(
          "[Dagger/IncompatiblyScopedBindings] "
              // TODO clarify which "(sub)component" failed
              // (method when UnlinkedAndroidInjectorFactoryBinding is being created)
              // ([sub]componentClass in when calling ComponentScopeBuilder is calling create)
              + "(sub)component scoped with "
              + scopeBuilder.annotations
              + " may not reference bindings with different scopes:\n"
              + "@"
              + scope.annotationType().getCanonicalName()
              + " "
              + binding);
    } else {
      binding = binding.asScoped();
    }
  }

  if (findAnnotation(annotations, IntoSet.class) != null) {
    addSetBinding(scopeBuilder, key, binding);
  } else if (findAnnotation(annotations, ElementsIntoSet.class) != null) {
    addSetElementsBinding(scopeBuilder, key, binding);
  } else if (findAnnotation(annotations, IntoMap.class) != null) {
    addMapBinding(scopeBuilder, key, binding, annotations);
  } else {
    scopeBuilder.addBinding(key, binding);
  }
}
 
Example #11
Source File: PresenterModule.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
@PerFragment
@Provides
@IntoMap
@PresenterSelectorKey(DetailsOverviewRow.class)
public Presenter provideDetailsOverviewRowPresenter() {

    DetailsDescriptionPresenter pre = new DetailsDescriptionPresenter();
    return new FullWidthDetailsOverviewRowPresenter(pre);
}
 
Example #12
Source File: PresenterModule.java    From tv-samples with Apache License 2.0 5 votes vote down vote up
@PerFragment
@Provides
@IntoMap
@PresenterSelectorKey(VideoEntity.class)
public Presenter provideVideoCardPresenter() {
    return new VideoCardPresenter();
}
 
Example #13
Source File: TestPushNotificationModule.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@IntoMap
@SupportedPushNotificationFacadeTypeKey(SupportedPushNotificationFacadeType.FCM)
@Singleton
@Provides
public static PushNotificationServiceFacade provideFcmFacade() {
    return mock(FCMNotificationServiceFacade.class);
}
 
Example #14
Source File: TestWalletsModule.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@IntoMap
@SupportedWalletFacadeTypeKey(SupportedWalletFacadeType.ADM)
@Singleton
@Provides
public static WalletFacade provideAdamantInfoDriver() {
    return mock(AdamantWalletFacade.class);
}
 
Example #15
Source File: WalletsModule.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@IntoMap
@SupportedWalletFacadeTypeKey(SupportedWalletFacadeType.ADM)
@Singleton
@Provides
public static WalletFacade provideAdamantInfoDriver(AdamantApiWrapper api, ChatsStorage chatStorage) {
    AdamantWalletFacade driver = new AdamantWalletFacade(api);
    driver.setChatStorage(chatStorage);

    return driver;
}
 
Example #16
Source File: PushNotificationsModule.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@IntoMap
@SupportedPushNotificationFacadeTypeKey(SupportedPushNotificationFacadeType.DISABLED)
@Singleton
@Provides
public static PushNotificationServiceFacade provideDisabledFacade() {
    return new DisabledNotificationServiceFacade();
}
 
Example #17
Source File: PushNotificationsModule.java    From adamant-android with GNU General Public License v3.0 5 votes vote down vote up
@IntoMap
@SupportedPushNotificationFacadeTypeKey(SupportedPushNotificationFacadeType.FCM)
@Singleton
@Provides
public static PushNotificationServiceFacade provideFcmFacade(
        Gson gson,
        Settings settings,
        MessageFactoryProvider messageFactoryProvider
) {
    return new FCMNotificationServiceFacade(gson, settings, messageFactoryProvider);
}
 
Example #18
Source File: ViewHolderCreatorModule.java    From Graywater with Apache License 2.0 4 votes vote down vote up
@Binds
@IntoMap
@PrimitiveCreatorKey(TextPrimitiveViewHolder.class)
abstract GraywaterAdapter.ViewHolderCreator bindsTextPrimitiveViewHolderCreator(
		TextPrimitiveViewHolderCreator textPrimitiveViewHolderCreator);
 
Example #19
Source File: ViewHolderCreatorModule.java    From Graywater with Apache License 2.0 4 votes vote down vote up
@Binds
@IntoMap
@PrimitiveCreatorKey(HeaderViewHolder.class)
abstract GraywaterAdapter.ViewHolderCreator bindsHeaderViewHolderCreator(HeaderViewHolderCreator headerViewHolderCreator);
 
Example #20
Source File: ViewModelModule.java    From Dagger2-Sample with MIT License 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(MovieListViewModel.class)
protected abstract ViewModel movieListViewModel(MovieListViewModel moviesListViewModel);
 
Example #21
Source File: ViewModelModule.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(IssueDetailViewModel.class)
abstract ViewModel provideIssueDetailViewModel(IssueDetailViewModel viewModel);
 
Example #22
Source File: ActionListenerModule.java    From Graywater with Apache License 2.0 4 votes vote down vote up
@PerActivity
@Binds
@IntoMap
@PrimitiveItemBinderKey(ColorNamePrimitive.class)
abstract GraywaterAdapter.ActionListener<? extends Primitive, PrimitiveViewHolder, ? extends PrimitiveViewHolder>
bindsColorNamePrimitiveActionListener(ColorNamePrimitiveItemBinder colorNamePrimitiveItemBinder);
 
Example #23
Source File: ViewHolderCreatorModule.java    From Graywater with Apache License 2.0 4 votes vote down vote up
@Binds
@IntoMap
@PrimitiveCreatorKey(ColorPrimitiveViewHolder.class)
abstract GraywaterAdapter.ViewHolderCreator bindsColorPrimitiveViewHolderCreator(
		ColorPrimitiveViewHolderCreator colorPrimitiveViewHolderCreator);
 
Example #24
Source File: ViewModelModule.java    From ground-android with Apache License 2.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(TextFieldViewModel.class)
abstract ViewModel bindTextFieldViewModel(TextFieldViewModel viewModel);
 
Example #25
Source File: ViewModelModule.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(CodeViewerViewModel.class)
abstract ViewModel provideCodeViewerViewModel(CodeViewerViewModel viewModel);
 
Example #26
Source File: ViewModelModule.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(ContributorsViewModel.class)
abstract ViewModel provideContributorsViewModel(ContributorsViewModel viewModel);
 
Example #27
Source File: ViewModelModule.java    From ground-android with Apache License 2.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(MultipleChoiceFieldViewModel.class)
abstract ViewModel bindMultipleChoiceFieldViewModel(MultipleChoiceFieldViewModel viewModel);
 
Example #28
Source File: ViewModelModule.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(ProfileFollowersViewModel.class)
abstract ViewModel provideProfileFollowersViewModel(ProfileFollowersViewModel viewModel);
 
Example #29
Source File: ViewModelModule.java    From ground-android with Apache License 2.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(PhotoFieldViewModel.class)
abstract ViewModel bindPhotoFieldViewModel(PhotoFieldViewModel viewModel);
 
Example #30
Source File: ViewModelModule.java    From mvvm-template with GNU General Public License v3.0 4 votes vote down vote up
@Binds
@IntoMap
@ViewModelKey(MainViewModel.class)
abstract ViewModel mainViewModel(MainViewModel viewModel);