mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Use product name on rich document, if available
use placeholder for string reset to master-snapshot fix analysis warning use new translatable string use var vor qa flavor too Signed-off-by: tobiasKaminsky <tobias@kaminsky.me> Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
9b0a789d3b
commit
403a3e062c
8 changed files with 51 additions and 14 deletions
|
@ -48,6 +48,7 @@ configurations.all {
|
|||
|
||||
ext {
|
||||
jacocoVersion = "0.8.2"
|
||||
androidLibraryVersion = "master-SNAPSHOT"
|
||||
|
||||
travisBuild = System.getenv("TRAVIS") == "true"
|
||||
|
||||
|
@ -236,10 +237,10 @@ dependencies {
|
|||
// dependencies for app building
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
// implementation project('nextcloud-android-library')
|
||||
genericImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
|
||||
gplayImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
|
||||
versionDevImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
|
||||
qaImplementation 'com.github.nextcloud:android-library:master-SNAPSHOT'
|
||||
genericImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
|
||||
gplayImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
|
||||
versionDevImplementation "com.github.nextcloud:android-library:$androidLibraryVersion"
|
||||
qaImplementation 'com.github.nextcloud:android-library:$androidLibraryVersion'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.0.0'
|
||||
|
|
|
@ -55,10 +55,10 @@ else
|
|||
|
||||
# check library, only if base branch is master
|
||||
baseBranch=$(scripts/analysis/getBranchBase.sh $1 $2 $7 | tr -d "\"")
|
||||
if [ $baseBranch = "master" -a $(grep "android-library:master" build.gradle -c) -ne 4 ]; then
|
||||
if [ $baseBranch = "master" -a $(grep "androidLibraryVersion = \"master-SNAPSHOT\"" build.gradle -c) -ne 1 ]; then
|
||||
checkLibraryMessage="<h1>Android-library is not set to master branch in build.gradle</h1>"
|
||||
checkLibrary=1
|
||||
elif [ $baseBranch != "master" -a $baseBranch = $stableBranch -a $(grep "android-library:.*SNAPSHOT" build.gradle -c) -ne 0 ]; then
|
||||
elif [ $baseBranch != "master" -a $baseBranch = $stableBranch -a $(grep "androidLibraryVersion.*SNAPSHOT" build.gradle -c) -ne 0 ]; then
|
||||
checkLibraryMessage="<h1>Android-library is set to a SNAPSHOT in build.gradle</h1>"
|
||||
checkLibrary=1
|
||||
else
|
||||
|
|
|
@ -1969,6 +1969,7 @@ public class FileDataStorageManager {
|
|||
.getValue());
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_TEMPLATES, capability.getRichDocumentsTemplatesAvailable()
|
||||
.getValue());
|
||||
cv.put(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_PRODUCT_NAME, capability.getRichDocumentsProductName());
|
||||
|
||||
if (capabilityExists(account.name)) {
|
||||
if (getContentResolver() != null) {
|
||||
|
@ -2146,6 +2147,8 @@ public class FileDataStorageManager {
|
|||
optionalMimetypes = "";
|
||||
}
|
||||
capability.setRichDocumentsOptionalMimeTypeList(Arrays.asList(optionalMimetypes.split(",")));
|
||||
capability.setRichDocumentsProductName(
|
||||
c.getString(c.getColumnIndex(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_PRODUCT_NAME)));
|
||||
}
|
||||
return capability;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import com.owncloud.android.MainApp;
|
|||
*/
|
||||
public class ProviderMeta {
|
||||
public static final String DB_NAME = "filelist";
|
||||
public static final int DB_VERSION = 47;
|
||||
public static final int DB_VERSION = 48;
|
||||
|
||||
private ProviderMeta() {
|
||||
// No instance
|
||||
|
@ -190,6 +190,7 @@ public class ProviderMeta {
|
|||
"richdocument_optional_mimetype_list";
|
||||
public static final String CAPABILITIES_RICHDOCUMENT_DIRECT_EDITING = "richdocument_direct_editing";
|
||||
public static final String CAPABILITIES_RICHDOCUMENT_TEMPLATES = "richdocument_direct_templates";
|
||||
public static final String CAPABILITIES_RICHDOCUMENT_PRODUCT_NAME = "richdocument_product_name";
|
||||
|
||||
public static final String CAPABILITIES_DEFAULT_SORT_ORDER = CAPABILITIES_ACCOUNT_NAME
|
||||
+ " collate nocase asc";
|
||||
|
|
|
@ -106,7 +106,7 @@ public class FileMenuFilter {
|
|||
List<Integer> toShow = new ArrayList<>();
|
||||
List<Integer> toHide = new ArrayList<>();
|
||||
|
||||
filter(toShow, toHide, inSingleFileFragment);
|
||||
filter(toShow, toHide, inSingleFileFragment, menu);
|
||||
|
||||
for (int i : toShow) {
|
||||
showMenuItem(menu.findItem(i));
|
||||
|
@ -162,7 +162,7 @@ public class FileMenuFilter {
|
|||
* @param toHide List to save the options that must be shown in the menu.
|
||||
* @param inSingleFileFragment True if this is not listing, but single file fragment, like preview or details.
|
||||
*/
|
||||
private void filter(List<Integer> toShow, List<Integer> toHide, boolean inSingleFileFragment) {
|
||||
private void filter(List<Integer> toShow, List<Integer> toHide, boolean inSingleFileFragment, Menu menu) {
|
||||
boolean synchronizing = anyFileSynchronizing();
|
||||
OCCapability capability = mComponentsGetter.getStorageManager().getCapability(mAccount.name);
|
||||
boolean endToEndEncryptionEnabled = capability.getEndToEndEncryption().isTrue();
|
||||
|
@ -184,7 +184,7 @@ public class FileMenuFilter {
|
|||
filterUnsetEncrypted(toShow, toHide, endToEndEncryptionEnabled);
|
||||
filterSetPictureAs(toShow, toHide);
|
||||
filterStream(toShow, toHide);
|
||||
filterOpenAsRichDocument(toShow, toHide, capability);
|
||||
filterOpenAsRichDocument(toShow, toHide, capability, menu);
|
||||
}
|
||||
|
||||
private void filterShareFile(List<Integer> toShow, List<Integer> toHide, OCCapability capability) {
|
||||
|
@ -247,12 +247,25 @@ public class FileMenuFilter {
|
|||
}
|
||||
}
|
||||
|
||||
private void filterOpenAsRichDocument(List<Integer> toShow, List<Integer> toHide, OCCapability capability) {
|
||||
private void filterOpenAsRichDocument(List<Integer> toShow,
|
||||
List<Integer> toHide,
|
||||
OCCapability capability,
|
||||
Menu menu) {
|
||||
String mimeType = mFiles.iterator().next().getMimeType();
|
||||
|
||||
if (isSingleFile() && android.os.Build.VERSION.SDK_INT >= RichDocumentsWebView.MINIMUM_API &&
|
||||
(capability.getRichDocumentsMimeTypeList().contains(mimeType) ||
|
||||
capability.getRichDocumentsOptionalMimeTypeList().contains(mimeType)) &&
|
||||
capability.getRichDocumentsDirectEditing().isTrue()) {
|
||||
|
||||
String openWith = mContext.getResources().getString(R.string.actionbar_open_as_richdocument_parameter);
|
||||
String productName = capability.getRichDocumentsProductName();
|
||||
MenuItem item = menu.findItem(R.id.action_open_file_as_richdocument);
|
||||
|
||||
if (item != null) {
|
||||
item.setTitle(String.format(openWith, productName));
|
||||
}
|
||||
|
||||
toShow.add(R.id.action_open_file_as_richdocument);
|
||||
} else {
|
||||
toHide.add(R.id.action_open_file_as_richdocument);
|
||||
|
|
|
@ -771,7 +771,8 @@ public class FileContentProvider extends ContentProvider {
|
|||
+ ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_DIRECT_EDITING + INTEGER
|
||||
+ ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_TEMPLATES + INTEGER
|
||||
+ ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_OPTIONAL_MIMETYPE_LIST + TEXT
|
||||
+ ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_OPTIONAL_PASSWORD + " INTEGER );");
|
||||
+ ProviderTableMeta.CAPABILITIES_SHARING_PUBLIC_ASK_FOR_OPTIONAL_PASSWORD + INTEGER
|
||||
+ ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_PRODUCT_NAME + " TEXT );");
|
||||
}
|
||||
|
||||
private void createUploadsTable(SQLiteDatabase db) {
|
||||
|
@ -1966,6 +1967,24 @@ public class FileContentProvider extends ContentProvider {
|
|||
if (!upgraded) {
|
||||
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
|
||||
}
|
||||
|
||||
if (oldVersion < 48 && newVersion >= 48) {
|
||||
Log_OC.i(SQL, "Entering in the #48 add product name to capabilities table");
|
||||
db.beginTransaction();
|
||||
try {
|
||||
db.execSQL(ALTER_TABLE + ProviderTableMeta.CAPABILITIES_TABLE_NAME +
|
||||
ADD_COLUMN + ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_PRODUCT_NAME + " TEXT ");
|
||||
|
||||
upgraded = true;
|
||||
db.setTransactionSuccessful();
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
if (!upgraded) {
|
||||
Log_OC.i(SQL, String.format(Locale.ENGLISH, UPGRADE_VERSION_MSG, oldVersion, newVersion));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
|
||||
<item
|
||||
android:id="@+id/action_open_file_as_richdocument"
|
||||
android:title="@string/actionbar_open_as_richdocument"
|
||||
android:title="@string/actionbar_open_as_richdocument_parameter"
|
||||
app:showAsAction="never"
|
||||
android:showAsAction="never"/>
|
||||
|
||||
|
|
|
@ -794,7 +794,7 @@
|
|||
<string name="stream_not_possible_headline">Internal streaming not possible</string>
|
||||
<string name="stream_not_possible_message">Please download media instead or use external app.</string>
|
||||
<string name="folder_already_exists">Folder already exists</string>
|
||||
<string name="actionbar_open_as_richdocument">Open with Collabora</string>
|
||||
<string name="actionbar_open_as_richdocument_parameter">Open with %1$s</string>
|
||||
<string name="notification_icon">Notification icon</string>
|
||||
<string name="folder_confirm_create">Create</string>
|
||||
<string name="file_delete">Delete</string>
|
||||
|
|
Loading…
Reference in a new issue