Removed obsolete accessibility wrapper for AlertDialog.Builder class.

This commit is contained in:
Igor B. Poretsky 2016-03-31 06:52:10 +03:00
parent d5078bbf52
commit 9b5acdb32f
11 changed files with 13 additions and 87 deletions

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/message"
android:focusable="true"
android:layout_marginLeft="4dp"
android:layout_marginRight="4dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textSize="@dimen/default_list_text_size"
android:gravity="fill_horizontal" />
</LinearLayout>

View file

@ -1,50 +0,0 @@
package net.osmand.access;
import android.content.Context;
import android.support.v7.app.AlertDialog;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
// Since usual message in an AlertDialog that is set by
// AlertDialog.Builder.setMessage() is spoken only once
// at the best case and there is no way to explore or even repeat it,
// this class provides more accessible alternative
// that wraps the message into a dedicated view.
// Such message will be focusable and so it can be repeated
// by selecting.
//
// Note: when accessibility extensions option is not checked
// or system accessibility service is turned off this class
// acts just identical to it's direct parent.
//
public class AccessibleAlertBuilder extends AlertDialog.Builder {
// The method getContext() is only available
// starting from API level 11, so store it here.
private final Context context;
// Conventional constructor.
public AccessibleAlertBuilder(Context context) {
super(context);
this.context = context;
}
// Provided setMessage() alternatives.
@Override
public AlertDialog.Builder setMessage(CharSequence msg) {
if (((OsmandApplication) context.getApplicationContext()).accessibilityExtensions())
return setView(TextMessage.makeView(context, msg, R.layout.alert));
return super.setMessage(msg);
}
@Override
public AlertDialog.Builder setMessage(int msgid) {
if (((OsmandApplication) context.getApplicationContext()).accessibilityExtensions())
return setView(TextMessage.makeView(context, msgid, R.layout.alert));
return super.setMessage(msgid);
}
}

View file

