Map widgets accessibility feedback fix.
This commit is contained in:
parent
26d9901200
commit
55076a41c8
1 changed files with 13 additions and 15 deletions
|
@ -7,6 +7,7 @@ import android.app.Activity;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
@ -99,12 +100,17 @@ public class TextInfoWidget {
|
||||||
return isNight;
|
return isNight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContentDescription(CharSequence text) {
|
private CharSequence combine(CharSequence text, CharSequence subtext) {
|
||||||
if (contentTitle != null) {
|
if (TextUtils.isEmpty(text)) {
|
||||||
view.setContentDescription(contentTitle + " " + text); //$NON-NLS-1$
|
return subtext;
|
||||||
} else {
|
} else if (TextUtils.isEmpty(subtext)) {
|
||||||
view.setContentDescription(text);
|
return text;
|
||||||
}
|
}
|
||||||
|
return text + " " + subtext; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContentDescription(CharSequence text) {
|
||||||
|
view.setContentDescription(combine(contentTitle, text));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContentTitle(int messageId) {
|
public void setContentTitle(int messageId) {
|
||||||
|
@ -113,7 +119,7 @@ public class TextInfoWidget {
|
||||||
|
|
||||||
public void setContentTitle(String text) {
|
public void setContentTitle(String text) {
|
||||||
contentTitle = text;
|
contentTitle = text;
|
||||||
view.setContentDescription(text);
|
setContentDescription(combine(textView.getText(), smallTextView.getText()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String text, String subtext) {
|
public void setText(String text, String subtext) {
|
||||||
|
@ -122,15 +128,7 @@ public class TextInfoWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void setTextNoUpdateVisibility(String text, String subtext) {
|
protected void setTextNoUpdateVisibility(String text, String subtext) {
|
||||||
if (text != null) {
|
setContentDescription(combine(text, subtext));
|
||||||
if (subtext != null) {
|
|
||||||
setContentDescription(text + " " + subtext); //$NON-NLS-1$
|
|
||||||
} else {
|
|
||||||
setContentDescription(text);
|
|
||||||
}
|
|
||||||
} else if(subtext != null){
|
|
||||||
setContentDescription(subtext);
|
|
||||||
}
|
|
||||||
// if(this.text != null && this.text.length() > 7) {
|
// if(this.text != null && this.text.length() > 7) {
|
||||||
// this.text = this.text.substring(0, 6) +"..";
|
// this.text = this.text.substring(0, 6) +"..";
|
||||||
// }
|
// }
|
||||||
|
|
Loading…
Reference in a new issue