55import com .fox2code .mmm .BuildConfig ;
66import com .fox2code .mmm .MainApplication ;
77import com .fox2code .mmm .R ;
8+ import com .fox2code .mmm .XRepo ;
89import com .fox2code .mmm .manager .ModuleInfo ;
910import com .fox2code .mmm .utils .Files ;
1011import com .fox2code .mmm .utils .PropUtils ;
2122import java .util .Iterator ;
2223import java .util .List ;
2324
24- public class RepoData {
25+ public class RepoData extends XRepo {
2526 private static final String TAG = "RepoData" ;
2627 private final Object populateLock = new Object ();
2728 public final String url ;
@@ -43,7 +44,7 @@ protected RepoData(String url, File cacheRoot, SharedPreferences cachedPreferenc
4344 this .moduleHashMap = new HashMap <>();
4445 this .name = this .url ; // Set url as default name
4546 this .enabled = MainApplication .getSharedPreferences ()
46- .getBoolean ("pref_" + this .id + "_enabled" , this .isEnabledByDefault (this . id ));
47+ .getBoolean ("pref_" + this .id + "_enabled" , this .isEnabledByDefault ());
4748 if (!this .cacheRoot .isDirectory ()) {
4849 this .cacheRoot .mkdirs ();
4950 } else {
@@ -136,8 +137,9 @@ protected List<RepoModule> populate(JSONObject jsonObject) throws JSONException
136137 return newModules ;
137138 }
138139
139- protected boolean isEnabledByDefault (String id ) {
140- return !BuildConfig .DISABLED_REPOS .contains (id );
140+ @ Override
141+ public boolean isEnabledByDefault () {
142+ return !BuildConfig .DISABLED_REPOS .contains (this .id );
141143 }
142144
143145 public void storeMetadata (RepoModule repoModule ,byte [] data ) throws IOException {
@@ -170,10 +172,12 @@ public String getNameOrFallback(String fallback) {
170172 fallback : this .name ;
171173 }
172174
175+ @ Override
173176 public boolean isEnabled () {
174177 return this .enabled ;
175178 }
176179
180+ @ Override
177181 public void setEnabled (boolean enabled ) {
178182 this .enabled = enabled ;
179183 MainApplication .getSharedPreferences ().edit ()
@@ -182,6 +186,6 @@ public void setEnabled(boolean enabled) {
182186
183187 public void updateEnabledState () {
184188 this .enabled = MainApplication .getSharedPreferences ()
185- .getBoolean ("pref_" + this .id + "_enabled" , this .isEnabledByDefault (this . id ));
189+ .getBoolean ("pref_" + this .id + "_enabled" , this .isEnabledByDefault ());
186190 }
187191}
0 commit comments