Use override functions

This commit is contained in:
topjohnwu 2017-09-30 03:25:50 +08:00
parent c92f30b122
commit 566714a75d
2 changed files with 15 additions and 9 deletions

View File

@ -1,6 +1,7 @@
package com.topjohnwu.magisk.container;
import android.content.ContentValues;
import android.database.Cursor;
import android.support.annotation.NonNull;
@ -25,7 +26,19 @@ public abstract class BaseModule implements Comparable<BaseModule> {
templateVersion = c.getInt(c.getColumnIndex("template"));
}
protected void parseProps(List<String> props) throws CacheModException { parseProps(props.toArray(new String[props.size()])); }
public ContentValues getContentValues() {
ContentValues values = new ContentValues();
values.put("id", mId);
values.put("name", mName);
values.put("version", mVersion);
values.put("versionCode", mVersionCode);
values.put("author", mAuthor);
values.put("description", mDescription);
values.put("template", templateVersion);
return values;
}
protected void parseProps(List<String> props) throws CacheModException { parseProps(props.toArray(new String[0])); }
protected void parseProps(String[] props) throws CacheModException {
for (String line : props) {

View File

@ -45,16 +45,9 @@ public class Repo extends BaseModule {
}
public ContentValues getContentValues() {
ContentValues values = new ContentValues();
values.put("id", getId());
values.put("name", getName());
values.put("version", getVersion());
values.put("versionCode", getVersionCode());
values.put("author", getAuthor());
values.put("description", getDescription());
ContentValues values = super.getContentValues();
values.put("repo_name", repoName);
values.put("last_update", mLastUpdate.getTime());
values.put("template", getTemplateVersion());
return values;
}