From: David A. Velasco Date: Mon, 30 Mar 2015 12:38:26 +0000 (+0200) Subject: Fixed crashes in Android 2.x due to accesibility code X-Git-Tag: oc-android-1.7.1_signed^2~2 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/4fbce341beee83e770b491a44ad869d6c047b343?ds=inline;hp=-c Fixed crashes in Android 2.x due to accesibility code --- 4fbce341beee83e770b491a44ad869d6c047b343 diff --git a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java index 052250d3..3ea6822b 100644 --- a/src/com/owncloud/android/ui/activity/FileDisplayActivity.java +++ b/src/com/owncloud/android/ui/activity/FileDisplayActivity.java @@ -1393,9 +1393,9 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener { actionBar.setDisplayShowTitleEnabled(!noRoot); if (!noRoot) { actionBar.setTitle(getString(R.string.default_display_name_for_root_folder)); - View actionBarView = getWindow().getDecorView().findViewById(actionBarTitleId); - if (actionBarView != null) { // it's null in Android 2.x (at least) - actionBarView.setContentDescription(getString(R.string.default_display_name_for_root_folder)); + View actionBarTitleView = getWindow().getDecorView().findViewById(actionBarTitleId); + if (actionBarTitleView != null) { // it's null in Android 2.x + actionBarTitleView.setContentDescription(getString(R.string.default_display_name_for_root_folder)); } } actionBar.setNavigationMode(!noRoot ? ActionBar.NAVIGATION_MODE_STANDARD : ActionBar.NAVIGATION_MODE_LIST); @@ -1406,7 +1406,11 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener { actionBar.setDisplayShowTitleEnabled(true); actionBar.setTitle(chosenFile.getFileName()); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); - getWindow().getDecorView().findViewById(actionBarTitleId).setContentDescription(chosenFile.getFileName()); + View actionBarTitleView = getWindow().getDecorView().findViewById(actionBarTitleId); + if (actionBarTitleView != null) { // it's null in Android 2.x + getWindow().getDecorView().findViewById(actionBarTitleId). + setContentDescription(chosenFile.getFileName()); + } } } diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java index 2eb48fab..5585024d 100644 --- a/src/com/owncloud/android/ui/activity/Preferences.java +++ b/src/com/owncloud/android/ui/activity/Preferences.java @@ -119,7 +119,11 @@ public class Preferences extends SherlockPreferenceActivity // 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)); + View actionBarTitleView = getWindow().getDecorView().findViewById(actionBarTitleId); + if (actionBarTitleView != null) { // it's null in Android 2.x + 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");