Browse Source

Merge branch 'master' of https://github.com/nextcloud/android into userTheming

# Conflicts:
#	src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java
AndyScherzinger 7 years ago
parent
commit
914b32f7ab

+ 72 - 0
androidTest/java/com/owncloud/android/datamodel/UploadStorageManagerTest.java

@@ -0,0 +1,72 @@
+package com.owncloud.android.datamodel;
+
+import android.accounts.Account;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import com.owncloud.android.db.OCUpload;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+
+/**
+ * Created by JARP on 6/7/17.
+ */
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class UploadStorageManagerTest {
+
+    private Account[] Accounts;
+    private UploadsStorageManager uploadsStorageManager;
+
+    @Before
+    public void setUp() {
+        Context instrumentationCtx = InstrumentationRegistry.getTargetContext();
+        ContentResolver contentResolver = instrumentationCtx.getContentResolver();
+        uploadsStorageManager = new UploadsStorageManager(contentResolver, instrumentationCtx);
+        Accounts = new Account[]{new Account("A", "A"), new Account("B", "B")};
+    }
+
+    @Test
+    public void testDeleteAllUploads() {
+        //Clean
+        for (Account account : Accounts) {
+            uploadsStorageManager.removeAccountUploads(account);
+        }
+        int accountRowsA = 3;
+        int accountRowsB = 4;
+        insertUploads(Accounts[0], accountRowsA);
+        insertUploads(Accounts[1], accountRowsB);
+
+        Assert.assertTrue("Expected 4 removed uploads files", uploadsStorageManager.removeAccountUploads(Accounts[1]) == 4);
+    }
+
+    private void insertUploads(Account account, int rowsToInsert) {
+
+        for (int i = 0; i < rowsToInsert; i++) {
+            uploadsStorageManager.storeUpload(createUpload(account));
+        }
+    }
+
+    private OCUpload createUpload(Account acc) {
+        return new OCUpload(File.separator + "LocalPath",
+                OCFile.PATH_SEPARATOR + "RemotePath",
+                acc.name);
+    }
+
+    @After
+    public void tearDown() {
+        for (Account account : Accounts) {
+            uploadsStorageManager.removeAccountUploads(account);
+        }
+    }
+}

+ 1 - 1
scripts/lint/lint-results.txt

@@ -1,2 +1,2 @@
 DO NOT TOUCH; GENERATED BY DRONE
-      <span class="mdl-layout-title">Lint Report: 74 errors and 848 warnings</span>
+      <span class="mdl-layout-title">Lint Report: 73 errors and 853 warnings</span>

+ 8 - 0
src/main/java/com/owncloud/android/datamodel/UploadsStorageManager.java

@@ -605,4 +605,12 @@ public class UploadsStorageManager extends Observable {
         return result;
     }
 
+    public int removeAccountUploads(Account account) {
+        Log_OC.v(TAG, "Delete all uploads for account " + account.name);
+        return getDB().delete(
+                ProviderTableMeta.CONTENT_URI_UPLOADS,
+                ProviderTableMeta.UPLOADS_ACCOUNT_NAME + "=?",
+                new String[]{account.name});
+    }
+
 }

+ 2 - 1
src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java

