Removed app context for PreferenceUtil class

This commit is contained in:
h4h13 2019-09-09 18:34:53 +05:30
parent 5df5f6c93e
commit 2bbe39eab7
97 changed files with 397 additions and 456 deletions

View file

@ -47,13 +47,13 @@ public class BlacklistStore extends SQLiteOpenHelper {
public static synchronized BlacklistStore getInstance(@NonNull final Context context) {
if (sInstance == null) {
sInstance = new BlacklistStore(context.getApplicationContext());
if (!PreferenceUtil.getInstance().initializedBlacklist()) {
if (!PreferenceUtil.getInstance(context).initializedBlacklist()) {
// blacklisted by default
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_ALARMS));
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_NOTIFICATIONS));
sInstance.addPathImpl(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_RINGTONES));
PreferenceUtil.getInstance().setInitializedBlacklist();
PreferenceUtil.getInstance(context).setInitializedBlacklist();
}
}
return sInstance;

View file

@ -26,6 +26,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
class RepositoryImpl(private val context: Context) : Repository {
override fun artistInfoFloable(
name: String,
lang: String?,
@ -188,17 +189,4 @@ class RepositoryImpl(private val context: Context) : Repository {
return GenreLoader.getSongs(context, genreId)
}
companion object {
private var INSTANCE: RepositoryImpl? = null
val instance: RepositoryImpl
@Synchronized get() {
if (INSTANCE == null) {
INSTANCE = RepositoryImpl(App.instance)
}
return INSTANCE!!
}
}
}