File tree 4 files changed +9
-4
lines changed
app/src/main/java/io/mvpstarter/sample
4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 7
7
import javax .inject .Singleton ;
8
8
9
9
@ Singleton
10
- public class PreferencesHelper {
10
+ public class PrefHelper {
11
11
12
12
private static final String PREF_FILE_NAME = "mvpstarter_pref_file" ;
13
13
14
14
private final SharedPreferences preferences ;
15
15
16
16
@ Inject
17
- PreferencesHelper (SharedPreferences sharedPreferences ) {
17
+ PrefHelper (SharedPreferences sharedPreferences ) {
18
18
preferences = sharedPreferences ;
19
19
}
20
20
Original file line number Diff line number Diff line change 7
7
8
8
import dagger .Component ;
9
9
import io .mvpstarter .sample .data .DataManager ;
10
+ import io .mvpstarter .sample .data .local .PrefHelper ;
10
11
import io .mvpstarter .sample .injection .ApplicationContext ;
11
12
import io .mvpstarter .sample .injection .module .AppModule ;
12
13
@@ -20,4 +21,6 @@ public interface AppComponent {
20
21
Application application ();
21
22
22
23
DataManager apiManager ();
24
+
25
+ PrefHelper prefHelper ();
23
26
}
Original file line number Diff line number Diff line change 4
4
import android .content .Context ;
5
5
import android .content .SharedPreferences ;
6
6
7
+ import javax .inject .Singleton ;
8
+
7
9
import dagger .Module ;
8
10
import dagger .Provides ;
9
11
import io .mvpstarter .sample .injection .ApplicationContext ;
@@ -30,7 +32,7 @@ Context provideContext() {
30
32
}
31
33
32
34
@ Provides
33
- @ ApplicationContext
35
+ @ Singleton
34
36
SharedPreferences provideSharedPreference (@ ApplicationContext Context context ) {
35
37
return context .getSharedPreferences (PREF_FILE_NAME , Context .MODE_PRIVATE );
36
38
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ buildscript {
6
6
maven { url ' https://maven.fabric.io/public' }
7
7
}
8
8
dependencies {
9
- classpath ' com.android.tools.build:gradle:3.0.0-beta2 '
9
+ classpath ' com.android.tools.build:gradle:3.0.0-beta5 '
10
10
// noinspection GradleDynamicVersion
11
11
classpath ' io.fabric.tools:gradle:1.+'
12
12
classpath ' com.google.gms:google-services:3.1.0'
You can’t perform that action at this time.
0 commit comments