@@ -172,7 +172,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
                 listFragment.setMessageForEmptyList(
                         R.string.file_list_empty_headline,
                         R.string.file_list_empty_moving,
-                        R.drawable.ic_list_empty_create_folder
+                        R.drawable.ic_list_empty_create_folder,
+                        true
                 );
             } else {
                 listFragment.setEmptyListLoadingMessage();

+ 1 - 0
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -409,6 +409,7 @@ public class UserInfoActivity extends FileActivity {
                                     UploadsStorageManager uploadsStorageManager = new UploadsStorageManager(
                                             contentResolver, getActivity());
                                     uploadsStorageManager.cancelPendingAutoUploadJobsForAccount(account);
+                                    uploadsStorageManager.removeAccountUploads(account);
 
                                     // disable daily backup
                                     ArbitraryDataProvider arbitraryDataProvider = new ArbitraryDataProvider(

+ 20 - 3
src/main/java/com/owncloud/android/ui/fragment/ExtendedListFragment.java

@@ -661,14 +661,28 @@ public class ExtendedListFragment extends Fragment
         }
     }
 
+    /**
+     * displays an empty list information with a headline, a message and a not to be tinted icon.
+     *
+     * @param headline the headline
+     * @param message  the message
+     * @param icon     the icon to be shown
+     */
+    public void setMessageForEmptyList(@StringRes final int headline, @StringRes final int message,
+                                       @DrawableRes final int icon) {
+        setMessageForEmptyList(headline, message, icon, false);
+    }
+
     /**
      * displays an empty list information with a headline, a message and an icon.
      *
      * @param headline the headline
      * @param message  the message
      * @param icon     the icon to be shown
+     * @param tintIcon flag if the given icon should be tinted with primary color
      */
-    public void setMessageForEmptyList(@StringRes final int headline, @StringRes final int message, @DrawableRes final int icon) {
+    public void setMessageForEmptyList(@StringRes final int headline, @StringRes final int message,
+                                       @DrawableRes final int icon, final boolean tintIcon) {
         new Handler(Looper.getMainLooper()).post(new Runnable() {
             @Override
             public void run() {
@@ -677,7 +691,9 @@ public class ExtendedListFragment extends Fragment
                     mEmptyListHeadline.setText(headline);
                     mEmptyListMessage.setText(message);
 
-                    mEmptyListIcon.setImageDrawable(DisplayUtils.tintDrawable(icon, DisplayUtils.primaryColor()));
+                    if (tintIcon) {
+                        mEmptyListIcon.setImageDrawable(DisplayUtils.tintDrawable(icon, DisplayUtils.primaryColor()));
+                    }
 
                     mEmptyListIcon.setVisibility(View.VISIBLE);
                     mEmptyListProgress.setVisibility(View.GONE);
@@ -696,7 +712,8 @@ public class ExtendedListFragment extends Fragment
                     setMessageForEmptyList(
                             R.string.file_list_empty_headline,
                             R.string.file_list_empty,
-                            R.drawable.ic_list_empty_folder
+                            R.drawable.ic_list_empty_folder,
+                            true
                     );
                 } else if (searchType == SearchType.FILE_SEARCH) {
                     setMessageForEmptyList(R.string.file_list_empty_headline_server_search,

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/LocalFileListFragment.java

@@ -99,7 +99,7 @@ public class LocalFileListFragment extends ExtendedListFragment {
         setSwipeEnabled(false); // Disable pull-to-refresh
         setFabEnabled(false); // Disable FAB
         setMessageForEmptyList(R.string.file_list_empty_headline, R.string.local_file_list_empty,
-                R.drawable.ic_list_empty_folder);
+                R.drawable.ic_list_empty_folder, true);
         Log_OC.i(TAG, "onCreateView() end");
         return v;
     }

+ 1 - 1
src/main/java/com/owncloud/android/ui/fragment/UploadListFragment.java

@@ -67,7 +67,7 @@ public class UploadListFragment extends ExpandableListFragment {
         getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
         setMessageForEmptyList(
                 R.string.upload_list_empty_headline, R.string.upload_list_empty_text_auto_upload,
-                R.drawable.ic_list_empty_upload
+                R.drawable.ic_list_empty_upload, true
         );
         setOnRefreshListener(this);
         return v;

+ 0 - 1
src/main/res/layout/empty_list.xml

@@ -34,7 +34,6 @@
         android:layout_height="72dp"
         android:contentDescription="@string/file_list_folder"
         android:src="@drawable/ic_list_empty_folder"
-        android:tint="@color/primary"
         android:visibility="gone"/>
 
     <ProgressBar

+ 1 - 1
src/main/res/values-de/strings.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="about_android">%1$s Android AppAuto </string>
+    <string name="about_android">%1$s Android App</string>
     <string name="about_version">Version %1$s</string>
     <string name="actionbar_sync">Konto aktualisieren</string>
     <string name="actionbar_upload">Hochladen</string>

+ 1 - 0
src/main/res/values-el/strings.xml

@@ -657,6 +657,7 @@
     <!-- Notifications -->
     <string name="new_notification_received">Νέα ενημέρωση ελήφθη </string>
     <string name="drawer_logout">Έξοδος</string>
+    <string name="privacy">Ιδιωτικότητα</string>
     <string name="file_not_found">Δεν βρέθηκε το αρχείο!</string>
 
     <string name="folder_sync_folders">Ρύθμιση φακέλων</string>

+ 3 - 3
src/main/res/values-pt-rBR/strings.xml

@@ -54,7 +54,7 @@
     <string name="prefs_log_summary">Usado para registrar problemas</string>
     <string name="prefs_log_title_history">Histórico de logins</string>
     <string name="prefs_log_summary_history">Mostra os registros gravados</string>
-    <string name="prefs_log_delete_history_button">Excluir histórico</string>
+    <string name="prefs_log_delete_history_button">Eliminar histórico</string>
     <string name="prefs_calendar_contacts">Configurar a sincronização do calendário e dos contatos</string>
     <string name="prefs_calendar_contacts_summary">Configurar o DAVdroid (v1.3.0+) para a conta em uso</string>
     <string name="prefs_calendar_contacts_address_resolve_error">O endereço do servidor da conta não pôde ser reconhecido pelo DAVdroid</string>
@@ -80,7 +80,7 @@
     <string name="uploader_btn_upload_text">Enviar</string>
     <string name="uploader_top_message">Escolher pasta para envio</string>
     <string name="uploader_wrn_no_account_title">Nenhuma conta encontrada</string>
-    <string name="uploader_wrn_no_account_text">Não existe nenhuma conta %1$s em seu aparelho. Por favor, configure uma conta primeiro.</string>
+    <string name="uploader_wrn_no_account_text">Não existe nenhuma conta %1$s em seu dispositivo. Por favor, configure uma conta primeiro.</string>
     <string name="uploader_wrn_no_account_setup_btn_text">Instalação</string>
     <string name="uploader_wrn_no_account_quit_btn_text">Sair</string>
     <string name="uploader_error_title_no_file_to_upload">Nenhum arquivo para envio</string>
@@ -216,7 +216,7 @@
     
     <string name="pass_code_configure_your_pass_code">Digite o código de acesso</string>
     <string name="pass_code_configure_your_pass_code_explanation">O código de acesso será solicitado toda vez que o aplicativo for iniciado</string>
-    <string name="pass_code_reenter_your_pass_code">Por favor, digite seu códigode acesso novamente</string>
+    <string name="pass_code_reenter_your_pass_code">Por favor, digite seu código de acesso novamente</string>
     <string name="pass_code_remove_your_pass_code">Excluir seu código de acesso</string>
     <string name="pass_code_mismatch">Os códigos de acesso não são os mesmos</string>
     <string name="pass_code_wrong">Código de acesso incorreto</string>

+ 8 - 1
src/main/res/values-zh-rCN/strings.xml

@@ -307,6 +307,7 @@
     <string name="activity_chooser_title">发送链接给 &#8230;</string>
     <string name="wait_for_tmp_copy_from_private_storage">从私有存储中拷贝文件</string>
     
+    <string name="oauth_check_onoff">使用oAuth2登录</string> 
     <string name="oauth_login_connection">连接到OAuth 2服务器...</string>    
         
     <string name="ssl_validator_header">站点身份无法验证</string>
@@ -350,6 +351,7 @@
     <string name="instant_video_upload_on_charging">仅在充电时上传</string>
     <string name="instant_upload_on_charging">仅在充电时上传</string>
     <string name="instant_upload_path">/实时上传</string>
+    <string name="auto_upload_path">/自动上传</string>
     <string name="conflict_title">文件冲突</string>
     <string name="conflict_message">你想保留哪些文件? 如果您选择这两个版本,本地文件将附加一个号码。</string>
     <string name="conflict_keep_both">保留两者</string>
@@ -420,6 +422,7 @@
     <string name="file_migration_failed_while_coping">错误:迁移过程中失败</string>
     <string name="file_migration_failed_while_updating_index">错误:无法更新索引</string>
 
+    <string name="file_migration_directory_already_exists">数据文件夹已经存在。请选择以下选项:</string>
     <string name="file_migration_override_data_folder">代替</string>
     <string name="file_migration_use_data_folder">使用</string>
 
@@ -657,4 +660,8 @@
     <string name="drawer_logout">退出</string>
     <string name="picture_set_as_no_app">没有应用程序发现设置图片!</string>
     <string name="privacy">隐私</string>
-    </resources>
+    <string name="file_not_found">文件未找到</string>
+
+    <string name="folder_sync_folders">配置文件夹</string>
+
+  </resources>