Merge branch 'latest-apps-criteria' into 'master'
Latest apps criteria See merge request fdroid/fdroidclient!805
This commit is contained in:
commit
99591c050c
@ -204,7 +204,8 @@ public class MainActivityEspressoTest {
|
||||
allOf(withText(R.string.main_menu__swap_nearby), isDisplayed()));
|
||||
nearbyBottonNavButton.perform(click());
|
||||
ViewInteraction findPeopleButton = onView(
|
||||
allOf(withId(R.id.find_people_button), withText(R.string.nearby_splash__find_people_button), isDisplayed()));
|
||||
allOf(withId(R.id.find_people_button), withText(R.string.nearby_splash__find_people_button),
|
||||
isDisplayed()));
|
||||
findPeopleButton.perform(click());
|
||||
onView(withText(R.string.swap_send_fdroid)).check(matches(isDisplayed()));
|
||||
}
|
||||
|
@ -98,6 +98,8 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
public String preferredSigner;
|
||||
@JsonIgnore
|
||||
public boolean isApk;
|
||||
@JsonIgnore
|
||||
private boolean isLocalized = false;
|
||||
|
||||
/**
|
||||
* This is primarily for the purpose of saving app metadata when parsing an index.xml file.
|
||||
@ -144,6 +146,8 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
|
||||
public String sourceCode;
|
||||
|
||||
public String translation;
|
||||
|
||||
public String video;
|
||||
|
||||
public String changelog;
|
||||
@ -271,6 +275,9 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
case Cols.SOURCE_CODE:
|
||||
sourceCode = cursor.getString(i);
|
||||
break;
|
||||
case Cols.TRANSLATION:
|
||||
translation = cursor.getString(i);
|
||||
break;
|
||||
case Cols.VIDEO:
|
||||
video = cursor.getString(i);
|
||||
break;
|
||||
@ -349,6 +356,9 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
case Cols.IS_APK:
|
||||
isApk = cursor.getInt(i) == 1;
|
||||
break;
|
||||
case Cols.IS_LOCALIZED:
|
||||
isLocalized = cursor.getInt(i) == 1;
|
||||
break;
|
||||
case Cols.InstalledApp.VERSION_CODE:
|
||||
installedVersionCode = cursor.getInt(i);
|
||||
break;
|
||||
@ -468,6 +478,10 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
*/
|
||||
@JsonProperty("localized")
|
||||
private void setLocalized(Map<String, Map<String, Object>> localized) { // NOPMD
|
||||
if (localized.size() > 1) {
|
||||
isLocalized = true;
|
||||
}
|
||||
|
||||
Locale defaultLocale = Locale.getDefault();
|
||||
String languageTag = defaultLocale.getLanguage();
|
||||
String countryTag = defaultLocale.getCountry();
|
||||
@ -927,6 +941,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
values.put(Cols.WEBSITE, webSite);
|
||||
values.put(Cols.ISSUE_TRACKER, issueTracker);
|
||||
values.put(Cols.SOURCE_CODE, sourceCode);
|
||||
values.put(Cols.TRANSLATION, translation);
|
||||
values.put(Cols.VIDEO, video);
|
||||
values.put(Cols.CHANGELOG, changelog);
|
||||
values.put(Cols.DONATE, donate);
|
||||
@ -953,6 +968,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
values.put(Cols.WEAR_SCREENSHOTS, Utils.serializeCommaSeparatedString(wearScreenshots));
|
||||
values.put(Cols.IS_COMPATIBLE, compatible ? 1 : 0);
|
||||
values.put(Cols.IS_APK, isApk ? 1 : 0);
|
||||
values.put(Cols.IS_LOCALIZED, isLocalized ? 1 : 0);
|
||||
|
||||
return values;
|
||||
}
|
||||
@ -1151,6 +1167,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
dest.writeString(this.webSite);
|
||||
dest.writeString(this.issueTracker);
|
||||
dest.writeString(this.sourceCode);
|
||||
dest.writeString(this.translation);
|
||||
dest.writeString(this.video);
|
||||
dest.writeString(this.changelog);
|
||||
dest.writeString(this.donate);
|
||||
@ -1178,6 +1195,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
dest.writeStringArray(this.tvScreenshots);
|
||||
dest.writeStringArray(this.wearScreenshots);
|
||||
dest.writeByte(this.isApk ? (byte) 1 : (byte) 0);
|
||||
dest.writeByte(this.isLocalized ? (byte) 1 : (byte) 0);
|
||||
dest.writeString(this.installedVersionName);
|
||||
dest.writeInt(this.installedVersionCode);
|
||||
dest.writeParcelable(this.installedApk, flags);
|
||||
@ -1200,6 +1218,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
this.webSite = in.readString();
|
||||
this.issueTracker = in.readString();
|
||||
this.sourceCode = in.readString();
|
||||
this.translation = in.readString();
|
||||
this.video = in.readString();
|
||||
this.changelog = in.readString();
|
||||
this.donate = in.readString();
|
||||
@ -1229,6 +1248,7 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
|
||||
this.tvScreenshots = in.createStringArray();
|
||||
this.wearScreenshots = in.createStringArray();
|
||||
this.isApk = in.readByte() != 0;
|
||||
this.isLocalized = in.readByte() != 0;
|
||||
this.installedVersionName = in.readString();
|
||||
this.installedVersionCode = in.readInt();
|
||||
this.installedApk = in.readParcelable(Apk.class.getClassLoader());
|
||||
|
@ -143,6 +143,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
+ AppMetadataTable.Cols.WEBSITE + " text, "
|
||||
+ AppMetadataTable.Cols.ISSUE_TRACKER + " text, "
|
||||
+ AppMetadataTable.Cols.SOURCE_CODE + " text, "
|
||||
+ AppMetadataTable.Cols.TRANSLATION + " text, "
|
||||
+ AppMetadataTable.Cols.VIDEO + " string, "
|
||||
+ AppMetadataTable.Cols.CHANGELOG + " text, "
|
||||
+ AppMetadataTable.Cols.PREFERRED_SIGNER + " text,"
|
||||
@ -169,6 +170,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
+ AppMetadataTable.Cols.TV_SCREENSHOTS + " string,"
|
||||
+ AppMetadataTable.Cols.WEAR_SCREENSHOTS + " string,"
|
||||
+ AppMetadataTable.Cols.IS_APK + " boolean,"
|
||||
+ AppMetadataTable.Cols.IS_LOCALIZED + " boolean,"
|
||||
+ "primary key(" + AppMetadataTable.Cols.PACKAGE_ID + ", " + AppMetadataTable.Cols.REPO_ID + "));";
|
||||
|
||||
private static final String CREATE_TABLE_APP_PREFS = "CREATE TABLE " + AppPrefsTable.NAME
|
||||
@ -224,7 +226,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
+ "primary key(" + ApkAntiFeatureJoinTable.Cols.APK_ID + ", " + ApkAntiFeatureJoinTable.Cols.ANTI_FEATURE_ID + ") "
|
||||
+ " );";
|
||||
|
||||
protected static final int DB_VERSION = 80;
|
||||
protected static final int DB_VERSION = 82;
|
||||
|
||||
private final Context context;
|
||||
|
||||
@ -450,6 +452,32 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||
addUserMirrorsFields(db, oldVersion);
|
||||
removeNotNullFromVersionName(db, oldVersion);
|
||||
addDisabledMirrorsFields(db, oldVersion);
|
||||
addIsLocalized(db, oldVersion);
|
||||
addTranslation(db, oldVersion);
|
||||
}
|
||||
|
||||
private void addTranslation(SQLiteDatabase db, int oldVersion) {
|
||||
if (oldVersion >= 82) {
|
||||
return;
|
||||
}
|
||||
if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.TRANSLATION)) {
|
||||
Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.TRANSLATION + " field to "
|
||||
+ AppMetadataTable.NAME + " table in db.");
|
||||
db.execSQL("alter table " + AppMetadataTable.NAME + " add column "
|
||||
+ AppMetadataTable.Cols.TRANSLATION + " string;");
|
||||
}
|
||||
}
|
||||
|
||||
private void addIsLocalized(SQLiteDatabase db, int oldVersion) {
|
||||
if (oldVersion >= 81) {
|
||||
return;
|
||||
}
|
||||
if (!columnExists(db, AppMetadataTable.NAME, AppMetadataTable.Cols.IS_LOCALIZED)) {
|
||||
Utils.debugLog(TAG, "Adding " + AppMetadataTable.Cols.IS_LOCALIZED + " field to "
|
||||
+ AppMetadataTable.NAME + " table in db.");
|
||||
db.execSQL("alter table " + AppMetadataTable.NAME + " add column "
|
||||
+ AppMetadataTable.Cols.IS_LOCALIZED + " boolean;");
|
||||
}
|
||||
}
|
||||
|
||||
private void addDisabledMirrorsFields(SQLiteDatabase db, int oldVersion) {
|
||||
|
@ -12,11 +12,13 @@ public interface Schema {
|
||||
/**
|
||||
* A package is essentially the app that a developer builds and wants you to install on your
|
||||
* device. It differs from entries in:
|
||||
* * {@link ApkTable} because they are specific builds of a particular package. Many different
|
||||
* builds of the same package can exist.
|
||||
* * {@link AppMetadataTable} because this is metdata about a package which is specified by a
|
||||
* <ul>
|
||||
* <li>{@link ApkTable} because they are specific builds of a particular package. Many different
|
||||
* builds of the same package can exist.</li>
|
||||
* <li>{@link AppMetadataTable} because this is metdata about a package which is specified by a
|
||||
* given repo. Different repos can provide the same package with different descriptions,
|
||||
* categories, etc.
|
||||
* categories, etc.</li>
|
||||
* </ul>
|
||||
*/
|
||||
interface PackageTable {
|
||||
|
||||
@ -78,6 +80,7 @@ public interface Schema {
|
||||
* An entry in this table signifies that an app is in a particular category. Each repo can
|
||||
* classify its apps in separate categories, and so the same record in {@link PackageTable}
|
||||
* can be in the same category multiple times, if multiple repos think that is the case.
|
||||
*
|
||||
* @see CategoryTable
|
||||
* @see AppMetadataTable
|
||||
*/
|
||||
@ -90,12 +93,14 @@ public interface Schema {
|
||||
|
||||
/**
|
||||
* Foreign key to {@link AppMetadataTable}.
|
||||
*
|
||||
* @see AppMetadataTable
|
||||
*/
|
||||
String APP_METADATA_ID = "appMetadataId";
|
||||
|
||||
/**
|
||||
* Foreign key to {@link CategoryTable}.
|
||||
*
|
||||
* @see CategoryTable
|
||||
*/
|
||||
String CATEGORY_ID = "categoryId";
|
||||
@ -121,6 +126,7 @@ public interface Schema {
|
||||
|
||||
/**
|
||||
* An entry in this table signifies that an apk has a particular anti feature.
|
||||
*
|
||||
* @see AntiFeatureTable
|
||||
* @see ApkTable
|
||||
*/
|
||||
@ -131,12 +137,14 @@ public interface Schema {
|
||||
interface Cols {
|
||||
/**
|
||||
* Foreign key to {@link ApkTable}.
|
||||
*
|
||||
* @see ApkTable
|
||||
*/
|
||||
String APK_ID = "apkId";
|
||||
|
||||
/**
|
||||
* Foreign key to {@link AntiFeatureTable}.
|
||||
*
|
||||
* @see AntiFeatureTable
|
||||
*/
|
||||
String ANTI_FEATURE_ID = "antiFeatureId";
|
||||
@ -174,6 +182,7 @@ public interface Schema {
|
||||
String WEBSITE = "webURL";
|
||||
String ISSUE_TRACKER = "trackerURL";
|
||||
String SOURCE_CODE = "sourceURL";
|
||||
String TRANSLATION = "translation";
|
||||
String VIDEO = "video";
|
||||
String CHANGELOG = "changelogURL";
|
||||
String DONATE = "donateURL";
|
||||
@ -199,6 +208,7 @@ public interface Schema {
|
||||
String TV_SCREENSHOTS = "tvScreenshots";
|
||||
String WEAR_SCREENSHOTS = "wearScreenshots";
|
||||
String IS_APK = "isApk";
|
||||
String IS_LOCALIZED = "isLocalized";
|
||||
|
||||
interface SuggestedApk {
|
||||
String VERSION_NAME = "suggestedApkVersion";
|
||||
@ -233,28 +243,29 @@ public interface Schema {
|
||||
String[] ALL_COLS = {
|
||||
ROW_ID, PACKAGE_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
|
||||
WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
|
||||
VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
|
||||
TRANSLATION, VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
|
||||
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
|
||||
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
|
||||
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
|
||||
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
|
||||
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK,
|
||||
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK, IS_LOCALIZED,
|
||||
};
|
||||
|
||||
/**
|
||||
* Superset of {@link Cols#ALL_COLS} including fields from other tables and also an alias
|
||||
* to satisfy the Android requirement for an "_ID" field.
|
||||
*
|
||||
* @see Cols#ALL_COLS
|
||||
*/
|
||||
String[] ALL = {
|
||||
_ID, ROW_ID, REPO_ID, IS_COMPATIBLE, NAME, SUMMARY, ICON, DESCRIPTION,
|
||||
WHATSNEW, LICENSE, AUTHOR_NAME, AUTHOR_EMAIL, WEBSITE, ISSUE_TRACKER, SOURCE_CODE,
|
||||
VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
|
||||
TRANSLATION, VIDEO, CHANGELOG, DONATE, BITCOIN, LITECOIN, FLATTR_ID, LIBERAPAY_ID,
|
||||
UPSTREAM_VERSION_NAME, UPSTREAM_VERSION_CODE, ADDED, LAST_UPDATED,
|
||||
ANTI_FEATURES, REQUIREMENTS, ICON_URL,
|
||||
FEATURE_GRAPHIC, PROMO_GRAPHIC, TV_BANNER, PHONE_SCREENSHOTS,
|
||||
SEVEN_INCH_SCREENSHOTS, TEN_INCH_SCREENSHOTS, TV_SCREENSHOTS, WEAR_SCREENSHOTS,
|
||||
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK, SuggestedApk.VERSION_NAME,
|
||||
PREFERRED_SIGNER, SUGGESTED_VERSION_CODE, IS_APK, IS_LOCALIZED, SuggestedApk.VERSION_NAME,
|
||||
InstalledApp.VERSION_CODE, InstalledApp.VERSION_NAME,
|
||||
InstalledApp.SIGNATURE, Package.PACKAGE_NAME,
|
||||
};
|
||||
|
@ -981,6 +981,11 @@ public class AppDetailsRecyclerViewAdapter
|
||||
addLinkItemView(contentView, R.string.menu_issues, R.drawable.ic_issues, app.issueTracker);
|
||||
}
|
||||
|
||||
// Translation button
|
||||
if (uriIsSetAndCanBeOpened(app.translation)) {
|
||||
addLinkItemView(contentView, R.string.menu_translation, R.drawable.ic_translation, app.translation);
|
||||
}
|
||||
|
||||
// Changelog button
|
||||
if (uriIsSetAndCanBeOpened(app.changelog)) {
|
||||
addLinkItemView(contentView, R.string.menu_changelog, R.drawable.ic_changelog, app.changelog);
|
||||
|
@ -23,12 +23,13 @@ import org.fdroid.fdroid.UpdateService;
|
||||
import org.fdroid.fdroid.Utils;
|
||||
import org.fdroid.fdroid.data.AppProvider;
|
||||
import org.fdroid.fdroid.data.RepoProvider;
|
||||
import org.fdroid.fdroid.data.Schema;
|
||||
import org.fdroid.fdroid.data.Schema.AppMetadataTable;
|
||||
import org.fdroid.fdroid.views.apps.AppListActivity;
|
||||
import org.fdroid.fdroid.views.hiding.HidingManager;
|
||||
import org.fdroid.fdroid.views.whatsnew.WhatsNewAdapter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Loads a list of newly added or recently updated apps and displays them to the user.
|
||||
@ -100,11 +101,31 @@ class WhatsNewViewBinder implements LoaderManager.LoaderCallbacks<Cursor> {
|
||||
return null;
|
||||
}
|
||||
|
||||
// select that have all required items:
|
||||
String selection = "(" + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.NAME + " != ''"
|
||||
+ " AND " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.SUMMARY + " != ''"
|
||||
+ " AND " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.DESCRIPTION + " != ''"
|
||||
+ " AND " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.LICENSE + " != ''"
|
||||
+ " AND " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.WHATSNEW + " != ''";
|
||||
if (!"en".equals(Locale.getDefault().getLanguage())) {
|
||||
// only require localization if using a non-English locale
|
||||
selection += " AND " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.IS_LOCALIZED + " = 1";
|
||||
}
|
||||
// and at least one optional item:
|
||||
selection += ") AND ("
|
||||
+ AppMetadataTable.NAME + "." + AppMetadataTable.Cols.SEVEN_INCH_SCREENSHOTS + " IS NOT NULL "
|
||||
+ " OR " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.PHONE_SCREENSHOTS + " IS NOT NULL "
|
||||
+ " OR " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.TEN_INCH_SCREENSHOTS + " IS NOT NULL "
|
||||
+ " OR " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.TV_SCREENSHOTS + " IS NOT NULL "
|
||||
+ " OR " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.WEAR_SCREENSHOTS + " IS NOT NULL "
|
||||
+ " OR " + AppMetadataTable.NAME + "." + AppMetadataTable.Cols.FEATURE_GRAPHIC + " IS NOT NULL "
|
||||
+ ")";
|
||||
|
||||
return new CursorLoader(
|
||||
activity,
|
||||
AppProvider.getRecentlyUpdatedUri(),
|
||||
Schema.AppMetadataTable.Cols.ALL,
|
||||
null,
|
||||
AppMetadataTable.Cols.ALL,
|
||||
selection,
|
||||
null,
|
||||
null
|
||||
);
|
||||
|
9
app/src/main/res/drawable/ic_translation.xml
Normal file
9
app/src/main/res/drawable/ic_translation.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#666666"
|
||||
android:pathData="M12.87,15.07l-2.54,-2.51 0.03,-0.03c1.74,-1.94 2.98,-4.17 3.71,-6.53L17,6L17,4h-7L10,2L8,2v2L1,4v1.99h11.17C11.5,7.92 10.44,9.75 9,11.35 8.07,10.32 7.3,9.19 6.69,8h-2c0.73,1.63 1.73,3.17 2.98,4.56l-5.09,5.02L4,19l5,-5 3.11,3.11 0.76,-2.04zM18.5,10h-2L12,22h2l1.12,-3h4.75L21,22h2l-4.5,-12zM15.88,17l1.62,-4.33L19.12,17h-3.24z"/>
|
||||
</vector>
|
@ -210,11 +210,18 @@ This often occurs with apps installed via Google Play or other sources, if they
|
||||
<string name="menu_ignore_this">Ignore This Update</string>
|
||||
<string name="menu_website">Website</string>
|
||||
<string name="menu_email">E-Mail Author</string>
|
||||
<!-- The title for the link that points to the issue tracker for this app -->
|
||||
<string name="menu_issues">Issues</string>
|
||||
<!-- The title for the link that points to the Changelog document for this app -->
|
||||
<string name="menu_changelog">Changelog</string>
|
||||
<!-- The title for the link that points to a demo video for this app -->
|
||||
<string name="menu_video">Video</string>
|
||||
<!-- The title for the link that points to the license for this app -->
|
||||
<string name="menu_license">License: %s</string>
|
||||
<!-- The title for the link that points to the source code for this app -->
|
||||
<string name="menu_source">Source Code</string>
|
||||
<!-- The title for the link that points to the translation service for this app -->
|
||||
<string name="menu_translation">Translation</string>
|
||||
<string name="menu_upgrade">Update</string>
|
||||
<string name="menu_downgrade">Downgrade</string>
|
||||
<string name="menu_donate">Donate</string>
|
||||
|
@ -329,6 +329,7 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
||||
"suggestedVersionName",
|
||||
"summary",
|
||||
"tenInchScreenshots",
|
||||
"translation",
|
||||
"tvBanner",
|
||||
"tvScreenshots",
|
||||
"upstreamVersionCode",
|
||||
@ -347,6 +348,7 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
|
||||
"installedVersionCode",
|
||||
"installedVersionName",
|
||||
"isApk",
|
||||
"isLocalized",
|
||||
"preferredSigner",
|
||||
"prefs",
|
||||
"TAG",
|
||||
|
Loading…
x
Reference in New Issue
Block a user