move "What's New" placeholder to where its used

There is still quite a bit to figure out in the data format of the
per-package "What's New" entries, and its breaking the tests, so move
the placeholder code to the one spot where the placeholder whatsNew
entry is used.
This commit is contained in:
Hans-Christoph Steiner 2017-03-29 18:12:07 +02:00
parent d90c773161
commit b08dfdcb80
2 changed files with 11 additions and 15 deletions

View File

@ -11,7 +11,6 @@ import android.support.annotation.NonNull;
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.RepoXMLHandler;
import org.fdroid.fdroid.Utils;
import org.fdroid.fdroid.data.Schema.ApkTable.Cols;
@ -102,11 +101,6 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
public String[] incompatibleReasons;
/**
* A descriptive text for what has changed in the latest version.
*/
public String whatsNew;
public String[] antiFeatures;
/**
@ -246,13 +240,6 @@ public class Apk extends ValueObject implements Comparable<Apk>, Parcelable {
break;
}
}
// For now, just populate "what's new" with placeholder (or leave blank)
if (BuildConfig.DEBUG) {
if (Math.random() > 0.5) {
whatsNew = "This section will contain the 'what's new' information for the apk.\n\n\t• Bug fixes.";
}
}
}
private void checkRepoAddress() {

View File

@ -35,6 +35,7 @@ import android.widget.Toast;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
import org.fdroid.fdroid.BuildConfig;
import org.fdroid.fdroid.Preferences;
import org.fdroid.fdroid.R;
import org.fdroid.fdroid.Utils;
@ -413,7 +414,15 @@ public class AppDetailsRecyclerViewAdapter
lastUpdateView.setVisibility(View.GONE);
}
Apk suggestedApk = getSuggestedApk();
if (suggestedApk == null || TextUtils.isEmpty(suggestedApk.whatsNew)) {
// TODO replace this whatsNew test code with what comes from suggestedApk once that exists
//if (suggestedApk == null || TextUtils.isEmpty(suggestedApk.whatsNew)) {
String whatsNew = null;
if (BuildConfig.DEBUG) {
if (Math.random() > 0.5) {
whatsNew = "This section will contain the 'what's new' information for the apk.\n\n\t• Bug fixes.";
}
}
if (suggestedApk == null || TextUtils.isEmpty(whatsNew)) {
whatsNewView.setVisibility(View.GONE);
} else {
//noinspection deprecation Ignore deprecation because the suggested way is only available in API 24.
@ -422,7 +431,7 @@ public class AppDetailsRecyclerViewAdapter
StringBuilder sbWhatsNew = new StringBuilder();
sbWhatsNew.append(whatsNewView.getContext().getString(R.string.details_new_in_version, suggestedApk.versionName).toUpperCase(locale));
sbWhatsNew.append("\n\n");
sbWhatsNew.append(suggestedApk.whatsNew);
sbWhatsNew.append("This section will contain the 'what's new' information for the apk.\n\n\t• Bug fixes.");
whatsNewView.setText(sbWhatsNew);
whatsNewView.setVisibility(View.VISIBLE);
}