Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1f84ea8fe | ||
|
|
ab92579d3d | ||
|
|
41ef3d5a52 | ||
|
|
0065e576cf | ||
|
|
5263f21916 | ||
|
|
c429b79665 | ||
|
|
b3900741df | ||
|
|
1a980c6ce0 | ||
|
|
246b8d0194 | ||
|
|
8ca1f7c6b4 | ||
|
|
7d639bbbc9 | ||
|
|
0c4912c75b | ||
|
|
78ae569884 | ||
|
|
b6d4a0fb1c | ||
|
|
144e1dc0ec | ||
|
|
643f79e386 | ||
|
|
7b2ace5168 | ||
|
|
dc0387658d | ||
|
|
94945af5af | ||
|
|
dc9cc6ade5 | ||
|
|
c9f27b77a3 | ||
|
|
4ff1b3d7f6 | ||
|
|
200e2db1f3 | ||
|
|
3a6854b209 | ||
|
|
de4dba2c1a | ||
|
|
dc73d6f491 | ||
|
|
bab344320c | ||
|
|
aac41da5bc | ||
|
|
be73b12e65 | ||
|
|
315649309a | ||
|
|
57d2bd6712 | ||
|
|
90ec0dd2b2 | ||
|
|
5c94e8996e | ||
|
|
c28f001e1c | ||
|
|
824772c247 | ||
|
|
a3c1e0d8f3 | ||
|
|
ebff756b42 | ||
|
|
1803157541 | ||
|
|
1fc34bf38b | ||
|
|
9fd027fbd6 | ||
|
|
5fc8666da9 | ||
|
|
7baaaa4386 | ||
|
|
fd2729225b | ||
|
|
8d14a28d59 | ||
|
|
fc8d8fb459 | ||
|
|
69025b05e3 | ||
|
|
cef3cae981 | ||
|
|
d2224d1350 | ||
|
|
6561ea15ac | ||
|
|
4084163ec0 | ||
|
|
3cf0271e8f | ||
|
|
6d0566ff3b | ||
|
|
f333466875 | ||
|
|
6b086c56cd | ||
|
|
727cf0743c | ||
|
|
852591db40 | ||
|
|
70685974f3 | ||
|
|
ce9b61654f | ||
|
|
dd5adbbb41 | ||
|
|
2a0f7443ca | ||
|
|
73a39b9210 | ||
|
|
f82a3719bb | ||
|
|
3c83416a85 | ||
|
|
35597ded35 | ||
|
|
6756b4dfdc | ||
|
|
8cc428a3a9 | ||
|
|
dfe331e652 | ||
|
|
a543564078 | ||
|
|
585c17075c | ||
|
|
26e131e31a | ||
|
|
1bcef78f0a | ||
|
|
1af7b621e2 | ||
|
|
4262fa2c18 | ||
|
|
2bc2bbe3af | ||
|
|
dcdd79e2aa | ||
|
|
803c9c8081 | ||
|
|
ddad5ebf6e | ||
|
|
1de7b5af59 | ||
|
|
37641360c9 | ||
|
|
e4b9be195c | ||
|
|
dc3a833827 | ||
|
|
04f1dcf293 | ||
|
|
ce99a3ebd6 | ||
|
|
ff25cf949b | ||
|
|
600d6aa97f | ||
|
|
56e981af33 | ||
|
|
df0d4f9011 | ||
|
|
195cee2345 | ||
|
|
3e40a4b770 | ||
|
|
5709c20932 | ||
|
|
6cda6a4326 | ||
|
|
40b8834125 | ||
|
|
0395d31a6e | ||
|
|
4d39b7d4f3 | ||
|
|
326d229294 | ||
|
|
54156ea6bc | ||
|
|
68ae5106cb | ||
|
|
a5c0c6a953 | ||
|
|
27cf10705f | ||
|
|
04e6fb2c9c | ||
|
|
fa1e483c5d | ||
|
|
ae57ccbf0d | ||
|
|
3ec4439263 | ||
|
|
91c8c38e5a | ||
|
|
3bd77e142d | ||
|
|
f09c3dafbf | ||
|
|
23d120e5cc | ||
|
|
ccfe93bd45 | ||
|
|
63030282c7 | ||
|
|
273b7e547b | ||
|
|
7b13a87680 | ||
|
|
a4af8744f9 | ||
|
|
574cfae5b6 | ||
|
|
07e6c6d05c | ||
|
|
55d6933a3d | ||
|
|
6103234a21 | ||
|
|
b773a1455f | ||
|
|
298943963f | ||
|
|
230e81f1a8 | ||
|
|
259872c943 | ||
|
|
b369caaec7 | ||
|
|
1f0b1ed4c7 | ||
|
|
6050d6f8f9 | ||
|
|
51ffebecd2 | ||
|
|
6e0de62f58 | ||
|
|
b70471c8ff | ||
|
|
715b0866c6 | ||
|
|
05c269c31b | ||
|
|
ceeba26608 | ||
|
|
c79205a465 | ||
|
|
65f11e5d8c | ||
|
|
baef406394 | ||
|
|
c0441334d7 | ||
|
|
bd364e6e99 | ||
|
|
a3ceba17de | ||
|
|
47b66d67c5 | ||
|
|
89b0127cd4 | ||
|
|
8e7bbb3a50 | ||
|
|
b1a3b2f8ee | ||
|
|
124a56bf04 | ||
|
|
2d02398391 | ||
|
|
7f9bef4ec0 | ||
|
|
b93c248fb2 | ||
|
|
8a42743bfa | ||
|
|
1d3288b458 | ||
|
|
3b0aac34b4 | ||
|
|
c0e52ae09f | ||
|
|
e3d0ce39b4 | ||
|
|
6ff60c5e25 | ||
|
|
7b3ac36040 | ||
|
|
263e6e01ee | ||
|
|
d4737edbf9 | ||
|
|
d6f32ad71d | ||
|
|
67c2ed76d4 | ||
|
|
051c36a346 | ||
|
|
7b546e3589 | ||
|
|
0af3c1d5c7 | ||
|
|
57d360be49 | ||
|
|
1c2f58a4f8 | ||
|
|
58a8442b12 | ||
|
|
aaf0fb27dc | ||
|
|
dece04b40b | ||
|
|
a64762a56d | ||
|
|
21be7c3ec9 | ||
|
|
618745fa42 | ||
|
|
1a8f70e426 | ||
|
|
869f3ea7fc | ||
|
|
4cf2be8efa | ||
|
|
3a6374755f | ||
|
|
c7c3475621 | ||
|
|
5178e43813 | ||
|
|
449407870e | ||
|
|
7390417e64 | ||
|
|
03093cc5cb | ||
|
|
d86cd70ab8 | ||
|
|
e879bca55f | ||
|
|
e753fa3509 | ||
|
|
81f653177d | ||
|
|
e0192f4963 | ||
|
|
a51044953e | ||
|
|
4a9b49c1fc | ||
|
|
de722db90f | ||
|
|
49979ba5a9 | ||
|
|
cb0d0caaf8 | ||
|
|
2ec47ddef3 | ||
|
|
dc898c0f80 | ||
|
|
1d6f2d9215 | ||
|
|
407e851435 | ||
|
|
dd4b7c17b4 |
No files matched your search
@@ -32,7 +32,7 @@ services:
|
||||
image: ghcr.io/nextcloud/continuous-integration-shallow-server:latest # also change in updateScreenshots.sh
|
||||
environment:
|
||||
EVAL: true
|
||||
SERVER_VERSION: 'stable25'
|
||||
SERVER_VERSION: 'stable27'
|
||||
commands:
|
||||
- BRANCH="$SERVER_VERSION" /usr/local/bin/initnc.sh
|
||||
- echo 127.0.0.1 server >> /etc/hosts
|
||||
@@ -171,4 +171,6 @@ name: GIT_TOKEN
|
||||
data: XIoa9IYq+xQ+N5iln8dlpWv0jV6ROr7HuE24ioUr4uQ8m8SjyH0yognWYLYLqnbTKrFWlFZiEMQTH/sZiWjRFvV1iL0=
|
||||
---
|
||||
kind: signature
|
||||
hmac: aec1cabcb7b4f98f1be1d5b7a052a629ce3193e19a3692dd52ada48b6e72a1c9
|
||||
hmac: b78dcc477ff74ccbd7877df011090783847f8b5215a994be6597408bd735b524
|
||||
|
||||
...
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
repository: ${{ steps.get-vars.outputs.repo }}
|
||||
ref: ${{ steps.get-vars.outputs.branch }}
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
|
||||
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
|
||||
@@ -32,11 +32,11 @@ jobs:
|
||||
with:
|
||||
swap-size-gb: 10
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
|
||||
uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
|
||||
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: 17
|
||||
@@ -46,4 +46,4 @@ jobs:
|
||||
echo "org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError" > "$HOME/.gradle/gradle.properties"
|
||||
./gradlew assembleDebug
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
|
||||
uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
|
||||
@@ -37,6 +37,6 @@ jobs:
|
||||
|
||||
# Upload the results to GitHub's code scanning dashboard.
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@74483a38d39275f33fcff5f35b679b5ca4a26a99 # v2.22.5
|
||||
uses: github/codeql-action/upload-sarif@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
if: ${{ always() }}
|
||||
run: scripts/deleteOldComments.sh "test" "Unit" ${{github.event.number}}
|
||||
- name: Run unit tests with coverage
|
||||
uses: gradle/gradle-build-action@842c587ad8aa4c68eeba24c396e15af4c2e9f30a # v2.9.0
|
||||
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
|
||||
with:
|
||||
arguments: jacocoTestGplayDebugUnitTest
|
||||
- name: Upload failing results
|
||||
|
||||
@@ -84,8 +84,8 @@ android {
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 24
|
||||
targetSdkVersion 33
|
||||
compileSdk 33
|
||||
targetSdkVersion 34
|
||||
compileSdk 34
|
||||
|
||||
buildConfigField 'boolean', 'CI', ciBuild.toString()
|
||||
buildConfigField 'boolean', 'RUNTIME_PERF_ANALYSIS', perfAnalysis.toString()
|
||||
@@ -246,7 +246,7 @@ dependencies {
|
||||
implementation 'org.apache.jackrabbit:jackrabbit-webdav:2.13.5' // remove after entire switch to lib v2
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'com.google.android.material:material:1.9.0'
|
||||
implementation 'com.google.android.material:material:1.10.0'
|
||||
implementation 'com.jakewharton:disklrucache:2.0.2'
|
||||
implementation "androidx.appcompat:appcompat:$appCompatVersion"
|
||||
implementation 'androidx.webkit:webkit:1.7.0'
|
||||
@@ -377,7 +377,7 @@ dependencies {
|
||||
gplayImplementation "com.google.firebase:firebase-messaging:23.2.1"
|
||||
gplayImplementation 'com.google.android.play:review-ktx:2.0.1'
|
||||
|
||||
implementation 'com.github.nextcloud.android-common:ui:0.12.0'
|
||||
implementation 'com.github.nextcloud.android-common:ui:0.13.0'
|
||||
|
||||
implementation "androidx.room:room-runtime:$roomVersion"
|
||||
ksp "androidx.room:room-compiler:$roomVersion"
|
||||
|
||||
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 6.1 KiB |
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.9 KiB |
|
Before Width: | Height: | Size: 9.7 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@@ -174,7 +174,7 @@ class ActivitiesActivityIT : AbstractIT() {
|
||||
sut.dismissSnackbar()
|
||||
}
|
||||
|
||||
shortSleep()
|
||||
longSleep()
|
||||
waitForIdleSync()
|
||||
|
||||
screenshot(sut)
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.app.Activity
|
||||
import androidx.test.espresso.Espresso
|
||||
import androidx.test.espresso.Espresso.onView
|
||||
import androidx.test.espresso.action.ViewActions.click
|
||||
import androidx.test.espresso.action.ViewActions.closeSoftKeyboard
|
||||
import androidx.test.espresso.assertion.ViewAssertions.matches
|
||||
import androidx.test.espresso.contrib.DrawerActions
|
||||
import androidx.test.espresso.contrib.NavigationViewActions
|
||||
@@ -238,12 +239,14 @@ class FileDisplayActivityIT : AbstractOnServerIT() {
|
||||
onView(withId(R.id.sort_button)).check(matches(withEffectiveVisibility(ViewMatchers.Visibility.GONE)))
|
||||
|
||||
// browse into folder
|
||||
onView(withId(R.id.list_root)).perform(
|
||||
RecyclerViewActions.actionOnItemAtPosition<OCFileListItemViewHolder>(
|
||||
0,
|
||||
click()
|
||||
onView(withId(R.id.list_root))
|
||||
.perform(closeSoftKeyboard())
|
||||
.perform(
|
||||
RecyclerViewActions.actionOnItemAtPosition<OCFileListItemViewHolder>(
|
||||
0,
|
||||
click()
|
||||
)
|
||||
)
|
||||
)
|
||||
shortSleep()
|
||||
checkToolbarTitle(topFolder)
|
||||
// sort button should now be visible
|
||||
|
||||
@@ -128,11 +128,15 @@ public abstract class AbstractOnServerIT extends AbstractIT {
|
||||
|
||||
if (!remoteFile.getRemotePath().equals("/")) {
|
||||
if (remoteFile.isEncrypted()) {
|
||||
assertTrue(new ToggleEncryptionRemoteOperation(remoteFile.getLocalId(),
|
||||
remoteFile.getRemotePath(),
|
||||
false)
|
||||
.execute(client)
|
||||
.isSuccess());
|
||||
ToggleEncryptionRemoteOperation operation = new ToggleEncryptionRemoteOperation(remoteFile.getLocalId(),
|
||||
remoteFile.getRemotePath(),
|
||||
false);
|
||||
|
||||
boolean operationResult = operation
|
||||
.execute(client)
|
||||
.isSuccess();
|
||||
|
||||
assertTrue(operationResult);
|
||||
}
|
||||
|
||||
boolean removeResult = false;
|
||||
|
||||
@@ -460,7 +460,7 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
testOnlyOnServer(NextcloudVersion.nextcloud_27);
|
||||
|
||||
File file = getFile("gps.jpg");
|
||||
String remotePath = "/gps.jpg";
|
||||
String remotePath = "/metadata.jpg";
|
||||
OCUpload ocUpload = new OCUpload(file.getAbsolutePath(), remotePath, account.name);
|
||||
|
||||
assertTrue(
|
||||
@@ -497,7 +497,7 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
|
||||
OCFile ocFile = null;
|
||||
for (OCFile f : files) {
|
||||
if (f.getFileName().equals("gps.jpg")) {
|
||||
if (f.getFileName().equals("metadata.jpg")) {
|
||||
ocFile = f;
|
||||
break;
|
||||
}
|
||||
@@ -505,8 +505,8 @@ public class UploadIT extends AbstractOnServerIT {
|
||||
|
||||
assertNotNull(ocFile);
|
||||
assertEquals(remotePath, ocFile.getRemotePath());
|
||||
assertEquals(new ImageDimension(300f, 200f), ocFile.getImageDimension());
|
||||
assertEquals(new GeoLocation(64, -46), ocFile.getGeoLocation());
|
||||
assertEquals(new ImageDimension(300f, 200f), ocFile.getImageDimension());
|
||||
}
|
||||
|
||||
private void verifyStoragePath(OCFile file) {
|
||||
|
||||
@@ -37,6 +37,7 @@ class OCCapabilityIT : AbstractIT() {
|
||||
capability.etag = "123"
|
||||
capability.userStatus = CapabilityBooleanType.TRUE
|
||||
capability.userStatusSupportsEmoji = CapabilityBooleanType.TRUE
|
||||
capability.dropAccount = CapabilityBooleanType.TRUE
|
||||
|
||||
fileDataStorageManager.saveCapabilities(capability)
|
||||
|
||||
@@ -45,5 +46,6 @@ class OCCapabilityIT : AbstractIT() {
|
||||
assertEquals(capability.etag, newCapability.etag)
|
||||
assertEquals(capability.userStatus, newCapability.userStatus)
|
||||
assertEquals(capability.userStatusSupportsEmoji, newCapability.userStatusSupportsEmoji)
|
||||
assertEquals(capability.dropAccount, newCapability.dropAccount)
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
|
||||
import com.owncloud.android.ui.trashbin.TrashbinRepository.LoadFolderCallback
|
||||
|
||||
class TrashbinLocalRepository(val testCase: TrashbinActivityIT.TestCase) : TrashbinRepository {
|
||||
class TrashbinLocalRepository(private val testCase: TrashbinActivityIT.TestCase) : TrashbinRepository {
|
||||
override fun emptyTrashbin(callback: TrashbinRepository.OperationCallback?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
@@ -20,14 +20,15 @@
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
|
||||
/**
|
||||
* Activity providing information about ways to participate in the app's development.
|
||||
*/
|
||||
class HuaweiCommunityActivity : CommunityActivity() {
|
||||
override fun setupContent() {
|
||||
super.setupContent()
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding.communityReleaseCandidatePlaystore.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
@@ -457,16 +457,23 @@ public class InputStreamBinder extends IInputStreamService.Stub {
|
||||
}
|
||||
|
||||
private boolean isValid(NextcloudRequest request) {
|
||||
String callingPackageName = context.getPackageManager().getNameForUid(Binder.getCallingUid());
|
||||
String[] callingPackageNames = context.getPackageManager().getPackagesForUid(Binder.getCallingUid());
|
||||
|
||||
SharedPreferences sharedPreferences = context.getSharedPreferences(SSO_SHARED_PREFERENCE,
|
||||
Context.MODE_PRIVATE);
|
||||
String hash = sharedPreferences.getString(callingPackageName + DELIMITER + request.getAccountName(), "");
|
||||
return validateToken(hash, request.getToken());
|
||||
for (String callingPackageName : callingPackageNames) {
|
||||
String hash = sharedPreferences.getString(callingPackageName + DELIMITER + request.getAccountName(), "");
|
||||
if (hash.isEmpty())
|
||||
continue;
|
||||
if (validateToken(hash, request.getToken())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean validateToken(String hash, String token) {
|
||||
if (hash.isEmpty() || !hash.contains("$")) {
|
||||
if (!hash.contains("$")) {
|
||||
throw new IllegalStateException(EXCEPTION_INVALID_TOKEN);
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ import com.nextcloud.client.database.entity.ShareEntity
|
||||
import com.nextcloud.client.database.entity.SyncedFolderEntity
|
||||
import com.nextcloud.client.database.entity.UploadEntity
|
||||
import com.nextcloud.client.database.entity.VirtualEntity
|
||||
import com.nextcloud.client.database.migrations.DatabaseMigrationUtil
|
||||
import com.nextcloud.client.database.migrations.Migration67to68
|
||||
import com.nextcloud.client.database.migrations.Migration70to71
|
||||
import com.nextcloud.client.database.migrations.RoomMigration
|
||||
import com.nextcloud.client.database.migrations.addLegacyMigrations
|
||||
import com.owncloud.android.db.ProviderMeta
|
||||
@@ -64,8 +64,10 @@ import com.owncloud.android.db.ProviderMeta
|
||||
AutoMigration(from = 66, to = 67),
|
||||
AutoMigration(from = 68, to = 69),
|
||||
AutoMigration(from = 69, to = 70),
|
||||
AutoMigration(from = 70, to = 71, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class),
|
||||
AutoMigration(from = 71, to = 72),
|
||||
AutoMigration(from = 72, to = 73)
|
||||
AutoMigration(from = 72, to = 73),
|
||||
AutoMigration(from = 73, to = 74, spec = DatabaseMigrationUtil.ResetCapabilitiesPostMigration::class)
|
||||
],
|
||||
exportSchema = true
|
||||
)
|
||||
@@ -92,10 +94,9 @@ abstract class NextcloudDatabase : RoomDatabase() {
|
||||
INSTANCE = Room
|
||||
.databaseBuilder(context, NextcloudDatabase::class.java, ProviderMeta.DB_NAME)
|
||||
.allowMainThreadQueries()
|
||||
.addLegacyMigrations(clock)
|
||||
.addLegacyMigrations(clock, context)
|
||||
.addMigrations(RoomMigration())
|
||||
.addMigrations(Migration67to68())
|
||||
.addMigrations(Migration70to71())
|
||||
.fallbackToDestructiveMigration()
|
||||
.build()
|
||||
}
|
||||
|
||||
@@ -129,5 +129,7 @@ data class CapabilityEntity(
|
||||
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_FILES_LOCKING_VERSION)
|
||||
val filesLockingVersion: String?,
|
||||
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_GROUPFOLDERS)
|
||||
val groupfolders: Int?
|
||||
val groupfolders: Int?,
|
||||
@ColumnInfo(name = ProviderTableMeta.CAPABILITIES_DROP_ACCOUNT)
|
||||
val dropAccount: Int?
|
||||
)
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
package com.nextcloud.client.database.migrations
|
||||
|
||||
import androidx.room.migration.AutoMigrationSpec
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
object DatabaseMigrationUtil {
|
||||
@@ -102,4 +103,14 @@ object DatabaseMigrationUtil {
|
||||
database.execSQL("DROP TABLE $tableName")
|
||||
database.execSQL("ALTER TABLE $newTableTempName RENAME TO $tableName")
|
||||
}
|
||||
|
||||
/**
|
||||
* Room AutoMigrationSpec to reset capabilities post migration.
|
||||
*/
|
||||
class ResetCapabilitiesPostMigration : AutoMigrationSpec {
|
||||
override fun onPostMigrate(db: SupportSQLiteDatabase) {
|
||||
resetCapabilities(db)
|
||||
super.onPostMigrate(db)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
package com.nextcloud.client.database.migrations
|
||||
|
||||
import android.content.Context
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
@@ -36,12 +37,13 @@ private const val MIN_SUPPORTED_DB_VERSION = 24
|
||||
class LegacyMigration(
|
||||
private val from: Int,
|
||||
private val to: Int,
|
||||
private val clock: Clock
|
||||
private val clock: Clock,
|
||||
private val context: Context
|
||||
) : Migration(from, to) {
|
||||
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
LegacyMigrationHelper(clock)
|
||||
.onUpgrade(database, from, to)
|
||||
LegacyMigrationHelper(clock, context)
|
||||
.tryUpgrade(database, from, to)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,10 +54,11 @@ class LegacyMigration(
|
||||
*/
|
||||
@Suppress("ForEachOnRange")
|
||||
fun RoomDatabase.Builder<NextcloudDatabase>.addLegacyMigrations(
|
||||
clock: Clock
|
||||
clock: Clock,
|
||||
context: Context
|
||||
): RoomDatabase.Builder<NextcloudDatabase> {
|
||||
(MIN_SUPPORTED_DB_VERSION until NextcloudDatabase.FIRST_ROOM_DB_VERSION - 1)
|
||||
.map { from -> LegacyMigration(from, from + 1, clock) }
|
||||
.map { from -> LegacyMigration(from, from + 1, clock, context) }
|
||||
.forEach { migration -> this.addMigrations(migration) }
|
||||
return this
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
package com.nextcloud.client.database.migrations;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
@@ -31,11 +32,11 @@ import com.owncloud.android.datamodel.SyncedFolder;
|
||||
import com.owncloud.android.db.ProviderMeta;
|
||||
import com.owncloud.android.files.services.NameCollisionPolicy;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.providers.FileContentProvider;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
public class LegacyMigrationHelper {
|
||||
|
||||
@@ -52,12 +53,29 @@ public class LegacyMigrationHelper {
|
||||
private static final String UPGRADE_VERSION_MSG = "OUT of the ADD in onUpgrade; oldVersion == %d, newVersion == %d";
|
||||
|
||||
private final Clock clock;
|
||||
private final Context context;
|
||||
|
||||
public LegacyMigrationHelper(Clock clock) {
|
||||
public LegacyMigrationHelper(Clock clock, Context context) {
|
||||
this.clock = clock;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void onUpgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
public void tryUpgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
try {
|
||||
upgrade(db, oldVersion, newVersion);
|
||||
} catch (Throwable t) {
|
||||
Log_OC.i(TAG, "Migration upgrade failed due to " + t);
|
||||
clearStorage();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_BAD_PRACTICE")
|
||||
private void clearStorage() {
|
||||
context.getCacheDir().delete();
|
||||
((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).clearApplicationUserData();
|
||||
}
|
||||
|
||||
private void upgrade(SupportSQLiteDatabase db, int oldVersion, int newVersion) {
|
||||
Log_OC.i(TAG, "Entering in onUpgrade");
|
||||
boolean upgraded = false;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ import com.owncloud.android.ui.activity.ToolbarActivity;
|
||||
import com.owncloud.android.ui.activity.UploadFilesActivity;
|
||||
import com.owncloud.android.ui.activity.UploadListActivity;
|
||||
import com.owncloud.android.ui.activity.UserInfoActivity;
|
||||
import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
|
||||
import com.owncloud.android.ui.dialog.AccountRemovalDialog;
|
||||
import com.owncloud.android.ui.dialog.ChooseRichDocumentsTemplateDialogFragment;
|
||||
import com.owncloud.android.ui.dialog.ChooseTemplateDialogFragment;
|
||||
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
|
||||
@@ -270,7 +270,7 @@ abstract class ComponentsModule {
|
||||
abstract ChooseTemplateDialogFragment chooseTemplateDialogFragment();
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract AccountRemovalConfirmationDialog accountRemovalConfirmationDialog();
|
||||
abstract AccountRemovalDialog accountRemovalDialog();
|
||||
|
||||
@ContributesAndroidInjector
|
||||
abstract ChooseRichDocumentsTemplateDialogFragment chooseRichDocumentsTemplateDialogFragment();
|
||||
|
||||
@@ -137,6 +137,7 @@ interface BackgroundJobManager {
|
||||
fun startAccountRemovalJob(accountName: String, remoteWipe: Boolean)
|
||||
fun startFilesUploadJob(user: User)
|
||||
fun getFileUploads(user: User): LiveData<List<JobInfo>>
|
||||
fun cancelFilesUploadJob(user: User)
|
||||
|
||||
fun startPdfGenerateAndUploadWork(user: User, uploadFolder: String, imagePaths: List<String>, pdfPath: String)
|
||||
|
||||
|
||||
@@ -461,6 +461,10 @@ internal class BackgroundJobManagerImpl(
|
||||
return workInfo.map { it -> it.map { fromWorkInfo(it) ?: JobInfo() } }
|
||||
}
|
||||
|
||||
override fun cancelFilesUploadJob(user: User) {
|
||||
workManager.cancelJob(JOB_FILES_UPLOAD, user)
|
||||
}
|
||||
|
||||
override fun startPdfGenerateAndUploadWork(
|
||||
user: User,
|
||||
uploadFolder: String,
|
||||
|
||||
@@ -76,6 +76,7 @@ class FilesUploadWorker(
|
||||
private val notificationManager: NotificationManager =
|
||||
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
private val fileUploaderDelegate = FileUploaderDelegate()
|
||||
private var currentUploadFileOperation: UploadFileOperation? = null
|
||||
|
||||
override fun doWork(): Result {
|
||||
val accountName = inputData.getString(ACCOUNT)
|
||||
@@ -89,7 +90,7 @@ class FilesUploadWorker(
|
||||
* they will be present in the pages that follow.
|
||||
*/
|
||||
var currentPage = uploadsStorageManager.getCurrentAndPendingUploadsForAccountPageAscById(-1, accountName)
|
||||
while (currentPage.isNotEmpty()) {
|
||||
while (currentPage.isNotEmpty() && !isStopped) {
|
||||
Log_OC.d(TAG, "Handling ${currentPage.size} uploads for account $accountName")
|
||||
val lastId = currentPage.last().uploadId
|
||||
handlePendingUploads(currentPage, accountName)
|
||||
@@ -105,11 +106,16 @@ class FilesUploadWorker(
|
||||
val user = userAccountManager.getUser(accountName)
|
||||
|
||||
for (upload in uploads) {
|
||||
if (isStopped) {
|
||||
break
|
||||
}
|
||||
// create upload file operation
|
||||
if (user.isPresent) {
|
||||
val uploadFileOperation = createUploadFileOperation(upload, user.get())
|
||||
|
||||
currentUploadFileOperation = uploadFileOperation
|
||||
val result = upload(uploadFileOperation, user.get())
|
||||
currentUploadFileOperation = null
|
||||
|
||||
fileUploaderDelegate.sendBroadcastUploadFinished(
|
||||
uploadFileOperation,
|
||||
@@ -172,13 +178,16 @@ class FilesUploadWorker(
|
||||
Log_OC.e(TAG, "Error uploading", e)
|
||||
uploadResult = RemoteOperationResult<Any?>(e)
|
||||
} finally {
|
||||
uploadsStorageManager.updateDatabaseUploadResult(uploadResult, uploadFileOperation)
|
||||
// only update db if operation finished and worker didn't get canceled
|
||||
if (!(isStopped && uploadResult.isCancelled)) {
|
||||
uploadsStorageManager.updateDatabaseUploadResult(uploadResult, uploadFileOperation)
|
||||
|
||||
// / notify result
|
||||
notifyUploadResult(uploadFileOperation, uploadResult)
|
||||
// / notify result
|
||||
notifyUploadResult(uploadFileOperation, uploadResult)
|
||||
|
||||
// cancel notification
|
||||
notificationManager.cancel(FOREGROUND_SERVICE_ID)
|
||||
// cancel notification
|
||||
notificationManager.cancel(FOREGROUND_SERVICE_ID)
|
||||
}
|
||||
}
|
||||
|
||||
return uploadResult
|
||||
@@ -357,6 +366,12 @@ class FilesUploadWorker(
|
||||
lastPercent = percent
|
||||
}
|
||||
|
||||
override fun onStopped() {
|
||||
super.onStopped()
|
||||
currentUploadFileOperation?.cancel(null)
|
||||
notificationManager.cancel(FOREGROUND_SERVICE_ID)
|
||||
}
|
||||
|
||||
companion object {
|
||||
val TAG: String = FilesUploadWorker::class.java.simpleName
|
||||
private const val FOREGROUND_SERVICE_ID: Int = 412
|
||||
|
||||
@@ -105,12 +105,19 @@ class MediaFoldersDetectionWork constructor(
|
||||
)
|
||||
val imageMediaFolderPaths: MutableList<String> = ArrayList()
|
||||
val videoMediaFolderPaths: MutableList<String> = ArrayList()
|
||||
|
||||
for (imageMediaFolder in imageMediaFolders) {
|
||||
imageMediaFolderPaths.add(imageMediaFolder.absolutePath)
|
||||
imageMediaFolder.absolutePath?.let {
|
||||
imageMediaFolderPaths.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
for (videoMediaFolder in videoMediaFolders) {
|
||||
imageMediaFolderPaths.add(videoMediaFolder.absolutePath)
|
||||
videoMediaFolder.absolutePath?.let {
|
||||
imageMediaFolderPaths.add(it)
|
||||
}
|
||||
}
|
||||
|
||||
val arbitraryDataString = arbitraryDataProvider.getValue(ACCOUNT_NAME_GLOBAL, KEY_MEDIA_FOLDERS)
|
||||
if (!TextUtils.isEmpty(arbitraryDataString)) {
|
||||
mediaFoldersModel = gson.fromJson(arbitraryDataString, MediaFoldersModel::class.java)
|
||||
|
||||
@@ -198,17 +198,21 @@ class FirstRunActivity : BaseActivity(), ViewPager.OnPageChangeListener, Injecta
|
||||
this,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
onFinish()
|
||||
val isFromAddAccount = intent.getBooleanExtra(EXTRA_ALLOW_CLOSE, false)
|
||||
|
||||
if (intent.getBooleanExtra(EXTRA_ALLOW_CLOSE, false)) {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
val destination: Intent = if (isFromAddAccount) {
|
||||
Intent(applicationContext, FileDisplayActivity::class.java)
|
||||
} else {
|
||||
val intent = Intent(applicationContext, AuthenticatorActivity::class.java)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
intent.putExtra(EXTRA_EXIT, true)
|
||||
startActivity(intent)
|
||||
finish()
|
||||
Intent(applicationContext, AuthenticatorActivity::class.java)
|
||||
}
|
||||
|
||||
if (!isFromAddAccount) {
|
||||
destination.putExtra(EXTRA_EXIT, true)
|
||||
}
|
||||
|
||||
destination.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
startActivity(destination)
|
||||
finish()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Alper Ozturk
|
||||
* Copyright (C) 2023 Alper Ozturk
|
||||
* Copyright (C) 2023 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.nextcloud.utils.extensions
|
||||
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.widget.TextView
|
||||
import androidx.core.text.HtmlCompat
|
||||
|
||||
@Suppress("NewLineAtEndOfFile")
|
||||
fun TextView.setHtmlContent(value: String) {
|
||||
movementMethod = LinkMovementMethod.getInstance()
|
||||
text = HtmlCompat.fromHtml(value, HtmlCompat.FROM_HTML_MODE_LEGACY)
|
||||
}
|
||||
@@ -254,9 +254,12 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
||||
|
||||
if (!isCrashReportingProcess && !appInfo.isDebugBuild()) {
|
||||
Thread.UncaughtExceptionHandler defaultPlatformHandler = Thread.getDefaultUncaughtExceptionHandler();
|
||||
final ExceptionHandler crashReporter = new ExceptionHandler(this,
|
||||
defaultPlatformHandler);
|
||||
Thread.setDefaultUncaughtExceptionHandler(crashReporter);
|
||||
|
||||
if (defaultPlatformHandler != null) {
|
||||
final ExceptionHandler crashReporter = new ExceptionHandler(this,
|
||||
defaultPlatformHandler);
|
||||
Thread.setDefaultUncaughtExceptionHandler(crashReporter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,25 +794,34 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
||||
+ syncedFolder.getId() + " - " + syncedFolder.getLocalPath());
|
||||
|
||||
for (MediaFolder imageMediaFolder : imageMediaFolders) {
|
||||
if (imageMediaFolder.absolutePath.equals(syncedFolder.getLocalPath())) {
|
||||
newSyncedFolder = (SyncedFolder) syncedFolder.clone();
|
||||
newSyncedFolder.setType(MediaFolderType.IMAGE);
|
||||
primaryKey = syncedFolderProvider.storeSyncedFolder(newSyncedFolder);
|
||||
Log_OC.i(TAG, "Migrated image synced_folders record: "
|
||||
+ primaryKey + " - " + newSyncedFolder.getLocalPath());
|
||||
break;
|
||||
String absolutePathOfImageFolder = imageMediaFolder.absolutePath;
|
||||
|
||||
if (absolutePathOfImageFolder != null) {
|
||||
if (absolutePathOfImageFolder.equals(syncedFolder.getLocalPath())) {
|
||||
newSyncedFolder = (SyncedFolder) syncedFolder.clone();
|
||||
newSyncedFolder.setType(MediaFolderType.IMAGE);
|
||||
primaryKey = syncedFolderProvider.storeSyncedFolder(newSyncedFolder);
|
||||
Log_OC.i(TAG, "Migrated image synced_folders record: "
|
||||
+ primaryKey + " - " + newSyncedFolder.getLocalPath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (MediaFolder videoMediaFolder : videoMediaFolders) {
|
||||
if (videoMediaFolder.absolutePath.equals(syncedFolder.getLocalPath())) {
|
||||
newSyncedFolder = (SyncedFolder) syncedFolder.clone();
|
||||
newSyncedFolder.setType(MediaFolderType.VIDEO);
|
||||
primaryKey = syncedFolderProvider.storeSyncedFolder(newSyncedFolder);
|
||||
Log_OC.i(TAG, "Migrated video synced_folders record: "
|
||||
+ primaryKey + " - " + newSyncedFolder.getLocalPath());
|
||||
break;
|
||||
String absolutePathOfVideoFolder = videoMediaFolder.absolutePath;
|
||||
|
||||
if (absolutePathOfVideoFolder != null) {
|
||||
if (absolutePathOfVideoFolder.equals(syncedFolder.getLocalPath())) {
|
||||
newSyncedFolder = (SyncedFolder) syncedFolder.clone();
|
||||
newSyncedFolder.setType(MediaFolderType.VIDEO);
|
||||
primaryKey = syncedFolderProvider.storeSyncedFolder(newSyncedFolder);
|
||||
Log_OC.i(TAG, "Migrated video synced_folders record: "
|
||||
+ primaryKey + " - " + newSyncedFolder.getLocalPath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -835,19 +847,22 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
||||
|
||||
List<SyncedFolder> syncedFolderList = syncedFolderProvider.getSyncedFolders();
|
||||
Map<Pair<String, String>, Long> syncedFolders = new HashMap<>();
|
||||
ArrayList<Long> ids = new ArrayList<>();
|
||||
for (SyncedFolder syncedFolder : syncedFolderList) {
|
||||
Pair<String, String> checkPair = new Pair<>(syncedFolder.getAccount(), syncedFolder.getLocalPath());
|
||||
if (syncedFolders.containsKey(checkPair)) {
|
||||
if (syncedFolder.getId() > syncedFolders.get(checkPair)) {
|
||||
syncedFolders.put(checkPair, syncedFolder.getId());
|
||||
Long folderId = syncedFolders.get(checkPair);
|
||||
|
||||
if (folderId != null) {
|
||||
if (syncedFolder.getId() > folderId) {
|
||||
syncedFolders.put(checkPair, syncedFolder.getId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
syncedFolders.put(checkPair, syncedFolder.getId());
|
||||
}
|
||||
}
|
||||
|
||||
ids.addAll(syncedFolders.values());
|
||||
ArrayList<Long> ids = new ArrayList<>(syncedFolders.values());
|
||||
|
||||
if (ids.size() > 0) {
|
||||
int deletedCount = syncedFolderProvider.deleteSyncedFoldersNotInList(ids);
|
||||
@@ -865,18 +880,11 @@ public class MainApp extends MultiDexApplication implements HasAndroidInjector {
|
||||
return dispatchingAndroidInjector;
|
||||
}
|
||||
|
||||
|
||||
public static void setAppTheme(DarkMode mode) {
|
||||
switch (mode) {
|
||||
case LIGHT:
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
break;
|
||||
case DARK:
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
break;
|
||||
case SYSTEM:
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
break;
|
||||
case LIGHT -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
|
||||
case DARK -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
|
||||
case SYSTEM -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.owncloud.android.authentication;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.owncloud.android.R;
|
||||
|
||||
public class DeepLinkLoginActivity extends AuthenticatorActivity implements Injectable {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
if (!getResources().getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.getAccounts().length == 1) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.deep_link_login);
|
||||
|
||||
Uri data = getIntent().getData();
|
||||
|
||||
if (data != null) {
|
||||
try {
|
||||
String prefix = getString(R.string.login_data_own_scheme) + PROTOCOL_SUFFIX + "login/";
|
||||
LoginUrlInfo loginUrlInfo = parseLoginDataUrl(prefix, data.toString());
|
||||
|
||||
TextView loginText = findViewById(R.id.loginInfo);
|
||||
loginText.setText(String.format(getString(R.string.direct_login_text), loginUrlInfo.username,
|
||||
loginUrlInfo.serverAddress));
|
||||
} catch (IllegalArgumentException e) {
|
||||
Toast.makeText(this, R.string.direct_login_failed, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.owncloud.android.authentication
|
||||
|
||||
import android.os.Bundle
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.owncloud.android.R
|
||||
|
||||
class DeepLinkLoginActivity : AuthenticatorActivity(), Injectable {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
if (!resources.getBoolean(R.bool.multiaccount_support) &&
|
||||
accountManager.accounts.size == 1
|
||||
) {
|
||||
Toast.makeText(this, R.string.no_mutliple_accounts_allowed, Toast.LENGTH_LONG).show()
|
||||
return
|
||||
}
|
||||
|
||||
setContentView(R.layout.deep_link_login)
|
||||
|
||||
intent.data?.let {
|
||||
try {
|
||||
val prefix = getString(R.string.login_data_own_scheme) + PROTOCOL_SUFFIX + "login/"
|
||||
val loginUrlInfo = parseLoginDataUrl(prefix, it.toString())
|
||||
val loginText = findViewById<TextView>(R.id.loginInfo)
|
||||
loginText.text = String.format(
|
||||
getString(R.string.direct_login_text), loginUrlInfo.username,
|
||||
loginUrlInfo.serverAddress
|
||||
)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
Toast.makeText(this, R.string.direct_login_failed, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1947,6 +1947,7 @@ public class FileDataStorageManager {
|
||||
contentValues.put(ProviderTableMeta.CAPABILITIES_FILES_LOCKING_VERSION,
|
||||
capability.getFilesLockingVersion());
|
||||
contentValues.put(ProviderTableMeta.CAPABILITIES_GROUPFOLDERS, capability.getGroupfolders().getValue());
|
||||
contentValues.put(ProviderTableMeta.CAPABILITIES_DROP_ACCOUNT, capability.getDropAccount().getValue());
|
||||
|
||||
return contentValues;
|
||||
}
|
||||
@@ -2103,6 +2104,7 @@ public class FileDataStorageManager {
|
||||
capability.setFilesLockingVersion(
|
||||
getString(cursor, ProviderTableMeta.CAPABILITIES_FILES_LOCKING_VERSION));
|
||||
capability.setGroupfolders(getBoolean(cursor, ProviderTableMeta.CAPABILITIES_GROUPFOLDERS));
|
||||
capability.setDropAccount(getBoolean(cursor, ProviderTableMeta.CAPABILITIES_DROP_ACCOUNT));
|
||||
}
|
||||
return capability;
|
||||
}
|
||||
|
||||
@@ -16,29 +16,31 @@
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* License along with this program. If not, see <http:></http:>//www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.datamodel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
package com.owncloud.android.datamodel
|
||||
|
||||
/**
|
||||
* Business object representing a media folder with all information that are gathered via media queries.
|
||||
*/
|
||||
public class MediaFolder {
|
||||
/** name of the folder. */
|
||||
public String folderName;
|
||||
class MediaFolder {
|
||||
/** name of the folder. */
|
||||
@JvmField
|
||||
var folderName: String? = null
|
||||
|
||||
/** absolute path of the folder. */
|
||||
public String absolutePath;
|
||||
|
||||
/** list of file paths of the folder's content */
|
||||
public List<String> filePaths = new ArrayList<>();
|
||||
/** absolute path of the folder. */
|
||||
@JvmField
|
||||
var absolutePath: String? = null
|
||||
|
||||
/** total number of files in the media folder. */
|
||||
public long numberOfFiles;
|
||||
/** list of file paths of the folder's content */
|
||||
@JvmField
|
||||
var filePaths: List<String> = ArrayList()
|
||||
|
||||
/** type of media folder. */
|
||||
public MediaFolderType type;
|
||||
/** total number of files in the media folder. */
|
||||
@JvmField
|
||||
var numberOfFiles: Long = 0
|
||||
|
||||
/** type of media folder. */
|
||||
@JvmField
|
||||
var type: MediaFolderType? = null
|
||||
}
|
||||
@@ -17,37 +17,28 @@
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.datamodel;
|
||||
package com.owncloud.android.datamodel
|
||||
|
||||
import android.util.SparseArray;
|
||||
import android.util.SparseArray
|
||||
|
||||
/**
|
||||
* Types of media folder.
|
||||
*/
|
||||
public enum MediaFolderType {
|
||||
CUSTOM(0),
|
||||
IMAGE(1),
|
||||
VIDEO(2);
|
||||
enum class MediaFolderType(@JvmField val id: Int) {
|
||||
CUSTOM(0), IMAGE(1), VIDEO(2);
|
||||
|
||||
private Integer id;
|
||||
companion object {
|
||||
private val reverseMap = SparseArray<MediaFolderType>(3)
|
||||
|
||||
private static SparseArray<MediaFolderType> reverseMap = new SparseArray<>(3);
|
||||
init {
|
||||
reverseMap.put(CUSTOM.id, CUSTOM)
|
||||
reverseMap.put(IMAGE.id, IMAGE)
|
||||
reverseMap.put(VIDEO.id, VIDEO)
|
||||
}
|
||||
|
||||
static {
|
||||
reverseMap.put(CUSTOM.getId(), CUSTOM);
|
||||
reverseMap.put(IMAGE.getId(), IMAGE);
|
||||
reverseMap.put(VIDEO.getId(), VIDEO);
|
||||
}
|
||||
|
||||
MediaFolderType(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static MediaFolderType getById(Integer id) {
|
||||
return reverseMap.get(id);
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
@JvmStatic
|
||||
fun getById(id: Int?): MediaFolderType {
|
||||
return reverseMap[id!!]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2018 Mario Danic
|
||||
* Copyright (C) 2018 Andy Scherzinger
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.datamodel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MediaFoldersModel {
|
||||
private List<String> imageMediaFolders;
|
||||
private List<String> videoMediaFolders;
|
||||
|
||||
public MediaFoldersModel(List<String> imageMediaFolders, List<String> videoMediaFolders) {
|
||||
this.imageMediaFolders = imageMediaFolders;
|
||||
this.videoMediaFolders = videoMediaFolders;
|
||||
}
|
||||
|
||||
public List<String> getImageMediaFolders() {
|
||||
return this.imageMediaFolders;
|
||||
}
|
||||
|
||||
public List<String> getVideoMediaFolders() {
|
||||
return this.videoMediaFolders;
|
||||
}
|
||||
|
||||
public void setImageMediaFolders(List<String> imageMediaFolders) {
|
||||
this.imageMediaFolders = imageMediaFolders;
|
||||
}
|
||||
|
||||
public void setVideoMediaFolders(List<String> videoMediaFolders) {
|
||||
this.videoMediaFolders = videoMediaFolders;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Álvaro Brey
|
||||
* Copyright (C) 2023 Álvaro Brey
|
||||
* Copyright (C) 2023 Nextcloud GmbH
|
||||
* @author Mario Danic
|
||||
* @author Andy Scherzinger
|
||||
* Copyright (C) 2018 Mario Danic
|
||||
* Copyright (C) 2018 Andy Scherzinger
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
@@ -17,22 +18,7 @@
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.owncloud.android.datamodel
|
||||
|
||||
package com.nextcloud.client.database.migrations
|
||||
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
|
||||
/**
|
||||
* Migration from version 70 to 71.
|
||||
*
|
||||
* resets capabilities to show groupfolder
|
||||
*/
|
||||
@Suppress("MagicNumber")
|
||||
class Migration70to71 : Migration(70, 71) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
DatabaseMigrationUtil.resetCapabilities(database)
|
||||
}
|
||||
}
|
||||
class MediaFoldersModel(var imageMediaFolders: List<String>, var videoMediaFolders: List<String>)
|
||||
@@ -415,7 +415,7 @@ public class SyncedFolderProvider extends Observable {
|
||||
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_UPLOAD_ACTION, syncedFolder.getUploadAction());
|
||||
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_NAME_COLLISION_POLICY,
|
||||
syncedFolder.getNameCollisionPolicyInt());
|
||||
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_TYPE, syncedFolder.getType().getId());
|
||||
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_TYPE, syncedFolder.getType().id);
|
||||
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_HIDDEN, syncedFolder.isHidden());
|
||||
cv.put(ProviderMeta.ProviderTableMeta.SYNCED_FOLDER_SUBFOLDER_RULE, syncedFolder.getSubfolderRule().ordinal());
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.List;
|
||||
*/
|
||||
public class ProviderMeta {
|
||||
public static final String DB_NAME = "filelist";
|
||||
public static final int DB_VERSION = 73;
|
||||
public static final int DB_VERSION = 74;
|
||||
|
||||
private ProviderMeta() {
|
||||
// No instance
|
||||
@@ -259,6 +259,7 @@ public class ProviderMeta {
|
||||
public static final String CAPABILITIES_USER_STATUS = "user_status";
|
||||
public static final String CAPABILITIES_USER_STATUS_SUPPORTS_EMOJI = "user_status_supports_emoji";
|
||||
public static final String CAPABILITIES_GROUPFOLDERS = "groupfolders";
|
||||
public static final String CAPABILITIES_DROP_ACCOUNT = "drop_account";
|
||||
|
||||
//Columns of Uploads table
|
||||
public static final String UPLOADS_LOCAL_PATH = "local_path";
|
||||
|
||||
@@ -339,8 +339,7 @@ public class FileMenuFilter {
|
||||
}
|
||||
|
||||
private void filterRemove(List<Integer> toHide, boolean synchronizing) {
|
||||
if (files.isEmpty() || synchronizing || containsLockedFile()
|
||||
|| containsEncryptedFolder() || containsEncryptedFile()) {
|
||||
if (files.isEmpty() || synchronizing) {
|
||||
toHide.add(R.id.action_remove_file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
@@ -1152,24 +1153,34 @@ public class FileUploader extends Service
|
||||
* @param remotePath Remote target of the upload
|
||||
* @param resultCode Setting result code will pause rather than cancel the job
|
||||
*/
|
||||
private void cancel(String accountName, String remotePath, @Nullable ResultCode resultCode) {
|
||||
Pair<UploadFileOperation, String> removeResult = mPendingUploads.remove(accountName, remotePath);
|
||||
UploadFileOperation upload = removeResult.first;
|
||||
if (upload == null && mCurrentUpload != null && mCurrentAccount != null &&
|
||||
mCurrentUpload.getRemotePath().startsWith(remotePath) && accountName.equals(mCurrentAccount.name)) {
|
||||
public void cancel(String accountName, String remotePath, @Nullable ResultCode resultCode) {
|
||||
// Cancel for Android version >= Android 11
|
||||
if (useFilesUploadWorker(getApplicationContext())){
|
||||
try{
|
||||
new FilesUploadHelper().cancelFileUpload(remotePath, accountManager.getUser(accountName).get());
|
||||
}catch(NoSuchElementException e){
|
||||
Log_OC.e(TAG,"Error cancelling current upload because user does not exist!");
|
||||
}
|
||||
} else {
|
||||
// Cancel for Android version <= Android 10
|
||||
Pair<UploadFileOperation, String> removeResult = mPendingUploads.remove(accountName, remotePath);
|
||||
UploadFileOperation upload = removeResult.first;
|
||||
if (upload == null && mCurrentUpload != null && mCurrentAccount != null &&
|
||||
mCurrentUpload.getRemotePath().startsWith(remotePath) && accountName.equals(mCurrentAccount.name)) {
|
||||
|
||||
upload = mCurrentUpload;
|
||||
}
|
||||
upload = mCurrentUpload;
|
||||
}
|
||||
|
||||
if (upload != null) {
|
||||
upload.cancel(resultCode);
|
||||
// need to update now table in mUploadsStorageManager,
|
||||
// since the operation will not get to be run by FileUploader#uploadFile
|
||||
if (resultCode != null) {
|
||||
mUploadsStorageManager.updateDatabaseUploadResult(new RemoteOperationResult(resultCode), upload);
|
||||
notifyUploadResult(upload, new RemoteOperationResult(resultCode));
|
||||
} else {
|
||||
mUploadsStorageManager.removeUpload(accountName, remotePath);
|
||||
if (upload != null) {
|
||||
upload.cancel(resultCode);
|
||||
// need to update now table in mUploadsStorageManager,
|
||||
// since the operation will not get to be run by FileUploader#uploadFile
|
||||
if (resultCode != null) {
|
||||
mUploadsStorageManager.updateDatabaseUploadResult(new RemoteOperationResult(resultCode), upload);
|
||||
notifyUploadResult(upload, new RemoteOperationResult(resultCode));
|
||||
} else {
|
||||
mUploadsStorageManager.removeUpload(accountName, remotePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1180,16 +1191,19 @@ public class FileUploader extends Service
|
||||
* @param user Nextcloud user
|
||||
*/
|
||||
public void cancel(User user) {
|
||||
if (mCurrentUpload != null && mCurrentUpload.getUser().nameEquals(user)) {
|
||||
mCurrentUpload.cancel(ResultCode.CANCELLED);
|
||||
}
|
||||
cancelPendingUploads(user.getAccountName());
|
||||
cancel(user.getAccountName());
|
||||
}
|
||||
|
||||
public void cancel(String accountName) {
|
||||
if (mCurrentUpload != null && mCurrentUpload.getUser().nameEquals(accountName)) {
|
||||
mCurrentUpload.cancel(ResultCode.CANCELLED);
|
||||
cancelPendingUploads(accountName);
|
||||
if (useFilesUploadWorker(getApplicationContext())) {
|
||||
new FilesUploadHelper().restartUploadJob(accountManager.getUser(accountName).get());
|
||||
}else{
|
||||
if (mCurrentUpload != null && mCurrentUpload.getUser().nameEquals(accountName)) {
|
||||
mCurrentUpload.cancel(ResultCode.CANCELLED);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void clearListeners() {
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2016 Andy Scherzinger
|
||||
* Copyright (C) 2016 Nextcloud
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.text.method.LinkMovementMethod;
|
||||
import android.view.MenuItem;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.google.android.material.button.MaterialButton;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.CommunityLayoutBinding;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
|
||||
/**
|
||||
* Activity providing information about ways to participate in the app's development.
|
||||
*/
|
||||
public class CommunityActivity extends DrawerActivity {
|
||||
|
||||
protected CommunityLayoutBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = CommunityLayoutBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
// setup toolbar
|
||||
setupToolbar();
|
||||
|
||||
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_community));
|
||||
|
||||
// setup drawer
|
||||
setupDrawer(R.id.nav_community);
|
||||
|
||||
setupContent();
|
||||
}
|
||||
|
||||
protected void setupContent() {
|
||||
binding.communityReleaseCandidateText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
TextView contributeForumView = binding.communityContributeForumText;
|
||||
contributeForumView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
contributeForumView.setText(Html.fromHtml(getString(R.string.community_contribute_forum_text) + " " +
|
||||
getString(R.string.community_contribute_forum_text_link,
|
||||
viewThemeUtils
|
||||
.files
|
||||
.primaryColorToHexString(this),
|
||||
getString(R.string.help_link),
|
||||
getString(R.string.community_contribute_forum_forum))));
|
||||
|
||||
TextView contributeTranslationView = binding.communityContributeTranslateText;
|
||||
contributeTranslationView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
contributeTranslationView.setText(Html.fromHtml(
|
||||
getString(R.string.community_contribute_translate_link,
|
||||
viewThemeUtils.files.primaryColorToHexString(this),
|
||||
getString(R.string.translation_link),
|
||||
getString(R.string.community_contribute_translate_translate)) + " " +
|
||||
getString(R.string.community_contribute_translate_text)));
|
||||
|
||||
TextView contributeGithubView = binding.communityContributeGithubText;
|
||||
contributeGithubView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
contributeGithubView.setText(Html.fromHtml(
|
||||
getString(R.string.community_contribute_github_text,
|
||||
getString(R.string.community_contribute_github_text_link,
|
||||
viewThemeUtils.files.primaryColorToHexString(this),
|
||||
getString(R.string.contributing_link)))));
|
||||
|
||||
MaterialButton reportButton = binding.communityTestingReport;
|
||||
viewThemeUtils.material.colorMaterialButtonPrimaryFilled(reportButton);
|
||||
reportButton.setOnClickListener(v -> DisplayUtils.startLinkIntent(this, R.string.report_issue_empty_link));
|
||||
|
||||
binding.communityBetaFdroid.setOnClickListener(
|
||||
l -> DisplayUtils.startLinkIntent(this, R.string.fdroid_beta_link));
|
||||
|
||||
binding.communityReleaseCandidateFdroid.setOnClickListener(
|
||||
l -> DisplayUtils.startLinkIntent(this, R.string.fdroid_link));
|
||||
|
||||
binding.communityReleaseCandidatePlaystore.setOnClickListener(
|
||||
l -> DisplayUtils.startLinkIntent(this, R.string.play_store_register_beta));
|
||||
|
||||
binding.communityBetaApk.setOnClickListener(
|
||||
l -> DisplayUtils.startLinkIntent(this, R.string.beta_apk_link));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
boolean retval = true;
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
if (isDrawerOpen()) {
|
||||
closeDrawer();
|
||||
} else {
|
||||
openDrawer();
|
||||
}
|
||||
} else {
|
||||
retval = super.onOptionsItemSelected(item);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
setDrawerMenuItemChecked(R.id.nav_community);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2016 Andy Scherzinger
|
||||
* Copyright (C) 2016 Nextcloud
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.text.method.LinkMovementMethod
|
||||
import android.view.MenuItem
|
||||
import com.nextcloud.utils.extensions.setHtmlContent
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.CommunityLayoutBinding
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
|
||||
/**
|
||||
* Activity providing information about ways to participate in the app's development.
|
||||
*/
|
||||
open class CommunityActivity : DrawerActivity() {
|
||||
lateinit var binding: CommunityLayoutBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = CommunityLayoutBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
setupToolbar()
|
||||
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_community))
|
||||
|
||||
setupDrawer(R.id.nav_community)
|
||||
binding.communityReleaseCandidateText.movementMethod = LinkMovementMethod.getInstance()
|
||||
setupContributeForumView()
|
||||
setupContributeTranslationView()
|
||||
setupContributeGithubView()
|
||||
setupReportButton()
|
||||
setOnClickListeners()
|
||||
}
|
||||
|
||||
private fun setupContributeForumView() {
|
||||
val htmlContent = getString(R.string.community_contribute_forum_text) + " " +
|
||||
getString(
|
||||
R.string.community_contribute_forum_text_link,
|
||||
viewThemeUtils.files
|
||||
.primaryColorToHexString(this),
|
||||
getString(R.string.help_link),
|
||||
getString(R.string.community_contribute_forum_forum)
|
||||
)
|
||||
binding.communityContributeForumText.setHtmlContent(htmlContent)
|
||||
}
|
||||
|
||||
private fun setupContributeTranslationView() {
|
||||
val htmlContent = getString(
|
||||
R.string.community_contribute_translate_link,
|
||||
viewThemeUtils.files.primaryColorToHexString(this),
|
||||
getString(R.string.translation_link),
|
||||
getString(R.string.community_contribute_translate_translate)
|
||||
) + " " +
|
||||
getString(R.string.community_contribute_translate_text)
|
||||
binding.communityContributeTranslateText.setHtmlContent(htmlContent)
|
||||
}
|
||||
|
||||
private fun setupContributeGithubView() {
|
||||
val htmlContent = getString(
|
||||
R.string.community_contribute_github_text,
|
||||
getString(
|
||||
R.string.community_contribute_github_text_link,
|
||||
viewThemeUtils.files.primaryColorToHexString(this),
|
||||
getString(R.string.contributing_link)
|
||||
)
|
||||
)
|
||||
binding.communityContributeGithubText.setHtmlContent(htmlContent)
|
||||
}
|
||||
|
||||
private fun setupReportButton() {
|
||||
val reportButton = binding.communityTestingReport
|
||||
viewThemeUtils.material.colorMaterialButtonPrimaryFilled(reportButton)
|
||||
reportButton.setOnClickListener {
|
||||
DisplayUtils.startLinkIntent(
|
||||
this,
|
||||
R.string.report_issue_empty_link
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setOnClickListeners() {
|
||||
binding.communityBetaFdroid.setOnClickListener {
|
||||
DisplayUtils.startLinkIntent(
|
||||
this,
|
||||
R.string.fdroid_beta_link
|
||||
)
|
||||
}
|
||||
binding.communityReleaseCandidateFdroid.setOnClickListener {
|
||||
DisplayUtils.startLinkIntent(
|
||||
this,
|
||||
R.string.fdroid_link
|
||||
)
|
||||
}
|
||||
binding.communityReleaseCandidatePlaystore.setOnClickListener {
|
||||
DisplayUtils.startLinkIntent(
|
||||
this,
|
||||
R.string.play_store_register_beta
|
||||
)
|
||||
}
|
||||
binding.communityBetaApk.setOnClickListener {
|
||||
DisplayUtils.startLinkIntent(
|
||||
this,
|
||||
R.string.beta_apk_link
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
var retval = true
|
||||
if (item.itemId == android.R.id.home) {
|
||||
if (isDrawerOpen) {
|
||||
closeDrawer()
|
||||
} else {
|
||||
openDrawer()
|
||||
}
|
||||
} else {
|
||||
retval = super.onOptionsItemSelected(item)
|
||||
}
|
||||
return retval
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setDrawerMenuItemChecked(R.id.nav_community)
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import com.owncloud.android.ui.fragment.contactsbackup.BackupListFragment;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.drawerlayout.widget.DrawerLayout;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
@@ -115,6 +116,8 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag
|
||||
}
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
getOnBackPressedDispatcher().addCallback(this, onBackPressedCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -137,12 +140,14 @@ public class ContactsPreferenceActivity extends FileActivity implements FileFrag
|
||||
// not needed
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (getSupportFragmentManager().findFragmentByTag(BackupListFragment.TAG) != null) {
|
||||
getSupportFragmentManager().popBackStack(BACKUP_TO_LIST, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
} else {
|
||||
finish();
|
||||
private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
if (getSupportFragmentManager().findFragmentByTag(BackupListFragment.TAG) != null) {
|
||||
getSupportFragmentManager().popBackStack(BACKUP_TO_LIST, FragmentManager.POP_BACK_STACK_INCLUSIVE);
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -18,26 +18,20 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.owncloud.android.utils.ClipboardUtil;
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import com.owncloud.android.utils.ClipboardUtil
|
||||
|
||||
/**
|
||||
* Activity copying the text of the received Intent into the system clipboard.
|
||||
*/
|
||||
public class CopyToClipboardActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
ClipboardUtil.copyToClipboard(this, getIntent().getCharSequenceExtra(Intent.EXTRA_TEXT).toString());
|
||||
|
||||
finish();
|
||||
class CopyToClipboardActivity : Activity() {
|
||||
public override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
ClipboardUtil.copyToClipboard(this, intent.getCharSequenceExtra(Intent.EXTRA_TEXT).toString())
|
||||
finish()
|
||||
}
|
||||
}
|
||||
@@ -527,7 +527,7 @@ public abstract class DrawerActivity extends ToolbarActivity
|
||||
menuItem.setChecked(false);
|
||||
final Optional<User> optionalUser = getUser();
|
||||
if (optionalUser.isPresent()) {
|
||||
UserInfoActivity.openAccountRemovalConfirmationDialog(optionalUser.get(), getSupportFragmentManager());
|
||||
UserInfoActivity.openAccountRemovalDialog(optionalUser.get(), getSupportFragmentManager());
|
||||
}
|
||||
} else if (itemId == R.id.nav_shared) {
|
||||
startSharedSearch(menuItem);
|
||||
|
||||
@@ -779,6 +779,13 @@ public abstract class FileActivity extends DrawerActivity
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshList() {
|
||||
final Fragment fileListFragment = getSupportFragmentManager().findFragmentByTag(FileDisplayActivity.TAG_LIST_OF_FILES);
|
||||
if (fileListFragment != null) {
|
||||
((OCFileListFragment) fileListFragment).onRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
private void onCreateShareViaLinkOperationFinish(CreateShareViaLinkOperation operation,
|
||||
RemoteOperationResult result) {
|
||||
FileDetailSharingFragment sharingFragment = getShareFileFragment();
|
||||
|
||||
@@ -2507,8 +2507,7 @@ public class FileDisplayActivity extends FileActivity
|
||||
setUser(user);
|
||||
|
||||
if (fileId == null) {
|
||||
dismissLoadingDialog();
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.error_retrieving_file));
|
||||
onFileRequestError(null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2529,8 +2528,7 @@ public class FileDisplayActivity extends FileActivity
|
||||
setUser(user);
|
||||
|
||||
if (filepath == null) {
|
||||
dismissLoadingDialog();
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.error_retrieving_file));
|
||||
onFileRequestError(null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2544,8 +2542,7 @@ public class FileDisplayActivity extends FileActivity
|
||||
try {
|
||||
client = clientFactory.create(user);
|
||||
} catch (ClientFactory.CreationException e) {
|
||||
dismissLoadingDialog();
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.error_retrieving_file));
|
||||
onFileRequestError(null);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2554,9 +2551,17 @@ public class FileDisplayActivity extends FileActivity
|
||||
client,
|
||||
storageManager,
|
||||
user);
|
||||
asyncRunner.postQuickTask(getRemoteFileTask, this::onFileRequestResult, null);
|
||||
asyncRunner.postQuickTask(getRemoteFileTask, this::onFileRequestResult, this::onFileRequestError);
|
||||
}
|
||||
|
||||
private Unit onFileRequestError(Throwable throwable) {
|
||||
dismissLoadingDialog();
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.error_retrieving_file));
|
||||
Log_OC.e(TAG, "Requesting file from remote failed!", throwable);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private Unit onFileRequestResult(GetRemoteFileTask.Result result) {
|
||||
dismissLoadingDialog();
|
||||
|
||||
|
||||
@@ -18,40 +18,29 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.ui.fragment.OCFileListFragment;
|
||||
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import android.os.Bundle
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.ui.fragment.OCFileListFragment
|
||||
|
||||
/**
|
||||
* File picker of remote files
|
||||
*/
|
||||
public class FilePickerActivity extends FolderPickerActivity {
|
||||
class FilePickerActivity : FolderPickerActivity() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
super.onClick(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createFragments() {
|
||||
OCFileListFragment listOfFiles = new OCFileListFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putBoolean(OCFileListFragment.ARG_ONLY_FOLDERS_CLICKABLE, true);
|
||||
args.putBoolean(OCFileListFragment.ARG_HIDE_FAB, true);
|
||||
args.putBoolean(OCFileListFragment.ARG_HIDE_ITEM_OPTIONS, true);
|
||||
args.putBoolean(OCFileListFragment.ARG_SEARCH_ONLY_FOLDER, false);
|
||||
args.putBoolean(OCFileListFragment.ARG_FILE_SELECTABLE, true);
|
||||
args.putString(OCFileListFragment.ARG_MIMETYPE, getIntent().getStringExtra(OCFileListFragment.ARG_MIMETYPE));
|
||||
listOfFiles.setArguments(args);
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.add(R.id.fragment_container, listOfFiles, TAG_LIST_OF_FOLDERS);
|
||||
transaction.commit();
|
||||
override fun createFragments() {
|
||||
val listOfFiles = OCFileListFragment()
|
||||
val args = Bundle()
|
||||
args.putBoolean(OCFileListFragment.ARG_ONLY_FOLDERS_CLICKABLE, true)
|
||||
args.putBoolean(OCFileListFragment.ARG_HIDE_FAB, true)
|
||||
args.putBoolean(OCFileListFragment.ARG_HIDE_ITEM_OPTIONS, true)
|
||||
args.putBoolean(OCFileListFragment.ARG_SEARCH_ONLY_FOLDER, false)
|
||||
args.putBoolean(OCFileListFragment.ARG_FILE_SELECTABLE, true)
|
||||
args.putString(OCFileListFragment.ARG_MIMETYPE, intent.getStringExtra(OCFileListFragment.ARG_MIMETYPE))
|
||||
listOfFiles.arguments = args
|
||||
val transaction = supportFragmentManager.beginTransaction()
|
||||
transaction.add(R.id.fragment_container, listOfFiles, TAG_LIST_OF_FOLDERS)
|
||||
transaction.commit()
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,7 @@ import android.view.ActionMode
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.nextcloud.client.di.Injectable
|
||||
@@ -125,9 +126,33 @@ open class FolderPickerActivity :
|
||||
|
||||
// sets message for empty list of folders
|
||||
setBackgroundText()
|
||||
|
||||
handleOnBackPressed()
|
||||
|
||||
Log_OC.d(TAG, "onCreate() end")
|
||||
}
|
||||
|
||||
private fun handleOnBackPressed() {
|
||||
onBackPressedDispatcher.addCallback(
|
||||
this,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
val listOfFiles = listOfFilesFragment
|
||||
if (listOfFiles != null) {
|
||||
// should never be null, indeed
|
||||
val levelsUp = listOfFiles.onBrowseUp()
|
||||
if (levelsUp == 0) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
file = listOfFiles.currentFile
|
||||
updateUiElements()
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun onActionModeStarted(mode: ActionMode) {
|
||||
super.onActionModeStarted(mode)
|
||||
if (account != null) {
|
||||
@@ -321,20 +346,6 @@ open class FolderPickerActivity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
val listOfFiles = listOfFilesFragment
|
||||
if (listOfFiles != null) {
|
||||
// should never be null, indeed
|
||||
val levelsUp = listOfFiles.onBrowseUp()
|
||||
if (levelsUp == 0) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
file = listOfFiles.currentFile
|
||||
updateUiElements()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateUiElements() {
|
||||
toggleChooseEnabled()
|
||||
updateNavigationElementsInActionBar()
|
||||
@@ -605,6 +616,7 @@ open class FolderPickerActivity :
|
||||
const val MOVE_OR_COPY = "MOVE_OR_COPY"
|
||||
const val CHOOSE_LOCATION = "CHOOSE_LOCATION"
|
||||
private val TAG = FolderPickerActivity::class.java.simpleName
|
||||
protected const val TAG_LIST_OF_FOLDERS = "LIST_OF_FOLDERS"
|
||||
|
||||
const val TAG_LIST_OF_FOLDERS = "LIST_OF_FOLDERS"
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.services.OperationsService;
|
||||
import com.owncloud.android.ui.adapter.UserListAdapter;
|
||||
import com.owncloud.android.ui.adapter.UserListItem;
|
||||
import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
|
||||
import com.owncloud.android.ui.dialog.AccountRemovalDialog;
|
||||
import com.owncloud.android.ui.events.AccountRemovedEvent;
|
||||
import com.owncloud.android.ui.helpers.FileOperationsHelper;
|
||||
|
||||
@@ -470,9 +470,8 @@ public class ManageAccountsActivity extends FileActivity implements UserListAdap
|
||||
}
|
||||
}
|
||||
|
||||
public static void openAccountRemovalConfirmationDialog(User user, FragmentManager fragmentManager) {
|
||||
AccountRemovalConfirmationDialog dialog =
|
||||
AccountRemovalConfirmationDialog.newInstance(user);
|
||||
public static void openAccountRemovalDialog(User user, FragmentManager fragmentManager) {
|
||||
AccountRemovalDialog dialog = AccountRemovalDialog.newInstance(user);
|
||||
dialog.show(fragmentManager, "dialog");
|
||||
}
|
||||
|
||||
@@ -509,7 +508,7 @@ public class ManageAccountsActivity extends FileActivity implements UserListAdap
|
||||
if (itemId == R.id.action_open_account) {
|
||||
accountClicked(user.hashCode());
|
||||
} else if (itemId == R.id.action_delete_account) {
|
||||
openAccountRemovalConfirmationDialog(user, getSupportFragmentManager());
|
||||
openAccountRemovalDialog(user, getSupportFragmentManager());
|
||||
} else {
|
||||
openAccount(user);
|
||||
}
|
||||
|
||||
@@ -1,373 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Mario Danic
|
||||
* @author Chris Narkiewicz
|
||||
* Copyright (C) 2017 Andy Scherzinger
|
||||
* Copyright (C) 2017 Mario Danic
|
||||
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.account.UserAccountManager;
|
||||
import com.nextcloud.client.jobs.NotificationWork;
|
||||
import com.nextcloud.client.network.ClientFactory;
|
||||
import com.nextcloud.java.util.Optional;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.NotificationsLayoutBinding;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider;
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.lib.resources.notifications.GetNotificationsRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.notifications.models.Notification;
|
||||
import com.owncloud.android.ui.adapter.NotificationListAdapter;
|
||||
import com.owncloud.android.ui.asynctasks.DeleteAllNotificationsTask;
|
||||
import com.owncloud.android.ui.notifications.NotificationsContract;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.PushUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
/**
|
||||
* Activity displaying all server side stored notification items.
|
||||
*/
|
||||
public class NotificationsActivity extends DrawerActivity implements NotificationsContract.View {
|
||||
|
||||
private static final String TAG = NotificationsActivity.class.getSimpleName();
|
||||
|
||||
private NotificationsLayoutBinding binding;
|
||||
private NotificationListAdapter adapter;
|
||||
private Snackbar snackbar;
|
||||
private OwnCloudClient client;
|
||||
private Optional<User> optionalUser;
|
||||
|
||||
@Inject ClientFactory clientFactory;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
Log_OC.v(TAG, "onCreate() start");
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
binding = NotificationsLayoutBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
optionalUser = getUser();
|
||||
|
||||
// use account from intent (opened via android notification can have a different account than current one)
|
||||
if (getIntent() != null && getIntent().getExtras() != null) {
|
||||
String accountName = getIntent().getExtras().getString(NotificationWork.KEY_NOTIFICATION_ACCOUNT);
|
||||
if (accountName != null && optionalUser.isPresent()) {
|
||||
User user = optionalUser.get();
|
||||
if (user.getAccountName().equalsIgnoreCase(accountName)) {
|
||||
accountManager.setCurrentOwnCloudAccount(accountName);
|
||||
setUser(getUserAccountManager().getUser());
|
||||
optionalUser = getUser();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// setup toolbar
|
||||
setupToolbar();
|
||||
|
||||
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_notifications));
|
||||
|
||||
viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingList);
|
||||
viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingEmpty);
|
||||
|
||||
// setup drawer
|
||||
setupDrawer(R.id.nav_notifications);
|
||||
|
||||
if (!optionalUser.isPresent()) {
|
||||
// show error
|
||||
runOnUiThread(() -> setEmptyContent(
|
||||
getString(R.string.notifications_no_results_headline),
|
||||
getString(R.string.account_not_found))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
binding.swipeContainingList.setOnRefreshListener(() -> {
|
||||
setLoadingMessage();
|
||||
binding.swipeContainingList.setRefreshing(true);
|
||||
fetchAndSetData();
|
||||
});
|
||||
|
||||
binding.swipeContainingEmpty.setOnRefreshListener(() -> {
|
||||
setLoadingMessageEmpty();
|
||||
fetchAndSetData();
|
||||
});
|
||||
|
||||
setupPushWarning();
|
||||
setupContent();
|
||||
}
|
||||
|
||||
private void setupPushWarning() {
|
||||
if (!getResources().getBoolean(R.bool.show_push_warning)) {
|
||||
return;
|
||||
}
|
||||
if (snackbar != null) {
|
||||
if (!snackbar.isShown()) {
|
||||
snackbar.show();
|
||||
}
|
||||
} else {
|
||||
String pushUrl = getResources().getString(R.string.push_server_url);
|
||||
|
||||
if (pushUrl.isEmpty()) {
|
||||
snackbar = Snackbar.make(binding.emptyList.emptyListView,
|
||||
R.string.push_notifications_not_implemented,
|
||||
Snackbar.LENGTH_INDEFINITE);
|
||||
} else {
|
||||
final ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProviderImpl(this);
|
||||
final String accountName = optionalUser.isPresent() ? optionalUser.get().getAccountName() : "";
|
||||
final boolean usesOldLogin = arbitraryDataProvider.getBooleanValue(accountName,
|
||||
UserAccountManager.ACCOUNT_USES_STANDARD_PASSWORD);
|
||||
|
||||
if (usesOldLogin) {
|
||||
snackbar = Snackbar.make(binding.emptyList.emptyListView,
|
||||
R.string.push_notifications_old_login,
|
||||
Snackbar.LENGTH_INDEFINITE);
|
||||
} else {
|
||||
String pushValue = arbitraryDataProvider.getValue(accountName, PushUtils.KEY_PUSH);
|
||||
|
||||
if (pushValue == null || pushValue.isEmpty()) {
|
||||
snackbar = Snackbar.make(binding.emptyList.emptyListView,
|
||||
R.string.push_notifications_temp_error,
|
||||
Snackbar.LENGTH_INDEFINITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (snackbar != null && !snackbar.isShown()) {
|
||||
snackbar.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openDrawer() {
|
||||
super.openDrawer();
|
||||
|
||||
if (snackbar != null && snackbar.isShown()) {
|
||||
snackbar.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeDrawer() {
|
||||
super.closeDrawer();
|
||||
|
||||
setupPushWarning();
|
||||
}
|
||||
|
||||
/**
|
||||
* sets up the UI elements and loads all notification items.
|
||||
*/
|
||||
private void setupContent() {
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_notification);
|
||||
setLoadingMessageEmpty();
|
||||
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
||||
|
||||
binding.list.setLayoutManager(layoutManager);
|
||||
|
||||
fetchAndSetData();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void populateList(List<Notification> notifications) {
|
||||
initializeAdapter();
|
||||
adapter.setNotificationItems(notifications);
|
||||
binding.loadingContent.setVisibility(View.GONE);
|
||||
|
||||
if (notifications.size() > 0) {
|
||||
binding.swipeContainingEmpty.setVisibility(View.GONE);
|
||||
binding.swipeContainingList.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
setEmptyContent(
|
||||
getString(R.string.notifications_no_results_headline),
|
||||
getString(R.string.notifications_no_results_message)
|
||||
);
|
||||
binding.swipeContainingList.setVisibility(View.GONE);
|
||||
binding.swipeContainingEmpty.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchAndSetData() {
|
||||
Thread t = new Thread(() -> {
|
||||
initializeAdapter();
|
||||
|
||||
GetNotificationsRemoteOperation getRemoteNotificationOperation = new GetNotificationsRemoteOperation();
|
||||
final RemoteOperationResult<List<Notification>> result = getRemoteNotificationOperation.execute(client);
|
||||
|
||||
if (result.isSuccess() && result.getResultData() != null) {
|
||||
runOnUiThread(() -> populateList(result.getResultData()));
|
||||
} else {
|
||||
Log_OC.d(TAG, result.getLogMessage());
|
||||
// show error
|
||||
runOnUiThread(() -> setEmptyContent(getString(R.string.notifications_no_results_headline), result.getLogMessage()));
|
||||
}
|
||||
|
||||
hideRefreshLayoutLoader();
|
||||
});
|
||||
|
||||
t.start();
|
||||
}
|
||||
|
||||
private void initializeClient() {
|
||||
if (client == null && optionalUser.isPresent()) {
|
||||
try {
|
||||
User user = optionalUser.get();
|
||||
client = clientFactory.create(user);
|
||||
} catch (ClientFactory.CreationException e) {
|
||||
Log_OC.e(TAG, "Error initializing client", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeAdapter() {
|
||||
initializeClient();
|
||||
if (adapter == null) {
|
||||
adapter = new NotificationListAdapter(client, this, viewThemeUtils);
|
||||
binding.list.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
|
||||
private void hideRefreshLayoutLoader() {
|
||||
runOnUiThread(() -> {
|
||||
binding.swipeContainingList.setRefreshing(false);
|
||||
binding.swipeContainingEmpty.setRefreshing(false);
|
||||
});
|
||||
}
|
||||
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_notifications, menu);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
boolean retval = true;
|
||||
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
if (isDrawerOpen()) {
|
||||
closeDrawer();
|
||||
} else {
|
||||
openDrawer();
|
||||
}
|
||||
} else if (itemId == R.id.action_empty_notifications) {
|
||||
new DeleteAllNotificationsTask(client, this).execute();
|
||||
} else {
|
||||
retval = super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
private void setLoadingMessage() {
|
||||
binding.swipeContainingEmpty.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setLoadingMessageEmpty() {
|
||||
binding.swipeContainingList.setVisibility(View.GONE);
|
||||
binding.emptyList.emptyListView.setVisibility(View.GONE);
|
||||
binding.loadingContent.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void setEmptyContent(String headline, String message) {
|
||||
binding.swipeContainingList.setVisibility(View.GONE);
|
||||
binding.loadingContent.setVisibility(View.GONE);
|
||||
binding.swipeContainingEmpty.setVisibility(View.VISIBLE);
|
||||
binding.emptyList.emptyListView.setVisibility(View.VISIBLE);
|
||||
|
||||
binding.emptyList.emptyListViewHeadline.setText(headline);
|
||||
binding.emptyList.emptyListViewText.setText(message);
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_notification);
|
||||
|
||||
binding.emptyList.emptyListViewText.setVisibility(View.VISIBLE);
|
||||
binding.emptyList.emptyListIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
setDrawerMenuItemChecked(R.id.nav_notifications);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemovedNotification(boolean isSuccess) {
|
||||
if (!isSuccess) {
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.remove_notification_failed));
|
||||
fetchAndSetData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNotification(NotificationListAdapter.NotificationViewHolder holder) {
|
||||
adapter.removeNotification(holder);
|
||||
|
||||
if (adapter.getItemCount() == 0) {
|
||||
setEmptyContent(getString(R.string.notifications_no_results_headline), getString(R.string.notifications_no_results_message));
|
||||
binding.swipeContainingList.setVisibility(View.GONE);
|
||||
binding.loadingContent.setVisibility(View.GONE);
|
||||
binding.swipeContainingEmpty.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemovedAllNotifications(boolean isSuccess) {
|
||||
if (isSuccess) {
|
||||
adapter.removeAllNotifications();
|
||||
setEmptyContent(getString(R.string.notifications_no_results_headline), getString(R.string.notifications_no_results_message));
|
||||
binding.loadingContent.setVisibility(View.GONE);
|
||||
binding.swipeContainingList.setVisibility(View.GONE);
|
||||
binding.swipeContainingEmpty.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.clear_notifications_failed));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionCallback(boolean isSuccess,
|
||||
Notification notification,
|
||||
NotificationListAdapter.NotificationViewHolder holder) {
|
||||
if (isSuccess) {
|
||||
adapter.removeNotification(holder);
|
||||
} else {
|
||||
adapter.setButtons(holder, notification);
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.notification_action_failed));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,376 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
* @author Mario Danic
|
||||
* @author Chris Narkiewicz
|
||||
* Copyright (C) 2017 Andy Scherzinger
|
||||
* Copyright (C) 2017 Mario Danic
|
||||
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.nextcloud.client.account.User
|
||||
import com.nextcloud.client.account.UserAccountManager
|
||||
import com.nextcloud.client.jobs.NotificationWork
|
||||
import com.nextcloud.client.network.ClientFactory.CreationException
|
||||
import com.nextcloud.java.util.Optional
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.NotificationsLayoutBinding
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProvider
|
||||
import com.owncloud.android.datamodel.ArbitraryDataProviderImpl
|
||||
import com.owncloud.android.lib.common.OwnCloudClient
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.notifications.GetNotificationsRemoteOperation
|
||||
import com.owncloud.android.lib.resources.notifications.models.Notification
|
||||
import com.owncloud.android.ui.adapter.NotificationListAdapter
|
||||
import com.owncloud.android.ui.adapter.NotificationListAdapter.NotificationViewHolder
|
||||
import com.owncloud.android.ui.asynctasks.DeleteAllNotificationsTask
|
||||
import com.owncloud.android.ui.notifications.NotificationsContract
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
import com.owncloud.android.utils.PushUtils
|
||||
|
||||
/**
|
||||
* Activity displaying all server side stored notification items.
|
||||
*/
|
||||
class NotificationsActivity : DrawerActivity(), NotificationsContract.View {
|
||||
|
||||
private lateinit var binding: NotificationsLayoutBinding
|
||||
|
||||
private var adapter: NotificationListAdapter? = null
|
||||
private var snackbar: Snackbar? = null
|
||||
private var client: OwnCloudClient? = null
|
||||
private var optionalUser: Optional<User>? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Log_OC.v(TAG, "onCreate() start")
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
binding = NotificationsLayoutBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
optionalUser = user
|
||||
|
||||
intent?.let {
|
||||
it.extras?.let { bundle ->
|
||||
setupUser(bundle)
|
||||
}
|
||||
}
|
||||
|
||||
setupToolbar()
|
||||
updateActionBarTitleAndHomeButtonByString(getString(R.string.drawer_item_notifications))
|
||||
setupDrawer(R.id.nav_notifications)
|
||||
|
||||
if (optionalUser?.isPresent == false) {
|
||||
showError()
|
||||
}
|
||||
|
||||
setupContainingList()
|
||||
setupPushWarning()
|
||||
setupContent()
|
||||
}
|
||||
|
||||
private fun setupContainingList() {
|
||||
viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingList)
|
||||
viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingEmpty)
|
||||
binding.swipeContainingList.setOnRefreshListener {
|
||||
setLoadingMessage()
|
||||
binding.swipeContainingList.isRefreshing = true
|
||||
fetchAndSetData()
|
||||
}
|
||||
binding.swipeContainingEmpty.setOnRefreshListener {
|
||||
setLoadingMessageEmpty()
|
||||
fetchAndSetData()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupUser(bundle: Bundle) {
|
||||
val accountName = bundle.getString(NotificationWork.KEY_NOTIFICATION_ACCOUNT)
|
||||
|
||||
if (accountName != null && optionalUser?.isPresent == true) {
|
||||
val user = optionalUser?.get()
|
||||
if (user?.accountName.equals(accountName, ignoreCase = true)) {
|
||||
accountManager.setCurrentOwnCloudAccount(accountName)
|
||||
setUser(userAccountManager.user)
|
||||
optionalUser = getUser()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showError() {
|
||||
runOnUiThread {
|
||||
setEmptyContent(
|
||||
getString(R.string.notifications_no_results_headline),
|
||||
getString(R.string.account_not_found)
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
private fun setupPushWarning() {
|
||||
if (!resources.getBoolean(R.bool.show_push_warning)) {
|
||||
return
|
||||
}
|
||||
|
||||
if (snackbar != null) {
|
||||
if (snackbar?.isShown == false) {
|
||||
snackbar?.show()
|
||||
}
|
||||
} else {
|
||||
val pushUrl = resources.getString(R.string.push_server_url)
|
||||
if (pushUrl.isEmpty()) {
|
||||
snackbar = Snackbar.make(
|
||||
binding.emptyList.emptyListView,
|
||||
R.string.push_notifications_not_implemented,
|
||||
Snackbar.LENGTH_INDEFINITE
|
||||
)
|
||||
} else {
|
||||
val arbitraryDataProvider: ArbitraryDataProvider = ArbitraryDataProviderImpl(this)
|
||||
val accountName: String = if (optionalUser?.isPresent == true) {
|
||||
optionalUser?.get()?.accountName ?: ""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
val usesOldLogin = arbitraryDataProvider.getBooleanValue(
|
||||
accountName,
|
||||
UserAccountManager.ACCOUNT_USES_STANDARD_PASSWORD
|
||||
)
|
||||
|
||||
if (usesOldLogin) {
|
||||
snackbar = Snackbar.make(
|
||||
binding.emptyList.emptyListView,
|
||||
R.string.push_notifications_old_login,
|
||||
Snackbar.LENGTH_INDEFINITE
|
||||
)
|
||||
} else {
|
||||
val pushValue = arbitraryDataProvider.getValue(accountName, PushUtils.KEY_PUSH)
|
||||
if (pushValue.isEmpty()) {
|
||||
snackbar = Snackbar.make(
|
||||
binding.emptyList.emptyListView,
|
||||
R.string.push_notifications_temp_error,
|
||||
Snackbar.LENGTH_INDEFINITE
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (snackbar != null && snackbar?.isShown == false) {
|
||||
snackbar?.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun openDrawer() {
|
||||
super.openDrawer()
|
||||
if (snackbar != null && snackbar?.isShown == true) {
|
||||
snackbar?.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
override fun closeDrawer() {
|
||||
super.closeDrawer()
|
||||
setupPushWarning()
|
||||
}
|
||||
|
||||
/**
|
||||
* sets up the UI elements and loads all notification items.
|
||||
*/
|
||||
private fun setupContent() {
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_notification)
|
||||
setLoadingMessageEmpty()
|
||||
val layoutManager = LinearLayoutManager(this)
|
||||
binding.list.layoutManager = layoutManager
|
||||
fetchAndSetData()
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun populateList(notifications: List<Notification>?) {
|
||||
initializeAdapter()
|
||||
adapter?.setNotificationItems(notifications)
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
|
||||
if (notifications?.isNotEmpty() == true) {
|
||||
binding.swipeContainingEmpty.visibility = View.GONE
|
||||
binding.swipeContainingList.visibility = View.VISIBLE
|
||||
} else {
|
||||
setEmptyContent(
|
||||
getString(R.string.notifications_no_results_headline),
|
||||
getString(R.string.notifications_no_results_message)
|
||||
)
|
||||
binding.swipeContainingList.visibility = View.GONE
|
||||
binding.swipeContainingEmpty.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchAndSetData() {
|
||||
val t = Thread {
|
||||
initializeAdapter()
|
||||
val getRemoteNotificationOperation = GetNotificationsRemoteOperation()
|
||||
val result = getRemoteNotificationOperation.execute(client)
|
||||
if (result.isSuccess && result.resultData != null) {
|
||||
runOnUiThread { populateList(result.resultData) }
|
||||
} else {
|
||||
Log_OC.d(TAG, result.logMessage)
|
||||
// show error
|
||||
runOnUiThread {
|
||||
setEmptyContent(
|
||||
getString(R.string.notifications_no_results_headline),
|
||||
result.logMessage
|
||||
)
|
||||
}
|
||||
}
|
||||
hideRefreshLayoutLoader()
|
||||
}
|
||||
t.start()
|
||||
}
|
||||
|
||||
private fun initializeClient() {
|
||||
if (client == null && optionalUser?.isPresent == true) {
|
||||
try {
|
||||
val user = optionalUser?.get()
|
||||
client = clientFactory.create(user)
|
||||
} catch (e: CreationException) {
|
||||
Log_OC.e(TAG, "Error initializing client", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initializeAdapter() {
|
||||
initializeClient()
|
||||
if (adapter == null) {
|
||||
adapter = NotificationListAdapter(client, this, viewThemeUtils)
|
||||
binding.list.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideRefreshLayoutLoader() {
|
||||
runOnUiThread {
|
||||
binding.swipeContainingList.isRefreshing = false
|
||||
binding.swipeContainingEmpty.isRefreshing = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.activity_notifications, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
var retval = true
|
||||
val itemId = item.itemId
|
||||
if (itemId == android.R.id.home) {
|
||||
if (isDrawerOpen) {
|
||||
closeDrawer()
|
||||
} else {
|
||||
openDrawer()
|
||||
}
|
||||
} else if (itemId == R.id.action_empty_notifications) {
|
||||
DeleteAllNotificationsTask(client, this).execute()
|
||||
} else {
|
||||
retval = super.onOptionsItemSelected(item)
|
||||
}
|
||||
return retval
|
||||
}
|
||||
|
||||
private fun setLoadingMessage() {
|
||||
binding.swipeContainingEmpty.visibility = View.GONE
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun setLoadingMessageEmpty() {
|
||||
binding.swipeContainingList.visibility = View.GONE
|
||||
binding.emptyList.emptyListView.visibility = View.GONE
|
||||
binding.loadingContent.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun setEmptyContent(headline: String?, message: String?) {
|
||||
binding.swipeContainingList.visibility = View.GONE
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
binding.swipeContainingEmpty.visibility = View.VISIBLE
|
||||
binding.emptyList.emptyListView.visibility = View.VISIBLE
|
||||
binding.emptyList.emptyListViewHeadline.text = headline
|
||||
binding.emptyList.emptyListViewText.text = message
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_notification)
|
||||
binding.emptyList.emptyListViewText.visibility = View.VISIBLE
|
||||
binding.emptyList.emptyListIcon.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
setDrawerMenuItemChecked(R.id.nav_notifications)
|
||||
}
|
||||
|
||||
override fun onRemovedNotification(isSuccess: Boolean) {
|
||||
if (!isSuccess) {
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.remove_notification_failed))
|
||||
fetchAndSetData()
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeNotification(holder: NotificationViewHolder) {
|
||||
adapter?.removeNotification(holder)
|
||||
if (adapter?.itemCount == 0) {
|
||||
setEmptyContent(
|
||||
getString(R.string.notifications_no_results_headline),
|
||||
getString(R.string.notifications_no_results_message)
|
||||
)
|
||||
binding.swipeContainingList.visibility = View.GONE
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
binding.swipeContainingEmpty.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRemovedAllNotifications(isSuccess: Boolean) {
|
||||
if (isSuccess) {
|
||||
adapter?.removeAllNotifications()
|
||||
setEmptyContent(
|
||||
getString(R.string.notifications_no_results_headline),
|
||||
getString(R.string.notifications_no_results_message)
|
||||
)
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
binding.swipeContainingList.visibility = View.GONE
|
||||
binding.swipeContainingEmpty.visibility = View.VISIBLE
|
||||
} else {
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.clear_notifications_failed))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onActionCallback(
|
||||
isSuccess: Boolean,
|
||||
notification: Notification,
|
||||
holder: NotificationViewHolder
|
||||
) {
|
||||
if (isSuccess) {
|
||||
adapter?.removeNotification(holder)
|
||||
} else {
|
||||
adapter?.setButtons(holder, notification)
|
||||
DisplayUtils.showSnackMessage(this, getString(R.string.notification_action_failed))
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val TAG = NotificationsActivity::class.java.simpleName
|
||||
}
|
||||
}
|
||||
@@ -1,478 +0,0 @@
|
||||
/*
|
||||
* ownCloud Android client application
|
||||
*
|
||||
* @author Bartek Przybylski
|
||||
* @author masensio
|
||||
* @author David A. Velasco
|
||||
* Copyright (C) 2011 Bartek Przybylski
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
* Copyright (C) 2020 Kwon Yuna <yunaghgh@naver.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.authentication.PassCodeManager;
|
||||
import com.owncloud.android.databinding.PasscodelockBinding;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.ui.components.PassCodeEditText;
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
public class PassCodeActivity extends AppCompatActivity implements Injectable {
|
||||
|
||||
private static final String TAG = PassCodeActivity.class.getSimpleName();
|
||||
private static final String KEY_PASSCODE_DIGITS = "PASSCODE_DIGITS";
|
||||
private static final String KEY_CONFIRMING_PASSCODE = "CONFIRMING_PASSCODE";
|
||||
|
||||
public final static String ACTION_REQUEST_WITH_RESULT = "ACTION_REQUEST_WITH_RESULT";
|
||||
public final static String ACTION_CHECK_WITH_RESULT = "ACTION_CHECK_WITH_RESULT";
|
||||
public final static String ACTION_CHECK = "ACTION_CHECK";
|
||||
public final static String KEY_PASSCODE = "KEY_PASSCODE";
|
||||
public final static String KEY_CHECK_RESULT = "KEY_CHECK_RESULT";
|
||||
|
||||
public final static String PREFERENCE_PASSCODE_D = "PrefPinCode";
|
||||
public final static String PREFERENCE_PASSCODE_D1 = "PrefPinCode1";
|
||||
public final static String PREFERENCE_PASSCODE_D2 = "PrefPinCode2";
|
||||
public final static String PREFERENCE_PASSCODE_D3 = "PrefPinCode3";
|
||||
public final static String PREFERENCE_PASSCODE_D4 = "PrefPinCode4";
|
||||
|
||||
@Inject AppPreferences preferences;
|
||||
@Inject PassCodeManager passCodeManager;
|
||||
@Inject ViewThemeUtils viewThemeUtils;
|
||||
private PasscodelockBinding binding;
|
||||
private final PassCodeEditText[] passCodeEditTexts = new PassCodeEditText[4];
|
||||
private String[] passCodeDigits = {"", "", "", ""};
|
||||
private boolean confirmingPassCode;
|
||||
private boolean changed = true; // to control that only one blocks jump
|
||||
|
||||
/**
|
||||
* Initializes the activity.
|
||||
* <p>
|
||||
* An intent with a valid ACTION is expected; if none is found, an {@link IllegalArgumentException} will be thrown.
|
||||
*
|
||||
* @param savedInstanceState Previously saved state - irrelevant in this case
|
||||
*/
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
binding = PasscodelockBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
viewThemeUtils.platform.colorTextButtons(binding.cancel);
|
||||
|
||||
passCodeEditTexts[0] = binding.txt0;
|
||||
passCodeEditTexts[1] = binding.txt1;
|
||||
passCodeEditTexts[2] = binding.txt2;
|
||||
passCodeEditTexts[3] = binding.txt3;
|
||||
|
||||
for (EditText passCodeEditText : passCodeEditTexts) {
|
||||
viewThemeUtils.platform.colorEditText(passCodeEditText);
|
||||
}
|
||||
|
||||
passCodeEditTexts[0].requestFocus();
|
||||
|
||||
Window window = getWindow();
|
||||
if (window != null) {
|
||||
window.setSoftInputMode(android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
}
|
||||
|
||||
if (ACTION_CHECK.equals(getIntent().getAction())) {
|
||||
/// this is a pass code request; the user has to input the right value
|
||||
binding.header.setText(R.string.pass_code_enter_pass_code);
|
||||
binding.explanation.setVisibility(View.INVISIBLE);
|
||||
setCancelButtonEnabled(false); // no option to cancel
|
||||
|
||||
showDelay();
|
||||
|
||||
} else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction())) {
|
||||
if (savedInstanceState != null) {
|
||||
confirmingPassCode = savedInstanceState.getBoolean(PassCodeActivity.KEY_CONFIRMING_PASSCODE);
|
||||
passCodeDigits = savedInstanceState.getStringArray(PassCodeActivity.KEY_PASSCODE_DIGITS);
|
||||
}
|
||||
if (confirmingPassCode) {
|
||||
// the app was in the passcode confirmation
|
||||
requestPassCodeConfirmation();
|
||||
} else {
|
||||
// pass code preference has just been activated in SettingsActivity;
|
||||
// will receive and confirm pass code value
|
||||
binding.header.setText(R.string.pass_code_configure_your_pass_code);
|
||||
|
||||
binding.explanation.setVisibility(View.VISIBLE);
|
||||
}
|
||||
setCancelButtonEnabled(true);
|
||||
|
||||
} else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
|
||||
// pass code preference has just been disabled in SettingsActivity;
|
||||
// will confirm user knows pass code, then remove it
|
||||
binding.header.setText(R.string.pass_code_remove_your_pass_code);
|
||||
binding.explanation.setVisibility(View.INVISIBLE);
|
||||
setCancelButtonEnabled(true);
|
||||
|
||||
} else {
|
||||
throw new IllegalArgumentException("A valid ACTION is needed in the Intent passed to " + TAG);
|
||||
}
|
||||
|
||||
setTextListeners();
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables the cancel button to allow the user interrupt the ACTION requested to the activity.
|
||||
*
|
||||
* @param enabled 'True' makes the cancel button available, 'false' hides it.
|
||||
*/
|
||||
protected void setCancelButtonEnabled(boolean enabled) {
|
||||
if (enabled) {
|
||||
binding.cancel.setVisibility(View.VISIBLE);
|
||||
binding.cancel.setOnClickListener(v -> finish());
|
||||
} else {
|
||||
binding.cancel.setVisibility(View.INVISIBLE);
|
||||
binding.cancel.setOnClickListener(null);
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public PasscodelockBinding getBinding() {
|
||||
return binding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds the appropriate listeners to the input boxes receiving each digit of the pass code.
|
||||
*/
|
||||
protected void setTextListeners() {
|
||||
for (int i = 0; i < passCodeEditTexts.length; i++) {
|
||||
final PassCodeEditText editText = passCodeEditTexts[i];
|
||||
boolean isLast = (i == 3);
|
||||
|
||||
editText.addTextChangedListener(new PassCodeDigitTextWatcher(i, isLast));
|
||||
if (i > 0) {
|
||||
setOnKeyListener(i);
|
||||
}
|
||||
|
||||
int finalIndex = i;
|
||||
editText.setOnFocusChangeListener((v, hasFocus) -> onPassCodeEditTextFocusChange(finalIndex));
|
||||
}
|
||||
}
|
||||
|
||||
private void onPassCodeEditTextFocusChange(final int passCodeIndex) {
|
||||
for (int i = 0; i < passCodeIndex; i++) {
|
||||
if (TextUtils.isEmpty(passCodeEditTexts[i].getText())) {
|
||||
passCodeEditTexts[i].requestFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setOnKeyListener(final int passCodeIndex) {
|
||||
passCodeEditTexts[passCodeIndex].setOnKeyListener((v, keyCode, event) -> {
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL && changed) {
|
||||
passCodeEditTexts[passCodeIndex - 1].requestFocus();
|
||||
if (!confirmingPassCode) {
|
||||
passCodeDigits[passCodeIndex - 1] = "";
|
||||
}
|
||||
passCodeEditTexts[passCodeIndex - 1].setText("");
|
||||
changed = false;
|
||||
|
||||
} else if (!changed) {
|
||||
changed = true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the pass code entered by the user just after the last digit was in.
|
||||
* <p>
|
||||
* Takes into account the action requested to the activity, the currently saved pass code and the previously typed
|
||||
* pass code, if any.
|
||||
*/
|
||||
private void processFullPassCode() {
|
||||
if (ACTION_CHECK.equals(getIntent().getAction())) {
|
||||
if (checkPassCode()) {
|
||||
preferences.resetPinWrongAttempts();
|
||||
|
||||
/// pass code accepted in request, user is allowed to access the app
|
||||
passCodeManager.updateLockTimestamp();
|
||||
hideSoftKeyboard();
|
||||
finish();
|
||||
|
||||
} else {
|
||||
preferences.increasePinWrongAttempts();
|
||||
|
||||
showErrorAndRestart(R.string.pass_code_wrong, R.string.pass_code_enter_pass_code, View.INVISIBLE);
|
||||
}
|
||||
|
||||
} else if (ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
|
||||
if (checkPassCode()) {
|
||||
passCodeManager.updateLockTimestamp();
|
||||
Intent resultIntent = new Intent();
|
||||
resultIntent.putExtra(KEY_CHECK_RESULT, true);
|
||||
setResult(RESULT_OK, resultIntent);
|
||||
hideSoftKeyboard();
|
||||
finish();
|
||||
} else {
|
||||
showErrorAndRestart(R.string.pass_code_wrong, R.string.pass_code_enter_pass_code, View.INVISIBLE);
|
||||
}
|
||||
|
||||
} else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction())) {
|
||||
/// enabling pass code
|
||||
if (!confirmingPassCode) {
|
||||
requestPassCodeConfirmation();
|
||||
|
||||
} else if (confirmPassCode()) {
|
||||
/// confirmed: user typed the same pass code twice
|
||||
savePassCodeAndExit();
|
||||
|
||||
} else {
|
||||
showErrorAndRestart(R.string.pass_code_mismatch, R.string.pass_code_configure_your_pass_code, View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void hideSoftKeyboard() {
|
||||
View focusedView = getCurrentFocus();
|
||||
if (focusedView != null) {
|
||||
InputMethodManager inputMethodManager =
|
||||
(InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
|
||||
inputMethodManager.hideSoftInputFromWindow(
|
||||
focusedView.getWindowToken(),
|
||||
0);
|
||||
}
|
||||
}
|
||||
|
||||
private void showErrorAndRestart(int errorMessage, int headerMessage, int explanationVisibility) {
|
||||
Arrays.fill(passCodeDigits, null);
|
||||
Snackbar.make(findViewById(android.R.id.content), getString(errorMessage), Snackbar.LENGTH_LONG).show();
|
||||
binding.header.setText(headerMessage); // TODO check if really needed
|
||||
binding.explanation.setVisibility(explanationVisibility); // TODO check if really needed
|
||||
clearBoxes();
|
||||
|
||||
showDelay();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Ask to the user for retyping the pass code just entered before saving it as the current pass code.
|
||||
*/
|
||||
protected void requestPassCodeConfirmation() {
|
||||
clearBoxes();
|
||||
binding.header.setText(R.string.pass_code_reenter_your_pass_code);
|
||||
binding.explanation.setVisibility(View.INVISIBLE);
|
||||
confirmingPassCode = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares pass code entered by the user with the value currently saved in the app.
|
||||
*
|
||||
* @return 'True' if entered pass code equals to the saved one.
|
||||
*/
|
||||
protected boolean checkPassCode() {
|
||||
String[] savedPassCodeDigits = preferences.getPassCode();
|
||||
|
||||
boolean result = true;
|
||||
for (int i = 0; i < passCodeDigits.length && result; i++) {
|
||||
result = passCodeDigits[i] != null && passCodeDigits[i].equals(savedPassCodeDigits[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares pass code retyped by the user in the input fields with the value entered just before.
|
||||
*
|
||||
* @return 'True' if retyped pass code equals to the entered before.
|
||||
*/
|
||||
protected boolean confirmPassCode() {
|
||||
confirmingPassCode = false;
|
||||
|
||||
for (int i = 0; i < passCodeEditTexts.length; i++) {
|
||||
Editable passCodeText = passCodeEditTexts[i].getText();
|
||||
if (passCodeText == null || !passCodeText.toString().equals(passCodeDigits[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the input fields to empty strings and puts the focus on the first one.
|
||||
*/
|
||||
protected void clearBoxes() {
|
||||
for (EditText mPassCodeEditText : passCodeEditTexts) {
|
||||
mPassCodeEditText.setText("");
|
||||
}
|
||||
passCodeEditTexts[0].requestFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides click on the BACK arrow to correctly cancel ACTION_ENABLE or ACTION_DISABLE, while preventing than
|
||||
* ACTION_CHECK may be worked around.
|
||||
*
|
||||
* @param keyCode Key code of the key that triggered the down event.
|
||||
* @param event Event triggered.
|
||||
* @return 'True' when the key event was processed by this method.
|
||||
*/
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
|
||||
if (ACTION_CHECK.equals(getIntent().getAction())) {
|
||||
moveTaskToBack(true);
|
||||
finishAndRemoveTask();
|
||||
} else if (ACTION_REQUEST_WITH_RESULT.equals(getIntent().getAction()) ||
|
||||
ACTION_CHECK_WITH_RESULT.equals(getIntent().getAction())) {
|
||||
finish();
|
||||
}// else, do nothing, but report that the key was consumed to stay alive
|
||||
return true;
|
||||
}
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the pass code input by the user as the current pass code.
|
||||
*/
|
||||
protected void savePassCodeAndExit() {
|
||||
Intent resultIntent = new Intent();
|
||||
resultIntent.putExtra(KEY_PASSCODE,
|
||||
passCodeDigits[0] + passCodeDigits[1] + passCodeDigits[2] + passCodeDigits[3]);
|
||||
|
||||
setResult(RESULT_OK, resultIntent);
|
||||
|
||||
passCodeManager.updateLockTimestamp();
|
||||
|
||||
finish();
|
||||
}
|
||||
|
||||
private void showDelay() {
|
||||
int delay = preferences.pinBruteForceDelay();
|
||||
|
||||
if (delay > 0) {
|
||||
binding.explanation.setText(R.string.brute_force_delay);
|
||||
binding.explanation.setVisibility(View.VISIBLE);
|
||||
binding.txt0.setEnabled(false);
|
||||
binding.txt1.setEnabled(false);
|
||||
binding.txt2.setEnabled(false);
|
||||
binding.txt3.setEnabled(false);
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(delay * 1000L);
|
||||
|
||||
runOnUiThread(() -> {
|
||||
binding.explanation.setVisibility(View.INVISIBLE);
|
||||
binding.txt0.setEnabled(true);
|
||||
binding.txt1.setEnabled(true);
|
||||
binding.txt2.setEnabled(true);
|
||||
binding.txt3.setEnabled(true);
|
||||
});
|
||||
} catch (InterruptedException e) {
|
||||
Log_OC.e(this, "Could not delay password input prompt");
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putBoolean(PassCodeActivity.KEY_CONFIRMING_PASSCODE, confirmingPassCode);
|
||||
outState.putStringArray(PassCodeActivity.KEY_PASSCODE_DIGITS, passCodeDigits);
|
||||
}
|
||||
|
||||
private class PassCodeDigitTextWatcher implements TextWatcher {
|
||||
|
||||
private int mIndex = -1;
|
||||
private boolean mLastOne;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param index Position in the pass code of the input field that will be bound to this watcher.
|
||||
* @param lastOne 'True' means that watcher corresponds to the last position of the pass code.
|
||||
*/
|
||||
PassCodeDigitTextWatcher(int index, boolean lastOne) {
|
||||
mIndex = index;
|
||||
mLastOne = lastOne;
|
||||
|
||||
if (mIndex < 0) {
|
||||
throw new IllegalArgumentException(
|
||||
"Invalid index in " + PassCodeDigitTextWatcher.class.getSimpleName() +
|
||||
" constructor"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private int next() {
|
||||
return mLastOne ? 0 : mIndex + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs several actions when the user types a digit in an input field: - saves the input digit to the state
|
||||
* of the activity; this will allow retyping the pass code to confirm it. - moves the focus automatically to the
|
||||
* next field - for the last field, triggers the processing of the full pass code
|
||||
*
|
||||
* @param s Changed text
|
||||
*/
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
if (s.length() > 0) {
|
||||
if (!confirmingPassCode) {
|
||||
Editable passCodeText = passCodeEditTexts[mIndex].getText();
|
||||
|
||||
if (passCodeText != null) {
|
||||
passCodeDigits[mIndex] = passCodeText.toString();
|
||||
}
|
||||
}
|
||||
|
||||
if (mLastOne) {
|
||||
processFullPassCode();
|
||||
} else {
|
||||
passCodeEditTexts[next()].requestFocus();
|
||||
}
|
||||
|
||||
} else {
|
||||
Log_OC.d(TAG, "Text box " + mIndex + " was cleaned");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,437 @@
|
||||
/*
|
||||
* ownCloud Android client application
|
||||
*
|
||||
* @author Bartek Przybylski
|
||||
* @author masensio
|
||||
* @author David A. Velasco
|
||||
* Copyright (C) 2011 Bartek Przybylski
|
||||
* Copyright (C) 2015 ownCloud Inc.
|
||||
* Copyright (C) 2020 Kwon Yuna <yunaghgh@naver.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextUtils
|
||||
import android.text.TextWatcher
|
||||
import android.view.KeyEvent
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.nextcloud.client.preferences.AppPreferences
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.authentication.PassCodeManager
|
||||
import com.owncloud.android.databinding.PasscodelockBinding
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.ui.components.PassCodeEditText
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import java.util.Arrays
|
||||
import javax.inject.Inject
|
||||
|
||||
@Suppress("TooManyFunctions", "MagicNumber")
|
||||
class PassCodeActivity : AppCompatActivity(), Injectable {
|
||||
|
||||
companion object {
|
||||
private val TAG = PassCodeActivity::class.java.simpleName
|
||||
|
||||
private const val KEY_PASSCODE_DIGITS = "PASSCODE_DIGITS"
|
||||
private const val KEY_CONFIRMING_PASSCODE = "CONFIRMING_PASSCODE"
|
||||
const val ACTION_REQUEST_WITH_RESULT = "ACTION_REQUEST_WITH_RESULT"
|
||||
const val ACTION_CHECK_WITH_RESULT = "ACTION_CHECK_WITH_RESULT"
|
||||
const val ACTION_CHECK = "ACTION_CHECK"
|
||||
const val KEY_PASSCODE = "KEY_PASSCODE"
|
||||
const val KEY_CHECK_RESULT = "KEY_CHECK_RESULT"
|
||||
const val PREFERENCE_PASSCODE_D = "PrefPinCode"
|
||||
const val PREFERENCE_PASSCODE_D1 = "PrefPinCode1"
|
||||
const val PREFERENCE_PASSCODE_D2 = "PrefPinCode2"
|
||||
const val PREFERENCE_PASSCODE_D3 = "PrefPinCode3"
|
||||
const val PREFERENCE_PASSCODE_D4 = "PrefPinCode4"
|
||||
}
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var preferences: AppPreferences? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var passCodeManager: PassCodeManager? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var viewThemeUtils: ViewThemeUtils? = null
|
||||
|
||||
@get:VisibleForTesting
|
||||
lateinit var binding: PasscodelockBinding
|
||||
private set
|
||||
|
||||
private val passCodeEditTexts = arrayOfNulls<PassCodeEditText>(4)
|
||||
private var passCodeDigits: Array<String?>? = arrayOf("", "", "", "")
|
||||
private var confirmingPassCode = false
|
||||
private var changed = true // to control that only one blocks jump
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
binding = PasscodelockBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
|
||||
applyTint()
|
||||
setupPasscodeEditTexts()
|
||||
setSoftInputMode()
|
||||
setupUI(savedInstanceState)
|
||||
setTextListeners()
|
||||
}
|
||||
|
||||
private fun applyTint() {
|
||||
viewThemeUtils?.platform?.colorViewBackground(binding.cardViewContent, ColorRole.SURFACE_VARIANT)
|
||||
viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(binding.cancel)
|
||||
}
|
||||
|
||||
private fun setupPasscodeEditTexts() {
|
||||
passCodeEditTexts[0] = binding.txt0
|
||||
passCodeEditTexts[1] = binding.txt1
|
||||
passCodeEditTexts[2] = binding.txt2
|
||||
passCodeEditTexts[3] = binding.txt3
|
||||
|
||||
passCodeEditTexts.forEach {
|
||||
it?.let { viewThemeUtils?.platform?.colorEditText(it) }
|
||||
}
|
||||
|
||||
passCodeEditTexts[0]?.requestFocus()
|
||||
}
|
||||
|
||||
private fun setSoftInputMode() {
|
||||
window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE)
|
||||
}
|
||||
|
||||
private fun setupUI(savedInstanceState: Bundle?) {
|
||||
if (ACTION_CHECK == intent.action) {
|
||||
// / this is a pass code request; the user has to input the right value
|
||||
binding.header.setText(R.string.pass_code_enter_pass_code)
|
||||
binding.explanation.visibility = View.INVISIBLE
|
||||
setCancelButtonEnabled(false) // no option to cancel
|
||||
showDelay()
|
||||
} else if (ACTION_REQUEST_WITH_RESULT == intent.action) {
|
||||
if (savedInstanceState != null) {
|
||||
confirmingPassCode = savedInstanceState.getBoolean(KEY_CONFIRMING_PASSCODE)
|
||||
passCodeDigits = savedInstanceState.getStringArray(KEY_PASSCODE_DIGITS)
|
||||
}
|
||||
if (confirmingPassCode) {
|
||||
// the app was in the passcode confirmation
|
||||
requestPassCodeConfirmation()
|
||||
} else {
|
||||
// pass code preference has just been activated in SettingsActivity;
|
||||
// will receive and confirm pass code value
|
||||
binding.header.setText(R.string.pass_code_configure_your_pass_code)
|
||||
binding.explanation.visibility = View.VISIBLE
|
||||
}
|
||||
setCancelButtonEnabled(true)
|
||||
} else if (ACTION_CHECK_WITH_RESULT == intent.action) {
|
||||
// pass code preference has just been disabled in SettingsActivity;
|
||||
// will confirm user knows pass code, then remove it
|
||||
binding.header.setText(R.string.pass_code_remove_your_pass_code)
|
||||
binding.explanation.visibility = View.INVISIBLE
|
||||
setCancelButtonEnabled(true)
|
||||
} else {
|
||||
throw IllegalArgumentException("A valid ACTION is needed in the Intent passed to $TAG")
|
||||
}
|
||||
}
|
||||
|
||||
private fun setCancelButtonEnabled(enabled: Boolean) {
|
||||
binding.cancel.visibility = if (enabled) {
|
||||
View.VISIBLE
|
||||
} else {
|
||||
View.INVISIBLE
|
||||
}
|
||||
binding.cancel.setOnClickListener {
|
||||
if (enabled) {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTextListeners() {
|
||||
for (i in passCodeEditTexts.indices) {
|
||||
val editText = passCodeEditTexts[i]
|
||||
val isLast = (i == 3)
|
||||
|
||||
editText?.addTextChangedListener(PassCodeDigitTextWatcher(i, isLast))
|
||||
|
||||
if (i > 0) {
|
||||
setOnKeyListener(i)
|
||||
}
|
||||
|
||||
editText?.onFocusChangeListener = View.OnFocusChangeListener { _: View?, _: Boolean ->
|
||||
onPassCodeEditTextFocusChange(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun onPassCodeEditTextFocusChange(passCodeIndex: Int) {
|
||||
for (i in 0 until passCodeIndex) {
|
||||
if (TextUtils.isEmpty(passCodeEditTexts[i]?.text)) {
|
||||
passCodeEditTexts[i]?.requestFocus()
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setOnKeyListener(passCodeIndex: Int) {
|
||||
passCodeEditTexts[passCodeIndex]?.setOnKeyListener { _: View?, keyCode: Int, _: KeyEvent? ->
|
||||
if (keyCode == KeyEvent.KEYCODE_DEL && changed) {
|
||||
passCodeEditTexts[passCodeIndex - 1]?.requestFocus()
|
||||
|
||||
if (!confirmingPassCode) {
|
||||
passCodeDigits?.set(passCodeIndex - 1, "")
|
||||
}
|
||||
|
||||
passCodeEditTexts[passCodeIndex - 1]?.setText("")
|
||||
|
||||
changed = false
|
||||
} else if (!changed) {
|
||||
changed = true
|
||||
}
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Processes the pass code entered by the user just after the last digit was in.
|
||||
*
|
||||
*
|
||||
* Takes into account the action requested to the activity, the currently saved pass code and the previously typed
|
||||
* pass code, if any.
|
||||
*/
|
||||
private fun processFullPassCode() {
|
||||
if (ACTION_CHECK == intent.action) {
|
||||
if (checkPassCode()) {
|
||||
preferences?.resetPinWrongAttempts()
|
||||
|
||||
// / pass code accepted in request, user is allowed to access the app
|
||||
passCodeManager?.updateLockTimestamp()
|
||||
hideSoftKeyboard()
|
||||
finish()
|
||||
} else {
|
||||
preferences?.increasePinWrongAttempts()
|
||||
showErrorAndRestart(R.string.pass_code_wrong, R.string.pass_code_enter_pass_code, View.INVISIBLE)
|
||||
}
|
||||
} else if (ACTION_CHECK_WITH_RESULT == intent.action) {
|
||||
if (checkPassCode()) {
|
||||
passCodeManager?.updateLockTimestamp()
|
||||
|
||||
val resultIntent = Intent()
|
||||
resultIntent.putExtra(KEY_CHECK_RESULT, true)
|
||||
setResult(RESULT_OK, resultIntent)
|
||||
hideSoftKeyboard()
|
||||
finish()
|
||||
} else {
|
||||
showErrorAndRestart(R.string.pass_code_wrong, R.string.pass_code_enter_pass_code, View.INVISIBLE)
|
||||
}
|
||||
} else if (ACTION_REQUEST_WITH_RESULT == intent.action) {
|
||||
// / enabling pass code
|
||||
if (!confirmingPassCode) {
|
||||
requestPassCodeConfirmation()
|
||||
} else if (confirmPassCode()) {
|
||||
// / confirmed: user typed the same pass code twice
|
||||
savePassCodeAndExit()
|
||||
} else {
|
||||
showErrorAndRestart(
|
||||
R.string.pass_code_mismatch,
|
||||
R.string.pass_code_configure_your_pass_code,
|
||||
View.VISIBLE
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun hideSoftKeyboard() {
|
||||
currentFocus?.let {
|
||||
val inputMethodManager = getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
inputMethodManager.hideSoftInputFromWindow(
|
||||
it.windowToken,
|
||||
0
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showErrorAndRestart(errorMessage: Int, headerMessage: Int, explanationVisibility: Int) {
|
||||
passCodeDigits?.let { Arrays.fill(it, null) }
|
||||
|
||||
Snackbar.make(findViewById(android.R.id.content), getString(errorMessage), Snackbar.LENGTH_LONG).show()
|
||||
binding.header.setText(headerMessage) // TODO check if really needed
|
||||
binding.explanation.visibility = explanationVisibility // TODO check if really needed
|
||||
clearBoxes()
|
||||
showDelay()
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask to the user for retyping the pass code just entered before saving it as the current pass code.
|
||||
*/
|
||||
private fun requestPassCodeConfirmation() {
|
||||
clearBoxes()
|
||||
binding.header.setText(R.string.pass_code_reenter_your_pass_code)
|
||||
binding.explanation.visibility = View.INVISIBLE
|
||||
confirmingPassCode = true
|
||||
}
|
||||
|
||||
private fun checkPassCode(): Boolean {
|
||||
val savedPassCodeDigits = preferences?.passCode
|
||||
return passCodeDigits?.zip(savedPassCodeDigits.orEmpty()) { input, saved ->
|
||||
input != null && input == saved
|
||||
}?.all { it } ?: false
|
||||
}
|
||||
|
||||
private fun confirmPassCode(): Boolean {
|
||||
return passCodeEditTexts.indices.all { i ->
|
||||
passCodeEditTexts[i]?.text.toString() == passCodeDigits!![i]
|
||||
}
|
||||
}
|
||||
|
||||
private fun clearBoxes() {
|
||||
passCodeEditTexts.forEach { it?.text?.clear() }
|
||||
passCodeEditTexts.firstOrNull()?.requestFocus()
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides click on the BACK arrow to correctly cancel ACTION_ENABLE or ACTION_DISABLE, while preventing than
|
||||
* ACTION_CHECK may be worked around.
|
||||
*
|
||||
* @param keyCode Key code of the key that triggered the down event.
|
||||
* @param event Event triggered.
|
||||
* @return 'True' when the key event was processed by this method.
|
||||
*/
|
||||
override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.repeatCount == 0) {
|
||||
if (ACTION_CHECK == intent.action) {
|
||||
moveTaskToBack(true)
|
||||
finishAndRemoveTask()
|
||||
} else if (ACTION_REQUEST_WITH_RESULT == intent.action || ACTION_CHECK_WITH_RESULT == intent.action) {
|
||||
finish()
|
||||
} // else, do nothing, but report that the key was consumed to stay alive
|
||||
return true
|
||||
}
|
||||
return super.onKeyDown(keyCode, event)
|
||||
}
|
||||
|
||||
private fun savePassCodeAndExit() {
|
||||
val resultIntent = Intent()
|
||||
resultIntent.putExtra(
|
||||
KEY_PASSCODE,
|
||||
passCodeDigits!![0] + passCodeDigits!![1] + passCodeDigits!![2] + passCodeDigits!![3]
|
||||
)
|
||||
setResult(RESULT_OK, resultIntent)
|
||||
passCodeManager?.updateLockTimestamp()
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun showDelay() {
|
||||
val delay = preferences?.pinBruteForceDelay() ?: 0
|
||||
|
||||
if (delay <= 0) {
|
||||
return
|
||||
}
|
||||
|
||||
binding.explanation.setText(R.string.brute_force_delay)
|
||||
binding.explanation.visibility = View.VISIBLE
|
||||
binding.txt0.isEnabled = false
|
||||
binding.txt1.isEnabled = false
|
||||
binding.txt2.isEnabled = false
|
||||
binding.txt3.isEnabled = false
|
||||
|
||||
Thread(object : Runnable {
|
||||
override fun run() {
|
||||
try {
|
||||
Thread.sleep(delay * 1000L)
|
||||
|
||||
runOnUiThread {
|
||||
binding.explanation.visibility = View.INVISIBLE
|
||||
binding.txt0.isEnabled = true
|
||||
binding.txt1.isEnabled = true
|
||||
binding.txt2.isEnabled = true
|
||||
binding.txt3.isEnabled = true
|
||||
}
|
||||
} catch (e: InterruptedException) {
|
||||
Log_OC.e(this, "Could not delay password input prompt")
|
||||
}
|
||||
}
|
||||
}).start()
|
||||
}
|
||||
|
||||
public override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
outState.putBoolean(KEY_CONFIRMING_PASSCODE, confirmingPassCode)
|
||||
outState.putStringArray(KEY_PASSCODE_DIGITS, passCodeDigits)
|
||||
}
|
||||
|
||||
private inner class PassCodeDigitTextWatcher(index: Int, lastOne: Boolean) : TextWatcher {
|
||||
private var mIndex = -1
|
||||
private val mLastOne: Boolean
|
||||
|
||||
init {
|
||||
mIndex = index
|
||||
mLastOne = lastOne
|
||||
|
||||
require(mIndex >= 0) {
|
||||
"Invalid index in " + PassCodeDigitTextWatcher::class.java.simpleName +
|
||||
" constructor"
|
||||
}
|
||||
}
|
||||
|
||||
private operator fun next(): Int {
|
||||
return if (mLastOne) 0 else mIndex + 1
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs several actions when the user types a digit in an input field: - saves the input digit to the state
|
||||
* of the activity; this will allow retyping the pass code to confirm it. - moves the focus automatically to the
|
||||
* next field - for the last field, triggers the processing of the full pass code
|
||||
*
|
||||
* @param s Changed text
|
||||
*/
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
if (s.isNotEmpty()) {
|
||||
if (!confirmingPassCode) {
|
||||
val passCodeText = passCodeEditTexts[mIndex]?.text
|
||||
|
||||
if (passCodeText != null) {
|
||||
passCodeDigits!![mIndex] = passCodeText.toString()
|
||||
}
|
||||
}
|
||||
|
||||
if (mLastOne) {
|
||||
processFullPassCode()
|
||||
} else {
|
||||
passCodeEditTexts[next()]?.requestFocus()
|
||||
}
|
||||
} else {
|
||||
Log_OC.d(TAG, "Text box $mIndex was cleaned")
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("EmptyFunctionBlock")
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
|
||||
}
|
||||
|
||||
@Suppress("EmptyFunctionBlock")
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author Chris Narkiewicz
|
||||
*
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.ui.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.webkit.JavascriptInterface;
|
||||
|
||||
import com.nextcloud.client.account.CurrentAccountProvider;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.network.ClientFactory;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.operations.RichDocumentsCreateAssetOperation;
|
||||
import com.owncloud.android.ui.asynctasks.PrintAsyncTask;
|
||||
import com.owncloud.android.ui.asynctasks.RichDocumentsLoadUrlTask;
|
||||
import com.owncloud.android.ui.fragment.OCFileListFragment;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.FileStorageUtils;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* Opens document for editing via Richdocuments app in a web view
|
||||
*/
|
||||
public class RichDocumentsEditorWebView extends EditorWebView {
|
||||
private static final int REQUEST_REMOTE_FILE = 100;
|
||||
private static final String URL = "URL";
|
||||
private static final String HYPERLINK = "Url";
|
||||
private static final String TYPE = "Type";
|
||||
private static final String PRINT = "print";
|
||||
private static final String SLIDESHOW = "slideshow";
|
||||
private static final String NEW_NAME = "NewName";
|
||||
|
||||
@Inject
|
||||
protected CurrentAccountProvider currentAccountProvider;
|
||||
|
||||
@Inject
|
||||
protected ClientFactory clientFactory;
|
||||
|
||||
@SuppressFBWarnings("ANDROID_WEB_VIEW_JAVASCRIPT_INTERFACE")
|
||||
@Override
|
||||
protected void postOnCreate() {
|
||||
super.postOnCreate();
|
||||
|
||||
getWebView().addJavascriptInterface(new RichDocumentsMobileInterface(), "RichDocumentsMobileInterface");
|
||||
|
||||
// load url in background
|
||||
loadUrl(getIntent().getStringExtra(EXTRA_URL));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
}
|
||||
|
||||
private void openFileChooser() {
|
||||
Intent action = new Intent(this, FilePickerActivity.class);
|
||||
action.putExtra(OCFileListFragment.ARG_MIMETYPE, "image/");
|
||||
startActivityForResult(action, REQUEST_REMOTE_FILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
switch (requestCode) {
|
||||
case REQUEST_REMOTE_FILE:
|
||||
handleRemoteFile(data);
|
||||
break;
|
||||
|
||||
default:
|
||||
// unexpected, do nothing
|
||||
break;
|
||||
}
|
||||
|
||||
super.handleActivityResult(requestCode, resultCode, data);
|
||||
}
|
||||
|
||||
private void handleRemoteFile(Intent data) {
|
||||
OCFile file = data.getParcelableExtra(FolderPickerActivity.EXTRA_FILES);
|
||||
|
||||
new Thread(() -> {
|
||||
User user = currentAccountProvider.getUser();
|
||||
RichDocumentsCreateAssetOperation operation = new RichDocumentsCreateAssetOperation(file.getRemotePath());
|
||||
RemoteOperationResult result = operation.execute(user, this);
|
||||
|
||||
if (result.isSuccess()) {
|
||||
String asset = (String) result.getSingleData();
|
||||
|
||||
runOnUiThread(() -> getWebView().evaluateJavascript("OCA.RichDocuments.documentsMain.postAsset('" +
|
||||
file.getFileName() + "', '" + asset + "');", null));
|
||||
} else {
|
||||
runOnUiThread(() -> DisplayUtils.showSnackMessage(this, "Inserting image failed!"));
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putString(EXTRA_URL, url);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(@NonNull Bundle savedInstanceState) {
|
||||
url = savedInstanceState.getString(EXTRA_URL);
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
getWebView().evaluateJavascript("if (typeof OCA.RichDocuments.documentsMain.postGrabFocus !== 'undefined') " +
|
||||
"{ OCA.RichDocuments.documentsMain.postGrabFocus(); }",
|
||||
null);
|
||||
}
|
||||
|
||||
private void printFile(Uri url) {
|
||||
OwnCloudAccount account = accountManager.getCurrentOwnCloudAccount();
|
||||
|
||||
if (account == null) {
|
||||
DisplayUtils.showSnackMessage(getWebView(), getString(R.string.failed_to_print));
|
||||
return;
|
||||
}
|
||||
|
||||
File targetFile = new File(FileStorageUtils.getTemporalPath(account.getName()) + "/print.pdf");
|
||||
|
||||
new PrintAsyncTask(targetFile, url.toString(), new WeakReference<>(this)).execute();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUrl(String url) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
new RichDocumentsLoadUrlTask(this, getUser().get(), getFile()).execute();
|
||||
} else {
|
||||
super.loadUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
private void showSlideShow(Uri url) {
|
||||
Intent intent = new Intent(this, ExternalSiteWebView.class);
|
||||
intent.putExtra(ExternalSiteWebView.EXTRA_URL, url.toString());
|
||||
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_SIDEBAR, false);
|
||||
intent.putExtra(ExternalSiteWebView.EXTRA_SHOW_TOOLBAR, false);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
private class RichDocumentsMobileInterface extends MobileInterface {
|
||||
@JavascriptInterface
|
||||
public void insertGraphic() {
|
||||
openFileChooser();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void documentLoaded() {
|
||||
runOnUiThread(RichDocumentsEditorWebView.this::hideLoading);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void downloadAs(String json) {
|
||||
try {
|
||||
JSONObject downloadJson = new JSONObject(json);
|
||||
|
||||
Uri url = Uri.parse(downloadJson.getString(URL));
|
||||
|
||||
switch (downloadJson.getString(TYPE)) {
|
||||
case PRINT:
|
||||
printFile(url);
|
||||
break;
|
||||
|
||||
case SLIDESHOW:
|
||||
showSlideShow(url);
|
||||
break;
|
||||
|
||||
default:
|
||||
downloadFile(url);
|
||||
break;
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log_OC.e(this, "Failed to parse download json message: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void fileRename(String renameString) {
|
||||
// when shared file is renamed in another instance, we will get notified about it
|
||||
// need to change filename for sharing
|
||||
try {
|
||||
JSONObject renameJson = new JSONObject(renameString);
|
||||
String newName = renameJson.getString(NEW_NAME);
|
||||
getFile().setFileName(newName);
|
||||
} catch (JSONException e) {
|
||||
Log_OC.e(this, "Failed to parse rename json message: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void paste() {
|
||||
// Javascript cannot do this by itself, so help out.
|
||||
getWebView().dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_PASTE));
|
||||
getWebView().dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_PASTE));
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void hyperlink(String hyperlink) {
|
||||
try {
|
||||
String url = new JSONObject(hyperlink).getString(HYPERLINK);
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(url));
|
||||
startActivity(intent);
|
||||
} catch (JSONException e) {
|
||||
Log_OC.e(this, "Failed to parse download json message: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author Chris Narkiewicz
|
||||
*
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.activity
|
||||
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.KeyEvent
|
||||
import android.webkit.JavascriptInterface
|
||||
import androidx.activity.result.ActivityResult
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import com.nextcloud.client.account.CurrentAccountProvider
|
||||
import com.nextcloud.client.network.ClientFactory
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.operations.RichDocumentsCreateAssetOperation
|
||||
import com.owncloud.android.ui.asynctasks.PrintAsyncTask
|
||||
import com.owncloud.android.ui.asynctasks.RichDocumentsLoadUrlTask
|
||||
import com.owncloud.android.ui.fragment.OCFileListFragment
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
import com.owncloud.android.utils.FileStorageUtils
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import java.io.File
|
||||
import java.lang.ref.WeakReference
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* Opens document for editing via Richdocuments app in a web view
|
||||
*/
|
||||
class RichDocumentsEditorWebView : EditorWebView() {
|
||||
@JvmField
|
||||
@Inject
|
||||
var currentAccountProvider: CurrentAccountProvider? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var clientFactory: ClientFactory? = null
|
||||
|
||||
private var activityResult: ActivityResultLauncher<Intent>? = null
|
||||
|
||||
@SuppressFBWarnings("ANDROID_WEB_VIEW_JAVASCRIPT_INTERFACE")
|
||||
override fun postOnCreate() {
|
||||
super.postOnCreate()
|
||||
|
||||
webView.addJavascriptInterface(RichDocumentsMobileInterface(), "RichDocumentsMobileInterface")
|
||||
|
||||
intent.getStringExtra(EXTRA_URL)?.let {
|
||||
loadUrl(it)
|
||||
}
|
||||
|
||||
registerActivityResult()
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
}
|
||||
|
||||
private fun openFileChooser() {
|
||||
val action = Intent(this, FilePickerActivity::class.java)
|
||||
action.putExtra(OCFileListFragment.ARG_MIMETYPE, "image/")
|
||||
activityResult?.launch(action)
|
||||
}
|
||||
|
||||
private fun registerActivityResult() {
|
||||
activityResult =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result: ActivityResult ->
|
||||
if (RESULT_OK == result.resultCode) {
|
||||
result.data?.let {
|
||||
handleRemoteFile(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleRemoteFile(data: Intent) {
|
||||
val file = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
data.getParcelableExtra(FolderPickerActivity.EXTRA_FILES, OCFile::class.java)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
data.getParcelableExtra(FolderPickerActivity.EXTRA_FILES)
|
||||
}
|
||||
|
||||
Thread {
|
||||
val user = currentAccountProvider?.user
|
||||
val operation = RichDocumentsCreateAssetOperation(file?.remotePath)
|
||||
val result = operation.execute(user, this)
|
||||
if (result.isSuccess) {
|
||||
val asset = result.singleData as String
|
||||
runOnUiThread {
|
||||
webView.evaluateJavascript(
|
||||
"OCA.RichDocuments.documentsMain.postAsset('" +
|
||||
file?.fileName + "', '" + asset + "');",
|
||||
null
|
||||
)
|
||||
}
|
||||
} else {
|
||||
runOnUiThread { DisplayUtils.showSnackMessage(this, "Inserting image failed!") }
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
outState.putString(EXTRA_URL, url)
|
||||
super.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
|
||||
url = savedInstanceState.getString(EXTRA_URL)
|
||||
super.onRestoreInstanceState(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
webView.evaluateJavascript(
|
||||
"if (typeof OCA.RichDocuments.documentsMain.postGrabFocus !== 'undefined') " +
|
||||
"{ OCA.RichDocuments.documentsMain.postGrabFocus(); }",
|
||||
null
|
||||
)
|
||||
}
|
||||
|
||||
private fun printFile(url: Uri) {
|
||||
val account = accountManager.currentOwnCloudAccount
|
||||
if (account == null) {
|
||||
DisplayUtils.showSnackMessage(webView, getString(R.string.failed_to_print))
|
||||
return
|
||||
}
|
||||
val targetFile = File(FileStorageUtils.getTemporalPath(account.name) + "/print.pdf")
|
||||
PrintAsyncTask(targetFile, url.toString(), WeakReference(this)).execute()
|
||||
}
|
||||
|
||||
public override fun loadUrl(url: String) {
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
RichDocumentsLoadUrlTask(this, user.get(), file).execute()
|
||||
} else {
|
||||
super.loadUrl(url)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showSlideShow(url: Uri) {
|
||||
val intent = Intent(this, ExternalSiteWebView::class.java)
|
||||
intent.putExtra(EXTRA_URL, url.toString())
|
||||
intent.putExtra(EXTRA_SHOW_SIDEBAR, false)
|
||||
intent.putExtra(EXTRA_SHOW_TOOLBAR, false)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
private inner class RichDocumentsMobileInterface : MobileInterface() {
|
||||
@JavascriptInterface
|
||||
fun insertGraphic() {
|
||||
openFileChooser()
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun documentLoaded() {
|
||||
runOnUiThread { hideLoading() }
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun downloadAs(json: String?) {
|
||||
try {
|
||||
json ?: return
|
||||
val downloadJson = JSONObject(json)
|
||||
val url = Uri.parse(downloadJson.getString(URL))
|
||||
when (downloadJson.getString(TYPE)) {
|
||||
PRINT -> printFile(url)
|
||||
SLIDESHOW -> showSlideShow(url)
|
||||
else -> downloadFile(url)
|
||||
}
|
||||
} catch (e: JSONException) {
|
||||
Log_OC.e(this, "Failed to parse download json message: $e")
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun fileRename(renameString: String?) {
|
||||
// when shared file is renamed in another instance, we will get notified about it
|
||||
// need to change filename for sharing
|
||||
try {
|
||||
renameString ?: return
|
||||
val renameJson = JSONObject(renameString)
|
||||
val newName = renameJson.getString(NEW_NAME)
|
||||
file.fileName = newName
|
||||
} catch (e: JSONException) {
|
||||
Log_OC.e(this, "Failed to parse rename json message: $e")
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun paste() {
|
||||
// Javascript cannot do this by itself, so help out.
|
||||
webView.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_PASTE))
|
||||
webView.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_PASTE))
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
fun hyperlink(hyperlink: String?) {
|
||||
try {
|
||||
hyperlink ?: return
|
||||
val url = JSONObject(hyperlink).getString(HYPERLINK)
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
intent.data = Uri.parse(url)
|
||||
startActivity(intent)
|
||||
} catch (e: JSONException) {
|
||||
Log_OC.e(this, "Failed to parse download json message: $e")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val URL = "URL"
|
||||
private const val HYPERLINK = "Url"
|
||||
private const val TYPE = "Type"
|
||||
private const val PRINT = "print"
|
||||
private const val SLIDESHOW = "slideshow"
|
||||
private const val NEW_NAME = "NewName"
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,7 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.activity.OnBackPressedCallback;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.appcompat.app.ActionBar;
|
||||
@@ -258,6 +259,8 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
|
||||
|
||||
checkWritableFolder(mCurrentDir);
|
||||
|
||||
getOnBackPressedDispatcher().addCallback(this, onBackPressedCallback);
|
||||
|
||||
Log_OC.d(TAG, "onCreate() end");
|
||||
}
|
||||
|
||||
@@ -369,43 +372,45 @@ public class UploadFilesActivity extends DrawerActivity implements LocalFileList
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (isSearchOpen() && mSearchView != null) {
|
||||
mSearchView.setQuery("", false);
|
||||
mFileListFragment.onClose();
|
||||
mSearchView.onActionViewCollapsed();
|
||||
setDrawerIndicatorEnabled(isDrawerIndicatorAvailable());
|
||||
} else {
|
||||
if (mDirectories.getCount() <= SINGLE_DIR) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
private final OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) {
|
||||
@Override
|
||||
public void handleOnBackPressed() {
|
||||
if (isSearchOpen() && mSearchView != null) {
|
||||
mSearchView.setQuery("", false);
|
||||
mFileListFragment.onClose();
|
||||
mSearchView.onActionViewCollapsed();
|
||||
setDrawerIndicatorEnabled(isDrawerIndicatorAvailable());
|
||||
} else {
|
||||
if (mDirectories.getCount() <= SINGLE_DIR) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
File parentFolder = mCurrentDir.getParentFile();
|
||||
if (!parentFolder.canRead()) {
|
||||
checkLocalStoragePathPickerPermission();
|
||||
return;
|
||||
}
|
||||
File parentFolder = mCurrentDir.getParentFile();
|
||||
if (!parentFolder.canRead()) {
|
||||
checkLocalStoragePathPickerPermission();
|
||||
return;
|
||||
}
|
||||
|
||||
popDirname();
|
||||
mFileListFragment.onNavigateUp();
|
||||
mCurrentDir = mFileListFragment.getCurrentDirectory();
|
||||
checkWritableFolder(mCurrentDir);
|
||||
popDirname();
|
||||
mFileListFragment.onNavigateUp();
|
||||
mCurrentDir = mFileListFragment.getCurrentDirectory();
|
||||
checkWritableFolder(mCurrentDir);
|
||||
|
||||
if (mCurrentDir.getParentFile() == null) {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
if (mCurrentDir.getParentFile() == null) {
|
||||
ActionBar actionBar = getSupportActionBar();
|
||||
if (actionBar != null) {
|
||||
actionBar.setDisplayHomeAsUpEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
// invalidate checked state when navigating directories
|
||||
if (!mLocalFolderPickerMode) {
|
||||
setSelectAllMenuItem(mOptionsMenu.findItem(R.id.action_select_all), false);
|
||||
}
|
||||
}
|
||||
|
||||
// invalidate checked state when navigating directories
|
||||
if (!mLocalFolderPickerMode) {
|
||||
setSelectAllMenuItem(mOptionsMenu.findItem(R.id.action_select_all), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
|
||||
@@ -56,7 +56,7 @@ import com.owncloud.android.lib.common.accounts.AccountUtils;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.lib.resources.users.GetUserInfoRemoteOperation;
|
||||
import com.owncloud.android.ui.dialog.AccountRemovalConfirmationDialog;
|
||||
import com.owncloud.android.ui.dialog.AccountRemovalDialog;
|
||||
import com.owncloud.android.ui.events.TokenPushEvent;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.PushUtils;
|
||||
@@ -173,7 +173,7 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
|
||||
} else if (itemId == R.id.action_open_account) {
|
||||
accountClicked(user.hashCode());
|
||||
} else if (itemId == R.id.action_delete_account) {
|
||||
openAccountRemovalConfirmationDialog(user, getSupportFragmentManager());
|
||||
openAccountRemovalDialog(user, getSupportFragmentManager());
|
||||
} else {
|
||||
retval = super.onOptionsItemSelected(item);
|
||||
}
|
||||
@@ -302,8 +302,8 @@ public class UserInfoActivity extends DrawerActivity implements Injectable {
|
||||
}
|
||||
}
|
||||
|
||||
public static void openAccountRemovalConfirmationDialog(User user, FragmentManager fragmentManager) {
|
||||
AccountRemovalConfirmationDialog dialog = AccountRemovalConfirmationDialog.newInstance(user);
|
||||
public static void openAccountRemovalDialog(User user, FragmentManager fragmentManager) {
|
||||
AccountRemovalDialog dialog = AccountRemovalDialog.newInstance(user);
|
||||
dialog.show(fragmentManager, "dialog");
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
package com.owncloud.android.ui.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
@@ -94,15 +95,15 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
switch (ShareType.fromValue(viewType)) {
|
||||
case PUBLIC_LINK:
|
||||
case EMAIL:
|
||||
case PUBLIC_LINK, EMAIL -> {
|
||||
return new LinkShareViewHolder(
|
||||
FileDetailsShareLinkShareItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false),
|
||||
fileActivity,
|
||||
viewThemeUtils);
|
||||
case NEW_PUBLIC_LINK:
|
||||
}
|
||||
case NEW_PUBLIC_LINK -> {
|
||||
if (encrypted) {
|
||||
return new NewSecureFileDropViewHolder(
|
||||
FileDetailsShareSecureFileDropAddNewItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
@@ -116,17 +117,20 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
false)
|
||||
);
|
||||
}
|
||||
case INTERNAL:
|
||||
}
|
||||
case INTERNAL -> {
|
||||
return new InternalShareViewHolder(
|
||||
FileDetailsShareInternalShareLinkBinding.inflate(LayoutInflater.from(fileActivity), parent, false),
|
||||
fileActivity);
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
return new ShareViewHolder(FileDetailsShareShareItemBinding.inflate(LayoutInflater.from(fileActivity),
|
||||
parent,
|
||||
false),
|
||||
user,
|
||||
fileActivity,
|
||||
viewThemeUtils);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,17 +142,13 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
|
||||
final OCShare share = shares.get(position);
|
||||
|
||||
if (holder instanceof LinkShareViewHolder) {
|
||||
LinkShareViewHolder publicShareViewHolder = (LinkShareViewHolder) holder;
|
||||
if (holder instanceof LinkShareViewHolder publicShareViewHolder) {
|
||||
publicShareViewHolder.bind(share, listener);
|
||||
} else if (holder instanceof InternalShareViewHolder) {
|
||||
InternalShareViewHolder internalShareViewHolder = (InternalShareViewHolder) holder;
|
||||
} else if (holder instanceof InternalShareViewHolder internalShareViewHolder) {
|
||||
internalShareViewHolder.bind(share, listener);
|
||||
} else if (holder instanceof NewLinkShareViewHolder) {
|
||||
NewLinkShareViewHolder newLinkShareViewHolder = (NewLinkShareViewHolder) holder;
|
||||
} else if (holder instanceof NewLinkShareViewHolder newLinkShareViewHolder) {
|
||||
newLinkShareViewHolder.bind(listener);
|
||||
} else if (holder instanceof NewSecureFileDropViewHolder) {
|
||||
NewSecureFileDropViewHolder newSecureFileDropViewHolder = (NewSecureFileDropViewHolder) holder;
|
||||
} else if (holder instanceof NewSecureFileDropViewHolder newSecureFileDropViewHolder) {
|
||||
newSecureFileDropViewHolder.bind(listener);
|
||||
} else {
|
||||
ShareViewHolder userViewHolder = (ShareViewHolder) holder;
|
||||
@@ -166,6 +166,7 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
return shares.size();
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void addShares(List<OCShare> sharesToAdd) {
|
||||
shares.addAll(sharesToAdd);
|
||||
sortShares();
|
||||
@@ -174,22 +175,21 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
|
||||
@Override
|
||||
public void avatarGenerated(Drawable avatarDrawable, Object callContext) {
|
||||
if (callContext instanceof ImageView) {
|
||||
ImageView iv = (ImageView) callContext;
|
||||
if (callContext instanceof ImageView iv) {
|
||||
iv.setImageDrawable(avatarDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCallGeneratedCallback(String tag, Object callContext) {
|
||||
if (callContext instanceof ImageView) {
|
||||
ImageView iv = (ImageView) callContext;
|
||||
if (callContext instanceof ImageView iv) {
|
||||
// needs to be changed once federated users have avatars
|
||||
return String.valueOf(iv.getTag()).equals(tag.split("@")[0]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
public void remove(OCShare share) {
|
||||
shares.remove(share);
|
||||
notifyDataSetChanged();
|
||||
@@ -210,8 +210,8 @@ public class ShareeListAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(links, (o1, o2) -> Long.compare(o2.getSharedDate(), o1.getSharedDate()));
|
||||
Collections.sort(users, (o1, o2) -> Long.compare(o2.getSharedDate(), o1.getSharedDate()));
|
||||
links.sort((o1, o2) -> Long.compare(o2.getSharedDate(), o1.getSharedDate()));
|
||||
users.sort((o1, o2) -> Long.compare(o2.getSharedDate(), o1.getSharedDate()));
|
||||
|
||||
shares = links;
|
||||
shares.addAll(users);
|
||||
|
||||
@@ -248,7 +248,7 @@ public class SyncedFolderAdapter extends SectionedRecyclerViewAdapter<SectionedV
|
||||
public int getSectionByLocalPathAndType(String localPath, int type) {
|
||||
for (int i = 0; i < filteredSyncFolderItems.size(); i++) {
|
||||
if (filteredSyncFolderItems.get(i).getLocalPath().equalsIgnoreCase(localPath) &&
|
||||
filteredSyncFolderItems.get(i).getType().getId().equals(type)) {
|
||||
filteredSyncFolderItems.get(i).getType().id == type) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.operations.RefreshFolderOperation;
|
||||
import com.owncloud.android.ui.activity.ConflictsResolveActivity;
|
||||
import com.owncloud.android.ui.activity.FileActivity;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.preview.PreviewImageFragment;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.MimeTypeUtil;
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils;
|
||||
@@ -346,12 +348,15 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
||||
itemViewHolder.binding.uploadRightButton.setOnClickListener(v -> removeUpload(item));
|
||||
}
|
||||
itemViewHolder.binding.uploadRightButton.setVisibility(View.VISIBLE);
|
||||
} else { // UploadStatus.UPLOAD_SUCCESS
|
||||
} else { // UploadStatus.UPLOAD_SUCCEEDED
|
||||
itemViewHolder.binding.uploadRightButton.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
||||
itemViewHolder.binding.uploadListItemLayout.setOnClickListener(null);
|
||||
|
||||
// Set icon or thumbnail
|
||||
itemViewHolder.binding.thumbnail.setImageResource(R.drawable.file);
|
||||
|
||||
// click on item
|
||||
if (item.getUploadStatus() == UploadStatus.UPLOAD_FAILED) {
|
||||
final UploadResult uploadResult = item.getLastResult();
|
||||
@@ -381,12 +386,15 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
itemViewHolder.binding.uploadListItemLayout.setOnClickListener(v -> onUploadItemClick(item));
|
||||
} else if (item.getUploadStatus() == UploadStatus.UPLOAD_SUCCEEDED){
|
||||
itemViewHolder.binding.uploadListItemLayout.setOnClickListener(v -> onUploadedItemClick(item));
|
||||
}
|
||||
|
||||
// Set icon or thumbnail
|
||||
itemViewHolder.binding.thumbnail.setImageResource(R.drawable.file);
|
||||
|
||||
// click on thumbnail to open locally
|
||||
if (item.getUploadStatus() != UploadStatus.UPLOAD_SUCCEEDED){
|
||||
itemViewHolder.binding.thumbnail.setOnClickListener(v -> onUploadingItemClick(item));
|
||||
}
|
||||
|
||||
/*
|
||||
* Cancellation needs do be checked and done before changing the drawable in fileIcon, or
|
||||
@@ -738,7 +746,10 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void onUploadItemClick(OCUpload file) {
|
||||
/**
|
||||
* Open local file.
|
||||
*/
|
||||
private void onUploadingItemClick(OCUpload file) {
|
||||
File f = new File(file.getLocalPath());
|
||||
if (!f.exists()) {
|
||||
DisplayUtils.showSnackMessage(parentActivity, R.string.local_file_not_found_message);
|
||||
@@ -747,6 +758,30 @@ public class UploadListAdapter extends SectionedRecyclerViewAdapter<SectionedVie
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Open remote file.
|
||||
*/
|
||||
private void onUploadedItemClick(OCUpload upload) {
|
||||
final OCFile file = parentActivity.getStorageManager().getFileByEncryptedRemotePath(upload.getRemotePath());
|
||||
if (file == null){
|
||||
DisplayUtils.showSnackMessage(parentActivity, R.string.error_retrieving_file);
|
||||
Log_OC.i(TAG, "Could not find uploaded file on remote.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (PreviewImageFragment.canBePreviewed(file)){
|
||||
//show image preview and stay in uploads tab
|
||||
Intent intent = FileDisplayActivity.openFileIntent(parentActivity, parentActivity.getUser().get(), file);
|
||||
parentActivity.startActivity(intent);
|
||||
}else{
|
||||
Intent intent = new Intent(parentActivity, FileDisplayActivity.class);
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.putExtra(FileDisplayActivity.KEY_FILE_PATH, upload.getRemotePath());
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
parentActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Open file with app associates with its MIME type. If MIME type unknown, show list with all apps.
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2020 Tobias Kaminsky
|
||||
* Copyright (C) 2020 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.DialogInterface
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.nextcloud.client.account.User
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.nextcloud.client.jobs.BackgroundJobManager
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import javax.inject.Inject
|
||||
|
||||
class AccountRemovalConfirmationDialog : DialogFragment(), Injectable {
|
||||
@JvmField
|
||||
@Inject
|
||||
var backgroundJobManager: BackgroundJobManager? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var viewThemeUtils: ViewThemeUtils? = null
|
||||
|
||||
private var user: User? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
user = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
|
||||
requireArguments().getParcelable(KEY_USER, User::class.java)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
requireArguments().getParcelable(KEY_USER)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
val alertDialog = dialog as AlertDialog?
|
||||
|
||||
if (alertDialog != null) {
|
||||
val positiveButton = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton
|
||||
viewThemeUtils?.material?.colorMaterialButtonPrimaryTonal(positiveButton)
|
||||
|
||||
val negativeButton = alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton
|
||||
viewThemeUtils?.material?.colorMaterialButtonPrimaryBorderless(negativeButton)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val builder = MaterialAlertDialogBuilder(requireActivity())
|
||||
.setTitle(R.string.delete_account)
|
||||
.setMessage(resources.getString(R.string.delete_account_warning, user!!.accountName))
|
||||
.setIcon(R.drawable.ic_warning)
|
||||
.setPositiveButton(R.string.common_ok) { _: DialogInterface?, _: Int ->
|
||||
backgroundJobManager?.startAccountRemovalJob(
|
||||
user!!.accountName,
|
||||
false
|
||||
)
|
||||
}
|
||||
.setNegativeButton(R.string.common_cancel, null)
|
||||
|
||||
viewThemeUtils?.dialog?.colorMaterialAlertDialogBackground(requireActivity(), builder)
|
||||
|
||||
return builder.create()
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
private const val KEY_USER = "USER"
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(user: User?): AccountRemovalConfirmationDialog {
|
||||
val bundle = Bundle()
|
||||
bundle.putParcelable(KEY_USER, user)
|
||||
val dialog = AccountRemovalConfirmationDialog()
|
||||
dialog.arguments = bundle
|
||||
return dialog
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author ZetaTom
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2023 ZetaTom
|
||||
* Copyright (C) 2020 Tobias Kaminsky
|
||||
* Copyright (C) 2020 Nextcloud GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.owncloud.android.ui.dialog
|
||||
|
||||
import android.app.Dialog
|
||||
import android.graphics.drawable.Drawable
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import com.nextcloud.client.account.User
|
||||
import com.nextcloud.client.account.UserAccountManager
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.nextcloud.client.jobs.BackgroundJobManager
|
||||
import com.nextcloud.utils.extensions.getParcelableArgument
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.AccountRemovalDialogBinding
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
import com.owncloud.android.utils.DisplayUtils.AvatarGenerationListener
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import javax.inject.Inject
|
||||
|
||||
class AccountRemovalDialog : DialogFragment(), AvatarGenerationListener, Injectable {
|
||||
|
||||
@Inject
|
||||
lateinit var backgroundJobManager: BackgroundJobManager
|
||||
|
||||
@Inject
|
||||
lateinit var viewThemeUtils: ViewThemeUtils
|
||||
|
||||
private var user: User? = null
|
||||
private lateinit var alertDialog: AlertDialog
|
||||
private var _binding: AccountRemovalDialogBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
user = requireArguments().getParcelableArgument(KEY_USER, User::class.java)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
// disable positive button and apply theming
|
||||
alertDialog = dialog as AlertDialog
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).isEnabled = false
|
||||
|
||||
viewThemeUtils.platform.themeRadioButton(binding.radioLocalRemove)
|
||||
viewThemeUtils.platform.themeRadioButton(binding.radioRequestDeletion)
|
||||
viewThemeUtils.material.colorMaterialButtonPrimaryTonal(
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE) as MaterialButton
|
||||
)
|
||||
viewThemeUtils.material.colorMaterialButtonPrimaryBorderless(
|
||||
alertDialog.getButton(AlertDialog.BUTTON_NEGATIVE) as MaterialButton
|
||||
)
|
||||
|
||||
binding.userName.text = UserAccountManager.getDisplayName(user)
|
||||
binding.account.text = user?.let { DisplayUtils.convertIdn(it.accountName, false) }
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
_binding = AccountRemovalDialogBinding.inflate(layoutInflater)
|
||||
|
||||
// start avatar generation
|
||||
setAvatar()
|
||||
|
||||
// hide second option when plug-in isn't installed
|
||||
if (hasDropAccount()) {
|
||||
binding.requestDeletion.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
val builder =
|
||||
MaterialAlertDialogBuilder(requireActivity())
|
||||
.setTitle(R.string.delete_account)
|
||||
.setView(binding.root)
|
||||
.setNegativeButton(R.string.common_cancel) { _, _ -> }
|
||||
.setPositiveButton(R.string.delete_account) { _, _ -> removeAccount() }
|
||||
|
||||
// allow selection by clicking on list element
|
||||
binding.localRemove.setOnClickListener {
|
||||
binding.radioLocalRemove.performClick()
|
||||
}
|
||||
binding.requestDeletion.setOnClickListener {
|
||||
binding.radioRequestDeletion.performClick()
|
||||
}
|
||||
|
||||
// set listeners for custom radio button list
|
||||
binding.radioLocalRemove.setOnClickListener {
|
||||
binding.radioRequestDeletion.isChecked = false
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).apply {
|
||||
text = getText(R.string.delete_account)
|
||||
isEnabled = true
|
||||
}
|
||||
}
|
||||
binding.radioRequestDeletion.setOnClickListener {
|
||||
binding.radioLocalRemove.isChecked = false
|
||||
alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).apply {
|
||||
text = getString(R.string.request_account_deletion_button)
|
||||
isEnabled = true
|
||||
}
|
||||
}
|
||||
|
||||
viewThemeUtils.dialog.colorMaterialAlertDialogBackground(requireActivity(), builder)
|
||||
|
||||
return builder.create()
|
||||
}
|
||||
|
||||
/**
|
||||
* Get value of `drop-account` capability.
|
||||
*/
|
||||
private fun hasDropAccount(): Boolean {
|
||||
val capability = FileDataStorageManager(user, context?.contentResolver).getCapability(user)
|
||||
return capability.dropAccount.isTrue
|
||||
}
|
||||
|
||||
/**
|
||||
* Start removal of account. Depending on which option is checked, either a browser will open to request deletion,
|
||||
* or the local account will be removed immediately.
|
||||
*/
|
||||
private fun removeAccount() {
|
||||
user?.let { user ->
|
||||
if (binding.radioRequestDeletion.isChecked) {
|
||||
DisplayUtils.startLinkIntent(activity, user.server.uri.toString() + DROP_ACCOUNT_URI)
|
||||
} else {
|
||||
backgroundJobManager.startAccountRemovalJob(user.accountName, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start avatar generation.
|
||||
*/
|
||||
private fun setAvatar() {
|
||||
try {
|
||||
val imageView = binding.userIcon
|
||||
imageView.tag = user!!.accountName
|
||||
DisplayUtils.setAvatar(
|
||||
user!!,
|
||||
this,
|
||||
resources.getDimension(R.dimen.list_item_avatar_icon_radius),
|
||||
resources,
|
||||
imageView,
|
||||
context
|
||||
)
|
||||
} catch (_: Exception) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun avatarGenerated(avatarDrawable: Drawable?, callContext: Any?) {
|
||||
avatarDrawable?.let {
|
||||
binding.userIcon.setImageDrawable(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun shouldCallGeneratedCallback(tag: String?, callContext: Any?): Boolean {
|
||||
return binding.userIcon.tag == tag
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val KEY_USER = "USER"
|
||||
private const val DROP_ACCOUNT_URI = "/settings/user/drop_account"
|
||||
|
||||
@JvmStatic
|
||||
fun newInstance(user: User) = AccountRemovalDialog().apply {
|
||||
arguments = Bundle().apply {
|
||||
putParcelable(KEY_USER, user)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ public class SyncedFolderParcelable implements Parcelable {
|
||||
dest.writeInt(existing ? 1 : 0);
|
||||
dest.writeInt(enabled ? 1 : 0);
|
||||
dest.writeInt(subfolderByDate ? 1 : 0);
|
||||
dest.writeInt(type.getId());
|
||||
dest.writeInt(type.id);
|
||||
dest.writeString(account);
|
||||
dest.writeInt(uploadAction);
|
||||
dest.writeInt(nameCollisionPolicy.serialize());
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Copyright (C) 2018 Andy Scherzinger
|
||||
* Copyright (C) 2020 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
* Copyright (C) 2020 TSI-mc
|
||||
* Copyright (C) 2023 TSI-mc
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
@@ -25,11 +25,17 @@
|
||||
|
||||
package com.owncloud.android.ui.fragment;
|
||||
|
||||
import android.Manifest;
|
||||
import android.accounts.AccountManager;
|
||||
import android.app.Activity;
|
||||
import android.app.SearchManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.provider.ContactsContract;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -46,6 +52,7 @@ import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||
import com.owncloud.android.datamodel.OCFile;
|
||||
import com.owncloud.android.lib.common.OwnCloudAccount;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.lib.resources.shares.OCShare;
|
||||
import com.owncloud.android.lib.resources.shares.ShareType;
|
||||
import com.owncloud.android.lib.resources.status.NextcloudVersion;
|
||||
@@ -61,6 +68,7 @@ import com.owncloud.android.ui.fragment.util.FileDetailSharingFragmentHelper;
|
||||
import com.owncloud.android.ui.helpers.FileOperationsHelper;
|
||||
import com.owncloud.android.utils.ClipboardUtil;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.PermissionUtil;
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -68,6 +76,8 @@ import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.activity.result.ActivityResultLauncher;
|
||||
import androidx.activity.result.contract.ActivityResultContracts;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
@@ -81,7 +91,6 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
|
||||
private static final String ARG_FILE = "FILE";
|
||||
private static final String ARG_USER = "USER";
|
||||
public static final int PERMISSION_EDITING_ALLOWED = 17;
|
||||
|
||||
private OCFile file;
|
||||
private User user;
|
||||
@@ -118,8 +127,8 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
} else {
|
||||
Bundle arguments = getArguments();
|
||||
if (arguments != null) {
|
||||
file = getArguments().getParcelable(ARG_FILE);
|
||||
user = getArguments().getParcelable(ARG_USER);
|
||||
file = arguments.getParcelable(ARG_FILE);
|
||||
user = arguments.getParcelable(ARG_USER);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,12 +158,11 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
binding = FileDetailsSharingFragmentBinding.inflate(inflater, container, false);
|
||||
View view = binding.getRoot();
|
||||
|
||||
fileOperationsHelper = fileActivity.getFileOperationsHelper();
|
||||
fileDataStorageManager = fileActivity.getStorageManager();
|
||||
|
||||
AccountManager accountManager = AccountManager.get(getContext());
|
||||
AccountManager accountManager = AccountManager.get(requireContext());
|
||||
String userId = accountManager.getUserData(user.toPlatformAccount(),
|
||||
com.owncloud.android.lib.common.accounts.AccountUtils.Constants.KEY_USER_ID);
|
||||
|
||||
@@ -165,11 +173,14 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
user,
|
||||
viewThemeUtils,
|
||||
file.isEncrypted()));
|
||||
binding.sharesList.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
|
||||
binding.sharesList.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
|
||||
binding.pickContactEmailBtn.setOnClickListener(v -> checkContactPermission());
|
||||
|
||||
setupView();
|
||||
|
||||
return view;
|
||||
return binding.getRoot();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,6 +219,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
} else {
|
||||
binding.searchView.setQueryHint(getResources().getString(R.string.reshare_not_allowed));
|
||||
binding.searchView.setInputType(InputType.TYPE_NULL);
|
||||
binding.pickContactEmailBtn.setVisibility(View.GONE);
|
||||
disableSearchView(binding.searchView);
|
||||
}
|
||||
}
|
||||
@@ -216,9 +228,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
private void disableSearchView(View view) {
|
||||
view.setEnabled(false);
|
||||
|
||||
if (view instanceof ViewGroup) {
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
|
||||
if (view instanceof ViewGroup viewGroup) {
|
||||
for (int i = 0; i < viewGroup.getChildCount(); i++) {
|
||||
disableSearchView(viewGroup.getChildAt(i));
|
||||
}
|
||||
@@ -302,7 +312,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
if (TextUtils.isEmpty(share.getShareLink())) {
|
||||
fileOperationsHelper.getFileWithLink(file, viewThemeUtils);
|
||||
} else {
|
||||
ClipboardUtil.copyToClipboard(getActivity(), share.getShareLink());
|
||||
ClipboardUtil.copyToClipboard(requireActivity(), share.getShareLink());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -460,6 +470,52 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
adapter.addShares(publicShares);
|
||||
}
|
||||
|
||||
private void checkContactPermission() {
|
||||
if (PermissionUtil.checkSelfPermission(requireActivity(), Manifest.permission.READ_CONTACTS)) {
|
||||
pickContactEmail();
|
||||
} else {
|
||||
requestContactPermissionLauncher.launch(Manifest.permission.READ_CONTACTS);
|
||||
}
|
||||
}
|
||||
|
||||
private void pickContactEmail() {
|
||||
Intent intent = new Intent(Intent.ACTION_PICK);
|
||||
intent.setDataAndType(ContactsContract.Contacts.CONTENT_URI, ContactsContract.CommonDataKinds.Email.CONTENT_TYPE);
|
||||
onContactSelectionResultLauncher.launch(intent);
|
||||
}
|
||||
|
||||
private void handleContactResult(@NonNull Uri contactUri) {
|
||||
// Define the projection to get all email addresses.
|
||||
String[] projection = {ContactsContract.CommonDataKinds.Email.ADDRESS};
|
||||
|
||||
Cursor cursor = fileActivity.getContentResolver().query(contactUri, projection, null, null, null);
|
||||
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
// The contact has only one email address, use it.
|
||||
int columnIndex = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.ADDRESS);
|
||||
if (columnIndex != -1) {
|
||||
// Use the email address as needed.
|
||||
// email variable contains the selected contact's email address.
|
||||
String email = cursor.getString(columnIndex);
|
||||
binding.searchView.post(() -> {
|
||||
binding.searchView.setQuery(email, false);
|
||||
binding.searchView.requestFocus();
|
||||
});
|
||||
} else {
|
||||
DisplayUtils.showSnackMessage(binding.getRoot(), R.string.email_pick_failed);
|
||||
Log_OC.e(FileDetailSharingFragment.class.getSimpleName(), "Failed to pick email address.");
|
||||
}
|
||||
} else {
|
||||
DisplayUtils.showSnackMessage(binding.getRoot(), R.string.email_pick_failed);
|
||||
Log_OC.e(FileDetailSharingFragment.class.getSimpleName(), "Failed to pick email address as no Email found.");
|
||||
}
|
||||
cursor.close();
|
||||
} else {
|
||||
DisplayUtils.showSnackMessage(binding.getRoot(), R.string.email_pick_failed);
|
||||
Log_OC.e(FileDetailSharingFragment.class.getSimpleName(), "Failed to pick email address as Cursor is null.");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean containsNoNewPublicShare(List<OCShare> shares) {
|
||||
for (OCShare share : shares) {
|
||||
@@ -496,7 +552,7 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
|
||||
@VisibleForTesting
|
||||
public void search(String query) {
|
||||
SearchView searchView = getView().findViewById(R.id.searchView);
|
||||
SearchView searchView = requireView().findViewById(R.id.searchView);
|
||||
searchView.setQuery(query, true);
|
||||
}
|
||||
|
||||
@@ -546,6 +602,38 @@ public class FileDetailSharingFragment extends Fragment implements ShareeListAda
|
||||
fileOperationsHelper.setPermissionsToShare(share, permission);
|
||||
}
|
||||
|
||||
//launcher for contact permission
|
||||
private final ActivityResultLauncher<String> requestContactPermissionLauncher =
|
||||
registerForActivityResult(new ActivityResultContracts.RequestPermission(), isGranted -> {
|
||||
if (isGranted) {
|
||||
pickContactEmail();
|
||||
} else {
|
||||
DisplayUtils.showSnackMessage(binding.getRoot(), R.string.contact_no_permission);
|
||||
}
|
||||
});
|
||||
|
||||
//launcher to handle contact selection
|
||||
private final ActivityResultLauncher<Intent> onContactSelectionResultLauncher =
|
||||
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(),
|
||||
result -> {
|
||||
if (result.getResultCode() == Activity.RESULT_OK) {
|
||||
Intent intent = result.getData();
|
||||
if (intent == null) {
|
||||
DisplayUtils.showSnackMessage(binding.getRoot(), R.string.email_pick_failed);
|
||||
return;
|
||||
}
|
||||
|
||||
Uri contactUri = intent.getData();
|
||||
if (contactUri == null) {
|
||||
DisplayUtils.showSnackMessage(binding.getRoot(), R.string.email_pick_failed);
|
||||
return;
|
||||
}
|
||||
|
||||
handleContactResult(contactUri);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
public interface OnEditShareListener {
|
||||
void editExistingShare(OCShare share, int screenTypePermission, boolean isReshareShown,
|
||||
boolean isExpiryDateShown);
|
||||
|
||||
@@ -545,7 +545,7 @@ class FileDetailsSharingProcessFragment :
|
||||
)
|
||||
// copy the share link if available
|
||||
if (!TextUtils.isEmpty(share?.shareLink)) {
|
||||
ClipboardUtil.copyToClipboard(activity, share?.shareLink)
|
||||
ClipboardUtil.copyToClipboard(requireActivity(), share?.shareLink)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -932,15 +932,15 @@ public class FileOperationsHelper {
|
||||
}
|
||||
|
||||
public void renameFile(OCFile file, String newFilename) {
|
||||
// RenameFile
|
||||
Intent service = new Intent(fileActivity, OperationsService.class);
|
||||
|
||||
service.setAction(OperationsService.ACTION_RENAME);
|
||||
service.putExtra(OperationsService.EXTRA_ACCOUNT, fileActivity.getAccount());
|
||||
service.putExtra(OperationsService.EXTRA_REMOTE_PATH, file.getRemotePath());
|
||||
service.putExtra(OperationsService.EXTRA_NEWNAME, newFilename);
|
||||
mWaitingForOpId = fileActivity.getOperationsServiceBinder().queueNewOperation(service);
|
||||
|
||||
fileActivity.showLoadingDialog(fileActivity.getString(R.string.wait_a_moment));
|
||||
fileActivity.refreshList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,227 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author TSI-mc
|
||||
* @author Chris Narkiewicz
|
||||
*
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
* Copyright (C) 2023 TSI-mc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.trashbin;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.network.ClientFactory;
|
||||
import com.nextcloud.common.NextcloudClient;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import com.owncloud.android.lib.resources.trashbin.EmptyTrashbinRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.trashbin.ReadTrashbinFolderRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.trashbin.RemoveTrashbinFileRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.trashbin.RestoreTrashbinFileRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class RemoteTrashbinRepository implements TrashbinRepository {
|
||||
|
||||
private final User user;
|
||||
private final ClientFactory clientFactory;
|
||||
|
||||
RemoteTrashbinRepository(User user, ClientFactory clientFactory) {
|
||||
this.user = user;
|
||||
this.clientFactory = clientFactory;
|
||||
}
|
||||
|
||||
public void removeTrashbinFile(TrashbinFile file, OperationCallback callback) {
|
||||
new RemoveTrashbinFileTask(user, clientFactory, file, callback).execute();
|
||||
}
|
||||
|
||||
private static class RemoveTrashbinFileTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
private User user;
|
||||
private ClientFactory clientFactory;
|
||||
private TrashbinFile file;
|
||||
private OperationCallback callback;
|
||||
|
||||
private RemoveTrashbinFileTask(User user,
|
||||
ClientFactory clientFactory,
|
||||
TrashbinFile file,
|
||||
OperationCallback callback) {
|
||||
this.user = user;
|
||||
this.clientFactory = clientFactory;
|
||||
this.file = file;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
try {
|
||||
OwnCloudClient client = clientFactory.create(user);
|
||||
RemoteOperationResult result = new RemoveTrashbinFileRemoteOperation(file.getFullRemotePath())
|
||||
.execute(client);
|
||||
return result.isSuccess();
|
||||
} catch (ClientFactory.CreationException e) {
|
||||
Log_OC.e(this, "Cannot create client", e);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean success) {
|
||||
super.onPostExecute(success);
|
||||
|
||||
callback.onResult(success);
|
||||
}
|
||||
}
|
||||
|
||||
public void emptyTrashbin(OperationCallback callback) {
|
||||
new EmptyTrashbinTask(user, clientFactory, callback).execute();
|
||||
}
|
||||
|
||||
private static class EmptyTrashbinTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
private User user;
|
||||
private ClientFactory clientFactory;
|
||||
private OperationCallback callback;
|
||||
|
||||
private EmptyTrashbinTask(User user, ClientFactory clientFactory, OperationCallback callback) {
|
||||
this.user = user;
|
||||
this.clientFactory = clientFactory;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
try {
|
||||
NextcloudClient client = clientFactory.createNextcloudClient(user);
|
||||
EmptyTrashbinRemoteOperation emptyTrashbinFileOperation = new EmptyTrashbinRemoteOperation();
|
||||
RemoteOperationResult<Boolean> result = emptyTrashbinFileOperation.execute(client);
|
||||
return result.isSuccess();
|
||||
} catch (ClientFactory.CreationException e) {
|
||||
Log_OC.e(this, "Cannot create client", e);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean success) {
|
||||
super.onPostExecute(success);
|
||||
|
||||
callback.onResult(success);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreFile(TrashbinFile file, OperationCallback callback) {
|
||||
new RestoreTrashbinFileTask(file, user, clientFactory, callback).execute();
|
||||
}
|
||||
|
||||
private static class RestoreTrashbinFileTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
private TrashbinFile file;
|
||||
private User user;
|
||||
private ClientFactory clientFactory;
|
||||
private TrashbinRepository.OperationCallback callback;
|
||||
|
||||
private RestoreTrashbinFileTask(TrashbinFile file, User user, ClientFactory clientFactory,
|
||||
TrashbinRepository.OperationCallback callback) {
|
||||
this.file = file;
|
||||
this.user = user;
|
||||
this.clientFactory = clientFactory;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
try {
|
||||
OwnCloudClient client = clientFactory.create(user);
|
||||
RemoteOperationResult result = new RestoreTrashbinFileRemoteOperation(file.getFullRemotePath(),
|
||||
file.getFileName()).execute(client);
|
||||
|
||||
return result.isSuccess();
|
||||
} catch (ClientFactory.CreationException e) {
|
||||
Log_OC.e(this, "Cannot create client", e);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean success) {
|
||||
super.onPostExecute(success);
|
||||
|
||||
callback.onResult(success);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getFolder(String remotePath, @NonNull LoadFolderCallback callback) {
|
||||
new ReadRemoteTrashbinFolderTask(remotePath, user, clientFactory, callback).execute();
|
||||
}
|
||||
|
||||
private static class ReadRemoteTrashbinFolderTask extends AsyncTask<Void, Void, Boolean> {
|
||||
|
||||
private String remotePath;
|
||||
private User user;
|
||||
private ClientFactory clientFactory;
|
||||
private List<TrashbinFile> trashbinFiles;
|
||||
private LoadFolderCallback callback;
|
||||
|
||||
private ReadRemoteTrashbinFolderTask(String remotePath, User user, ClientFactory clientFactory,
|
||||
LoadFolderCallback callback) {
|
||||
this.remotePath = remotePath;
|
||||
this.user = user;
|
||||
this.clientFactory = clientFactory;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
try {
|
||||
OwnCloudClient client = clientFactory.create(user);
|
||||
RemoteOperationResult<List<TrashbinFile>> result =
|
||||
new ReadTrashbinFolderRemoteOperation(remotePath).execute(client);
|
||||
if (result.isSuccess()) {
|
||||
trashbinFiles = result.getResultData();
|
||||
return Boolean.TRUE;
|
||||
} else {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
} catch (ClientFactory.CreationException e) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean success) {
|
||||
super.onPostExecute(success);
|
||||
|
||||
if (success) {
|
||||
callback.onSuccess(trashbinFiles);
|
||||
} else {
|
||||
callback.onError(R.string.trashbin_loading_failed);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author TSI-mc
|
||||
* @author Chris Narkiewicz
|
||||
*
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
* Copyright (C) 2023 TSI-mc
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
@file:Suppress("DEPRECATION")
|
||||
|
||||
package com.owncloud.android.ui.trashbin
|
||||
|
||||
import android.os.AsyncTask
|
||||
import com.nextcloud.client.account.User
|
||||
import com.nextcloud.client.network.ClientFactory
|
||||
import com.nextcloud.client.network.ClientFactory.CreationException
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
import com.owncloud.android.lib.resources.trashbin.EmptyTrashbinRemoteOperation
|
||||
import com.owncloud.android.lib.resources.trashbin.ReadTrashbinFolderRemoteOperation
|
||||
import com.owncloud.android.lib.resources.trashbin.RemoveTrashbinFileRemoteOperation
|
||||
import com.owncloud.android.lib.resources.trashbin.RestoreTrashbinFileRemoteOperation
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
|
||||
import com.owncloud.android.ui.trashbin.TrashbinRepository.LoadFolderCallback
|
||||
import com.owncloud.android.ui.trashbin.TrashbinRepository.OperationCallback
|
||||
|
||||
class RemoteTrashbinRepository internal constructor(private val user: User, private val clientFactory: ClientFactory) :
|
||||
TrashbinRepository {
|
||||
|
||||
override fun removeTrashbinFile(file: TrashbinFile?, callback: OperationCallback?) {
|
||||
RemoveTrashbinFileTask(user, clientFactory, file, callback).execute()
|
||||
}
|
||||
|
||||
private class RemoveTrashbinFileTask(
|
||||
private val user: User,
|
||||
private val clientFactory: ClientFactory,
|
||||
private val file: TrashbinFile?,
|
||||
private val callback: OperationCallback?
|
||||
) : AsyncTask<Void?, Void?, Boolean>() {
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun doInBackground(vararg voids: Void?): Boolean {
|
||||
return try {
|
||||
val client = clientFactory.create(user)
|
||||
val result = RemoveTrashbinFileRemoteOperation(file!!.fullRemotePath)
|
||||
.execute(client)
|
||||
result.isSuccess
|
||||
} catch (e: CreationException) {
|
||||
Log_OC.e(this, "Cannot create client", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onPostExecute(success: Boolean) {
|
||||
super.onPostExecute(success)
|
||||
callback?.onResult(success)
|
||||
}
|
||||
}
|
||||
|
||||
override fun emptyTrashbin(callback: OperationCallback?) {
|
||||
EmptyTrashbinTask(user, clientFactory, callback).execute()
|
||||
}
|
||||
|
||||
private class EmptyTrashbinTask(
|
||||
private val user: User,
|
||||
private val clientFactory: ClientFactory,
|
||||
private val callback: OperationCallback?
|
||||
) : AsyncTask<Void?, Void?, Boolean>() {
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun doInBackground(vararg voids: Void?): Boolean {
|
||||
return try {
|
||||
val client = clientFactory.createNextcloudClient(user)
|
||||
val emptyTrashbinFileOperation = EmptyTrashbinRemoteOperation()
|
||||
val result = emptyTrashbinFileOperation.execute(client)
|
||||
result.isSuccess
|
||||
} catch (e: CreationException) {
|
||||
Log_OC.e(this, "Cannot create client", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onPostExecute(success: Boolean) {
|
||||
super.onPostExecute(success)
|
||||
callback?.onResult(success)
|
||||
}
|
||||
}
|
||||
|
||||
override fun restoreFile(file: TrashbinFile?, callback: OperationCallback?) {
|
||||
RestoreTrashbinFileTask(file, user, clientFactory, callback).execute()
|
||||
}
|
||||
|
||||
private class RestoreTrashbinFileTask(
|
||||
private val file: TrashbinFile?,
|
||||
private val user: User,
|
||||
private val clientFactory: ClientFactory,
|
||||
private val callback: OperationCallback?
|
||||
) : AsyncTask<Void?, Void?, Boolean>() {
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun doInBackground(vararg voids: Void?): Boolean {
|
||||
return try {
|
||||
val client = clientFactory.create(user)
|
||||
val result = RestoreTrashbinFileRemoteOperation(
|
||||
file!!.fullRemotePath,
|
||||
file.fileName
|
||||
).execute(client)
|
||||
result.isSuccess
|
||||
} catch (e: CreationException) {
|
||||
Log_OC.e(this, "Cannot create client", e)
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onPostExecute(success: Boolean) {
|
||||
super.onPostExecute(success)
|
||||
callback?.onResult(success)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getFolder(remotePath: String?, callback: LoadFolderCallback?) {
|
||||
callback?.let {
|
||||
ReadRemoteTrashbinFolderTask(remotePath, user, clientFactory, it).execute()
|
||||
}
|
||||
}
|
||||
|
||||
private class ReadRemoteTrashbinFolderTask(
|
||||
private val remotePath: String?,
|
||||
private val user: User,
|
||||
private val clientFactory: ClientFactory,
|
||||
private val callback: LoadFolderCallback
|
||||
) : AsyncTask<Void?, Void?, Boolean>() {
|
||||
private var trashbinFiles: List<TrashbinFile?>? = null
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun doInBackground(vararg voids: Void?): Boolean {
|
||||
return try {
|
||||
val client = clientFactory.create(user)
|
||||
val result = ReadTrashbinFolderRemoteOperation(remotePath).execute(client)
|
||||
if (result.isSuccess) {
|
||||
trashbinFiles = result.resultData
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
} catch (e: CreationException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun onPostExecute(success: Boolean) {
|
||||
super.onPostExecute(success)
|
||||
|
||||
if (success) {
|
||||
callback.onSuccess(trashbinFiles)
|
||||
} else {
|
||||
callback.onError(R.string.trashbin_loading_failed)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author Chris Narkiewicz
|
||||
*
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.trashbin;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.PopupMenu;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
import com.nextcloud.client.account.CurrentAccountProvider;
|
||||
import com.nextcloud.client.account.User;
|
||||
import com.nextcloud.client.di.Injectable;
|
||||
import com.nextcloud.client.network.ClientFactory;
|
||||
import com.nextcloud.client.preferences.AppPreferences;
|
||||
import com.nextcloud.java.util.Optional;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.databinding.TrashbinActivityBinding;
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
|
||||
import com.owncloud.android.ui.EmptyRecyclerView;
|
||||
import com.owncloud.android.ui.activity.DrawerActivity;
|
||||
import com.owncloud.android.ui.adapter.TrashbinListAdapter;
|
||||
import com.owncloud.android.ui.dialog.SortingOrderDialogFragment;
|
||||
import com.owncloud.android.ui.interfaces.TrashbinActivityInterface;
|
||||
import com.owncloud.android.utils.DisplayUtils;
|
||||
import com.owncloud.android.utils.FileSortOrder;
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.content.res.ResourcesCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import static com.owncloud.android.utils.DisplayUtils.openSortingOrderDialogFragment;
|
||||
|
||||
/**
|
||||
* Presenting trashbin data, received from presenter
|
||||
*/
|
||||
public class TrashbinActivity extends DrawerActivity implements
|
||||
TrashbinActivityInterface,
|
||||
SortingOrderDialogFragment.OnSortingOrderListener,
|
||||
TrashbinContract.View,
|
||||
Injectable {
|
||||
|
||||
public static final int EMPTY_LIST_COUNT = 1;
|
||||
@Inject AppPreferences preferences;
|
||||
@Inject CurrentAccountProvider accountProvider;
|
||||
@Inject ClientFactory clientFactory;
|
||||
@Inject ViewThemeUtils viewThemeUtils;
|
||||
|
||||
private TrashbinListAdapter trashbinListAdapter;
|
||||
|
||||
@VisibleForTesting
|
||||
TrashbinPresenter trashbinPresenter;
|
||||
|
||||
private boolean active;
|
||||
private TrashbinActivityBinding binding;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
final User currentUser = getUser().orElse(accountProvider.getUser());
|
||||
final String targetAccount = getIntent().getStringExtra(Intent.EXTRA_USER);
|
||||
if (targetAccount != null && !currentUser.nameEquals(targetAccount)) {
|
||||
final Optional<User> targetUser = getUserAccountManager().getUser(targetAccount);
|
||||
if (targetUser.isPresent()) {
|
||||
setUser(targetUser.get());
|
||||
} else {
|
||||
Toast.makeText(this, R.string.associated_account_not_found, Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final RemoteTrashbinRepository trashRepository =
|
||||
new RemoteTrashbinRepository(getUser().orElse(accountProvider.getUser()), clientFactory);
|
||||
trashbinPresenter = new TrashbinPresenter(trashRepository, this);
|
||||
|
||||
binding = TrashbinActivityBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
setupToolbar();
|
||||
findViewById(R.id.sort_list_button_group).setVisibility(View.VISIBLE);
|
||||
findViewById(R.id.switch_grid_view_button).setVisibility(View.GONE);
|
||||
updateActionBarTitleAndHomeButtonByString(getString(R.string.trashbin_activity_title));
|
||||
setupDrawer(R.id.nav_trashbin);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
active = true;
|
||||
setupContent();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
setDrawerMenuItemChecked(R.id.nav_trashbin);
|
||||
}
|
||||
|
||||
private void setupContent() {
|
||||
EmptyRecyclerView recyclerView = binding.list;
|
||||
recyclerView.setEmptyView(binding.emptyList.emptyListView);
|
||||
binding.emptyList.emptyListView.setVisibility(View.GONE);
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_delete);
|
||||
binding.emptyList.emptyListIcon.setVisibility(View.VISIBLE);
|
||||
binding.emptyList.emptyListViewHeadline.setText(getString(R.string.trashbin_empty_headline));
|
||||
binding.emptyList.emptyListViewText.setText(getString(R.string.trashbin_empty_message));
|
||||
binding.emptyList.emptyListViewText.setVisibility(View.VISIBLE);
|
||||
|
||||
trashbinListAdapter = new TrashbinListAdapter(
|
||||
this,
|
||||
getStorageManager(),
|
||||
preferences,
|
||||
this,
|
||||
getUser().orElse(accountProvider.getUser()),
|
||||
viewThemeUtils
|
||||
);
|
||||
recyclerView.setAdapter(trashbinListAdapter);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setHasFooter(true);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(this));
|
||||
|
||||
viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingList);
|
||||
binding.swipeContainingList.setOnRefreshListener(this::loadFolder);
|
||||
|
||||
viewThemeUtils.material.colorMaterialTextButton(findViewById(R.id.sort_button));
|
||||
|
||||
findViewById(R.id.sort_button).setOnClickListener(l ->
|
||||
openSortingOrderDialogFragment(getSupportFragmentManager(),
|
||||
preferences.getSortOrderByType(
|
||||
FileSortOrder.Type.trashBinView,
|
||||
FileSortOrder.sort_new_to_old))
|
||||
);
|
||||
|
||||
loadFolder();
|
||||
}
|
||||
|
||||
protected void loadFolder() {
|
||||
if (trashbinListAdapter.getItemCount() > EMPTY_LIST_COUNT) {
|
||||
binding.swipeContainingList.setRefreshing(true);
|
||||
} else {
|
||||
showInitialLoading();
|
||||
}
|
||||
trashbinPresenter.loadFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
boolean retval = true;
|
||||
int itemId = item.getItemId();
|
||||
if (itemId == android.R.id.home) {
|
||||
if (isDrawerOpen()) {
|
||||
closeDrawer();
|
||||
} else if (trashbinPresenter.isRoot()) {
|
||||
onBackPressed();
|
||||
} else {
|
||||
openDrawer();
|
||||
}
|
||||
} else if (itemId == R.id.action_empty_trashbin) {
|
||||
trashbinPresenter.emptyTrashbin();
|
||||
} else {
|
||||
retval = super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOverflowIconClicked(TrashbinFile file, View view) {
|
||||
PopupMenu popup = new PopupMenu(this, view);
|
||||
popup.inflate(R.menu.item_trashbin);
|
||||
|
||||
popup.setOnMenuItemClickListener(item -> {
|
||||
trashbinPresenter.removeTrashbinFile(file);
|
||||
|
||||
return true;
|
||||
});
|
||||
popup.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClicked(TrashbinFile file) {
|
||||
if (file.isFolder()) {
|
||||
trashbinPresenter.enterFolder(file.getRemotePath());
|
||||
|
||||
mDrawerToggle.setDrawerIndicatorEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreIconClicked(TrashbinFile file, View view) {
|
||||
trashbinPresenter.restoreTrashbinFile(file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu) {
|
||||
getMenuInflater().inflate(R.menu.activity_trashbin, menu);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
active = false;
|
||||
|
||||
trashbinListAdapter.cancelAllPendingTasks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
trashbinPresenter.navigateUp();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
public void setDrawerIndicatorEnabled(boolean bool) {
|
||||
mDrawerToggle.setDrawerIndicatorEnabled(bool);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSortingOrderChosen(FileSortOrder sortOrder) {
|
||||
TextView sortButton = findViewById(R.id.sort_button);
|
||||
sortButton.setText(DisplayUtils.getSortOrderStringId(sortOrder));
|
||||
trashbinListAdapter.setSortOrder(sortOrder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showTrashbinFolder(List<TrashbinFile> trashbinFiles) {
|
||||
if (active) {
|
||||
trashbinListAdapter.setTrashbinFiles(trashbinFiles, true);
|
||||
binding.swipeContainingList.setRefreshing(false);
|
||||
binding.loadingContent.setVisibility(View.GONE);
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_delete);
|
||||
binding.emptyList.emptyListViewHeadline.setText(getString(R.string.trashbin_empty_headline));
|
||||
binding.emptyList.emptyListViewText.setText(getString(R.string.trashbin_empty_message));
|
||||
binding.list.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFile(TrashbinFile file) {
|
||||
if (active) {
|
||||
trashbinListAdapter.removeFile(file);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAllFiles() {
|
||||
trashbinListAdapter.removeAllFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showSnackbarError(int message, TrashbinFile file) {
|
||||
if (active) {
|
||||
binding.swipeContainingList.setRefreshing(false);
|
||||
Snackbar.make(binding.list,
|
||||
String.format(getString(message), file.getFileName()), Snackbar.LENGTH_LONG)
|
||||
.show();
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void showInitialLoading() {
|
||||
binding.emptyList.emptyListView.setVisibility(View.GONE);
|
||||
binding.list.setVisibility(View.GONE);
|
||||
binding.loadingContent.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public void showUser() {
|
||||
binding.loadingContent.setVisibility(View.GONE);
|
||||
binding.list.setVisibility(View.VISIBLE);
|
||||
binding.swipeContainingList.setRefreshing(false);
|
||||
|
||||
binding.emptyList.emptyListViewText.setText(getUser().get().getAccountName());
|
||||
binding.emptyList.emptyListViewText.setVisibility(View.VISIBLE);
|
||||
binding.emptyList.emptyListView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showError(int message) {
|
||||
if (active) {
|
||||
trashbinListAdapter.removeAllFiles();
|
||||
|
||||
binding.loadingContent.setVisibility(View.GONE);
|
||||
binding.list.setVisibility(View.VISIBLE);
|
||||
binding.swipeContainingList.setRefreshing(false);
|
||||
|
||||
binding.emptyList.emptyListViewHeadline.setText(R.string.common_error);
|
||||
binding.emptyList.emptyListIcon.setImageDrawable(ResourcesCompat.getDrawable(getResources(),
|
||||
R.drawable.ic_list_empty_error,
|
||||
null));
|
||||
binding.emptyList.emptyListViewText.setText(message);
|
||||
binding.emptyList.emptyListViewText.setVisibility(View.VISIBLE);
|
||||
binding.emptyList.emptyListIcon.setVisibility(View.VISIBLE);
|
||||
binding.emptyList.emptyListView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* @author Chris Narkiewicz
|
||||
*
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
* Copyright (C) 2019 Chris Narkiewicz <hello@ezaquarii.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.trashbin
|
||||
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.PopupMenu
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.annotation.VisibleForTesting
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.nextcloud.client.account.CurrentAccountProvider
|
||||
import com.nextcloud.client.di.Injectable
|
||||
import com.nextcloud.client.network.ClientFactory
|
||||
import com.nextcloud.client.preferences.AppPreferences
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.databinding.TrashbinActivityBinding
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
|
||||
import com.owncloud.android.ui.activity.DrawerActivity
|
||||
import com.owncloud.android.ui.adapter.TrashbinListAdapter
|
||||
import com.owncloud.android.ui.dialog.SortingOrderDialogFragment.OnSortingOrderListener
|
||||
import com.owncloud.android.ui.interfaces.TrashbinActivityInterface
|
||||
import com.owncloud.android.utils.DisplayUtils
|
||||
import com.owncloud.android.utils.FileSortOrder
|
||||
import com.owncloud.android.utils.theme.ViewThemeUtils
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
* Presenting trashbin data, received from presenter
|
||||
*/
|
||||
class TrashbinActivity :
|
||||
DrawerActivity(),
|
||||
TrashbinActivityInterface,
|
||||
OnSortingOrderListener,
|
||||
TrashbinContract.View,
|
||||
Injectable {
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var preferences: AppPreferences? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var accountProvider: CurrentAccountProvider? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var clientFactory: ClientFactory? = null
|
||||
|
||||
@JvmField
|
||||
@Inject
|
||||
var viewThemeUtils: ViewThemeUtils? = null
|
||||
|
||||
private var trashbinListAdapter: TrashbinListAdapter? = null
|
||||
|
||||
@VisibleForTesting
|
||||
var trashbinPresenter: TrashbinPresenter? = null
|
||||
|
||||
private var active = false
|
||||
private lateinit var binding: TrashbinActivityBinding
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val currentUser = user.orElse(accountProvider!!.user)
|
||||
val targetAccount = intent.getStringExtra(Intent.EXTRA_USER)
|
||||
|
||||
if (targetAccount != null && !currentUser.nameEquals(targetAccount)) {
|
||||
val targetUser = userAccountManager.getUser(targetAccount)
|
||||
if (targetUser.isPresent) {
|
||||
setUser(targetUser.get())
|
||||
} else {
|
||||
Toast.makeText(this, R.string.associated_account_not_found, Toast.LENGTH_LONG).show()
|
||||
finish()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
clientFactory?.let {
|
||||
val trashRepository = RemoteTrashbinRepository(user.orElse(accountProvider!!.user), it)
|
||||
trashbinPresenter = TrashbinPresenter(trashRepository, this)
|
||||
}
|
||||
|
||||
binding = TrashbinActivityBinding.inflate(layoutInflater)
|
||||
|
||||
setContentView(binding.root)
|
||||
setupToolbar()
|
||||
|
||||
findViewById<View>(R.id.sort_list_button_group).visibility = View.VISIBLE
|
||||
findViewById<View>(R.id.switch_grid_view_button).visibility =
|
||||
View.GONE
|
||||
|
||||
updateActionBarTitleAndHomeButtonByString(getString(R.string.trashbin_activity_title))
|
||||
setupDrawer(R.id.nav_trashbin)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
active = true
|
||||
setupContent()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
|
||||
setDrawerMenuItemChecked(R.id.nav_trashbin)
|
||||
}
|
||||
|
||||
private fun setupContent() {
|
||||
val recyclerView = binding.list
|
||||
recyclerView.setEmptyView(binding.emptyList.emptyListView)
|
||||
|
||||
binding.emptyList.emptyListView.visibility = View.GONE
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_delete)
|
||||
binding.emptyList.emptyListIcon.visibility = View.VISIBLE
|
||||
binding.emptyList.emptyListViewHeadline.text = getString(R.string.trashbin_empty_headline)
|
||||
binding.emptyList.emptyListViewText.text = getString(R.string.trashbin_empty_message)
|
||||
binding.emptyList.emptyListViewText.visibility = View.VISIBLE
|
||||
|
||||
trashbinListAdapter = TrashbinListAdapter(
|
||||
this,
|
||||
storageManager,
|
||||
preferences,
|
||||
this,
|
||||
user.orElse(accountProvider!!.user),
|
||||
viewThemeUtils
|
||||
)
|
||||
|
||||
recyclerView.adapter = trashbinListAdapter
|
||||
recyclerView.setHasFixedSize(true)
|
||||
recyclerView.setHasFooter(true)
|
||||
recyclerView.layoutManager = LinearLayoutManager(this)
|
||||
|
||||
viewThemeUtils.androidx.themeSwipeRefreshLayout(binding.swipeContainingList)
|
||||
binding.swipeContainingList.setOnRefreshListener { loadFolder() }
|
||||
viewThemeUtils.material.colorMaterialTextButton(findViewById(R.id.sort_button))
|
||||
|
||||
findViewById<View>(R.id.sort_button).setOnClickListener {
|
||||
DisplayUtils.openSortingOrderDialogFragment(
|
||||
supportFragmentManager,
|
||||
preferences?.getSortOrderByType(
|
||||
FileSortOrder.Type.trashBinView,
|
||||
FileSortOrder.sort_new_to_old
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
loadFolder()
|
||||
|
||||
handleOnBackPressed()
|
||||
}
|
||||
|
||||
private fun handleOnBackPressed() {
|
||||
onBackPressedDispatcher.addCallback(
|
||||
this,
|
||||
object : OnBackPressedCallback(true) {
|
||||
override fun handleOnBackPressed() {
|
||||
trashbinPresenter?.navigateUp()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
fun loadFolder() {
|
||||
trashbinListAdapter?.let {
|
||||
if (it.itemCount > EMPTY_LIST_COUNT) {
|
||||
binding.swipeContainingList.isRefreshing = true
|
||||
} else {
|
||||
showInitialLoading()
|
||||
}
|
||||
|
||||
trashbinPresenter?.loadFolder()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
var retval = true
|
||||
val itemId = item.itemId
|
||||
if (itemId == android.R.id.home) {
|
||||
if (isDrawerOpen) {
|
||||
closeDrawer()
|
||||
} else if (trashbinPresenter?.isRoot == true) {
|
||||
trashbinPresenter?.navigateUp()
|
||||
} else {
|
||||
openDrawer()
|
||||
}
|
||||
} else if (itemId == R.id.action_empty_trashbin) {
|
||||
trashbinPresenter?.emptyTrashbin()
|
||||
} else {
|
||||
retval = super.onOptionsItemSelected(item)
|
||||
}
|
||||
return retval
|
||||
}
|
||||
|
||||
override fun onOverflowIconClicked(file: TrashbinFile, view: View) {
|
||||
val popup = PopupMenu(this, view)
|
||||
popup.inflate(R.menu.item_trashbin)
|
||||
popup.setOnMenuItemClickListener {
|
||||
trashbinPresenter?.removeTrashbinFile(file)
|
||||
true
|
||||
}
|
||||
popup.show()
|
||||
}
|
||||
|
||||
override fun onItemClicked(file: TrashbinFile) {
|
||||
if (file.isFolder) {
|
||||
trashbinPresenter?.enterFolder(file.remotePath)
|
||||
mDrawerToggle.isDrawerIndicatorEnabled = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRestoreIconClicked(file: TrashbinFile, view: View) {
|
||||
trashbinPresenter?.restoreTrashbinFile(file)
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.activity_trashbin, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
active = false
|
||||
trashbinListAdapter?.cancelAllPendingTasks()
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
trashbinPresenter?.navigateUp()
|
||||
}
|
||||
|
||||
override fun setDrawerIndicatorEnabled(bool: Boolean) {
|
||||
mDrawerToggle.isDrawerIndicatorEnabled = bool
|
||||
}
|
||||
|
||||
override fun onSortingOrderChosen(sortOrder: FileSortOrder?) {
|
||||
val sortButton = findViewById<TextView>(R.id.sort_button)
|
||||
sortButton.setText(DisplayUtils.getSortOrderStringId(sortOrder))
|
||||
trashbinListAdapter?.setSortOrder(sortOrder)
|
||||
}
|
||||
|
||||
override fun showTrashbinFolder(trashbinFiles: List<TrashbinFile?>?) {
|
||||
if (active) {
|
||||
trashbinListAdapter?.setTrashbinFiles(trashbinFiles, true)
|
||||
binding.swipeContainingList.isRefreshing = false
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
binding.emptyList.emptyListIcon.setImageResource(R.drawable.ic_delete)
|
||||
binding.emptyList.emptyListViewHeadline.text = getString(R.string.trashbin_empty_headline)
|
||||
binding.emptyList.emptyListViewText.text = getString(R.string.trashbin_empty_message)
|
||||
binding.list.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeFile(file: TrashbinFile?) {
|
||||
if (active) {
|
||||
trashbinListAdapter?.removeFile(file)
|
||||
}
|
||||
}
|
||||
|
||||
override fun removeAllFiles() {
|
||||
trashbinListAdapter?.removeAllFiles()
|
||||
}
|
||||
|
||||
override fun showSnackbarError(message: Int, file: TrashbinFile?) {
|
||||
if (active) {
|
||||
binding.swipeContainingList.isRefreshing = false
|
||||
Snackbar.make(binding.list, String.format(getString(message), file?.fileName), Snackbar.LENGTH_LONG)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun showInitialLoading() {
|
||||
binding.emptyList.emptyListView.visibility = View.GONE
|
||||
binding.list.visibility = View.GONE
|
||||
binding.loadingContent.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
fun showUser() {
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
binding.list.visibility = View.VISIBLE
|
||||
binding.swipeContainingList.isRefreshing = false
|
||||
binding.emptyList.emptyListViewText.text = user.get().accountName
|
||||
binding.emptyList.emptyListViewText.visibility = View.VISIBLE
|
||||
binding.emptyList.emptyListView.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
override fun showError(message: Int) {
|
||||
if (active) {
|
||||
trashbinListAdapter?.removeAllFiles()
|
||||
binding.loadingContent.visibility = View.GONE
|
||||
binding.list.visibility = View.VISIBLE
|
||||
binding.swipeContainingList.isRefreshing = false
|
||||
binding.emptyList.emptyListViewHeadline.setText(R.string.common_error)
|
||||
binding.emptyList.emptyListIcon.setImageDrawable(
|
||||
ResourcesCompat.getDrawable(
|
||||
resources,
|
||||
R.drawable.ic_list_empty_error,
|
||||
null
|
||||
)
|
||||
)
|
||||
binding.emptyList.emptyListViewText.setText(message)
|
||||
binding.emptyList.emptyListViewText.visibility = View.VISIBLE
|
||||
binding.emptyList.emptyListIcon.visibility = View.VISIBLE
|
||||
binding.emptyList.emptyListView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val EMPTY_LIST_COUNT = 1
|
||||
}
|
||||
}
|
||||
@@ -18,47 +18,31 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.trashbin;
|
||||
package com.owncloud.android.ui.trashbin
|
||||
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
|
||||
|
||||
import java.util.List;
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
|
||||
|
||||
/**
|
||||
* Contract between view (TrashbinActivity) and presenter (TrashbinPresenter)
|
||||
*/
|
||||
public interface TrashbinContract {
|
||||
|
||||
interface TrashbinContract {
|
||||
interface View {
|
||||
void showTrashbinFolder(List<TrashbinFile> trashbinFiles);
|
||||
|
||||
void showSnackbarError(int message, TrashbinFile file);
|
||||
|
||||
void showError(int message);
|
||||
|
||||
void removeFile(TrashbinFile file);
|
||||
|
||||
void removeAllFiles();
|
||||
|
||||
void close();
|
||||
|
||||
void setDrawerIndicatorEnabled(boolean bool);
|
||||
fun showTrashbinFolder(trashbinFiles: List<TrashbinFile?>?)
|
||||
fun showSnackbarError(message: Int, file: TrashbinFile?)
|
||||
fun showError(message: Int)
|
||||
fun removeFile(file: TrashbinFile?)
|
||||
fun removeAllFiles()
|
||||
fun close()
|
||||
fun setDrawerIndicatorEnabled(bool: Boolean)
|
||||
}
|
||||
|
||||
interface Presenter {
|
||||
|
||||
boolean isRoot();
|
||||
|
||||
void loadFolder();
|
||||
|
||||
void navigateUp();
|
||||
|
||||
void enterFolder(String folder);
|
||||
|
||||
void restoreTrashbinFile(TrashbinFile file);
|
||||
|
||||
void removeTrashbinFile(TrashbinFile file);
|
||||
|
||||
void emptyTrashbin();
|
||||
val isRoot: Boolean
|
||||
fun loadFolder()
|
||||
fun navigateUp()
|
||||
fun enterFolder(folder: String?)
|
||||
fun restoreTrashbinFile(file: TrashbinFile?)
|
||||
fun removeTrashbinFile(file: TrashbinFile?)
|
||||
fun emptyTrashbin()
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.trashbin;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import static com.owncloud.android.datamodel.OCFile.ROOT_PATH;
|
||||
|
||||
/**
|
||||
* Coordinates between model and view: querying model, updating view, react to UI input
|
||||
*/
|
||||
public class TrashbinPresenter implements TrashbinContract.Presenter {
|
||||
|
||||
private TrashbinContract.View trashbinView;
|
||||
private TrashbinRepository trashbinRepository;
|
||||
private String currentPath = ROOT_PATH;
|
||||
|
||||
public TrashbinPresenter(TrashbinRepository trashbinRepository, TrashbinContract.View trashbinView) {
|
||||
this.trashbinRepository = trashbinRepository;
|
||||
this.trashbinView = trashbinView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enterFolder(String folder) {
|
||||
currentPath = folder;
|
||||
loadFolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRoot() {
|
||||
return !ROOT_PATH.equals(currentPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigateUp() {
|
||||
if (ROOT_PATH.equals(currentPath)) {
|
||||
trashbinView.close();
|
||||
} else {
|
||||
currentPath = new File(currentPath).getParent();
|
||||
|
||||
loadFolder();
|
||||
}
|
||||
|
||||
trashbinView.setDrawerIndicatorEnabled(ROOT_PATH.equals(currentPath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFolder() {
|
||||
trashbinRepository.getFolder(currentPath, new TrashbinRepository.LoadFolderCallback() {
|
||||
@Override
|
||||
public void onSuccess(List<TrashbinFile> files) {
|
||||
trashbinView.showTrashbinFolder(files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int error) {
|
||||
trashbinView.showError(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restoreTrashbinFile(TrashbinFile file) {
|
||||
trashbinRepository.restoreFile(file, success -> {
|
||||
if (success) {
|
||||
trashbinView.removeFile(file);
|
||||
} else {
|
||||
trashbinView.showSnackbarError(R.string.trashbin_file_not_restored, file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeTrashbinFile(TrashbinFile file) {
|
||||
trashbinRepository.removeTrashbinFile(file, success -> {
|
||||
if (success) {
|
||||
trashbinView.removeFile(file);
|
||||
} else {
|
||||
trashbinView.showSnackbarError(R.string.trashbin_file_not_deleted, file);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emptyTrashbin() {
|
||||
trashbinRepository.emptyTrashbin(success -> {
|
||||
if (success) {
|
||||
trashbinView.removeAllFiles();
|
||||
} else {
|
||||
trashbinView.showError(R.string.trashbin_not_emptied);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Tobias Kaminsky
|
||||
* Copyright (C) 2018 Tobias Kaminsky
|
||||
* Copyright (C) 2018 Nextcloud GmbH.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.trashbin
|
||||
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.OCFile
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
|
||||
import com.owncloud.android.ui.trashbin.TrashbinContract.Presenter
|
||||
import com.owncloud.android.ui.trashbin.TrashbinRepository.LoadFolderCallback
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* Coordinates between model and view: querying model, updating view, react to UI input
|
||||
*/
|
||||
class TrashbinPresenter(
|
||||
private val trashbinRepository: TrashbinRepository,
|
||||
private val trashbinView: TrashbinContract.View
|
||||
) : Presenter {
|
||||
|
||||
private var currentPath: String? = OCFile.ROOT_PATH
|
||||
|
||||
override fun enterFolder(folder: String?) {
|
||||
currentPath = folder
|
||||
loadFolder()
|
||||
}
|
||||
|
||||
override val isRoot: Boolean
|
||||
get() = OCFile.ROOT_PATH != currentPath
|
||||
|
||||
override fun navigateUp() {
|
||||
if (OCFile.ROOT_PATH == currentPath) {
|
||||
trashbinView.close()
|
||||
} else {
|
||||
currentPath?.let {
|
||||
currentPath = File(it).parent
|
||||
loadFolder()
|
||||
}
|
||||
}
|
||||
|
||||
trashbinView.setDrawerIndicatorEnabled(OCFile.ROOT_PATH == currentPath)
|
||||
}
|
||||
|
||||
override fun loadFolder() {
|
||||
trashbinRepository.getFolder(
|
||||
currentPath,
|
||||
object : LoadFolderCallback {
|
||||
override fun onSuccess(files: List<TrashbinFile?>?) {
|
||||
trashbinView.showTrashbinFolder(files)
|
||||
}
|
||||
|
||||
override fun onError(error: Int) {
|
||||
trashbinView.showError(error)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun restoreTrashbinFile(file: TrashbinFile?) {
|
||||
trashbinRepository.restoreFile(
|
||||
file,
|
||||
object : TrashbinRepository.OperationCallback {
|
||||
override fun onResult(success: Boolean) {
|
||||
if (success) {
|
||||
trashbinView.removeFile(file)
|
||||
} else {
|
||||
trashbinView.showSnackbarError(R.string.trashbin_file_not_restored, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun removeTrashbinFile(file: TrashbinFile?) {
|
||||
trashbinRepository.removeTrashbinFile(
|
||||
file,
|
||||
object : TrashbinRepository.OperationCallback {
|
||||
override fun onResult(success: Boolean) {
|
||||
if (success) {
|
||||
trashbinView.removeFile(file)
|
||||
} else {
|
||||
trashbinView.showSnackbarError(R.string.trashbin_file_not_deleted, file)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
override fun emptyTrashbin() {
|
||||
trashbinRepository.emptyTrashbin(object : TrashbinRepository.OperationCallback {
|
||||
override fun onResult(success: Boolean) {
|
||||
if (success) {
|
||||
trashbinView.removeAllFiles()
|
||||
} else {
|
||||
trashbinView.showError(R.string.trashbin_not_emptied)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -18,31 +18,25 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.ui.trashbin;
|
||||
package com.owncloud.android.ui.trashbin
|
||||
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile;
|
||||
|
||||
import java.util.List;
|
||||
import com.owncloud.android.lib.resources.trashbin.model.TrashbinFile
|
||||
|
||||
/**
|
||||
* Contract between presenter and model
|
||||
*/
|
||||
public interface TrashbinRepository {
|
||||
interface TrashbinRepository {
|
||||
interface LoadFolderCallback {
|
||||
void onSuccess(List<TrashbinFile> files);
|
||||
|
||||
void onError(int error);
|
||||
fun onSuccess(files: List<TrashbinFile?>?)
|
||||
fun onError(error: Int)
|
||||
}
|
||||
|
||||
interface OperationCallback {
|
||||
void onResult(boolean success);
|
||||
fun onResult(success: Boolean)
|
||||
}
|
||||
|
||||
void getFolder(String remotePath, LoadFolderCallback callback);
|
||||
|
||||
void restoreFile(TrashbinFile file, OperationCallback callback);
|
||||
|
||||
void emptyTrashbin(OperationCallback callback);
|
||||
|
||||
void removeTrashbinFile(TrashbinFile file, OperationCallback callback);
|
||||
fun getFolder(remotePath: String?, callback: LoadFolderCallback?)
|
||||
fun restoreFile(file: TrashbinFile?, callback: OperationCallback?)
|
||||
fun emptyTrashbin(callback: OperationCallback?)
|
||||
fun removeTrashbinFile(file: TrashbinFile?, callback: OperationCallback?)
|
||||
}
|
||||
@@ -17,51 +17,46 @@
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.owncloud.android.utils
|
||||
|
||||
package com.owncloud.android.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.common.utils.Log_OC;
|
||||
import android.app.Activity
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.text.TextUtils
|
||||
import android.widget.Toast
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.lib.common.utils.Log_OC
|
||||
|
||||
/**
|
||||
* Helper implementation to copy a string into the system clipboard.
|
||||
*/
|
||||
public final class ClipboardUtil {
|
||||
private static final String TAG = ClipboardUtil.class.getName();
|
||||
object ClipboardUtil {
|
||||
private val TAG = ClipboardUtil::class.java.name
|
||||
|
||||
private ClipboardUtil() {
|
||||
}
|
||||
|
||||
public static void copyToClipboard(Activity activity, String text) {
|
||||
copyToClipboard(activity, text, true);
|
||||
}
|
||||
|
||||
public static void copyToClipboard(Activity activity, String text, boolean showToast) {
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
@Suppress("TooGenericExceptionCaught")
|
||||
fun copyToClipboard(activity: Activity, text: String?, showToast: Boolean = true) {
|
||||
if (!TextUtils.isEmpty(text)) {
|
||||
try {
|
||||
ClipData clip = ClipData.newPlainText(
|
||||
activity.getString(
|
||||
R.string.clipboard_label, activity.getString(R.string.app_name)),
|
||||
text
|
||||
);
|
||||
((ClipboardManager) activity.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(clip);
|
||||
|
||||
val clip = ClipData.newPlainText(
|
||||
activity.getString(
|
||||
R.string.clipboard_label,
|
||||
activity.getString(R.string.app_name)
|
||||
),
|
||||
text
|
||||
)
|
||||
(activity.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager).setPrimaryClip(clip)
|
||||
if (showToast) {
|
||||
Toast.makeText(activity, R.string.clipboard_text_copied, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(activity, R.string.clipboard_text_copied, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(activity, R.string.clipboard_unexpected_error, Toast.LENGTH_SHORT).show();
|
||||
Log_OC.e(TAG, "Exception caught while copying to clipboard", e);
|
||||
} catch (e: Exception) {
|
||||
Toast.makeText(activity, R.string.clipboard_unexpected_error, Toast.LENGTH_SHORT).show()
|
||||
Log_OC.e(TAG, "Exception caught while copying to clipboard", e)
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, R.string.clipboard_no_text_to_copy, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(activity, R.string.clipboard_no_text_to_copy, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +70,19 @@ class FilesUploadHelper {
|
||||
backgroundJobManager.startFilesUploadJob(user)
|
||||
}
|
||||
|
||||
fun cancelFileUpload(remotePath: String, user: User) {
|
||||
// need to update now table in mUploadsStorageManager,
|
||||
// since the operation will not get to be run by FileUploader#uploadFile
|
||||
uploadsStorageManager.removeUpload(user.accountName, remotePath)
|
||||
|
||||
restartUploadJob(user)
|
||||
}
|
||||
|
||||
fun restartUploadJob(user: User) {
|
||||
backgroundJobManager.cancelFilesUploadJob(user)
|
||||
backgroundJobManager.startFilesUploadJob(user)
|
||||
}
|
||||
|
||||
fun uploadUpdatedFile(
|
||||
user: User,
|
||||
existingFiles: Array<OCFile>,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
<!--
|
||||
@author Google LLC
|
||||
Copyright (C) 2023 Google LLC
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="#666666"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M20,0L4,0v2h16L20,0zM4,24h16v-2L4,22v2zM20,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM12,6.75c1.24,0 2.25,1.01 2.25,2.25s-1.01,2.25 -2.25,2.25S9.75,10.24 9.75,9 10.76,6.75 12,6.75zM17,17L7,17v-1.5c0,-1.67 3.33,-2.5 5,-2.5s5,0.83 5,2.5L17,17z" />
|
||||
</vector>
|
||||
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Nextcloud Android client application
|
||||
|
||||
@author ZetaTom
|
||||
Copyright (C) 2023 ZetaTom
|
||||
Copyright (C) 2023 Nextcloud GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="12dp"
|
||||
android:paddingHorizontal="24dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/user_icon"
|
||||
android:layout_width="@dimen/user_icon_size"
|
||||
android:layout_height="@dimen/user_icon_size"
|
||||
android:layout_margin="6dp"
|
||||
android:contentDescription="@string/avatar"
|
||||
android:src="@drawable/ic_user" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="6dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/user_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="middle"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelLarge"
|
||||
tools:text="Alice Muster" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="middle"
|
||||
tools:text="[email protected]" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/local_remove"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="8dp">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:id="@+id/radio_local_remove"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
tools:checked="true" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/remove_local_account"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelLarge" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/remove_local_account_details" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/request_deletion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="24dp"
|
||||
android:paddingVertical="8dp"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:id="@+id/radio_request_deletion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/request_account_deletion"
|
||||
android:textAppearance="@style/TextAppearance.Material3.LabelLarge" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/request_account_deletion_details" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.google.android.material.divider.MaterialDivider
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,7 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Nextcloud Android client application
|
||||
|
||||
@author TSI-mc
|
||||
|
||||
Copyright (C) 2018 Andy Scherzinger
|
||||
Copyright (C) 2023 TSI-mc
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
@@ -29,83 +32,94 @@
|
||||
android:id="@+id/search_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="@dimen/standard_padding"
|
||||
android:paddingEnd="@dimen/zero">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/searchViewIcon"
|
||||
android:layout_height="@dimen/user_icon_size"
|
||||
android:layout_width="@dimen/user_icon_size"
|
||||
android:padding="@dimen/standard_half_padding"
|
||||
android:contentDescription="@string/avatar"
|
||||
android:layout_height="@dimen/user_icon_size"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:contentDescription="@string/avatar"
|
||||
android:padding="@dimen/standard_half_padding"
|
||||
android:src="@drawable/ic_search_grey" />
|
||||
|
||||
<androidx.appcompat.widget.SearchView
|
||||
android:id="@+id/searchView"
|
||||
style="@style/ownCloud.SearchView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/zero"
|
||||
android:layout_marginEnd="@dimen/standard_quarter_margin"
|
||||
android:layout_weight="1"
|
||||
android:hint="@string/share_search"
|
||||
app:searchIcon="@null" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/pick_contact_email_btn"
|
||||
android:layout_width="@dimen/minimum_size_for_touchable_area"
|
||||
android:layout_height="@dimen/minimum_size_for_touchable_area"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:padding="12dp"
|
||||
android:layout_marginEnd="@dimen/standard_quarter_margin"
|
||||
android:src="@drawable/ic_contact_book" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/shared_with_you_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/standard_half_margin"
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/standard_padding"
|
||||
android:paddingRight="@dimen/standard_padding"
|
||||
android:paddingTop="@dimen/standard_padding">
|
||||
android:paddingTop="@dimen/standard_padding"
|
||||
android:paddingRight="@dimen/standard_padding">
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/avatar"
|
||||
android:id="@+id/shared_with_you_avatar"
|
||||
android:layout_height="@dimen/user_icon_size"
|
||||
android:layout_width="@dimen/user_icon_size"
|
||||
android:layout_height="@dimen/user_icon_size"
|
||||
android:contentDescription="@string/avatar"
|
||||
android:src="@drawable/ic_user" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/standard_padding"
|
||||
android:paddingRight="@dimen/standard_padding"
|
||||
android:paddingTop="@dimen/standard_half_padding">
|
||||
android:paddingTop="@dimen/standard_half_padding"
|
||||
android:paddingRight="@dimen/standard_padding">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shared_with_you_username"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/shared_with_you_by"
|
||||
android:textSize="@dimen/two_line_primary_text_size" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/shared_with_you_note_container"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="@dimen/standard_half_padding"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:contentDescription="@string/note_icon_hint"
|
||||
android:layout_height="16dp"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:contentDescription="@string/note_icon_hint"
|
||||
android:src="@drawable/file_text" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/shared_with_you_note"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="0dp"
|
||||
android:paddingEnd="@dimen/standard_half_padding"
|
||||
android:paddingStart="@dimen/standard_half_padding"
|
||||
android:paddingEnd="@dimen/standard_half_padding"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
@@ -113,10 +127,11 @@
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/sharesList"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@drawable/divider"
|
||||
android:dividerHeight="1dp"
|
||||
android:id="@+id/sharesList"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent" />
|
||||
tools:listitem="@layout/file_details_share_link_share_item" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -17,36 +17,36 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<ScrollView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<androidx.cardview.widget.CardView xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/card_view"
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_margin="@dimen/standard_double_margin"
|
||||
card_view:cardCornerRadius="4dp"
|
||||
card_view:strokeWidth="0dp"
|
||||
card_view:cardCornerRadius="16dp"
|
||||
card_view:cardElevation="@dimen/dialog_elevation">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/card_view_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/standard_padding"
|
||||
android:paddingTop="@dimen/standard_padding"
|
||||
android:paddingEnd="@dimen/standard_padding"
|
||||
android:paddingBottom="@dimen/standard_half_padding">
|
||||
android:padding="@dimen/standard_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/header"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -56,7 +56,7 @@
|
||||
android:textSize="@dimen/two_line_primary_text_size"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
<com.google.android.material.textview.MaterialTextView
|
||||
android:id="@+id/explanation"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -96,12 +96,14 @@
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/cancel"
|
||||
style="@style/Button.Borderless"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:text="@string/common_cancel" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</ScrollView>
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="conflict_message_description">إذا قمت باختيار كلا الاصدارين, الملف المحلي سيحتوي على رقم ملحق باسم الملف.</string>
|
||||
<string name="conflict_server_file">ملف على الخادم</string>
|
||||
<string name="contact_backup_title">نسخ احتياطي لجهات الاتصال</string>
|
||||
<string name="contact_no_permission">إذن الاتصال بالجهة لازم.</string>
|
||||
<string name="contactlist_item_icon">أيقونة المستخدمين المتواجدين في قائمة جهات الإتصال</string>
|
||||
<string name="contactlist_no_permission">لا يوجد إذن، لم يتم استيراد أي شيء</string>
|
||||
<string name="contacts">جهات الاتصال</string>
|
||||
@@ -258,6 +259,7 @@
|
||||
<string name="ecosystem_apps_more">المزيد من تطبيقات نكست كلاود</string>
|
||||
<string name="ecosystem_apps_notes">ملاحظات Notes نيكست كلاود</string>
|
||||
<string name="ecosystem_apps_talk">تطبيق \"المحادثة\" talk من نكست كلاود</string>
|
||||
<string name="email_pick_failed">تعذّر التقاط عنوان الإيميل.</string>
|
||||
<string name="encrypted">عيّنه كَمشفر</string>
|
||||
<string name="end_to_end_encryption_confirm_button">تنصيب التشفير</string>
|
||||
<string name="end_to_end_encryption_decrypting">جارِ فك التشفير …</string>
|
||||
@@ -325,7 +327,6 @@
|
||||
<string name="file_delete">حذف </string>
|
||||
<string name="file_detail_activity_error">خطأ في استرداد النشاطات للملف</string>
|
||||
<string name="file_details_no_content">حدث خطأ في تحميل التفاصيل</string>
|
||||
<string name="file_downloader_notification_title_prefix">تنزيل \u0020</string>
|
||||
<string name="file_icon">الملف</string>
|
||||
<string name="file_keep">حفظ</string>
|
||||
<string name="file_list_empty">قم برفع بعض المحتوى أو زامن مع أجهزتك</string>
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<string name="actionbar_copy">Copy</string>
|
||||
<string name="actionbar_mkdir">New folder</string>
|
||||
<string name="actionbar_move">Move</string>
|
||||
<string name="actionbar_move_or_copy">Move or Copy</string>
|
||||
<string name="actionbar_open_with">Open with</string>
|
||||
<string name="actionbar_search">Search</string>
|
||||
<string name="actionbar_see_details">Details</string>
|
||||
@@ -159,6 +160,7 @@
|
||||
<string name="conflict_message_description">If you select both versions, the local file will have a number appended to its name.</string>
|
||||
<string name="conflict_server_file">Server file</string>
|
||||
<string name="contact_backup_title">Contacts backup</string>
|
||||
<string name="contact_no_permission">Contact permission is required.</string>
|
||||
<string name="contactlist_item_icon">User icon for contact list</string>
|
||||
<string name="contactlist_no_permission">No permission given, nothing imported.</string>
|
||||
<string name="contacts">Contacts</string>
|
||||
@@ -257,6 +259,7 @@
|
||||
<string name="ecosystem_apps_more">More Nextcloud Apps</string>
|
||||
<string name="ecosystem_apps_notes">Nextcloud Notes</string>
|
||||
<string name="ecosystem_apps_talk">Nextcloud Talk</string>
|
||||
<string name="email_pick_failed">Failed to pick email address.</string>
|
||||
<string name="encrypted">Set as encrypted</string>
|
||||
<string name="end_to_end_encryption_confirm_button">Set up encryption</string>
|
||||
<string name="end_to_end_encryption_decrypting">Decrypting…</string>
|
||||
@@ -287,7 +290,7 @@
|
||||
<string name="error_report_issue_text">Report issue to tracker? (requires a GitHub account)</string>
|
||||
<string name="error_retrieving_file">Error retrieving file</string>
|
||||
<string name="error_retrieving_templates">Error retrieving templates</string>
|
||||
<string name="error_showing_encryption_dialog">Error showing encryption setup dialog!</string>
|
||||
<string name="error_showing_encryption_dialog">Error showing encryption setup dialogue!</string>
|
||||
<string name="error_starting_direct_camera_upload">Error starting camera</string>
|
||||
<string name="error_starting_doc_scan">Error starting document scan</string>
|
||||
<string name="etm_accounts">Accounts</string>
|
||||
@@ -944,7 +947,9 @@
|
||||
<string name="wait_a_moment">Wait a moment…</string>
|
||||
<string name="wait_checking_credentials">Checking stored credentials</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">Copying file from private storage</string>
|
||||
<string name="webview_version_check_alert_dialog_message">Please update the Android System WebView app for a login</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">Update</string>
|
||||
<string name="webview_version_check_alert_dialog_title">Update Android System WebView</string>
|
||||
<string name="what_s_new_image">What\'s new image</string>
|
||||
<string name="whats_new_skip">Skip</string>
|
||||
<string name="whats_new_title">New in %1$s</string>
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<string name="auth_host_url">Adresa serveru https://…</string>
|
||||
<string name="auth_incorrect_address_title">Nesprávný formát adresy serveru</string>
|
||||
<string name="auth_incorrect_path_title">Server nenalezen</string>
|
||||
<string name="auth_no_net_conn_title">Žádné síťové spojení</string>
|
||||
<string name="auth_no_net_conn_title">Nepřipojeno k síti</string>
|
||||
<string name="auth_nossl_plain_ok_title">Zabezpečené spojení není k dispozici.</string>
|
||||
<string name="auth_not_configured_title">Nesprávně formulované nastavení pro server</string>
|
||||
<string name="auth_oauth_error">Neúspěšné ověření se</string>
|
||||
@@ -160,14 +160,15 @@
|
||||
<string name="conflict_message_description">Pokud zvolíte obě verze, k názvu místního souboru bude připojeno číslo.</string>
|
||||
<string name="conflict_server_file">Soubor na serveru</string>
|
||||
<string name="contact_backup_title">Záloha kontaktů</string>
|
||||
<string name="contact_no_permission">Je vyžadováno oprávnění pro přístup ke kontaktům.</string>
|
||||
<string name="contactlist_item_icon">Ikona uživatele v seznamu kontaktů</string>
|
||||
<string name="contactlist_no_permission">Nejsou udělena oprávnění, proto nebylo nic naimportováno.</string>
|
||||
<string name="contacts">Kontakty</string>
|
||||
<string name="contacts_backup_button">Zálohovat nyní</string>
|
||||
<string name="contacts_backup_button">Zazálohovat nyní</string>
|
||||
<string name="contacts_preferences_backup_scheduled">Zálohování naplánováno a brzy začne</string>
|
||||
<string name="contacts_preferences_import_scheduled">Import naplánován a brzy začne</string>
|
||||
<string name="contacts_preferences_no_file_found">Nenalezen žádný soubor</string>
|
||||
<string name="contacts_preferences_something_strange_happened">Nepodařilo se najít vaši poslední zálohu!</string>
|
||||
<string name="contacts_preferences_something_strange_happened">Nepodařilo se najít vaši nejaktuálnější zálohu!</string>
|
||||
<string name="copied_to_clipboard">Zkopírováno do schránky</string>
|
||||
<string name="copy_file_error">Při pokusu o zkopírování tohoto souboru či složky došlo k chybě</string>
|
||||
<string name="copy_file_invalid_into_descendent">Není možné zkopírovat složku do některé z jejích vlastních podsložek</string>
|
||||
@@ -258,6 +259,7 @@
|
||||
<string name="ecosystem_apps_more">Další Nextcloud aplikace</string>
|
||||
<string name="ecosystem_apps_notes">Nextcloud poznámky</string>
|
||||
<string name="ecosystem_apps_talk">Nextcloud Talk</string>
|
||||
<string name="email_pick_failed">Nepodařilo se vybrat e-mailovou adresu.</string>
|
||||
<string name="encrypted">Nastavit jako šifrované</string>
|
||||
<string name="end_to_end_encryption_confirm_button">Nastavit šifrování</string>
|
||||
<string name="end_to_end_encryption_decrypting">Rozšifrovávání…</string>
|
||||
@@ -325,7 +327,6 @@
|
||||
<string name="file_delete">Smazat</string>
|
||||
<string name="file_detail_activity_error">Při načítání aktivit u souboru došlo k chybě</string>
|
||||
<string name="file_details_no_content">Nepodařilo se načíst podrobnosti.</string>
|
||||
<string name="file_downloader_notification_title_prefix">Stahování \u0020</string>
|
||||
<string name="file_icon">Soubor</string>
|
||||
<string name="file_keep">Ponechat</string>
|
||||
<string name="file_list_empty">Nahrajte nějaký obsah, nebo synchronizujte s vašimi zařízeními.</string>
|
||||
@@ -363,7 +364,7 @@
|
||||
<string name="file_migration_migrating">Přesouvání dat…</string>
|
||||
<string name="file_migration_ok_finished">Dokončeno</string>
|
||||
<string name="file_migration_override_data_folder">Nahradit</string>
|
||||
<string name="file_migration_preparing">Příprava migrace…</string>
|
||||
<string name="file_migration_preparing">Příprava stěhování…</string>
|
||||
<string name="file_migration_restoring_accounts_configuration">Obnovování nastavení účtu…</string>
|
||||
<string name="file_migration_saving_accounts_configuration">Ukládání nastavení účtu…</string>
|
||||
<string name="file_migration_source_not_readable">Opravdu chcete změnit složku pro ukládání dat na %1$s?\n\nPoznámka: Všechna data bude třeba znovu stáhnout.</string>
|
||||
@@ -598,7 +599,7 @@
|
||||
<string name="prefs_enable_media_scan_notifications_summary">Upozorňovat na nově nalezené složky s médii</string>
|
||||
<string name="prefs_gpl_v2">GNU General Public License, verze 2</string>
|
||||
<string name="prefs_help">Nápověda</string>
|
||||
<string name="prefs_imprint">Imprint</string>
|
||||
<string name="prefs_imprint">Impresum</string>
|
||||
<string name="prefs_instant_behaviour_dialogTitle">Původní soubor bude…</string>
|
||||
<string name="prefs_instant_behaviour_title">Původní soubor bude…</string>
|
||||
<string name="prefs_instant_upload_path_use_date_subfolders_summary">Ukládat v podsložkách podle data</string>
|
||||
@@ -935,7 +936,7 @@
|
||||
<string name="user_info_address">Adresa</string>
|
||||
<string name="user_info_email">E-mail</string>
|
||||
<string name="user_info_phone">Telefonní číslo</string>
|
||||
<string name="user_info_twitter">Twitter</string>
|
||||
<string name="user_info_twitter">X (Twitter)</string>
|
||||
<string name="user_info_website">Webové stránky</string>
|
||||
<string name="user_information_retrieval_error">Chyba při načítání informací o uživateli</string>
|
||||
<string name="userinfo_no_info_headline">Nezadány žádné osobní údaje</string>
|
||||
|
||||
@@ -325,7 +325,6 @@
|
||||
<string name="file_delete">Slet</string>
|
||||
<string name="file_detail_activity_error">Fejl ved indlæsning af aktiviteter for fil</string>
|
||||
<string name="file_details_no_content">Fejl ved indlæsning af detaljer</string>
|
||||
<string name="file_downloader_notification_title_prefix">Downloader \u0020</string>
|
||||
<string name="file_icon">Fil</string>
|
||||
<string name="file_keep">Behold</string>
|
||||
<string name="file_list_empty">Upload indhold eller synkronisér med dine enheder.</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="conflict_message_description">Falls beide Versionen gewählt werden, wird bei der lokalen Datei eine Zahl am Ende des Dateinamens hinzugefügt.</string>
|
||||
<string name="conflict_server_file">Server-Datei</string>
|
||||
<string name="contact_backup_title">Kontakte-Backup</string>
|
||||
<string name="contact_no_permission">Eine Kontakterlaubnis ist erforderlich.</string>
|
||||
<string name="contactlist_item_icon">Nutzericon für Kontaktliste</string>
|
||||
<string name="contactlist_no_permission">Keine Berechtigung vergeben, es wurde nichts importiert.</string>
|
||||
<string name="contacts">Kontakte</string>
|
||||
@@ -258,6 +259,7 @@
|
||||
<string name="ecosystem_apps_more">Weitere Nextcloud-Apps</string>
|
||||
<string name="ecosystem_apps_notes">Nextcloud Notizen</string>
|
||||
<string name="ecosystem_apps_talk">Nextcloud Talk</string>
|
||||
<string name="email_pick_failed">E-Mail-Adresse konnte nicht ausgewählt werden.</string>
|
||||
<string name="encrypted">Als verschlüsselt festlegen</string>
|
||||
<string name="end_to_end_encryption_confirm_button">Verschlüsselung einrichten</string>
|
||||
<string name="end_to_end_encryption_decrypting">Entschlüssele…</string>
|
||||
@@ -325,7 +327,6 @@
|
||||
<string name="file_delete">Löschen</string>
|
||||
<string name="file_detail_activity_error">Fehler beim Abrufen der Aktivitäten für die Datei</string>
|
||||
<string name="file_details_no_content">Fehler beim Laden der Details</string>
|
||||
<string name="file_downloader_notification_title_prefix">Herunterladen \u0020</string>
|
||||
<string name="file_icon">Datei</string>
|
||||
<string name="file_keep">Behalten</string>
|
||||
<string name="file_list_empty">Laden Sie Inhalt hoch oder synchronisieren Sie mit Ihren Geräten.</string>
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
<string name="action_clear_failed_uploads">Vakigi malsukcesajn alŝutojn</string>
|
||||
<string name="action_edit">Modifi</string>
|
||||
<string name="action_empty_notifications">Forviŝi ĉiujn sciigojn</string>
|
||||
<string name="action_empty_trashbin">Malpleni rubujon</string>
|
||||
<string name="action_send_share">Sendi aŭ kunhavigi</string>
|
||||
<string name="action_switch_grid_view">Krada vido</string>
|
||||
<string name="action_switch_list_view">Lista vido</string>
|
||||
<string name="actionbar_copy">Kopii</string>
|
||||
<string name="actionbar_mkdir">Nova dosierujo</string>
|
||||
<string name="actionbar_move">Movi</string>
|
||||
<string name="actionbar_move_or_copy">Movi aŭ Kopii</string>
|
||||
<string name="actionbar_open_with">Malfermi per</string>
|
||||
<string name="actionbar_search">Serĉi</string>
|
||||
<string name="actionbar_see_details">Detaloj</string>
|
||||
@@ -77,6 +79,8 @@
|
||||
<string name="choose_local_folder">Elekti lokan dosierujon...</string>
|
||||
<string name="choose_remote_folder">Elekti foran dosierujon...</string>
|
||||
<string name="clear_notifications_failed">Malsukcesis forviŝi sciigojn.</string>
|
||||
<string name="clear_status_message">Forviŝi statusan mesaĝon</string>
|
||||
<string name="clear_status_message_after">Forviŝos statusan mesaĝon poste</string>
|
||||
<string name="clipboard_label">Teksto kopiita el %1$s</string>
|
||||
<string name="clipboard_no_text_to_copy">Neniu teksto ricevita por kopii tondujen</string>
|
||||
<string name="clipboard_text_copied">Ligilo kopiita</string>
|
||||
@@ -103,6 +107,8 @@
|
||||
<string name="common_send">Sendi</string>
|
||||
<string name="common_share">Kunhavigi</string>
|
||||
<string name="common_skip">Preterpasi</string>
|
||||
<string name="common_switch_account">Interŝanĝi konton</string>
|
||||
<string name="common_switch_to_account">Ŝanĝi al konto</string>
|
||||
<string name="common_yes">Jes</string>
|
||||
<string name="community_beta_headline">Testu la beta-version</string>
|
||||
<string name="community_beta_text">Ĝi enhavas ĉiujn venontajn funkciojn, kaj ĝi estas freŝfreŝa. Eraroj povas okazi: se kaj kiam tio okazas, bonvolu raporti ilin.</string>
|
||||
@@ -126,6 +132,8 @@
|
||||
<string name="confirmation_remove_folder_alert">Ĉu vi ja volas forigi %1$s kaj ĝian enhavon?</string>
|
||||
<string name="confirmation_remove_folders_alert">Ĉu vi ja volas forigi la elektitajn elementojn kaj ilian enhavon?</string>
|
||||
<string name="confirmation_remove_local">Nur loka</string>
|
||||
<string name="conflict_local_file">Loka dosiero</string>
|
||||
<string name="contact_backup_title">Savkopii kontaktojn</string>
|
||||
<string name="contactlist_item_icon">Uzanto-piktogramo por la kontaktlisto</string>
|
||||
<string name="contactlist_no_permission">Permeso ne donita, nenio importiĝis.</string>
|
||||
<string name="contacts">Kontaktoj</string>
|
||||
@@ -143,6 +151,7 @@
|
||||
<string name="copy_to">Kopii al...</string>
|
||||
<string name="create">Krei</string>
|
||||
<string name="create_dir_fail_msg">Ne eblis krei dosierujon</string>
|
||||
<string name="create_new">Krei nove</string>
|
||||
<string name="create_new_document">Krei novan dokumenton</string>
|
||||
<string name="create_new_folder">Krei novan dosierujon</string>
|
||||
<string name="create_new_presentation">Krei novan prezentaĵon</string>
|
||||
|
||||
@@ -239,6 +239,7 @@
|
||||
<string name="folder_confirm_create">Crear</string>
|
||||
<string name="folder_list_empty_headline">No hay carpetas aquí</string>
|
||||
<string name="folder_picker_choose_button_text">Seleccionar</string>
|
||||
<string name="folder_picker_move_button_text">Mover</string>
|
||||
<string name="forbidden_permissions">No se te permite %s</string>
|
||||
<string name="forbidden_permissions_copy">para copiar este archivo</string>
|
||||
<string name="forbidden_permissions_create">para crear este archivo</string>
|
||||
|
||||
@@ -540,6 +540,7 @@
|
||||
<string name="wait_a_moment">Aguarda un momento…</string>
|
||||
<string name="wait_checking_credentials">Verificando credenciales almacenadas</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">Copiando el archivo desde almacenamiento privado</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">Actualizar</string>
|
||||
<string name="what_s_new_image">Imagen de qué es nuevo</string>
|
||||
<string name="whats_new_skip">Omitir</string>
|
||||
<string name="whats_new_title">Nuevo en %1$s</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="conflict_message_description">Si seleccionas ambas versiones, el archivo local tendrá un número añadido a su nombre.</string>
|
||||
<string name="conflict_server_file">Archivo del servidor</string>
|
||||
<string name="contact_backup_title">Respaldo de contactos</string>
|
||||
<string name="contact_no_permission">Se requiere el permiso de contactos.</string>
|
||||
<string name="contactlist_item_icon">Icono de usuario para lista de contactos</string>
|
||||
<string name="contactlist_no_permission">No se han concedido permisos, por lo que no se ha importado nada</string>
|
||||
<string name="contacts">Contactos</string>
|
||||
@@ -258,6 +259,7 @@
|
||||
<string name="ecosystem_apps_more">Más apps de Nextcloud</string>
|
||||
<string name="ecosystem_apps_notes">Nextcloud Notas</string>
|
||||
<string name="ecosystem_apps_talk">Nextcloud Talk</string>
|
||||
<string name="email_pick_failed">Error al seleccionar dirección de correo.</string>
|
||||
<string name="encrypted">Establecer como cifrado</string>
|
||||
<string name="end_to_end_encryption_confirm_button">Configurar cifrado</string>
|
||||
<string name="end_to_end_encryption_decrypting">Descifrando…</string>
|
||||
@@ -945,7 +947,9 @@
|
||||
<string name="wait_a_moment">Espera un momento…</string>
|
||||
<string name="wait_checking_credentials">Comprobando las credenciales guardadas</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">Copiando el archivo desde el almacenamiento privado.</string>
|
||||
<string name="webview_version_check_alert_dialog_message">Por favor actualiza la aplicación WebView de Sistema Android para iniciar sesión</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">Actualizar</string>
|
||||
<string name="webview_version_check_alert_dialog_title">Actualiza WebView de Sistema Android</string>
|
||||
<string name="what_s_new_image">Imagen de Qué hay de nuevo</string>
|
||||
<string name="whats_new_skip">Omitir</string>
|
||||
<string name="whats_new_title">Nuevo en %1$s</string>
|
||||
|
||||
@@ -525,6 +525,7 @@
|
||||
<string name="version_dev_download">Lae alla</string>
|
||||
<string name="wait_a_moment">Oota üks hetk…</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">Faili kopeerimine privaatsest salvestusalast</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">Uuenda</string>
|
||||
<string name="whats_new_skip">Jäta vahele</string>
|
||||
<string name="whats_your_status">Mis on su staatus?</string>
|
||||
<string name="write_email">Saada kiri</string>
|
||||
|
||||
@@ -393,6 +393,7 @@
|
||||
<string name="folder_list_empty_headline">Ez dago karpetarik hemen</string>
|
||||
<string name="folder_picker_choose_button_text">Aukeratu</string>
|
||||
<string name="folder_picker_choose_caption_text">Aukeratu helburuko karpeta</string>
|
||||
<string name="folder_picker_copy_button_text">Kopiatu</string>
|
||||
<string name="folder_picker_move_button_text">Mugitu</string>
|
||||
<string name="forbidden_permissions">Ez daukazu baimenik %s</string>
|
||||
<string name="forbidden_permissions_copy">fitxategi hau kopiatzeko</string>
|
||||
@@ -943,6 +944,7 @@
|
||||
<string name="wait_a_moment">Itxaron momentu bat…</string>
|
||||
<string name="wait_checking_credentials">Gordetako nortasun-datuak konprobatzen</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">Fitxategia biltegiratze pribatutik kopiatzen</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">Eguneratu</string>
|
||||
<string name="what_s_new_image">Zer da irudi berria</string>
|
||||
<string name="whats_new_skip">Salto egin</string>
|
||||
<string name="whats_new_title">Berria %1$s-n</string>
|
||||
|
||||
@@ -393,6 +393,7 @@
|
||||
<string name="folder_list_empty_headline">هیچ پوشه ای اینجا وجود ندارد</string>
|
||||
<string name="folder_picker_choose_button_text">انتخاب کردن</string>
|
||||
<string name="folder_picker_choose_caption_text">پوشهٔ هدف را انتخاب کنید</string>
|
||||
<string name="folder_picker_copy_button_text">رونوشت</string>
|
||||
<string name="folder_picker_move_button_text">انتقال</string>
|
||||
<string name="forbidden_permissions">شما مجاز نیستید%s</string>
|
||||
<string name="forbidden_permissions_copy">کپی این فایل</string>
|
||||
@@ -943,6 +944,7 @@
|
||||
<string name="wait_a_moment">یک لحظه صبر کنید...</string>
|
||||
<string name="wait_checking_credentials">بررسی اعتبارنامههای ذخیره شده</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">کپی کردن فایل از حافظه خصوصی</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">بهروز رسانی</string>
|
||||
<string name="what_s_new_image">چه تصویر جدیدی است</string>
|
||||
<string name="whats_new_skip">رد شدن</string>
|
||||
<string name="whats_new_title">جدید در %1$s</string>
|
||||
|
||||
@@ -381,6 +381,7 @@
|
||||
<string name="folder_list_empty_headline">Ei kansioita täällä</string>
|
||||
<string name="folder_picker_choose_button_text">Valitse</string>
|
||||
<string name="folder_picker_choose_caption_text">Valitse kohdekansio</string>
|
||||
<string name="folder_picker_copy_button_text">Kopioi</string>
|
||||
<string name="folder_picker_move_button_text">Siirrä</string>
|
||||
<string name="forbidden_permissions">Sinulla ei ole oikeutta %s</string>
|
||||
<string name="forbidden_permissions_copy">kopioida tämä tiedosto</string>
|
||||
@@ -906,6 +907,7 @@ GNU yleinen lisenssi, versio 2</string>
|
||||
<string name="wait_a_moment">Odota hetki…</string>
|
||||
<string name="wait_checking_credentials">Tarkistetaan tallennettuja tilitietoja</string>
|
||||
<string name="wait_for_tmp_copy_from_private_storage">Kopioidaan tiedostoa yksityisestä tallennustilasta</string>
|
||||
<string name="webview_version_check_alert_dialog_positive_button_title">Päivitä</string>
|
||||
<string name="what_s_new_image">Mitä uutta -kuva</string>
|
||||
<string name="whats_new_skip">Ohita</string>
|
||||
<string name="whats_new_title">Uutta versiossa %1$s</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="conflict_message_description">Si vous sélectionnez les deux versions, le fichier local aura un numéro ajouté à son nom.</string>
|
||||
<string name="conflict_server_file">Fichier serveur</string>
|
||||
<string name="contact_backup_title">Sauvegarde des contacts</string>
|
||||
<string name="contact_no_permission">La permission d\'accès à vos contacts est requise</string>
|
||||
<string name="contactlist_item_icon">L\'icône de l\'utilisateur pour la liste des contacts</string>
|
||||
<string name="contactlist_no_permission">Pas de permission donnée, rien n\'a été importé.</string>
|
||||
<string name="contacts">Contacts</string>
|
||||
@@ -327,7 +328,6 @@ Attention, la suppression est irréversible.</string>
|
||||
<string name="file_delete">Supprimer</string>
|
||||
<string name="file_detail_activity_error">Erreur lors de la récupération de l’activité du fichier</string>
|
||||
<string name="file_details_no_content">Impossible de charger les détails</string>
|
||||
<string name="file_downloader_notification_title_prefix">Téléchargement de \u0020</string>
|
||||
<string name="file_icon">Fichier</string>
|
||||
<string name="file_keep">Conserver</string>
|
||||
<string name="file_list_empty">Déposez du contenu ou synchronisez vos appareils.</string>
|
||||
|
||||
@@ -160,6 +160,7 @@
|
||||
<string name="conflict_message_description">Se selecciona ambas versións, o ficheiro local terá un número engadido ao nome.</string>
|
||||
<string name="conflict_server_file">Ficheiro do servidor</string>
|
||||
<string name="contact_backup_title">Copia de seguranza dos contactos</string>
|
||||
<string name="contact_no_permission">Precisase de permiso de contacto.</string>
|
||||
<string name="contactlist_item_icon">Icona do usuario para a lista de contactos</string>
|
||||
<string name="contactlist_no_permission">Non se concederon permisos. Non se importou nada!</string>
|
||||
<string name="contacts">Contactos</string>
|
||||
@@ -258,6 +259,7 @@
|
||||
<string name="ecosystem_apps_more">Máis aplicacións de Nextcloud</string>
|
||||
<string name="ecosystem_apps_notes">Notas de Nextcloud</string>
|
||||
<string name="ecosystem_apps_talk">Talk de Nextcloud</string>
|
||||
<string name="email_pick_failed">Produciuse un fallo ao escoller o enderezo de correo.</string>
|
||||
<string name="encrypted">Estabelecer como cifrado</string>
|
||||
<string name="end_to_end_encryption_confirm_button">Configurar o cifrado</string>
|
||||
<string name="end_to_end_encryption_decrypting">Descifrando…</string>
|
||||
@@ -325,7 +327,6 @@
|
||||
<string name="file_delete">Eliminar</string>
|
||||
<string name="file_detail_activity_error">Produciuse un erro ao recuperar actividades para o ficheiro</string>
|
||||
<string name="file_details_no_content">Produciuse un fallo ao cargar os detalles</string>
|
||||
<string name="file_downloader_notification_title_prefix">Descargando \u0020</string>
|
||||
<string name="file_icon">Ficheiro</string>
|
||||
<string name="file_keep">Conservar</string>
|
||||
<string name="file_list_empty">Envíe algún contido ou sincronice cos seus dispositivos.</string>
|
||||
|
||||