Skip to content

Commit

Permalink
Merge pull request #5176 from Isira-Seneviratne/Use_ContextCompat_get…
Browse files Browse the repository at this point in the history
…DataDir

Use ContextCompat.getDataDir().
  • Loading branch information
Stypox authored Dec 15, 2020
2 parents 79189dc + 30613b7 commit 480348f
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.preference.Preference;
import androidx.preference.PreferenceManager;

Expand Down Expand Up @@ -120,15 +121,14 @@ public boolean onPreferenceTreeClick(final Preference preference) {

@Override
public void onCreatePreferences(final Bundle savedInstanceState, final String rootKey) {

final String homeDir = getActivity().getApplicationInfo().dataDir;
databasesDir = new File(homeDir + "/databases");
newpipeDb = new File(homeDir + "/databases/newpipe.db");
newpipeDbJournal = new File(homeDir + "/databases/newpipe.db-journal");
newpipeDbShm = new File(homeDir + "/databases/newpipe.db-shm");
newpipeDbWal = new File(homeDir + "/databases/newpipe.db-wal");

newpipeSettings = new File(homeDir + "/databases/newpipe.settings");
final File homeDir = ContextCompat.getDataDir(requireContext());
databasesDir = new File(homeDir, "/databases");
newpipeDb = new File(homeDir, "/databases/newpipe.db");
newpipeDbJournal = new File(homeDir, "/databases/newpipe.db-journal");
newpipeDbShm = new File(homeDir, "/databases/newpipe.db-shm");
newpipeDbWal = new File(homeDir, "/databases/newpipe.db-wal");

newpipeSettings = new File(homeDir, "/databases/newpipe.settings");
newpipeSettings.delete();

addPreferencesFromResource(R.xml.content_settings);
Expand Down

0 comments on commit 480348f

Please sign in to comment.