com.jess.arms.di.component.AppComponent Java Examples

The following examples show how to use com.jess.arms.di.component.AppComponent. 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: ReplyAdapter.java    From Aurora with Apache License 2.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, ReplySection item) {
    ImageView img = helper.getView(R.id.iv_pic);
    AppComponent mAppComponent = ((App)img.getContext().getApplicationContext())
            .getAppComponent();
    if (item.t.getData().getUser()!=null){
        mAppComponent.imageLoader().loadImage(img.getContext(),
                ImageConfigImpl
                        .builder()
                        .transformation(new GlideCircleTransform())
                        .url(item.t.getData().getUser().getAvatar())
                        .imageView(img)
                        .build());
    }
    DateFormat df = new SimpleDateFormat("yyyy/MM/dd");
    if (item.t.getData().getUser()!=null){
        helper.setText(R.id.tv_nickname,item.t.getData().getUser().getNickname());
    }
    helper.setText(R.id.tv_comment,item.t.getData().getMessage())
            .setText(R.id.tv_good_num,item.t.getData().getLikeCount()+"")
            .setText(R.id.tv_reply_time,df.format(item.t.getData().getCreateTime()));
}
 
Example #2
Source File: AurhorListAdapter.java    From Aurora with Apache License 2.0 6 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, MyAttentionEntity item) {
    ImageView imgAutor = helper.getView(R.id.img_icon);
    Context context = imgAutor.getContext();
    AppComponent mAppComponent = ((App)context.getApplicationContext())
            .getAppComponent();
    mAppComponent.imageLoader().loadImage(context,
            ImageConfigImpl
                    .builder()
                    .transformation(new GlideCircleTransform())
                    .url(item.getIcon())
                    .imageView(imgAutor)
                    .build());
    helper.setText(R.id.tv_name,item.getTitle())
            .setText(R.id.tv_desc,item.getDescription());
    FollowButton button = helper.getView(R.id.btn_attention);
    button.setState(FollowButton.FOLLOWED);
    button.setCanClick(false);
}
 
Example #3
Source File: BannerAdapter.java    From Aurora with Apache License 2.0 6 votes vote down vote up
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {
    int fakePosition = position % mList.size();
    mCardAdapterHelper.onBindViewHolder(holder.itemView, position, getItemCount());
    AppComponent mAppComponent = ((App)holder.mImageView.getContext().getApplicationContext())
            .getAppComponent();
    Context context = holder.mImageView.getContext();
    try {
        ((App)context.getApplicationContext())
                .getAppComponent().imageLoader().loadImage(mAppComponent.appManager().getCurrentActivity() == null
                        ? mAppComponent.application() : mAppComponent.appManager().getCurrentActivity(),
                ImageConfigImpl
                        .builder()
                        .url(StringUtils.replaceNull(mList.get(fakePosition).getData().getCover().getFeed()))
                        .imageView(holder.mImageView)
                        .build());
    }catch (NullPointerException e){

    }
}
 
Example #4
Source File: SaleActivity.java    From Hands-Chopping with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
    DaggerSaleComponent
            .builder()
            .appComponent(appComponent)
            .view(this)
            .build()
            .inject(this);
}
 
Example #5
Source File: GoldHomeActivity.java    From lifecycle-component with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
    DaggerGoldHomeComponent
            .builder()
            .appComponent(appComponent)
            .view(this)
            .build()
            .inject(this);
}
 
Example #6
Source File: SearchActivity.java    From Hands-Chopping with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(@NonNull AppComponent appComponent) {
    DaggerSearchComponent
            .builder()
            .appComponent(appComponent)
            .view(this)
            .build()
            .inject(this);
}
 
Example #7
Source File: BaseApplication.java    From Aurora with Apache License 2.0 5 votes vote down vote up
/**
 * 将 {@link AppComponent} 返回出去,供其它地方使用,{@link AppComponent} 中声明的方法所返回的实例
 * 在 {@link #getAppComponent()}拿到对象后都可以直接使用
 *
 * @return
 */
