summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/Presentation.java18
-rw-r--r--core/java/android/view/View.java37
-rw-r--r--core/java/android/widget/TextClock.java4
-rw-r--r--core/java/android/widget/TextView.java4
4 files changed, 38 insertions, 25 deletions
diff --git a/core/java/android/app/Presentation.java b/core/java/android/app/Presentation.java
index 3e8af60..16a0c57 100644
--- a/core/java/android/app/Presentation.java
+++ b/core/java/android/app/Presentation.java
@@ -79,17 +79,16 @@ import android.util.TypedValue;
* Here's how to use the media router to create and show a presentation on the preferred
* presentation display using {@link android.media.MediaRouter.RouteInfo#getPresentationDisplay()}.
* </p>
- * {@samplecode
+ * <pre>
* MediaRouter mediaRouter = (MediaRouter) context.getSystemService(Context.MEDIA_ROUTER_SERVICE);
* MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute();
- * if (route != null) $&#123;
+ * if (route != null) {
* Display presentationDisplay = route.getPresentationDisplay();
- * if (presentationDisplay != null) $&#123;
+ * if (presentationDisplay != null) {
* Presentation presentation = new MyPresentation(context, presentationDisplay);
* presentation.show();
- * $&#125;
- * $&#125;
- * }
+ * }
+ * }</pre>
* <p>
* The following sample code from <code>ApiDemos</code> demonstrates how to use the media
* router to automatically switch between showing content in the main activity and showing
@@ -114,18 +113,17 @@ import android.util.TypedValue;
* {@link DisplayManager#getDisplays(String)} and the
* {@link DisplayManager#DISPLAY_CATEGORY_PRESENTATION} category.
* </p>
- * {@samplecode
+ * <pre>
* DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
* Display[] presentationDisplays = displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
- * if (presentationDisplays.length > 0) $&#123;
+ * if (presentationDisplays.length > 0) {
* // If there is more than one suitable presentation display, then we could consider
* // giving the user a choice. For this example, we simply choose the first display
* // which is the one the system recommends as the preferred presentation display.
* Display display = presentationDisplays[0];
* Presentation presentation = new MyPresentation(context, presentationDisplay);
* presentation.show();
- * $&#125;
- * }
+ * }</pre>
* <p>
* The following sample code from <code>ApiDemos</code> demonstrates how to use the display
* manager to enumerate displays and show content on multiple presentation displays
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index d5e1ed3..ff44475 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -5088,24 +5088,35 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
*/
protected boolean isVisibleToUser(Rect boundInView) {
if (mAttachInfo != null) {
+ // Attached to invisible window means this view is not visible.
+ if (mAttachInfo.mWindowVisibility != View.VISIBLE) {
+ return false;
+ }
+ // An invisible predecessor or one with alpha zero means
+ // that this view is not visible to the user.
+ Object current = this;
+ while (current instanceof View) {
+ View view = (View) current;
+ // We have attach info so this view is attached and there is no
+ // need to check whether we reach to ViewRootImpl on the way up.
+ if (view.getAlpha() <= 0 || view.getVisibility() != VISIBLE) {
+ return false;
+ }
+ current = view.mParent;
+ }
+ // Check if the view is entirely covered by its predecessors.
Rect visibleRect = mAttachInfo.mTmpInvalRect;
Point offset = mAttachInfo.mPoint;
- // The first two checks are made also made by isShown() which
- // however traverses the tree up to the parent to catch that.
- // Therefore, we do some fail fast check to minimize the up
- // tree traversal.
- boolean isVisible = mAttachInfo.mWindowVisibility == View.VISIBLE
- && getAlpha() > 0
- && isShown()
- && getGlobalVisibleRect(visibleRect, offset);
- if (isVisible && boundInView != null) {
+ if (!getGlobalVisibleRect(visibleRect, offset)) {
+ return false;
+ }
+ // Check if the visible portion intersects the rectangle of interest.
+ if (boundInView != null) {
visibleRect.offset(-offset.x, -offset.y);
- // isVisible is always true here, use a simple assignment
- isVisible = boundInView.intersect(visibleRect);
+ return boundInView.intersect(visibleRect);
}
- return isVisible;
+ return true;
}
-
return false;
}
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java
index 4c46658..908eb0a 100644
--- a/core/java/android/widget/TextClock.java
+++ b/core/java/android/widget/TextClock.java
@@ -29,6 +29,7 @@ import android.os.SystemClock;
import android.provider.Settings;
import android.text.format.DateFormat;
import android.util.AttributeSet;
+import android.view.RemotableViewMethod;
import com.android.internal.R;
@@ -266,6 +267,7 @@ public class TextClock extends TextView {
*
* @attr ref android.R.styleable#TextClock_format12Hour
*/
+ @RemotableViewMethod
public void setFormat12Hour(CharSequence format) {
mFormat12 = format;
@@ -307,6 +309,7 @@ public class TextClock extends TextView {
*
* @attr ref android.R.styleable#TextClock_format24Hour
*/
+ @RemotableViewMethod
public void setFormat24Hour(CharSequence format) {
mFormat24 = format;
@@ -366,6 +369,7 @@ public class TextClock extends TextView {
*
* @attr ref android.R.styleable#TextClock_timeZone
*/
+ @RemotableViewMethod
public void setTimeZone(String timeZone) {
mTimeZone = timeZone;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index a46481c..5d90400 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8780,8 +8780,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
+ " before=" + before + " after=" + after + ": " + buffer);
if (AccessibilityManager.getInstance(mContext).isEnabled()
- && !isPasswordInputType(getInputType())
- && !hasPasswordTransformationMethod()) {
+ && ((!isPasswordInputType(getInputType()) && !hasPasswordTransformationMethod())
+ || shouldSpeakPasswordsForAccessibility())) {
mBeforeText = buffer.toString();
}