mirror of https://github.com/kurisufriend/Clover
parent
3a652cf51e
commit
33c5cc720e
@ -0,0 +1,5 @@ |
|||||||
|
package org.floens.chan.core; |
||||||
|
|
||||||
|
public interface UserAgentProvider { |
||||||
|
String getUserAgent(); |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
package org.floens.chan.core.di; |
||||||
|
|
||||||
|
import android.content.Context; |
||||||
|
|
||||||
|
import org.floens.chan.core.UserAgentProvider; |
||||||
|
|
||||||
|
import javax.inject.Singleton; |
||||||
|
|
||||||
|
import dagger.Module; |
||||||
|
import dagger.Provides; |
||||||
|
|
||||||
|
@Module |
||||||
|
public class AppModule { |
||||||
|
private Context applicationContext; |
||||||
|
private UserAgentProvider userAgentProvider; |
||||||
|
|
||||||
|
public AppModule(Context applicationContext, UserAgentProvider userAgentProvider) { |
||||||
|
this.applicationContext = applicationContext; |
||||||
|
this.userAgentProvider = userAgentProvider; |
||||||
|
} |
||||||
|
|
||||||
|
@Provides |
||||||
|
@Singleton |
||||||
|
public Context provideApplicationContext() { |
||||||
|
return applicationContext; |
||||||
|
} |
||||||
|
|
||||||
|
@Provides |
||||||
|
@Singleton |
||||||
|
public UserAgentProvider provideUserAgentProvider() { |
||||||
|
return userAgentProvider; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
package org.floens.chan.core.di; |
||||||
|
|
||||||
|
import org.floens.chan.Chan; |
||||||
|
import org.floens.chan.chan.ChanParser; |
||||||
|
import org.floens.chan.core.net.ChanReaderRequest; |
||||||
|
import org.floens.chan.core.presenter.ReplyPresenter; |
||||||
|
import org.floens.chan.ui.controller.DeveloperSettingsController; |
||||||
|
import org.floens.chan.ui.controller.MainSettingsController; |
||||||
|
import org.floens.chan.ui.layout.ThreadLayout; |
||||||
|
|
||||||
|
import javax.inject.Singleton; |
||||||
|
|
||||||
|
import dagger.Component; |
||||||
|
|
||||||
|
@Component(modules = { |
||||||
|
AppModule.class |
||||||
|
}) |
||||||
|
@Singleton |
||||||
|
public interface ChanGraph { |
||||||
|
void inject(Chan chan); |
||||||
|
|
||||||
|
void inject(MainSettingsController mainSettingsController); |
||||||
|
|
||||||
|
void inject(ReplyPresenter replyPresenter); |
||||||
|
|
||||||
|
void inject(ChanReaderRequest chanReaderRequest); |
||||||
|
|
||||||
|
void inject(ThreadLayout threadLayout); |
||||||
|
|
||||||
|
void inject(DeveloperSettingsController developerSettingsController); |
||||||
|
|
||||||
|
ChanParser getChanParser(); |
||||||
|
} |
Loading…
Reference in new issue