diff --git a/OsmAnd/src/net/osmand/access/AccessibilityAssistant.java b/OsmAnd/src/net/osmand/access/AccessibilityAssistant.java index b9e05b5e12..a7d6c9701e 100644 --- a/OsmAnd/src/net/osmand/access/AccessibilityAssistant.java +++ b/OsmAnd/src/net/osmand/access/AccessibilityAssistant.java @@ -2,10 +2,11 @@ package net.osmand.access; import android.app.Activity; import android.os.Build; +import android.support.v4.view.AccessibilityDelegateCompat; +import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.util.SparseArray; import android.view.View; -import android.view.View.AccessibilityDelegate; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; import android.widget.Button; @@ -14,7 +15,7 @@ import android.widget.ImageView; import net.osmand.plus.OsmandApplication; -public class AccessibilityAssistant extends AccessibilityDelegate implements OnPageChangeListener { +public class AccessibilityAssistant extends AccessibilityDelegateCompat implements OnPageChangeListener { private final Activity hostActivity; private final OsmandApplication app; @@ -33,7 +34,7 @@ public class AccessibilityAssistant extends AccessibilityDelegate implements OnP discourageUiUpdates = false; eventsLocked = false; focusedView = null; - monitoredPages = new SparseArray(); + monitoredPages = new SparseArray<>(); visiblePage = null; visiblePageId = 0; } @@ -68,7 +69,7 @@ public class AccessibilityAssistant extends AccessibilityDelegate implements OnP monitoredPages.put(id, page); if (id == visiblePageId) visiblePage = page; - page.setAccessibilityDelegate(this); + ViewCompat.setAccessibilityDelegate(page, this); } diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java index 78d89e204a..9f2a546bd3 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchActivity.java @@ -27,6 +27,7 @@ import android.app.ActionBar; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.support.v7.app.ActionBar.OnNavigationListener; @@ -205,7 +206,7 @@ public class SearchActivity extends TabActivity implements OsmAndLocationListene @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View itemView = super.getDropDownView(position, convertView, parent); - itemView.setAccessibilityDelegate(accessibilityAssistant); + ViewCompat.setAccessibilityDelegate(itemView, accessibilityAssistant); return itemView; } }; diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index 27dce44d3a..865ca0151b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -11,6 +11,7 @@ import android.os.AsyncTask; import android.os.AsyncTask.Status; import android.os.Bundle; import android.support.v4.view.MenuItemCompat; +import android.support.v4.view.ViewCompat; import android.support.v7.app.AlertDialog; import android.support.v7.widget.PopupMenu; import android.support.v7.widget.Toolbar; @@ -792,7 +793,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa String poiType = OsmAndFormatter.getPoiStringWithoutType(amenity, app.getSettings().MAP_PREFERRED_LOCALE.get()); label.setText(poiType); distanceText.setText(distance); - row.setAccessibilityDelegate(accessibilityAssistant); + ViewCompat.setAccessibilityDelegate(row, accessibilityAssistant); return (row); } diff --git a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java index fb53efc0fa..a8d8b26d5e 100644 --- a/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java +++ b/OsmAnd/src/net/osmand/plus/download/ui/ItemViewHolder.java @@ -6,6 +6,7 @@ import android.content.Intent; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.net.Uri; +import android.support.v4.view.ViewCompat; import android.support.v7.app.AlertDialog; import android.support.v7.widget.PopupMenu; import android.util.TypedValue; @@ -84,9 +85,9 @@ public class ItemViewHolder { rightImageButton = (ImageView) view.findViewById(R.id.secondaryIcon); nameTextView = (TextView) view.findViewById(R.id.title); - view.setAccessibilityDelegate(context.getAccessibilityAssistant()); - rightButton.setAccessibilityDelegate(context.getAccessibilityAssistant()); - rightImageButton.setAccessibilityDelegate(context.getAccessibilityAssistant()); + ViewCompat.setAccessibilityDelegate(view, context.getAccessibilityAssistant()); + ViewCompat.setAccessibilityDelegate(rightButton, context.getAccessibilityAssistant()); + ViewCompat.setAccessibilityDelegate(rightImageButton, context.getAccessibilityAssistant()); TypedValue typedValue = new TypedValue(); Resources.Theme theme = context.getTheme();