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
package com.chintansoni.android.mesamis.base; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.LayoutInflater; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import java.lang.reflect.Constructor; | |
import java.lang.reflect.InvocationTargetException; | |
import java.util.ArrayList; |
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 ScrollingActivity extends AppCompatActivity { | |
private SectionsPagerAdapter mSectionsPagerAdapter; | |
private ViewPager mViewPager; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_scrolling); |
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 BaseRecyclerAdapter<T, MVH extends BaseViewHolder<T>, EVH extends BaseViewHolder<T>> extends RecyclerView.Adapter<BaseViewHolder<T>> { | |
private static final int VIEW_TYPE_EMPTY = 0; | |
private static final int VIEW_TYPE_DATA = 1; | |
private List<T> list = new ArrayList<>(); | |
@LayoutRes | |
private int emptyViewLayoutResource; | |
private Class<EVH> emptyViewHolder; | |
@LayoutRes | |
private int dataLayoutResource; |
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 BaseRecyclerAdapter<T, MVH extends BaseViewHolder<T>, EVH extends BaseViewHolder<T>> extends RecyclerView.Adapter<BaseViewHolder<T>> { | |
private static final int VIEW_TYPE_EMPTY = 0; | |
private static final int VIEW_TYPE_DATA = 1; | |
private List<T> list = new ArrayList<>(); | |
@LayoutRes | |
private int emptyViewLayoutResource; | |
private Class<EVH> emptyViewHolder; | |
@LayoutRes | |
private int dataLayoutResource; |
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
apply plugin: 'com.android.application' | |
apply plugin: 'kotlin-android' | |
apply plugin: 'kotlin-android-extensions' | |
apply plugin: 'kotlin-kapt' | |
android { | |
compileSdkVersion 27 | |
defaultConfig { | |
applicationId "com.simform.android.dagger2advanced" | |
minSdkVersion 16 |
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
interface ApiService { | |
@GET("api") | |
fun getUsers(@Query("result") result: Int): Observable<RandomUserResponse> | |
} |
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
@Component(modules = [AndroidSupportInjectionModule::class, AppModule::class, ActivityModule::class]) | |
interface AppComponent : AndroidInjector<DaggerApplication> { | |
@Component.Builder | |
interface Builder { | |
@BindsInstance | |
fun application(application: Application): Builder | |
fun build(): AppComponent | |
} |
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 MyApplication : DaggerApplication() { | |
override fun onCreate() { | |
super.onCreate() | |
initializeTimber() | |
} | |
private fun initializeTimber() { | |
if (BuildConfig.DEBUG) { |
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
@Module | |
abstract class ActivityModule { | |
@ContributesAndroidInjector | |
internal abstract fun contributeHomeActivity(): HomeActivity | |
} |
OlderNewer