Merge pull request #914 from owncloud/accessibility

Added accesibility descriptions as a mean to add automatic tests un UI.
This commit is contained in:
David A. Velasco 2015-03-19 12:59:17 +01:00
commit 5ebd90ed2d
7 changed files with 78 additions and 30 deletions

View file

@ -38,7 +38,8 @@
android:layout_weight="1"
android:layout_gravity="center"
android:background="@color/login_logo_background_color"
android:src="@drawable/logo"
android:src="@drawable/logo"
android:contentDescription="@string/app_name"
/>
<ScrollView
@ -65,7 +66,8 @@
android:layout_marginBottom="10dp"
android:onClick="onRefreshClick"
android:text="@string/auth_check_server"
android:visibility="gone" />
android:visibility="gone"
android:contentDescription="@string/auth_check_server"/>
<TextView
android:id="@+id/instructions_message"
android:layout_width="wrap_content"
@ -73,7 +75,8 @@
android:layout_gravity="fill_horizontal"
android:text="@string/auth_expired_basic_auth_toast"
android:visibility="gone"
android:layout_marginBottom="10dp"/>
android:layout_marginBottom="10dp"
android:contentDescription="@string/auth_expired_basic_auth_toast"/>
<FrameLayout
android:id="@+id/hostUrlFrame"
android:layout_width="match_parent"
@ -89,6 +92,7 @@
android:inputType="textUri"
android:drawablePadding="5dp"
android:paddingRight="55dp"
android:contentDescription="@string/auth_host_address"
>
<requestFocus />
</EditText>
@ -104,6 +108,7 @@
android:onClick="onRefreshClick"
android:visibility="gone"
android:background="@android:color/transparent"
android:contentDescription="@string/auth_refresh_button"
/>
</FrameLayout>
@ -115,7 +120,8 @@
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="@string/auth_testing_connection" />
android:text="@string/auth_testing_connection"
android:contentDescription="@string/auth_testing_connection"/>
<CheckBox
android:id="@+id/oauth_onOff_check"
@ -125,6 +131,7 @@
android:onClick="onCheckClick"
android:text="@string/oauth_check_onoff"
android:textAppearance="?android:attr/textAppearanceSmall"
android:contentDescription="@string/oauth_check_onoff"
/>
<EditText
@ -136,7 +143,7 @@
android:text="@string/oauth2_url_endpoint_auth"
android:singleLine="true"
android:inputType="textUri"
android:visibility="gone" >
android:visibility="gone">
</EditText>
<EditText
@ -148,7 +155,7 @@
android:text="@string/oauth2_url_endpoint_access"
android:singleLine="true"
android:inputType="textUri"
android:visibility="gone" >
android:visibility="gone">
<requestFocus />
</EditText>
@ -158,7 +165,8 @@
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/auth_username"
android:inputType="textNoSuggestions" />
android:inputType="textNoSuggestions"
android:contentDescription="@string/auth_username"/>
<EditText
android:id="@+id/account_password"
@ -168,6 +176,7 @@
android:hint="@string/auth_password"
android:inputType="textPassword"
android:drawablePadding="5dp"
android:contentDescription="@string/auth_password"
/>
<TextView
@ -178,6 +187,7 @@
android:text="@string/auth_unauthorized"
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="5dip"
android:contentDescription="@string/auth_unauthorized"
/>
</LinearLayout>
@ -200,7 +210,8 @@
android:layout_gravity="center_horizontal"
android:enabled="false"
android:onClick="onOkClick"
android:text="@string/setup_btn_connect" />
android:text="@string/setup_btn_connect"
android:contentDescription="@string/setup_btn_connect"/>
<Button
android:id="@+id/welcome_link"
@ -212,7 +223,8 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/auth_register"
android:textColor="#0000FF"/>
android:textColor="#0000FF"
android:contentDescription="@string/auth_register"/>
</LinearLayout>
</RelativeLayout>

View file

@ -41,7 +41,8 @@
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="@color/login_logo_background_color"
android:src="@drawable/logo" />
android:src="@drawable/logo"
android:contentDescription="@string/app_name"/>
<Button
android:id="@+id/centeredRefreshButton"
@ -51,7 +52,8 @@
android:layout_marginBottom="10dp"
android:onClick="onRefreshClick"
android:text="@string/auth_check_server"
android:visibility="gone" />
android:visibility="gone"
android:contentDescription="@string/auth_check_server"/>
<TextView
android:id="@+id/instructions_message"
@ -60,7 +62,8 @@
android:layout_gravity="fill_horizontal"
android:text="@string/auth_expired_basic_auth_toast"
android:visibility="gone"
android:layout_marginBottom="10dp" />
android:layout_marginBottom="10dp"
android:contentDescription="@string/auth_expired_basic_auth_toast"/>
<FrameLayout
android:id="@+id/hostUrlFrame"
@ -77,6 +80,7 @@
android:inputType="textUri"
android:drawablePadding="5dp"
android:paddingRight="55dp"
android:contentDescription="@string/auth_host_address"
>
<requestFocus />
</EditText>
@ -92,6 +96,7 @@
android:onClick="onRefreshClick"
android:visibility="gone"
android:background="@android:color/transparent"
android:contentDescription="@string/auth_refresh_button"
/>
</FrameLayout>
@ -103,7 +108,8 @@
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="@string/auth_testing_connection" />
android:text="@string/auth_testing_connection"
android:contentDescription="@string/auth_testing_connection"/>
<CheckBox
android:id="@+id/oauth_onOff_check"
@ -113,6 +119,7 @@
android:onClick="onCheckClick"
android:text="@string/oauth_check_onoff"
android:textAppearance="?android:attr/textAppearanceSmall"
android:contentDescription="@string/oauth_check_onoff"
/>
<EditText
@ -124,7 +131,7 @@
android:text="@string/oauth2_url_endpoint_auth"
android:singleLine="true"
android:inputType="textUri"
android:visibility="gone" >
android:visibility="gone">
</EditText>
<EditText
@ -136,7 +143,7 @@
android:text="@string/oauth2_url_endpoint_access"
android:singleLine="true"
android:inputType="textUri"
android:visibility="gone" />
android:visibility="gone"/>
<EditText
android:id="@+id/account_username"
@ -144,7 +151,8 @@
android:layout_height="wrap_content"
android:ems="10"
android:hint="@string/auth_username"
android:inputType="textNoSuggestions"
android:inputType="textNoSuggestions"
android:contentDescription="@string/auth_username"
/>
<EditText
@ -154,7 +162,8 @@
android:drawablePadding="5dp"
android:ems="10"
android:hint="@string/auth_password"
android:inputType="textPassword"
android:inputType="textPassword"
android:contentDescription="@string/auth_password"
/>
<TextView
@ -165,7 +174,8 @@
android:drawableLeft="@android:drawable/stat_notify_sync"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="@string/auth_unauthorized" />
android:text="@string/auth_unauthorized"
android:contentDescription="@string/auth_unauthorized"/>
<Button
android:id="@+id/buttonOK"
@ -174,7 +184,8 @@
android:layout_gravity="center_horizontal"
android:enabled="false"
android:onClick="onOkClick"
android:text="@string/setup_btn_connect" />
android:text="@string/setup_btn_connect"
android:contentDescription="@string/setup_btn_connect"/>
<Button
android:id="@+id/welcome_link"
@ -185,7 +196,8 @@
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="@string/auth_register"
android:textColor="#0000FF"/>
android:textColor="#0000FF"
android:contentDescription="@string/auth_register"/>
</LinearLayout>

