Skip to content

Instantly share code, notes, and snippets.

View maydin's full-sized avatar

Murat AYDIN maydin

  • Vodafone
  • Berlin
View GitHub Profile
<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" />
@maydin
maydin / BaseActivity.java
Created October 21, 2016 08:25
free version
public class BaseActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public void setContentView(int layoutResID)
{
@maydin
maydin / build.gradle
Created November 10, 2016 20:43
build.gradle
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'
@maydin
maydin / gist.java
Created November 12, 2016 09:49
Dagger component and module
@Singleton
@Component (modules={UserModule.class})
public interface UserComponent {
void inject(MainActivity activity);
}
@Module
public class UserModule {
@maydin
maydin / App.java
Created November 12, 2016 09:59
Extended Application class
public class App extends Application {
UserComponent userComponent;
@Override
public void onCreate() {
super.onCreate();
userComponent = DaggerUserComponent.builder().userModule(new UserModule()).build();
}
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);
@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()
@maydin
maydin / activity_main.xml
Last active February 15, 2017 11:22
activity_main.xml
<?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"
@maydin
maydin / step1_layout.xml
Created February 15, 2017 11:24
Step1 Layout
<?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"/>
@maydin
maydin / PagerAdapter.java
Last active February 15, 2017 12:50
PagerAdapter
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() {