App Details: show the app's Translation links

fdroid/fdroidserver!450

icon is:
https://material.io/tools/icons/?search=trans&icon=translate&style=baseline
This commit is contained in:
Hans-Christoph Steiner 2019-03-22 15:22:11 +01:00
parent 3862f941e6
commit 4f1855c8a1
7 changed files with 48 additions and 3 deletions

View File

@ -146,6 +146,8 @@ public class App extends ValueObject implements Comparable<App>, Parcelable {
public String sourceCode;
public String translation;
public String video;
public String changelog;
@ -273,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;
@ -936,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);
@ -1161,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);
@ -1211,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();

View File

@ -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,"
@ -225,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 = 81;
protected static final int DB_VERSION = 82;
private final Context context;
@ -452,6 +453,19 @@ public class DBHelper extends SQLiteOpenHelper {
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) {

View File

@ -182,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";
@ -242,7 +243,7 @@ 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,
@ -259,7 +260,7 @@ public interface Schema {
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,

View File

@ -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);

View 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>

View File

@ -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>

View File

@ -329,6 +329,7 @@ public class IndexV1UpdaterTest extends FDroidProviderTest {
"suggestedVersionName",
"summary",
"tenInchScreenshots",
"translation",
"tvBanner",
"tvScreenshots",
"upstreamVersionCode",