@ -13,7 +13,6 @@ import android.support.v7.app.AlertDialog;
import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.map.OsmandRegions;
import net.osmand.map.OsmandRegions.RegionTranslation;
import net.osmand.map.WorldRegion;
@ -253,7 +252,7 @@ public class AppInitializer implements IProgress {
boolean check = pref.getBoolean(VECTOR_INDEXES_CHECK, true);
// do not show each time
if (check && new Random().nextInt() % 5 == 1) {
AlertDialog.Builder builder = new AccessibleAlertBuilder(ctx);
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
if (maps.isEmpty()) {
builder.setMessage(R.string.vector_data_missing);
} else if (!maps.basemapExists()) {

View file

@ -23,7 +23,6 @@ import android.widget.TextView;
import net.osmand.Location;
import net.osmand.TspAnt;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.data.LatLon;
import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.OsmandApplication;
@ -86,7 +85,7 @@ public class IntermediatePointsDialog {
}
});
AlertDialog.Builder builder = new AccessibleAlertBuilder(activity);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setView(contentView);
builder.setInverseBackgroundForced(true);
lv.setBackgroundColor(Color.WHITE);

View file

@ -21,7 +21,6 @@ import android.widget.Toast;
import net.osmand.IndexConstants;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.access.AccessibleToast;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
@ -483,7 +482,7 @@ public class MapActivityActions implements DialogProvider {
}
private Dialog createReloadTitleDialog(final Bundle args) {
AlertDialog.Builder builder = new AccessibleAlertBuilder(mapActivity);
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
builder.setMessage(R.string.context_menu_item_update_map_confirm);
builder.setNegativeButton(R.string.shared_string_cancel, null);
final OsmandMapTileView mapView = mapActivity.getMapView();

View file

@ -14,7 +14,6 @@ import android.text.ClipboardManager;
import android.text.Html;
import android.widget.Toast;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.Version;
@ -194,7 +193,7 @@ public class ShareDialog {
activity.startActivity(intent);
} else {
if (Version.isMarketEnabled((OsmandApplication) activity.getApplication())) {
AlertDialog.Builder builder = new AccessibleAlertBuilder(activity);
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setMessage(activity.getString(R.string.zxing_barcode_scanner_not_found));
builder.setPositiveButton(activity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
@Override

View file

@ -22,7 +22,6 @@ import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.plus.R;
import net.osmand.plus.Version;
import net.osmand.plus.activities.MapActivity;
@ -103,7 +102,7 @@ public class StartGPSStatus extends OsmAndAction {
res[i++] = g.stringRes;
}
OsmandMapTileView view = mapActivity.getMapView();
AlertDialog.Builder builder = new AccessibleAlertBuilder(mapActivity);
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
LinearLayout ll = new LinearLayout(activity);
final ListView lv = new ListView(activity);
lv.setPadding(7, 3, 7, 0);
@ -168,7 +167,7 @@ public class StartGPSStatus extends OsmAndAction {
mapActivity.startActivity(intent);
} else {
if (Version.isMarketEnabled(getMyApplication())) {
AlertDialog.Builder builder = new AccessibleAlertBuilder(mapActivity);
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
builder.setMessage(mapActivity. getString(R.string.gps_status_app_not_found));
builder.setPositiveButton(mapActivity.getString(R.string.shared_string_yes), new DialogInterface.OnClickListener() {
@Override

View file

@ -5,8 +5,8 @@ import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.support.v7.app.AlertDialog;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.data.LatLon;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication;
@ -43,7 +43,7 @@ public class AudioVideoNoteMenuController extends MenuController {
rightTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
AccessibleAlertBuilder bld = new AccessibleAlertBuilder(getMapActivity());
AlertDialog.Builder bld = new AlertDialog.Builder(getMapActivity());
bld.setMessage(R.string.recording_delete_confirm);
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {

View file

@ -24,6 +24,7 @@ import android.os.Build;
import android.os.StatFs;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AlertDialog;
import android.view.Display;
import android.view.KeyEvent;
import android.view.Surface;
@ -40,7 +41,6 @@ import net.osmand.IProgress;
import net.osmand.IndexConstants;
import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.access.AccessibleToast;
import net.osmand.data.DataTileManager;
import net.osmand.data.LatLon;
@ -740,7 +740,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
}
private void chooseDefaultAction(final double lat, final double lon, final MapActivity mapActivity) {
AccessibleAlertBuilder ab = new AccessibleAlertBuilder(mapActivity);
AlertDialog.Builder ab = new AlertDialog.Builder(mapActivity);
ab.setItems(
new String[]{mapActivity.getString(R.string.recording_context_menu_arecord),
mapActivity.getString(R.string.recording_context_menu_vrecord),

View file

@ -9,7 +9,6 @@ import android.support.v7.app.AlertDialog;
import android.widget.TextView;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.data.LatLon;
import net.osmand.plus.GPXUtilities;
import net.osmand.plus.GPXUtilities.GPXFile;
@ -48,7 +47,7 @@ public class FailSafeFuntions {
@Override
public void run() {
AlertDialog.Builder builder = new AccessibleAlertBuilder(ma);
AlertDialog.Builder builder = new AlertDialog.Builder(ma);
final TextView tv = new TextView(ma);
tv.setText(ma.getString(R.string.continue_follow_previous_route_auto, delay + ""));
tv.setPadding(7, 5, 7, 5);

View file

@ -3,8 +3,8 @@ package net.osmand.plus.osmedit;
import android.content.DialogInterface;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.data.PointDescription;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
@ -52,7 +52,7 @@ public class EditPOIMenuController extends MenuController {
rightTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
AccessibleAlertBuilder bld = new AccessibleAlertBuilder(getMapActivity());
AlertDialog.Builder bld = new AlertDialog.Builder(getMapActivity());
bld.setMessage(R.string.recording_delete_confirm);
bld.setPositiveButton(R.string.shared_string_yes, new DialogInterface.OnClickListener() {