// Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
//     private RequestCode() {
//         throw new AssertionError("constructor of the constants class should not be called");
//     }
// 
//     public static final int OAUTH = 100;
// }
// 
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
//     interface View {
//         void setFragment(Fragment fragment);
//         Context getActivityContext();
//         MainComponent getMainComponent();
//     }
// }
// 
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
//     public static final String TAG = OauthActivity.class.getSimpleName();
// 
//     @Inject RootStore store;
//     @Inject OauthParams oauthParams;
//     @Inject UserActionCreator userActionCreator;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_oauth);
//         inject();
// 
//         if (store.getAuthorizedUsers().isEmpty()) {
//             CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
//             intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
//         }
//     }
// 
//     @Override
//     protected void onNewIntent(Intent intent) {
//         super.onNewIntent(intent);
//         inject();
//         store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
//                 .subscribeOn(Schedulers.io())
//                 .observeOn(AndroidSchedulers.mainThread())
//                 .subscribe(
//                         _a -> returnToMain(),
//                         this::returnToMain
//                 );
//     }
// 
//     private void returnToMain() {
//         setResult(Activity.RESULT_OK);
//         finish();
//     }
// 
//     private void returnToMain(Throwable throwable) {
//         setResult(Activity.RESULT_CANCELED);
//         finish();
//     }
// 
//     private void inject() {
//         Sunazuri.get(this).getComponent().inject(this);
//     }
// }
// 
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
// 
// 
//     public PostsFragment() {
//         // Required empty public constructor
//     }
// 
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                              Bundle savedInstanceState) {
//         // Inflate the layout for this fragment
//         return inflater.inflate(R.layout.fragment_posts, container, false);
//     }
// 
// }


import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject;
    public void onAttach(Context context) {
        super.onAttach(context);
        if (getActivity() instanceof MainContract.View) {
            mainView = (MainContract.View) getActivity();
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_welcome, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        setupComponent();
        binding = FragmentWelcomeBinding.bind(view);
        binding.setController(controller);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        ActivityResult.onResult(requestCode, resultCode, data).into(controller);
    }

    @Override
    public void showOauthUi() {
// Path: app/src/main/java/info/izumin/android/sunazuri/RequestCode.java
// public class RequestCode {
//     private RequestCode() {
//         throw new AssertionError("constructor of the constants class should not be called");
//     }
// 
//     public static final int OAUTH = 100;
// }
// 
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/main/MainContract.java
// public interface MainContract {
//     interface View {
//         void setFragment(Fragment fragment);
//         Context getActivityContext();
//         MainComponent getMainComponent();
//     }
// }
// 
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/activity/oauth/OauthActivity.java
// public class OauthActivity extends AppCompatActivity {
//     public static final String TAG = OauthActivity.class.getSimpleName();
// 
//     @Inject RootStore store;
//     @Inject OauthParams oauthParams;
//     @Inject UserActionCreator userActionCreator;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_oauth);
//         inject();
// 
//         if (store.getAuthorizedUsers().isEmpty()) {
//             CustomTabsIntent intent = new CustomTabsIntent.Builder().build();
//             intent.launchUrl(this, Uri.parse(oauthParams.getAuthorizeUri()));
//         }
//     }
// 
//     @Override
//     protected void onNewIntent(Intent intent) {
//         super.onNewIntent(intent);
//         inject();
//         store.dispatch(userActionCreator.createAuthAction(intent.getDataString()))
//                 .subscribeOn(Schedulers.io())
//                 .observeOn(AndroidSchedulers.mainThread())
//                 .subscribe(
//                         _a -> returnToMain(),
//                         this::returnToMain
//                 );
//     }
// 
//     private void returnToMain() {
//         setResult(Activity.RESULT_OK);
//         finish();
//     }
// 
//     private void returnToMain(Throwable throwable) {
//         setResult(Activity.RESULT_CANCELED);
//         finish();
//     }
// 
//     private void inject() {
//         Sunazuri.get(this).getComponent().inject(this);
//     }
// }
// 
// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/posts/PostsFragment.java
// public class PostsFragment extends Fragment {
// 
// 
//     public PostsFragment() {
//         // Required empty public constructor
//     }
// 
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                              Bundle savedInstanceState) {
//         // Inflate the layout for this fragment
//         return inflater.inflate(R.layout.fragment_posts, container, false);
//     }
// 
// }


// Path: app/src/main/java/info/izumin/android/sunazuri/presentation/fragment/welcome/WelcomeFragment.java
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import info.izumin.android.sunazuri.R;
import info.izumin.android.sunazuri.RequestCode;
import info.izumin.android.sunazuri.databinding.FragmentWelcomeBinding;
import info.izumin.android.sunazuri.presentation.activity.main.MainContract;
import info.izumin.android.sunazuri.presentation.activity.oauth.OauthActivity;
import info.izumin.android.sunazuri.presentation.fragment.posts.PostsFragment;
import onactivityresult.ActivityResult;
import javax.inject.Inject;

    public void onAttach(Context context) {
        super.onAttach(context);
        if (getActivity() instanceof MainContract.View) {
            mainView = (MainContract.View) getActivity();
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_welcome, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        setupComponent();
        binding = FragmentWelcomeBinding.bind(view);
        binding.setController(controller);
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        ActivityResult.onResult(requestCode, resultCode, data).into(controller);
    }

    @Override
    public void showOauthUi() {
        startActivityForResult(new Intent(getActivity(), OauthActivity.class), RequestCode.OAUTH);