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
<android.support.v4.widget.DrawerLayout android:id="@+id/activity_container" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<FrameLayout | |
android:id="@+id/activity_content" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" /> |
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 BaseActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
} | |
@Override | |
public void setContentView(int layoutResID) | |
{ |
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
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2' | |
androidTestCompile 'com.android.support.test:runner:0.5' | |
androidTestCompile 'com.android.support:support-annotations:24.2.1' | |
compile 'com.android.support:appcompat-v7:24.2.1' | |
testCompile 'junit:junit:4.12' | |
compile 'com.google.dagger:dagger:2.6' |
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
@Singleton | |
@Component (modules={UserModule.class}) | |
public interface UserComponent { | |
void inject(MainActivity activity); | |
} | |
@Module | |
public class UserModule { |
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 App extends Application { | |
UserComponent userComponent; | |
@Override | |
public void onCreate() { | |
super.onCreate(); | |
userComponent = DaggerUserComponent.builder().userModule(new UserModule()).build(); | |
} |
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 MainActivity extends AppCompatActivity implements View.OnClickListener { | |
@Inject UserService userService; | |
Button login; | |
Button logout; | |
TextView status; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); |
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
@LargeTest | |
@RunWith(AndroidJUnit4.class) | |
public class UserServiceTest { | |
@Rule | |
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<MainActivity>(MainActivity.class) { | |
@Override | |
protected void beforeActivityLaunched() { | |
App application = (App) InstrumentationRegistry.getInstrumentation().getTargetContext().getApplicationContext(); | |
TestUserComponent component = DaggerUserServiceTest_TestUserComponent.builder() |
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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:id="@+id/main_layout" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<android.support.v4.view.ViewPager | |
android:id="@+id/viewpager" |
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
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<TextView | |
android:id="@+id/step1_textView" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:text="Step1"/> |
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 ViewPagerAdapter extends PagerAdapter { | |
private final List<Presenter> mPresenterList = new ArrayList<>(); | |
@Override | |
public boolean isViewFromObject(View view, Object object) { | |
return view == object; | |
} | |
@Override | |
public int getCount() { |