title: How to use Shared Preferences in MVP without Dagger and not causing Presenter to be Context dependent?
body: <p>I'm trying to implement MVP without Dagger (for learning purposes). But I got to the problem - I use Repository patter to get raw data either from cache (Shared Preferences) or network:</p>
  
  <pre><code>Shared Prefs| 
              |&lt;-&gt;Repository&lt;-&gt;Model&lt;-&gt;Presenter&lt;-&gt;View
       Network|
  </code></pre>
  
  <p>But to put my hands on Shared Preferences I have to put somewhere line like</p>
  
  <pre><code>presenter = new Presenter(getApplicationContext());
  </code></pre>
  
  <p>I use <code>onRetainCustomNonConfigurationInstance</code>/<code>getLastCustomNonConfigurationInstance</code> pair to keep Presenter "retained".</p>
  
  <pre><code>public class MyActivity extends AppCompatActivity implements MvpView {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          //...
          presenter = (MvpPresenter) getLastCustomNonConfigurationInstance();
  
          if(null == presenter){
              presenter = new Presenter(getApplicationContext());
          }
  
          presenter.attachView(this);
      }
  
      @Override
      public Object onRetainCustomNonConfigurationInstance() {
          return presenter;
      }
  
      //...
  }
  </code></pre>
  
  <p><strong>So how to use Shared Preferences in MVP without Dagger and not causing Presenter to be Context dependent?</strong></p>