|
2 | 2 |
|
3 | 3 | import android.content.SharedPreferences; |
4 | 4 |
|
| 5 | +import com.fox2code.mmm.BuildConfig; |
5 | 6 | import com.fox2code.mmm.MainApplication; |
6 | 7 | import com.fox2code.mmm.R; |
7 | 8 | import com.fox2code.mmm.manager.ModuleInfo; |
@@ -42,7 +43,7 @@ protected RepoData(String url, File cacheRoot, SharedPreferences cachedPreferenc |
42 | 43 | this.moduleHashMap = new HashMap<>(); |
43 | 44 | this.name = this.url; // Set url as default name |
44 | 45 | this.enabled = MainApplication.getSharedPreferences() |
45 | | - .getBoolean("pref_" + this.id + "_enabled", true); |
| 46 | + .getBoolean("pref_" + this.id + "_enabled", this.isEnabledByDefault(this.id)); |
46 | 47 | if (!this.cacheRoot.isDirectory()) { |
47 | 48 | this.cacheRoot.mkdirs(); |
48 | 49 | } else { |
@@ -134,6 +135,10 @@ protected List<RepoModule> populate(JSONObject jsonObject) throws JSONException |
134 | 135 | return newModules; |
135 | 136 | } |
136 | 137 |
|
| 138 | + protected boolean isEnabledByDefault(String id) { |
| 139 | + return !BuildConfig.DISABLED_REPOS.contains(id); |
| 140 | + } |
| 141 | + |
137 | 142 | public void storeMetadata(RepoModule repoModule,byte[] data) throws IOException { |
138 | 143 | Files.write(new File(this.cacheRoot, repoModule.id + ".prop"), data); |
139 | 144 | } |
@@ -176,6 +181,6 @@ public void setEnabled(boolean enabled) { |
176 | 181 |
|
177 | 182 | public void updateEnabledState() { |
178 | 183 | this.enabled = MainApplication.getSharedPreferences() |
179 | | - .getBoolean("pref_" + this.id + "_enabled", true); |
| 184 | + .getBoolean("pref_" + this.id + "_enabled", this.isEnabledByDefault(this.id)); |
180 | 185 | } |
181 | 186 | } |
0 commit comments