@NonNull
@Override
public AppComponent getAppComponent() {
    Preconditions.checkNotNull(mAppDelegate, "%s cannot be null", AppDelegate.class.getName());
    Preconditions.checkState(mAppDelegate instanceof App, "%s must be implements %s", AppDelegate.class.getName(), App.class.getName());
    return ((App) mAppDelegate).getAppComponent();
}
 
Example #8
Source File: AuthorIndexFragment.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    this.appComponent = appComponent;
    DaggerAuthorDetailIndexComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .authorDetailModule(new AuthorDetailModule(this))
            .build()
            .inject(this);
}
 
Example #9
Source File: HotFragment.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    this.mRxPermissions = new RxPermissions(getActivity());
    DaggerHotComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .hotModule(new HotModule(this))
            .build()
            .inject(this);
}
 
Example #10
Source File: AuthorVideoFragment.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    DaggerAuthorDetailVideoComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .authorDetailModule(new AuthorDetailModule(this))
            .build()
            .inject(this);
}
 
Example #11
Source File: AttentionFragment.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    DaggerAttentionComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .attentionModule(new AttentionModule(this))
            .build()
            .inject(this);
}
 
Example #12
Source File: CategoryFragment.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    mRxPermissions = new RxPermissions(getActivity());
    DaggerCategoryComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .categoryModule(new CategoryModule(this))
            .build()
            .inject(this);
}
 
Example #13
Source File: AuthorDynamicFragment.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    this.appComponent = appComponent;
    DaggerAuthorDetailDynamicComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .authorDetailModule(new AuthorDetailModule(this))
            .build()
            .inject(this);
}
 
Example #14
Source File: AuthorVideosAdapter.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, VideoListInfo.Video item) {
    helper.setText(R.id.tv_title,item.getData().getTitle())
            .setText(R.id.tv_type,getDetailStr(item));
    ImageView img = helper.getView(R.id.iv_left);
    AppComponent mAppComponent = ((App)img.getContext().getApplicationContext())
            .getAppComponent();
    Context context = img.getContext();
    mAppComponent.imageLoader().loadImage(context,
            ImageConfigImpl
                    .builder()
                    .url(item.getData().getCover().getFeed())
                    .imageView(img)
                    .build());
}
 
Example #15
Source File: VideoAdapter.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, VideoListInfo.Video item) {
    AppComponent  mAppComponent = ((App)helper.getView(R.id.img_main).getContext().getApplicationContext())
            .getAppComponent();
    ImageView imgMian = helper.getView(R.id.img_main);
    ImageView imgAutor = helper.getView(R.id.img_author);
    Context context = imgMian.getContext();
    Glide.with(context).load(item.getData().getCover().getFeed())
            .into(imgMian);
    mAppComponent.imageLoader().loadImage(context,
            ImageConfigImpl
                    .builder()
                    .url(item.getData().getCover().getFeed())
                    .imageView(imgMian)
                    .build());
    try {
        ((App)context.getApplicationContext())
                .getAppComponent().imageLoader().loadImage(context,
                ImageConfigImpl
                        .builder()
                        .transformation(new GlideCircleTransform())
                        .url(StringUtils.replaceNull(item.getData().getAuthor().getIcon()))
                        .imageView(helper.getView(R.id.img_author))
                        .build());
    }catch (NullPointerException e){

    }
    helper.setText(R.id.title,item.getData().getTitle())
            .setText(R.id.detail,getDetailStr(item));
    if (item.getData().getAuthor()!=null){
        helper.getView(R.id.img_author).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                gotoAuthorDetail(view,helper.getLayoutPosition());
            }
        });
    }
}
 
Example #16
Source File: RelateVideoAdapter.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, RelateVideoSection item) {
    helper.setText(R.id.tv_title,item.t.getData().getTitle())
            .setText(R.id.tv_type,getDetailStr(item.t));
    ImageView img = helper.getView(R.id.iv_left);
    AppComponent mAppComponent = ((App)img.getContext().getApplicationContext())
            .getAppComponent();
    Context context = img.getContext();
    mAppComponent.imageLoader().loadImage(context,
            ImageConfigImpl
                    .builder()
                    .url(item.t.getData().getCover().getFeed())
                    .imageView(img)
                    .build());
}
 
