This file contains hidden or 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 static BitmapDescriptor generateBitmapDescriptorFromRes( | |
Context context, int resId) { | |
Drawable drawable = ContextCompat.getDrawable(context, resId); | |
drawable.setBounds( | |
0, | |
0, | |
drawable.getIntrinsicWidth(), | |
drawable.getIntrinsicHeight()); | |
Bitmap bitmap = Bitmap.createBitmap( | |
drawable.getIntrinsicWidth(), |
This file contains hidden or 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
@Module | |
public class AppModule { | |
@Singleton | |
@Provides | |
Context provideContext(Application application) { | |
return application; | |
} | |
} |
This file contains hidden or 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 LoginFragment extends Fragment{ | |
@Inject | |
Context mContext; | |
@Override | |
public void onAttach(Context context) { | |
AndroidSupportInjection.inject(this); | |
super.onAttach(context); | |
} |
This file contains hidden or 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
BASE_URL="https://api.themoviedb.org/" | |
BASE_IMAGE_URL="https://image.tmdb.org/t/p/" | |
API_VERSION="3/" | |
API_KEY="TODO_GO_GET_YOUR_API_KEY_FROM_https://www.themoviedb.org/settings/api" |
This file contains hidden or 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
@Module | |
public abstract class FragmentModule { | |
@FragmentScope | |
@ContributesAndroidInjector(modules = MovieListFragmentModule.class) | |
abstract MovieListFragment contributesMovieListFragment(); | |
@FragmentScope | |
@ContributesAndroidInjector(modules = MovieDetailFragmentModule.class) | |
abstract MovieDetailFragment contributesMovieDetailFragment(); |
This file contains hidden or 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
@FragmentScope | |
@Module | |
public class MovieDetailFragmentModule { | |
@FragmentScope | |
@Provides | |
MovieDetailContract.View provideDetailView(MovieDetailFragment movieDetailFragment) { | |
return movieDetailFragment; | |
} |
This file contains hidden or 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
@FragmentScope | |
@Module | |
public abstract class MovieDetailFragmentProvider { | |
@FragmentScope | |
@ContributesAndroidInjector(modules = MovieDetailFragmentModule.class) | |
abstract MovieDetailFragment contributesMovieDetailFragment(); | |
} |
This file contains hidden or 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
@Singleton | |
@Component(modules = { | |
AndroidInjectionModule.class, | |
AppModule.class, | |
ApiModule.class, | |
ActivityModule.class}) | |
public interface AppComponent { | |
@Component.Builder | |
interface Builder { | |
@BindsInstance |
This file contains hidden or 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
@ActivityScope | |
@Module | |
public abstract class ActivityModule { | |
@ActivityScope | |
@ContributesAndroidInjector(modules = MovieListFragmentProvider.class) | |
abstract MovieListActivity contributesMovieListActivity(); | |
@ActivityScope | |
@ContributesAndroidInjector(modules = MovieDetailFragmentProvider.class) |