View file

@ -24,37 +24,43 @@
android:icon="@drawable/ic_action_upload"
android:orderInCategory="2"
android:showAsAction="always"
android:title="@string/actionbar_upload"/>
android:title="@string/actionbar_upload"
android:contentDescription="@string/actionbar_upload"/>
<item
android:id="@+id/action_create_dir"
android:icon="@drawable/ic_action_create_dir"
android:orderInCategory="2"
android:showAsAction="always"
android:title="@string/actionbar_mkdir"/>
android:title="@string/actionbar_mkdir"
android:contentDescription="@string/actionbar_mkdir"/>
<item
android:id="@+id/action_sync_account"
android:icon="@drawable/ic_action_refresh"
android:orderInCategory="2"
android:showAsAction="never"
android:title="@string/actionbar_sync"/>
android:title="@string/actionbar_sync"
android:contentDescription="@string/actionbar_sync"/>
<item
android:id="@+id/action_settings"
android:icon="@drawable/ic_action_settings"
android:orderInCategory="2"
android:showAsAction="never"
android:title="@string/actionbar_settings"/>
android:title="@string/actionbar_settings"
android:contentDescription="@string/actionbar_settings"/>
<item
android:id="@+id/action_logger"
android:icon="@drawable/ic_action_settings"
android:orderInCategory="2"
android:showAsAction="never"
android:title="@string/actionbar_logger"/>
android:title="@string/actionbar_logger"
android:contentDescription="@string/actionbar_logger"/>
<item
android:id="@+id/action_sort"
android:icon="@android:drawable/ic_menu_sort_alphabetically"
android:orderInCategory="2"
android:showAsAction="never"
android:title="@string/actionbar_sort"/>
android:title="@string/actionbar_sort"
android:contentDescription="@string/actionbar_sort"/>
<!-- <item android:id="@+id/search" android:title="@string/actionbar_search" android:icon="@drawable/ic_action_search"></item> -->

View file

@ -166,7 +166,7 @@
<string name="auth_no_net_conn_title">No network connection</string>
<string name="auth_nossl_plain_ok_title">Secure connection unavailable.</string>
<string name="auth_connection_established">Connection established</string>
<string name="auth_testing_connection">Testing connection&#8230;</string>
<string name="auth_testing_connection">Testing connection</string>
<string name="auth_not_configured_title">Malformed server configuration</string>
<string name="auth_account_not_new">An account for the same user and server already exists in the device</string>
<string name="auth_account_not_the_same">The entered user does not match the user of this account</string>
@ -331,4 +331,7 @@
<string name="subject_token">%1$s shared \"%2$s\" with you</string>
<string name="auth_refresh_button">Refresh connection</string>
<string name="auth_host_address">Server address</string>
</resources>

View file

@ -1380,7 +1380,11 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
* 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 +1393,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
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 +1403,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle(chosenFile.getFileName());
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
getWindow().getDecorView().findViewById(actionBarTitleId).setContentDescription(chosenFile.getFileName());
}
}

View file

@ -117,6 +117,10 @@ public class Preferences extends SherlockPreferenceActivity
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(R.string.actionbar_settings);
// For adding content description tag to a title field in the action bar
int actionBarTitleId = getResources().getIdentifier("action_bar_title", "id", "android");
getWindow().getDecorView().findViewById(actionBarTitleId).setContentDescription(getString(R.string.actionbar_settings));
// Load the accounts category for adding the list of accounts
mAccountsPrefCategory = (PreferenceCategory) findPreference("accounts_category");

View file

@ -39,6 +39,7 @@ import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.TextView;
@ -94,7 +95,6 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
// 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 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
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:
@ -316,6 +320,7 @@ public class FileListListAdapter extends BaseAdapter implements ListAdapter {
fileIcon.setImageResource(DisplayUtils.getFileTypeIconId(file.getMimetype(),
file.getFileName()));
}
} else {
// Folder
if (checkIfFileIsSharedWithMe(file)) {