rename Apk.repo to match App.repoId and Repo.id

Somehow, the Apk class has its Repo ID variable confusingly named just
"repo", which throughout the code is used to represent an instance of
Repo.
This commit is contained in:
Hans-Christoph Steiner 2017-03-21 12:14:47 +01:00 committed by Peter Serwylo
parent 6f58c2a13d
commit f86b65e12a
9 changed files with 15 additions and 15 deletions

View File

@ -228,7 +228,7 @@ public class AppDetails extends AppCompatActivity {
holder.status.setText(getInstalledStatus(apk)); holder.status.setText(getInstalledStatus(apk));
holder.repository.setText(getString(R.string.repo_provider, holder.repository.setText(getString(R.string.repo_provider,
RepoProvider.Helper.findById(getContext(), apk.repo).getName())); RepoProvider.Helper.findById(getContext(), apk.repoId).getName()));
if (apk.size > 0) { if (apk.size > 0) {
holder.size.setText(Utils.getFriendlySize(apk.size)); holder.size.setText(Utils.getFriendlySize(apk.size));

View File

@ -218,7 +218,7 @@ public final class AppUpdateStatusManager {
private AppUpdateStatus createAppEntry(Apk apk, Status status, PendingIntent intent) { private AppUpdateStatus createAppEntry(Apk apk, Status status, PendingIntent intent) {
synchronized (appMapping) { synchronized (appMapping) {
ContentResolver resolver = context.getContentResolver(); ContentResolver resolver = context.getContentResolver();
App app = AppProvider.Helper.findSpecificApp(resolver, apk.packageName, apk.repo); App app = AppProvider.Helper.findSpecificApp(resolver, apk.packageName, apk.repoId);
AppUpdateStatus ret = new AppUpdateStatus(app, apk, status, intent); AppUpdateStatus ret = new AppUpdateStatus(app, apk, status, intent);
appMapping.put(apk.getUrl(), ret); appMapping.put(apk.getUrl(), ret);
return ret; return ret;

View File

@ -359,7 +359,7 @@ public class RepoXMLHandler extends DefaultHandler {
} else if ("package".equals(localName) && curapp != null && curapk == null) { } else if ("package".equals(localName) && curapp != null && curapk == null) {
curapk = new Apk(); curapk = new Apk();
curapk.packageName = curapp.packageName; curapk.packageName = curapp.packageName;
curapk.repo = repo.getId(); curapk.repoId = repo.getId();
currentApkHashType = null; currentApkHashType = null;
} else if ("hash".equals(localName) && curapk != null) { } else if ("hash".equals(localName) && curapk != null) {

View File

@ -57,7 +57,7 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
public boolean compatible; // True if compatible with the device. public boolean compatible; // True if compatible with the device.
@JacksonInject @JacksonInject
public long repo; // ID of the repo it comes from public long repoId; // ID of the repo it comes from
// these come directly from the index metadata // these come directly from the index metadata
public String packageName; public String packageName;
@ -154,7 +154,7 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
// If we are being created from an InstalledApp, it is because we couldn't load it from the // If we are being created from an InstalledApp, it is because we couldn't load it from the
// apk table in the database, indicating it is not available in any of our repos. // apk table in the database, indicating it is not available in any of our repos.
repo = 0; repoId = 0;
} }
public Apk(Cursor cursor) { public Apk(Cursor cursor) {
@ -218,7 +218,7 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
incompatibleReasons = Utils.parseCommaSeparatedString(cursor.getString(i)); incompatibleReasons = Utils.parseCommaSeparatedString(cursor.getString(i));
break; break;
case Cols.REPO_ID: case Cols.REPO_ID:
repo = cursor.getInt(i); repoId = cursor.getInt(i);
break; break;
case Cols.SIGNATURE: case Cols.SIGNATURE:
sig = cursor.getString(i); sig = cursor.getString(i);
@ -333,7 +333,7 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
values.put(Cols.APP_ID, appId); values.put(Cols.APP_ID, appId);
values.put(Cols.VERSION_NAME, versionName); values.put(Cols.VERSION_NAME, versionName);
values.put(Cols.VERSION_CODE, versionCode); values.put(Cols.VERSION_CODE, versionCode);
values.put(Cols.REPO_ID, repo); values.put(Cols.REPO_ID, repoId);
values.put(Cols.HASH, hash); values.put(Cols.HASH, hash);
values.put(Cols.HASH_TYPE, hashType); values.put(Cols.HASH_TYPE, hashType);
values.put(Cols.SIGNATURE, sig); values.put(Cols.SIGNATURE, sig);
@ -377,7 +377,7 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
dest.writeString(this.versionName); dest.writeString(this.versionName);
dest.writeInt(this.versionCode); dest.writeInt(this.versionCode);
dest.writeInt(this.size); dest.writeInt(this.size);
dest.writeLong(this.repo); dest.writeLong(this.repoId);
dest.writeString(this.hash); dest.writeString(this.hash);
dest.writeString(this.hashType); dest.writeString(this.hashType);
dest.writeInt(this.minSdkVersion); dest.writeInt(this.minSdkVersion);
@ -408,7 +408,7 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
this.versionName = in.readString(); this.versionName = in.readString();
this.versionCode = in.readInt(); this.versionCode = in.readInt();
this.size = in.readInt(); this.size = in.readInt();
this.repo = in.readLong(); this.repoId = in.readLong();
this.hash = in.readString(); this.hash = in.readString();
this.hashType = in.readString(); this.hashType = in.readString();
this.minSdkVersion = in.readInt(); this.minSdkVersion = in.readInt();

View File

@ -185,7 +185,7 @@ public class RepoPersister {
for (Apk apk : packages) { for (Apk apk : packages) {
boolean exists = false; boolean exists = false;
for (Apk existing : existingApks) { for (Apk existing : existingApks) {
if (existing.repo == apk.repo && existing.packageName.equals(apk.packageName) && existing.versionCode == apk.versionCode) { if (existing.repoId == apk.repoId && existing.packageName.equals(apk.packageName) && existing.versionCode == apk.versionCode) {
exists = true; exists = true;
break; break;
} }

View File

@ -191,7 +191,7 @@ public class InstallConfirmActivity extends FragmentActivity implements OnCancel
intent = getIntent(); intent = getIntent();
Uri uri = intent.getData(); Uri uri = intent.getData();
Apk apk = ApkProvider.Helper.findByUri(this, uri, Schema.ApkTable.Cols.ALL); Apk apk = ApkProvider.Helper.findByUri(this, uri, Schema.ApkTable.Cols.ALL);
app = AppProvider.Helper.findSpecificApp(getContentResolver(), apk.packageName, apk.repo, Schema.AppMetadataTable.Cols.ALL); app = AppProvider.Helper.findSpecificApp(getContentResolver(), apk.packageName, apk.repoId, Schema.AppMetadataTable.Cols.ALL);
appDiff = new AppDiff(getPackageManager(), apk); appDiff = new AppDiff(getPackageManager(), apk);

View File

@ -805,7 +805,7 @@ public class AppDetailsRecyclerViewAdapter
status.setText(getInstalledStatus(apk)); status.setText(getInstalledStatus(apk));
repository.setText(context.getString(R.string.repo_provider, repository.setText(context.getString(R.string.repo_provider,
RepoProvider.Helper.findById(context, apk.repo).getName())); RepoProvider.Helper.findById(context, apk.repoId).getName()));
if (apk.size > 0) { if (apk.size > 0) {
size.setText(Utils.getFriendlySize(apk.size)); size.setText(Utils.getFriendlySize(apk.size));

View File

@ -235,7 +235,7 @@ public class ApkProviderTest extends FDroidProviderTest {
assertEquals("Some features", apk.features[0]); assertEquals("Some features", apk.features[0]);
assertEquals("com.example.com", apk.packageName); assertEquals("com.example.com", apk.packageName);
assertEquals(1, apk.versionCode); assertEquals(1, apk.versionCode);
assertEquals(10, apk.repo); assertEquals(10, apk.repoId);
} }
@Test @Test
@ -481,7 +481,7 @@ public class ApkProviderTest extends FDroidProviderTest {
protected void assertBelongsToRepo(Cursor apkCursor, long repoId) { protected void assertBelongsToRepo(Cursor apkCursor, long repoId) {
for (Apk apk : ApkProvider.Helper.cursorToList(apkCursor)) { for (Apk apk : ApkProvider.Helper.cursorToList(apkCursor)) {
assertEquals(repoId, apk.repo); assertEquals(repoId, apk.repoId);
} }
} }

View File

@ -261,7 +261,7 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
"obbPatchFile", "obbPatchFile",
"obbPatchFileSha256", "obbPatchFileSha256",
"packageName", "packageName",
"repo", "repoId",
"requestedPermissions", "requestedPermissions",
"sig", "sig",
"size", "size",