From: David A. Velasco Date: Thu, 19 Mar 2015 11:59:17 +0000 (+0100) Subject: Merge pull request #914 from owncloud/accessibility X-Git-Tag: oc-android-1.7.1_signed^2~17 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/5ebd90ed2d43a15e8ae5a53465c3c02d062998f8?hp=-c Merge pull request #914 from owncloud/accessibility Added accesibility descriptions as a mean to add automatic tests un UI. --- 5ebd90ed2d43a15e8ae5a53465c3c02d062998f8 diff --combined res/values/strings.xml index b6513e38,8f2898cb..8b2224bd --- a/res/values/strings.xml +++ b/res/values/strings.xml @@@ -166,7 -166,7 +166,7 @@@ No network connection Secure connection unavailable. Connection established - Testing connection… + Testing connection Malformed server configuration An account for the same user and server already exists in the device The entered user does not match the user of this account @@@ -275,8 -275,6 +275,8 @@@ An error occurred while trying to share this file or folder Unable to unshare. Please check whether the file exists An error occurred while trying to unshare this file or folder + Enter a password + You must enter a password Send @@@ -331,4 -329,7 +331,7 @@@ %1$s shared \"%2$s\" with you + Refresh connection + Server address + diff --combined src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 9c6f6dc5,58e7ec5e..5efe4232 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@@ -23,10 -23,13 +23,10 @@@ package com.owncloud.android.ui.activity; import java.io.File; -import java.io.IOException; import android.accounts.Account; import android.accounts.AccountManager; import android.accounts.AuthenticatorException; -import android.accounts.OperationCanceledException; -import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.AlertDialog; import android.app.Dialog; @@@ -1380,7 -1383,11 +1380,11 @@@ OnSslUntrustedCertListener, OnEnforceab * TODO */ private void updateNavigationElementsInActionBar(OCFile chosenFile) { - ActionBar actionBar = getSupportActionBar(); + ActionBar actionBar = getSupportActionBar(); + + // For adding content description tag to a title field in the action bar + int actionBarTitleId = getResources().getIdentifier("action_bar_title", "id", "android"); + if (chosenFile == null || mDualPane) { // only list of files - set for browsing through folders OCFile currentDir = getCurrentDir(); @@@ -1389,6 -1396,7 +1393,7 @@@ actionBar.setDisplayShowTitleEnabled(!noRoot); if (!noRoot) { actionBar.setTitle(getString(R.string.default_display_name_for_root_folder)); + getWindow().getDecorView().findViewById(actionBarTitleId).setContentDescription(getString(R.string.default_display_name_for_root_folder)); } actionBar.setNavigationMode(!noRoot ? ActionBar.NAVIGATION_MODE_STANDARD : ActionBar.NAVIGATION_MODE_LIST); actionBar.setListNavigationCallbacks(mDirectories, this); // assuming mDirectories is updated @@@ -1398,6 -1406,7 +1403,7 @@@ actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(chosenFile.getFileName()); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); + getWindow().getDecorView().findViewById(actionBarTitleId).setContentDescription(chosenFile.getFileName()); } } diff --combined src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 9fd7efe4,fbdf69d8..d4c1c7b2 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@@ -30,7 -30,6 +30,7 @@@ import android.accounts.Account import android.content.Context; import android.content.SharedPreferences; import android.graphics.Bitmap; +import android.os.Build; import android.preference.PreferenceManager; import android.text.format.DateUtils; import android.view.LayoutInflater; @@@ -38,7 -37,9 +38,8 @@@ import android.view.View import android.view.ViewGroup; import android.widget.AbsListView; import android.widget.BaseAdapter; -import android.widget.GridView; import android.widget.ImageView; + import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.TextView; @@@ -94,7 -95,6 +95,6 @@@ public class FileListListAdapter extend // Read sorting order, default to sort by name ascending FileStorageUtils.mSortOrder = mAppPreferences.getInt("sortOrder", 0); FileStorageUtils.mSortAscending = mAppPreferences.getBoolean("sortAscending", true); - // initialise thumbnails cache on background thread new ThumbnailsCacheManager.InitDiskCacheTask().execute(); @@@ -176,9 -176,13 +176,13 @@@ if (file != null){ ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail); + fileIcon.setTag(file.getFileId()); TextView fileName; - String name; + String name = file.getFileName(); + + LinearLayout linearLayout = (LinearLayout) view.findViewById(R.id.ListItemLayout); + linearLayout.setContentDescription("LinearLayout-" + name); switch (viewType){ case LIST_ITEM: @@@ -196,19 -200,15 +200,19 @@@ if (!file.isFolder()) { AbsListView parentList = (AbsListView)parent; - if (parentList.getChoiceMode() == AbsListView.CHOICE_MODE_NONE) { - checkBoxV.setVisibility(View.GONE); - } else { - if (parentList.isItemChecked(position)) { - checkBoxV.setImageResource(android.R.drawable.checkbox_on_background); + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + if (parentList.getChoiceMode() == AbsListView.CHOICE_MODE_NONE) { + checkBoxV.setVisibility(View.GONE); } else { - checkBoxV.setImageResource(android.R.drawable.checkbox_off_background); + if (parentList.isItemChecked(position)) { + checkBoxV.setImageResource( + android.R.drawable.checkbox_on_background); + } else { + checkBoxV.setImageResource( + android.R.drawable.checkbox_off_background); + } + checkBoxV.setVisibility(View.VISIBLE); } - checkBoxV.setVisibility(View.VISIBLE); } } else { //Folder @@@ -234,21 -234,15 +238,21 @@@ // local state ImageView localStateView = (ImageView) view.findViewById(R.id.localFileIndicator); localStateView.bringToFront(); - FileDownloaderBinder downloaderBinder = mTransferServiceGetter.getFileDownloaderBinder(); - FileUploaderBinder uploaderBinder = mTransferServiceGetter.getFileUploaderBinder(); - boolean downloading = (downloaderBinder != null && downloaderBinder.isDownloading(mAccount, file)); - OperationsServiceBinder opsBinder = mTransferServiceGetter.getOperationsServiceBinder(); - downloading |= (opsBinder != null && opsBinder.isSynchronizing(mAccount, file.getRemotePath())); + FileDownloaderBinder downloaderBinder = + mTransferServiceGetter.getFileDownloaderBinder(); + FileUploaderBinder uploaderBinder = + mTransferServiceGetter.getFileUploaderBinder(); + boolean downloading = (downloaderBinder != null && + downloaderBinder.isDownloading(mAccount, file)); + OperationsServiceBinder opsBinder = + mTransferServiceGetter.getOperationsServiceBinder(); + downloading |= (opsBinder != null && + opsBinder.isSynchronizing(mAccount, file.getRemotePath())); if (downloading) { localStateView.setImageResource(R.drawable.downloading_file_indicator); localStateView.setVisibility(View.VISIBLE); - } else if (uploaderBinder != null && uploaderBinder.isUploading(mAccount, file)) { + } else if (uploaderBinder != null && + uploaderBinder.isUploading(mAccount, file)) { localStateView.setImageResource(R.drawable.uploading_file_indicator); localStateView.setVisibility(View.VISIBLE); } else if (file.isDown()) { @@@ -260,8 -254,7 +264,8 @@@ // share with me icon if (!file.isFolder()) { - ImageView sharedWithMeIconV = (ImageView) view.findViewById(R.id.sharedWithMeIcon); + ImageView sharedWithMeIconV = (ImageView) + view.findViewById(R.id.sharedWithMeIcon); sharedWithMeIconV.bringToFront(); if (checkIfFileIsSharedWithMe(file)) { sharedWithMeIconV.setVisibility(View.VISIBLE); @@@ -313,9 -306,9 +317,10 @@@ } } } else { - fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(), file.getFileName())); + fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(), + file.getFileName())); } + } else { // Folder if (checkIfFileIsSharedWithMe(file)) {