Example #17
Source File: CategoryAdapter.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
protected void convert(BaseViewHolder helper, Category item) {
    AppComponent mAppComponent = ((App)helper.getView(R.id.iv_bg).getContext().getApplicationContext())
            .getAppComponent();
    ImageView bg = helper.getView(R.id.iv_bg);
    helper.setText(R.id.tv_name,item.getName());
    mAppComponent.imageLoader().loadImage(bg.getContext(),
            ImageConfigImpl
                    .builder()
                    .url(item.getBgPicture())
                    .imageView(bg)
                    .build());
}
 
Example #18
Source File: VideoListActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    DaggerVideoListActivityComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .videoListActivityModule(new VideoListActivityModule(this))
            .build()
            .inject(this);
}
 
Example #19
Source File: VideoDetailActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    this.mRxPermissions = new RxPermissions(this);
    mAppComponent = appComponent;
    gson = mAppComponent.gson();
    DaggerVideoDetailComponent
            .builder()
            .videoDetailModule(new VideoDetailModule(this))
            .appComponent(appComponent)
            .build()
            .inject(this);
}
 
Example #20
Source File: SplashActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    this.mRxPermissions = new RxPermissions(this);
    DaggerSplashComponent.builder()
            .appComponent(appComponent)
            .splashModule(new SplashModule(this))
            .build()
            .inject(this);
}
 
Example #21
Source File: MyAttentionActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    DaggerMyAttentionComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .attentionModule(new AttentionModule(this))
            .build()
            .inject(this);
}
 
Example #22
Source File: FlutterVideoDetailActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    this.mRxPermissions = new RxPermissions(this);
    mAppComponent = appComponent;
    gson = mAppComponent.gson();
    DaggerFlutterVideoDetailComponent
            .builder()
            .videoDetailModule(new VideoDetailModule(this))
            .appComponent(appComponent)
            .build()
            .inject(this);
}
 
Example #23
Source File: VideoDetailActivity.java    From LQRBiliBlili with MIT License 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    ARouter.getInstance().inject(this);
    DaggerVideoDetailComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .videoDetailModule(new VideoDetailModule(this))
            .build()
            .inject(this);
}
 
Example #24
Source File: AuthorDetailActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    DaggerAuthorDetailComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .authorDetailModule(new AuthorDetailModule(this))
            .build()
            .inject(this);
}
 
Example #25
Source File: SearchActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    this.mRxPermissions = new RxPermissions(this);
    DaggerSearchComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .searchModule(new SearchModule(this))
            .build()
            .inject(this);
}
 
Example #26
Source File: HistoryActivity.java    From Aurora with Apache License 2.0 5 votes vote down vote up
@Override
public void setupActivityComponent(AppComponent appComponent) {
    mAppComponent = appComponent;
    DaggerHistoryComponent //如找不到该类,请编译一下项目
            .builder()
            .appComponent(appComponent)
            .historyModule(new HistoryModule(this))
            .build()
            .inject(this);
}
 
Example #27
Source File: DaggerRule.java    From Aurora with Apache License 2.0 5 votes vote down vote up
public DaggerRule() {
    super(AppComponent.class,new AppModule(RuntimeEnvironment.application)
            ,new ClientModule(), new GlobalConfiguration());
    set(new ComponentSetter<AppComponent>() {
        @Override
        public void setComponent(AppComponent component) {

        }
    });
}
 
Example #28
Source File: MainCategoryFragment.java    From LQRBiliBlili with MIT License 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    DaggerMainCategoryComponent.builder()
            .appComponent(appComponent)
            .mainCategoryModule(new MainCategoryModule(this))
            .build()
            .inject(this);
}
 
Example #29
Source File: LiveFragment.java    From LQRBiliBlili with MIT License 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    DaggerLiveComponent.builder()
            .liveModule(new LiveModule(this))
            .appComponent(appComponent)
            .build()
            .inject(this);
}
 
Example #30
Source File: RecommendFragment.java    From LQRBiliBlili with MIT License 5 votes vote down vote up
@Override
public void setupFragmentComponent(AppComponent appComponent) {
    DaggerRecommendComponent
            .builder()
            .recommendModule(new RecommendModule(this))
            .appComponent(appComponent)
            .build()
            .inject(this);
}