rename App instance vars to match fdroidserver field names

This makes the name of the instance variables in the App class match the
names of the metadata fields in the new fdroidserver .yml YAML format. This
means that the Jackson parser can automatically instantiate instances for
us, which will be more efficient and maintainable.

These names aren't great, but it would a ton of work to rename the field
names in all of the metadata files, the docs, fdroidserver code, etc.
This commit is contained in:
Hans-Christoph Steiner 2016-11-25 23:36:37 +01:00
parent 199ab44ec3
commit 611fd6e5e3
7 changed files with 142 additions and 142 deletions

View File

@ -1163,23 +1163,23 @@ public class AppDetails extends AppCompatActivity {
App app = appDetails.getApp(); App app = appDetails.getApp();
switch (v.getId()) { switch (v.getId()) {
case R.id.website: case R.id.website:
url = app.webURL; url = app.webSite;
break; break;
case R.id.email: case R.id.email:
final String subject = Uri.encode(getString(R.string.app_details_subject, app.name)); final String subject = Uri.encode(getString(R.string.app_details_subject, app.name));
url = "mailto:" + app.email + "?subject=" + subject; url = "mailto:" + app.authorEmail + "?subject=" + subject;
break; break;
case R.id.source: case R.id.source:
url = app.sourceURL; url = app.sourceCode;
break; break;
case R.id.issues: case R.id.issues:
url = app.trackerURL; url = app.issueTracker;
break; break;
case R.id.changelog: case R.id.changelog:
url = app.changelogURL; url = app.changelog;
break; break;
case R.id.donate: case R.id.donate:
url = app.donateURL; url = app.donate;
break; break;
case R.id.bitcoin: case R.id.bitcoin:
url = app.getBitcoinUri(); url = app.getBitcoinUri();
@ -1267,7 +1267,7 @@ public class AppDetails extends AppCompatActivity {
// Website button // Website button
View tv = view.findViewById(R.id.website); View tv = view.findViewById(R.id.website);
if (!TextUtils.isEmpty(app.webURL)) { if (!TextUtils.isEmpty(app.webSite)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1275,7 +1275,7 @@ public class AppDetails extends AppCompatActivity {
// Email button // Email button
tv = view.findViewById(R.id.email); tv = view.findViewById(R.id.email);
if (!TextUtils.isEmpty(app.email)) { if (!TextUtils.isEmpty(app.authorEmail)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1283,7 +1283,7 @@ public class AppDetails extends AppCompatActivity {
// Source button // Source button
tv = view.findViewById(R.id.source); tv = view.findViewById(R.id.source);
if (!TextUtils.isEmpty(app.sourceURL)) { if (!TextUtils.isEmpty(app.sourceCode)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1291,7 +1291,7 @@ public class AppDetails extends AppCompatActivity {
// Issues button // Issues button
tv = view.findViewById(R.id.issues); tv = view.findViewById(R.id.issues);
if (!TextUtils.isEmpty(app.trackerURL)) { if (!TextUtils.isEmpty(app.issueTracker)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1299,7 +1299,7 @@ public class AppDetails extends AppCompatActivity {
// Changelog button // Changelog button
tv = view.findViewById(R.id.changelog); tv = view.findViewById(R.id.changelog);
if (!TextUtils.isEmpty(app.changelogURL)) { if (!TextUtils.isEmpty(app.changelog)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1307,7 +1307,7 @@ public class AppDetails extends AppCompatActivity {
// Donate button // Donate button
tv = view.findViewById(R.id.donate); tv = view.findViewById(R.id.donate);
if (!TextUtils.isEmpty(app.donateURL)) { if (!TextUtils.isEmpty(app.donate)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1315,7 +1315,7 @@ public class AppDetails extends AppCompatActivity {
// Bitcoin // Bitcoin
tv = view.findViewById(R.id.bitcoin); tv = view.findViewById(R.id.bitcoin);
if (!TextUtils.isEmpty(app.bitcoinAddr)) { if (!TextUtils.isEmpty(app.bitcoin)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1323,7 +1323,7 @@ public class AppDetails extends AppCompatActivity {
// Litecoin // Litecoin
tv = view.findViewById(R.id.litecoin); tv = view.findViewById(R.id.litecoin);
if (!TextUtils.isEmpty(app.litecoinAddr)) { if (!TextUtils.isEmpty(app.litecoin)) {
tv.setOnClickListener(onClickListener); tv.setOnClickListener(onClickListener);
} else { } else {
tv.setVisibility(View.GONE); tv.setVisibility(View.GONE);
@ -1642,8 +1642,8 @@ public class AppDetails extends AppCompatActivity {
btMain.setEnabled(true); btMain.setEnabled(true);
} }
TextView author = (TextView) view.findViewById(R.id.author); TextView author = (TextView) view.findViewById(R.id.author);
if (!TextUtils.isEmpty(app.author)) { if (!TextUtils.isEmpty(app.authorName)) {
author.setText(getString(R.string.by_author) + " " + app.author); author.setText(getString(R.string.by_author) + " " + app.authorName);
author.setVisibility(View.VISIBLE); author.setVisibility(View.VISIBLE);
} }
TextView currentVersion = (TextView) view.findViewById(R.id.current_version); TextView currentVersion = (TextView) view.findViewById(R.id.current_version);

View File

@ -205,34 +205,34 @@ public class RepoXMLHandler extends DefaultHandler {
curapp.license = str; curapp.license = str;
break; break;
case "author": case "author":
curapp.author = str; curapp.authorName = str;
break; break;
case "email": case "email":
curapp.email = str; curapp.authorEmail = str;
break; break;
case "source": case "source":
curapp.sourceURL = str; curapp.sourceCode = str;
break; break;
case "changelog": case "changelog":
curapp.changelogURL = str; curapp.changelog = str;
break; break;
case "donate": case "donate":
curapp.donateURL = str; curapp.donate = str;
break; break;
case "bitcoin": case "bitcoin":
curapp.bitcoinAddr = str; curapp.bitcoin = str;
break; break;
case "litecoin": case "litecoin":
curapp.litecoinAddr = str; curapp.litecoin = str;
break; break;
case "flattr": case "flattr":
curapp.flattrID = str; curapp.flattrID = str;
break; break;
case "web": case "web":
curapp.webURL = str; curapp.webSite = str;
break; break;
case "tracker": case "tracker":
curapp.trackerURL = str; curapp.issueTracker = str;
break; break;
case "added": case "added":
curapp.added = Utils.parseDate(str, null); curapp.added = Utils.parseDate(str, null);

View File

@ -65,22 +65,22 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
public String license = "Unknown"; public String license = "Unknown";
public String author; public String authorName;
public String email; public String authorEmail;
public String webURL; public String webSite;
public String trackerURL; public String issueTracker;
public String sourceURL; public String sourceCode;
public String changelogURL; public String changelog;
public String donateURL; public String donate;
public String bitcoinAddr; public String bitcoin;
public String litecoinAddr; public String litecoin;
public String flattrID; public String flattrID;
@ -186,32 +186,32 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
case Cols.LICENSE: case Cols.LICENSE:
license = cursor.getString(i); license = cursor.getString(i);
break; break;
case Cols.AUTHOR: case Cols.AUTHOR_NAME:
author = cursor.getString(i); authorName = cursor.getString(i);
break; break;
case Cols.EMAIL: case Cols.AUTHOR_EMAIL:
email = cursor.getString(i); authorEmail = cursor.getString(i);
break; break;
case Cols.WEB_URL: case Cols.WEBSITE:
webURL = cursor.getString(i); webSite = cursor.getString(i);
break; break;
case Cols.TRACKER_URL: case Cols.ISSUE_TRACKER:
trackerURL = cursor.getString(i); issueTracker = cursor.getString(i);
break; break;
case Cols.SOURCE_URL: case Cols.SOURCE_CODE:
sourceURL = cursor.getString(i); sourceCode = cursor.getString(i);
break; break;
case Cols.CHANGELOG_URL: case Cols.CHANGELOG:
changelogURL = cursor.getString(i); changelog = cursor.getString(i);
break; break;
case Cols.DONATE_URL: case Cols.DONATE:
donateURL = cursor.getString(i); donate = cursor.getString(i);
break; break;
case Cols.BITCOIN_ADDR: case Cols.BITCOIN:
bitcoinAddr = cursor.getString(i); bitcoin = cursor.getString(i);
break; break;
case Cols.LITECOIN_ADDR: case Cols.LITECOIN:
litecoinAddr = cursor.getString(i); litecoin = cursor.getString(i);
break; break;
case Cols.FLATTR_ID: case Cols.FLATTR_ID:
flattrID = cursor.getString(i); flattrID = cursor.getString(i);
@ -490,15 +490,15 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
values.put(Cols.ICON_URL_LARGE, iconUrlLarge); values.put(Cols.ICON_URL_LARGE, iconUrlLarge);
values.put(Cols.DESCRIPTION, description); values.put(Cols.DESCRIPTION, description);
values.put(Cols.LICENSE, license); values.put(Cols.LICENSE, license);
values.put(Cols.AUTHOR, author); values.put(Cols.AUTHOR_NAME, authorName);
values.put(Cols.EMAIL, email); values.put(Cols.AUTHOR_EMAIL, authorEmail);
values.put(Cols.WEB_URL, webURL); values.put(Cols.WEBSITE, webSite);
values.put(Cols.TRACKER_URL, trackerURL); values.put(Cols.ISSUE_TRACKER, issueTracker);
values.put(Cols.SOURCE_URL, sourceURL); values.put(Cols.SOURCE_CODE, sourceCode);
values.put(Cols.CHANGELOG_URL, changelogURL); values.put(Cols.CHANGELOG, changelog);
values.put(Cols.DONATE_URL, donateURL); values.put(Cols.DONATE, donate);
values.put(Cols.BITCOIN_ADDR, bitcoinAddr); values.put(Cols.BITCOIN, bitcoin);
values.put(Cols.LITECOIN_ADDR, litecoinAddr); values.put(Cols.LITECOIN, litecoin);
values.put(Cols.FLATTR_ID, flattrID); values.put(Cols.FLATTR_ID, flattrID);
values.put(Cols.ADDED, Utils.formatDate(added, "")); values.put(Cols.ADDED, Utils.formatDate(added, ""));
values.put(Cols.LAST_UPDATED, Utils.formatDate(lastUpdated, "")); values.put(Cols.LAST_UPDATED, Utils.formatDate(lastUpdated, ""));
@ -556,12 +556,12 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
@Nullable @Nullable
public String getBitcoinUri() { public String getBitcoinUri() {
return TextUtils.isEmpty(bitcoinAddr) ? null : "bitcoin:" + bitcoinAddr; return TextUtils.isEmpty(bitcoin) ? null : "bitcoin:" + bitcoin;
} }
@Nullable @Nullable
public String getLitecoinUri() { public String getLitecoinUri() {
return TextUtils.isEmpty(litecoinAddr) ? null : "litecoin:" + litecoinAddr; return TextUtils.isEmpty(bitcoin) ? null : "litecoin:" + bitcoin;
} }
@Nullable @Nullable
@ -632,15 +632,15 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
dest.writeString(this.icon); dest.writeString(this.icon);
dest.writeString(this.description); dest.writeString(this.description);
dest.writeString(this.license); dest.writeString(this.license);
dest.writeString(this.author); dest.writeString(this.authorName);
dest.writeString(this.email); dest.writeString(this.authorEmail);
dest.writeString(this.webURL); dest.writeString(this.webSite);
dest.writeString(this.trackerURL); dest.writeString(this.issueTracker);
dest.writeString(this.sourceURL); dest.writeString(this.sourceCode);
dest.writeString(this.changelogURL); dest.writeString(this.changelog);
dest.writeString(this.donateURL); dest.writeString(this.donate);
dest.writeString(this.bitcoinAddr); dest.writeString(this.bitcoin);
dest.writeString(this.litecoinAddr); dest.writeString(this.litecoin);
dest.writeString(this.flattrID); dest.writeString(this.flattrID);
dest.writeString(this.upstreamVersionName); dest.writeString(this.upstreamVersionName);
dest.writeInt(this.upstreamVersionCode); dest.writeInt(this.upstreamVersionCode);
@ -669,15 +669,15 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
this.icon = in.readString(); this.icon = in.readString();
this.description = in.readString(); this.description = in.readString();
this.license = in.readString(); this.license = in.readString();
this.author = in.readString(); this.authorName = in.readString();
this.email = in.readString(); this.authorEmail = in.readString();
this.webURL = in.readString(); this.webSite = in.readString();
this.trackerURL = in.readString(); this.issueTracker = in.readString();
this.sourceURL = in.readString(); this.sourceCode = in.readString();
this.changelogURL = in.readString(); this.changelog = in.readString();
this.donateURL = in.readString(); this.donate = in.readString();
this.bitcoinAddr = in.readString(); this.bitcoin = in.readString();
this.litecoinAddr = in.readString(); this.litecoin = in.readString();
this.flattrID = in.readString(); this.flattrID = in.readString();
this.upstreamVersionName = in.readString(); this.upstreamVersionName = in.readString();
this.upstreamVersionCode = in.readInt(); this.upstreamVersionCode = in.readInt();

View File

@ -116,19 +116,19 @@ class DBHelper extends SQLiteOpenHelper {
+ AppMetadataTable.Cols.ICON + " text, " + AppMetadataTable.Cols.ICON + " text, "
+ AppMetadataTable.Cols.DESCRIPTION + " text not null, " + AppMetadataTable.Cols.DESCRIPTION + " text not null, "
+ AppMetadataTable.Cols.LICENSE + " text not null, " + AppMetadataTable.Cols.LICENSE + " text not null, "
+ AppMetadataTable.Cols.AUTHOR + " text, " + AppMetadataTable.Cols.AUTHOR_NAME + " text, "
+ AppMetadataTable.Cols.EMAIL + " text, " + AppMetadataTable.Cols.AUTHOR_EMAIL + " text, "
+ AppMetadataTable.Cols.WEB_URL + " text, " + AppMetadataTable.Cols.WEBSITE + " text, "
+ AppMetadataTable.Cols.TRACKER_URL + " text, " + AppMetadataTable.Cols.ISSUE_TRACKER + " text, "
+ AppMetadataTable.Cols.SOURCE_URL + " text, " + AppMetadataTable.Cols.SOURCE_CODE + " text, "
+ AppMetadataTable.Cols.CHANGELOG_URL + " text, " + AppMetadataTable.Cols.CHANGELOG + " text, "
+ AppMetadataTable.Cols.SUGGESTED_VERSION_CODE + " text," + AppMetadataTable.Cols.SUGGESTED_VERSION_CODE + " text,"
+ AppMetadataTable.Cols.UPSTREAM_VERSION_NAME + " text," + AppMetadataTable.Cols.UPSTREAM_VERSION_NAME + " text,"
+ AppMetadataTable.Cols.UPSTREAM_VERSION_CODE + " integer," + AppMetadataTable.Cols.UPSTREAM_VERSION_CODE + " integer,"
+ AppMetadataTable.Cols.ANTI_FEATURES + " string," + AppMetadataTable.Cols.ANTI_FEATURES + " string,"
+ AppMetadataTable.Cols.DONATE_URL + " string," + AppMetadataTable.Cols.DONATE + " string,"
+ AppMetadataTable.Cols.BITCOIN_ADDR + " string," + AppMetadataTable.Cols.BITCOIN + " string,"
+ AppMetadataTable.Cols.LITECOIN_ADDR + " string," + AppMetadataTable.Cols.LITECOIN + " string,"
+ AppMetadataTable.Cols.FLATTR_ID + " string," + AppMetadataTable.Cols.FLATTR_ID + " string,"
+ AppMetadataTable.Cols.REQUIREMENTS + " string," + AppMetadataTable.Cols.REQUIREMENTS + " string,"
+ AppMetadataTable.Cols.ADDED + " string," + AppMetadataTable.Cols.ADDED + " string,"
@ -756,11 +756,11 @@ class DBHelper extends SQLiteOpenHelper {
} }
private void addChangelogToApp(SQLiteDatabase db, int oldVersion) { private void addChangelogToApp(SQLiteDatabase db, int oldVersion) {
if (oldVersion >= 48 || columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.CHANGELOG_URL)) { if (oldVersion >= 48 || columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.CHANGELOG)) {
return; return;
} }
Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.CHANGELOG_URL + " column to " + AppMetadataTable.NAME); Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.CHANGELOG + " column to " + AppMetadataTable.NAME);
db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.CHANGELOG_URL + " text"); db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.CHANGELOG + " text");
} }
private void addIconUrlLargeToApp(SQLiteDatabase db, int oldVersion) { private void addIconUrlLargeToApp(SQLiteDatabase db, int oldVersion) {
@ -809,13 +809,13 @@ class DBHelper extends SQLiteOpenHelper {
if (oldVersion >= 53) { if (oldVersion >= 53) {
return; return;
} }
if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.AUTHOR)) { if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.AUTHOR_NAME)) {
Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.AUTHOR + " column to " + AppMetadataTable.NAME); Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.AUTHOR_NAME + " column to " + AppMetadataTable.NAME);
db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.AUTHOR + " text"); db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.AUTHOR_NAME + " text");
} }
if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.EMAIL)) { if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.AUTHOR_EMAIL)) {
Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.EMAIL + " column to " + AppMetadataTable.NAME); Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.AUTHOR_EMAIL + " column to " + AppMetadataTable.NAME);
db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.EMAIL + " text"); db.execSQL("alter table " + AppMetadataTable.NAME + " add column " + AppMetadataTable.Cols.AUTHOR_EMAIL + " text");
} }
} }

View File

@ -124,15 +124,15 @@ public interface Schema {
String ICON = "icon"; String ICON = "icon";
String DESCRIPTION = "description"; String DESCRIPTION = "description";
String LICENSE = "license"; String LICENSE = "license";
String AUTHOR = "author"; String AUTHOR_NAME = "author";
String EMAIL = "email"; String AUTHOR_EMAIL = "email";
String WEB_URL = "webURL"; String WEBSITE = "webURL";
String TRACKER_URL = "trackerURL"; String ISSUE_TRACKER = "trackerURL";
String SOURCE_URL = "sourceURL"; String SOURCE_CODE = "sourceURL";
String CHANGELOG_URL = "changelogURL"; String CHANGELOG = "changelogURL";
String DONATE_URL = "donateURL"; String DONATE = "donateURL";
String BITCOIN_ADDR = "bitcoinAddr"; String BITCOIN = "bitcoinAddr";
String LITECOIN_ADDR = "litecoinAddr"; String LITECOIN = "litecoinAddr";
String FLATTR_ID = "flattrID"; String FLATTR_ID = "flattrID";
String SUGGESTED_VERSION_CODE = "suggestedVercode"; String SUGGESTED_VERSION_CODE = "suggestedVercode";
String UPSTREAM_VERSION_NAME = "upstreamVersion"; String UPSTREAM_VERSION_NAME = "upstreamVersion";
@ -176,8 +176,8 @@ public interface Schema {
*/ */
String[] ALL_COLS = { String[] ALL_COLS = {
ROW_ID, PACKAGE_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION, ROW_ID, PACKAGE_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
LICENSE, AUTHOR, EMAIL, WEB_URL, TRACKER_URL, SOURCE_URL, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
CHANGELOG_URL, DONATE_URL, BITCOIN_ADDR, LITECOIN_ADDR, FLATTR_ID, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID,
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED, UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE, ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE,
SUGGESTED_VERSION_CODE, SUGGESTED_VERSION_CODE,
@ -190,8 +190,8 @@ public interface Schema {
*/ */
String[] ALL = { String[] ALL = {
_ID, ROW_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION, _ID, ROW_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
LICENSE, AUTHOR, EMAIL, WEB_URL, TRACKER_URL, SOURCE_URL, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
CHANGELOG_URL, DONATE_URL, BITCOIN_ADDR, LITECOIN_ADDR, FLATTR_ID, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID,
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED, UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE, ANTI_FEATURES, REQUIREMENTS, ICON_URL, ICON_URL_LARGE,
SUGGESTED_VERSION_CODE, SuggestedApk.VERSION_NAME, SUGGESTED_VERSION_CODE, SuggestedApk.VERSION_NAME,

View File

@ -176,7 +176,7 @@ public class AppDetailsRecyclerViewAdapter
} }
private boolean shouldShowDonate() { private boolean shouldShowDonate() {
return uriIsSetAndCanBeOpened(app.donateURL) || return uriIsSetAndCanBeOpened(app.donate) ||
uriIsSetAndCanBeOpened(app.getBitcoinUri()) || uriIsSetAndCanBeOpened(app.getBitcoinUri()) ||
uriIsSetAndCanBeOpened(app.getLitecoinUri()) || uriIsSetAndCanBeOpened(app.getLitecoinUri()) ||
uriIsSetAndCanBeOpened(app.getFlattrUri()); uriIsSetAndCanBeOpened(app.getFlattrUri());
@ -382,8 +382,8 @@ public class AppDetailsRecyclerViewAdapter
public void bindModel() { public void bindModel() {
ImageLoader.getInstance().displayImage(app.iconUrlLarge, iconView, displayImageOptions); ImageLoader.getInstance().displayImage(app.iconUrlLarge, iconView, displayImageOptions);
titleView.setText(app.name); titleView.setText(app.name);
if (!TextUtils.isEmpty(app.author)) { if (!TextUtils.isEmpty(app.authorName)) {
authorView.setText(context.getString(R.string.by_author) + " " + app.author); authorView.setText(context.getString(R.string.by_author) + " " + app.authorName);
authorView.setVisibility(View.VISIBLE); authorView.setVisibility(View.VISIBLE);
} else { } else {
authorView.setVisibility(View.GONE); authorView.setVisibility(View.GONE);
@ -523,18 +523,18 @@ public class AppDetailsRecyclerViewAdapter
} }
public void bindModel() { public void bindModel() {
if (TextUtils.isEmpty(app.author)) { if (TextUtils.isEmpty(app.authorName)) {
donateHeading.setText(context.getString(R.string.app_details_donate_prompt_unknown_author, app.name)); donateHeading.setText(context.getString(R.string.app_details_donate_prompt_unknown_author, app.name));
} else { } else {
String author = "<strong>" + app.author + "</strong>"; String author = "<strong>" + app.authorName + "</strong>";
donateHeading.setText(Html.fromHtml(context.getString(R.string.app_details_donate_prompt, app.name, author))); donateHeading.setText(Html.fromHtml(context.getString(R.string.app_details_donate_prompt, app.name, author)));
} }
donationOptionsLayout.removeAllViews(); donationOptionsLayout.removeAllViews();
// Donate button // Donate button
if (uriIsSetAndCanBeOpened(app.donateURL)) { if (uriIsSetAndCanBeOpened(app.donate)) {
addDonateOption(R.layout.donate_generic, app.donateURL); addDonateOption(R.layout.donate_generic, app.donate);
} }
// Bitcoin // Bitcoin
@ -639,28 +639,28 @@ public class AppDetailsRecyclerViewAdapter
contentView.removeAllViews(); contentView.removeAllViews();
// Source button // Source button
if (uriIsSetAndCanBeOpened(app.sourceURL)) { if (uriIsSetAndCanBeOpened(app.sourceCode)) {
addLinkItemView(contentView, R.string.menu_source, R.drawable.ic_source_code, app.sourceURL); addLinkItemView(contentView, R.string.menu_source, R.drawable.ic_source_code, app.sourceCode);
} }
// Issues button // Issues button
if (uriIsSetAndCanBeOpened(app.trackerURL)) { if (uriIsSetAndCanBeOpened(app.issueTracker)) {
addLinkItemView(contentView, R.string.menu_issues, R.drawable.ic_issues, app.trackerURL); addLinkItemView(contentView, R.string.menu_issues, R.drawable.ic_issues, app.issueTracker);
} }
// Changelog button // Changelog button
if (uriIsSetAndCanBeOpened(app.changelogURL)) { if (uriIsSetAndCanBeOpened(app.changelog)) {
addLinkItemView(contentView, R.string.menu_changelog, R.drawable.ic_changelog, app.changelogURL); addLinkItemView(contentView, R.string.menu_changelog, R.drawable.ic_changelog, app.changelog);
} }
// Website button // Website button
if (uriIsSetAndCanBeOpened(app.webURL)) { if (uriIsSetAndCanBeOpened(app.webSite)) {
addLinkItemView(contentView, R.string.menu_website, R.drawable.ic_website, app.webURL); addLinkItemView(contentView, R.string.menu_website, R.drawable.ic_website, app.webSite);
} }
// Email button // Email button
final String subject = Uri.encode(context.getString(R.string.app_details_subject, app.name)); final String subject = Uri.encode(context.getString(R.string.app_details_subject, app.name));
String emailUrl = app.email == null ? null : ("mailto:" + app.email + "?subject=" + subject); String emailUrl = app.authorEmail == null ? null : ("mailto:" + app.authorEmail + "?subject=" + subject);
if (uriIsSetAndCanBeOpened(emailUrl)) { if (uriIsSetAndCanBeOpened(emailUrl)) {
addLinkItemView(contentView, R.string.menu_email, R.drawable.ic_email, emailUrl); addLinkItemView(contentView, R.string.menu_email, R.drawable.ic_email, emailUrl);
} }

View File

@ -274,9 +274,9 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
assertEquals("2048", a2048.name); assertEquals("2048", a2048.name);
assertEquals(String.format("<p>2048 from %s repo.</p>", id), a2048.description); assertEquals(String.format("<p>2048 from %s repo.</p>", id), a2048.description);
assertEquals(String.format("Puzzle game (%s)", id), a2048.summary); assertEquals(String.format("Puzzle game (%s)", id), a2048.summary);
assertEquals(String.format("https://github.com/uberspot/2048-android?%s", id), a2048.webURL); assertEquals(String.format("https://github.com/uberspot/2048-android?%s", id), a2048.webSite);
assertEquals(String.format("https://github.com/uberspot/2048-android?code&%s", id), a2048.sourceURL); assertEquals(String.format("https://github.com/uberspot/2048-android?code&%s", id), a2048.sourceCode);
assertEquals(String.format("https://github.com/uberspot/2048-android/issues?%s", id), a2048.trackerURL); assertEquals(String.format("https://github.com/uberspot/2048-android/issues?%s", id), a2048.issueTracker);
} }
private void assertAdAwayMetadata(Repo repo, @RepoIdentifier String id) { private void assertAdAwayMetadata(Repo repo, @RepoIdentifier String id) {
@ -290,11 +290,11 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
assertEquals(String.format("AdAway", id), adaway.name); assertEquals(String.format("AdAway", id), adaway.name);
assertEquals(String.format("<p>AdAway from %s repo.</p>", id), adaway.description); assertEquals(String.format("<p>AdAway from %s repo.</p>", id), adaway.description);
assertEquals(String.format("Block advertisements (%s)", id), adaway.summary); assertEquals(String.format("Block advertisements (%s)", id), adaway.summary);
assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.webURL); assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.webSite);
assertEquals(String.format("https://github.com/dschuermann/ad-away?%s", id), adaway.sourceURL); assertEquals(String.format("https://github.com/dschuermann/ad-away?%s", id), adaway.sourceCode);
assertEquals(String.format("https://github.com/dschuermann/ad-away/issues?%s", id), adaway.trackerURL); assertEquals(String.format("https://github.com/dschuermann/ad-away/issues?%s", id), adaway.issueTracker);
assertEquals(String.format("https://github.com/dschuermann/ad-away/raw/HEAD/CHANGELOG?%s", id), adaway.changelogURL); assertEquals(String.format("https://github.com/dschuermann/ad-away/raw/HEAD/CHANGELOG?%s", id), adaway.changelog);
assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.donateURL); assertEquals(String.format("http://sufficientlysecure.org/index.php/adaway?%s", id), adaway.donate);
assertEquals(String.format("369138", id), adaway.flattrID); assertEquals(String.format("369138", id), adaway.flattrID);
} }
@ -309,9 +309,9 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
assertEquals("adbWireless", adb.name); assertEquals("adbWireless", adb.name);
assertEquals(String.format("<p>adbWireless from %s repo.</p>", id), adb.description); assertEquals(String.format("<p>adbWireless from %s repo.</p>", id), adb.description);
assertEquals(String.format("Wireless adb (%s)", id), adb.summary); assertEquals(String.format("Wireless adb (%s)", id), adb.summary);
assertEquals(String.format("https://adbwireless.example.com?%s", id), adb.webURL); assertEquals(String.format("https://adbwireless.example.com?%s", id), adb.webSite);
assertEquals(String.format("https://adbwireless.example.com/source?%s", id), adb.sourceURL); assertEquals(String.format("https://adbwireless.example.com/source?%s", id), adb.sourceCode);
assertEquals(String.format("https://adbwireless.example.com/issues?%s", id), adb.trackerURL); assertEquals(String.format("https://adbwireless.example.com/issues?%s", id), adb.issueTracker);
} }
private void assertCalendarMetadata(Repo repo, @RepoIdentifier String id) { private void assertCalendarMetadata(Repo repo, @RepoIdentifier String id) {
@ -325,9 +325,9 @@ public class ProperMultiRepoUpdaterTest extends MultiRepoUpdaterTest {
assertEquals("Add to calendar", calendar.name); assertEquals("Add to calendar", calendar.name);
assertEquals(String.format("<p>Add to calendar from %s repo.</p>", id), calendar.description); assertEquals(String.format("<p>Add to calendar from %s repo.</p>", id), calendar.description);
assertEquals(String.format("Import .ics files into calendar (%s)", id), calendar.summary); assertEquals(String.format("Import .ics files into calendar (%s)", id), calendar.summary);
assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/blob/HEAD/README.md?%s", id), calendar.webURL); assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/blob/HEAD/README.md?%s", id), calendar.webSite);
assertEquals(String.format("https://github.com/danielegobbetti/ICSImport?%s", id), calendar.sourceURL); assertEquals(String.format("https://github.com/danielegobbetti/ICSImport?%s", id), calendar.sourceCode);
assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/issues?%s", id), calendar.trackerURL); assertEquals(String.format("https://github.com/danielegobbetti/ICSImport/issues?%s", id), calendar.issueTracker);
assertEquals("2225390", calendar.flattrID); assertEquals("2225390", calendar.flattrID);
} }