Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ configurations.all {

ext {
jacocoVersion = "0.8.2"
androidLibraryVersion = "master-SNAPSHOT"

travisBuild = System.getenv("TRAVIS") == "true"

Expand Down Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions scripts/analysis/analysis-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1969,6 +1969,7 @@ public OCCapability saveCapabilities(OCCapability capability) {
.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) {
Expand Down Expand Up @@ -2146,6 +2147,8 @@ private OCCapability createCapabilityInstance(Cursor c) {
optionalMimetypes = "";
}
capability.setRichDocumentsOptionalMimeTypeList(Arrays.asList(optionalMimetypes.split(",")));
capability.setRichDocumentsProductName(
c.getString(c.getColumnIndex(ProviderTableMeta.CAPABILITIES_RICHDOCUMENT_PRODUCT_NAME)));
}
return capability;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/owncloud/android/db/ProviderMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*/
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
Expand Down Expand Up @@ -190,6 +190,7 @@ static public class ProviderTableMeta implements BaseColumns {
"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";
Expand Down
21 changes: 17 additions & 4 deletions src/main/java/com/owncloud/android/files/FileMenuFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void filter(Menu menu, boolean inSingleFileFragment) {
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));
Expand Down Expand Up @@ -162,7 +162,7 @@ public static void hideMenuItems(MenuItem... items) {
* @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();
Expand All @@ -184,7 +184,7 @@ private void filter(List<Integer> toShow, List<Integer> toHide, boolean inSingle
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) {
Expand Down Expand Up @@ -247,12 +247,25 @@ private void filterSetPictureAs(List<Integer> toShow, List<Integer> toHide) {
}
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,8 @@ private void createCapabilitiesTable(SQLiteDatabase db) {
+ 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) {
Expand Down Expand Up @@ -1966,6 +1967,24 @@ public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
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
Expand Down
2 changes: 1 addition & 1 deletion src/main/res/menu/file_actions_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

Expand Down
2 changes: 1 addition & 1 deletion src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down