// Path: app/src/main/java/com/ragdroid/dahaka/activity/login/LoginActivity.java
// public class LoginActivity extends BaseActivity<LoginContract.Presenter> implements LoginContract.View {
// 
//     private ActivityLoginBinding binding;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         binding = DataBindingUtil.setContentView(this, R.layout.activity_login);
//         super.onCreate(savedInstanceState);
//         Toolbar toolbar = findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
//         toolbar.setTitle(R.string.title_activity_login);
//         binding.setPresenter(getPresenter());
//     }
// 
//     @Override
//     public void showHome() {
//         Intent intent = new Intent(this, HomeActivity.class);
//         startActivity(intent);
//         finish();
//     }
// 
//     @Override
//     public void setModel(LoginModel loginModel) {
//         binding.setModel(loginModel);
//     }
// }


import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.Toast;
import com.ragdroid.dahaka.R;
import com.ragdroid.dahaka.activity.login.LoginActivity;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;
package com.ragdroid.dahaka.mvp;





/**
 * Created by garimajain on 13/08/17.
 */

public abstract class BaseFragment<T extends BasePresenter> extends DaggerFragment implements BaseView {

    public T getPresenter() {
        return presenter;
    }

    @Inject
    T presenter;


    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        presenter.onViewAdded(this);
    }

    @Override
    public void showMessage(String message) {
        Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onDetach() {
        presenter.onViewRemoved();
        super.onDetach();
    }

    @Override
    public void finishView() {
        showMessage(getString(R.string.session_expired));
// Path: app/src/main/java/com/ragdroid/dahaka/activity/login/LoginActivity.java
// public class LoginActivity extends BaseActivity<LoginContract.Presenter> implements LoginContract.View {
// 
//     private ActivityLoginBinding binding;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         binding = DataBindingUtil.setContentView(this, R.layout.activity_login);
//         super.onCreate(savedInstanceState);
//         Toolbar toolbar = findViewById(R.id.toolbar);
//         setSupportActionBar(toolbar);
//         toolbar.setTitle(R.string.title_activity_login);
//         binding.setPresenter(getPresenter());
//     }
// 
//     @Override
//     public void showHome() {
//         Intent intent = new Intent(this, HomeActivity.class);
//         startActivity(intent);
//         finish();
//     }
// 
//     @Override
//     public void setModel(LoginModel loginModel) {
//         binding.setModel(loginModel);
//     }
// }


// Path: app/src/main/java/com/ragdroid/dahaka/mvp/BaseFragment.java
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.Toast;
import com.ragdroid.dahaka.R;
import com.ragdroid.dahaka.activity.login.LoginActivity;
import javax.inject.Inject;
import dagger.android.support.DaggerFragment;

package com.ragdroid.dahaka.mvp;





/**
 * Created by garimajain on 13/08/17.
 */

public abstract class BaseFragment<T extends BasePresenter> extends DaggerFragment implements BaseView {

    public T getPresenter() {
        return presenter;
    }

    @Inject
    T presenter;


    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        presenter.onViewAdded(this);
    }

    @Override
    public void showMessage(String message) {
        Toast.makeText(getActivity(), message, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onDetach() {
        presenter.onViewRemoved();
        super.onDetach();
    }

    @Override
    public void finishView() {
        showMessage(getString(R.string.session_expired));
        startActivity(new Intent(getActivity(), LoginActivity.class));