Search in sources :

Example 71 with CallSuper

use of android.annotation.CallSuper in project android_frameworks_base by ResurrectionRemix.

the class View method onAttachedToWindow.

/**
     * This is called when the view is attached to a window.  At this point it
     * has a Surface and will start drawing.  Note that this function is
     * guaranteed to be called before {@link #onDraw(android.graphics.Canvas)},
     * however it may be called any time before the first onDraw -- including
     * before or after {@link #onMeasure(int, int)}.
     *
     * @see #onDetachedFromWindow()
     */
@CallSuper
protected void onAttachedToWindow() {
    if ((mPrivateFlags & PFLAG_REQUEST_TRANSPARENT_REGIONS) != 0) {
        mParent.requestTransparentRegion(this);
    }
    mPrivateFlags3 &= ~PFLAG3_IS_LAID_OUT;
    jumpDrawablesToCurrentState();
    resetSubtreeAccessibilityStateChanged();
    // rebuild, since Outline not maintained while View is detached
    rebuildOutline();
    if (isFocused()) {
        InputMethodManager imm = InputMethodManager.peekInstance();
        if (imm != null) {
            imm.focusIn(this);
        }
    }
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager) CallSuper(android.annotation.CallSuper)

Example 72 with CallSuper

use of android.annotation.CallSuper in project android_frameworks_base by ResurrectionRemix.

the class View method encodeProperties.

/** {@hide} */
@CallSuper
protected void encodeProperties(@NonNull ViewHierarchyEncoder stream) {
    Object resolveId = ViewDebug.resolveId(getContext(), mID);
    if (resolveId instanceof String) {
        stream.addProperty("id", (String) resolveId);
    } else {
        stream.addProperty("id", mID);
    }
    stream.addProperty("misc:transformation.alpha", mTransformationInfo != null ? mTransformationInfo.mAlpha : 0);
    stream.addProperty("misc:transitionName", getTransitionName());
    // layout
    stream.addProperty("layout:left", mLeft);
    stream.addProperty("layout:right", mRight);
    stream.addProperty("layout:top", mTop);
    stream.addProperty("layout:bottom", mBottom);
    stream.addProperty("layout:width", getWidth());
    stream.addProperty("layout:height", getHeight());
    stream.addProperty("layout:layoutDirection", getLayoutDirection());
    stream.addProperty("layout:layoutRtl", isLayoutRtl());
    stream.addProperty("layout:hasTransientState", hasTransientState());
    stream.addProperty("layout:baseline", getBaseline());
    // layout params
    ViewGroup.LayoutParams layoutParams = getLayoutParams();
    if (layoutParams != null) {
        stream.addPropertyKey("layoutParams");
        layoutParams.encode(stream);
    }
    // scrolling
    stream.addProperty("scrolling:scrollX", mScrollX);
    stream.addProperty("scrolling:scrollY", mScrollY);
    // padding
    stream.addProperty("padding:paddingLeft", mPaddingLeft);
    stream.addProperty("padding:paddingRight", mPaddingRight);
    stream.addProperty("padding:paddingTop", mPaddingTop);
    stream.addProperty("padding:paddingBottom", mPaddingBottom);
    stream.addProperty("padding:userPaddingRight", mUserPaddingRight);
    stream.addProperty("padding:userPaddingLeft", mUserPaddingLeft);
    stream.addProperty("padding:userPaddingBottom", mUserPaddingBottom);
    stream.addProperty("padding:userPaddingStart", mUserPaddingStart);
    stream.addProperty("padding:userPaddingEnd", mUserPaddingEnd);
    // measurement
    stream.addProperty("measurement:minHeight", mMinHeight);
    stream.addProperty("measurement:minWidth", mMinWidth);
    stream.addProperty("measurement:measuredWidth", mMeasuredWidth);
    stream.addProperty("measurement:measuredHeight", mMeasuredHeight);
    // drawing
    stream.addProperty("drawing:elevation", getElevation());
    stream.addProperty("drawing:translationX", getTranslationX());
    stream.addProperty("drawing:translationY", getTranslationY());
    stream.addProperty("drawing:translationZ", getTranslationZ());
    stream.addProperty("drawing:rotation", getRotation());
    stream.addProperty("drawing:rotationX", getRotationX());
    stream.addProperty("drawing:rotationY", getRotationY());
    stream.addProperty("drawing:scaleX", getScaleX());
    stream.addProperty("drawing:scaleY", getScaleY());
    stream.addProperty("drawing:pivotX", getPivotX());
    stream.addProperty("drawing:pivotY", getPivotY());
    stream.addProperty("drawing:opaque", isOpaque());
    stream.addProperty("drawing:alpha", getAlpha());
    stream.addProperty("drawing:transitionAlpha", getTransitionAlpha());
    stream.addProperty("drawing:shadow", hasShadow());
    stream.addProperty("drawing:solidColor", getSolidColor());
    stream.addProperty("drawing:layerType", mLayerType);
    stream.addProperty("drawing:willNotDraw", willNotDraw());
    stream.addProperty("drawing:hardwareAccelerated", isHardwareAccelerated());
    stream.addProperty("drawing:willNotCacheDrawing", willNotCacheDrawing());
    stream.addProperty("drawing:drawingCacheEnabled", isDrawingCacheEnabled());
    stream.addProperty("drawing:overlappingRendering", hasOverlappingRendering());
    // focus
    stream.addProperty("focus:hasFocus", hasFocus());
    stream.addProperty("focus:isFocused", isFocused());
    stream.addProperty("focus:isFocusable", isFocusable());
    stream.addProperty("focus:isFocusableInTouchMode", isFocusableInTouchMode());
    stream.addProperty("misc:clickable", isClickable());
    stream.addProperty("misc:pressed", isPressed());
    stream.addProperty("misc:selected", isSelected());
    stream.addProperty("misc:touchMode", isInTouchMode());
    stream.addProperty("misc:hovered", isHovered());
    stream.addProperty("misc:activated", isActivated());
    stream.addProperty("misc:visibility", getVisibility());
    stream.addProperty("misc:fitsSystemWindows", getFitsSystemWindows());
    stream.addProperty("misc:filterTouchesWhenObscured", getFilterTouchesWhenObscured());
    stream.addProperty("misc:enabled", isEnabled());
    stream.addProperty("misc:soundEffectsEnabled", isSoundEffectsEnabled());
    stream.addProperty("misc:hapticFeedbackEnabled", isHapticFeedbackEnabled());
    // theme attributes
    Resources.Theme theme = getContext().getTheme();
    if (theme != null) {
        stream.addPropertyKey("theme");
        theme.encode(stream);
    }
    // view attribute information
    int n = mAttributes != null ? mAttributes.length : 0;
    stream.addProperty("meta:__attrCount__", n / 2);
    for (int i = 0; i < n; i += 2) {
        stream.addProperty("meta:__attr__" + mAttributes[i], mAttributes[i + 1]);
    }
    stream.addProperty("misc:scrollBarStyle", getScrollBarStyle());
    // text
    stream.addProperty("text:textDirection", getTextDirection());
    stream.addProperty("text:textAlignment", getTextAlignment());
    // accessibility
    CharSequence contentDescription = getContentDescription();
    stream.addProperty("accessibility:contentDescription", contentDescription == null ? "" : contentDescription.toString());
    stream.addProperty("accessibility:labelFor", getLabelFor());
    stream.addProperty("accessibility:importantForAccessibility", getImportantForAccessibility());
}
Also used : Resources(android.content.res.Resources) Paint(android.graphics.Paint) Point(android.graphics.Point) CallSuper(android.annotation.CallSuper)

Example 73 with CallSuper

use of android.annotation.CallSuper in project android_frameworks_base by ResurrectionRemix.

the class View method onFocusChanged.

/**
     * Called by the view system when the focus state of this view changes.
     * When the focus change event is caused by directional navigation, direction
     * and previouslyFocusedRect provide insight into where the focus is coming from.
     * When overriding, be sure to call up through to the super class so that
     * the standard focus handling will occur.
     *
     * @param gainFocus True if the View has focus; false otherwise.
     * @param direction The direction focus has moved when requestFocus()
     *                  is called to give this view focus. Values are
     *                  {@link #FOCUS_UP}, {@link #FOCUS_DOWN}, {@link #FOCUS_LEFT},
     *                  {@link #FOCUS_RIGHT}, {@link #FOCUS_FORWARD}, or {@link #FOCUS_BACKWARD}.
     *                  It may not always apply, in which case use the default.
     * @param previouslyFocusedRect The rectangle, in this view's coordinate
     *        system, of the previously focused view.  If applicable, this will be
     *        passed in as finer grained information about where the focus is coming
     *        from (in addition to direction).  Will be <code>null</code> otherwise.
     */
@CallSuper
protected void onFocusChanged(boolean gainFocus, @FocusDirection int direction, @Nullable Rect previouslyFocusedRect) {
    if (gainFocus) {
        sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
    } else {
        notifyViewAccessibilityStateChangedIfNeeded(AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED);
    }
    InputMethodManager imm = InputMethodManager.peekInstance();
    if (!gainFocus) {
        if (isPressed()) {
            setPressed(false);
        }
        if (imm != null && mAttachInfo != null && mAttachInfo.mHasWindowFocus) {
            imm.focusOut(this);
        }
        onFocusLost();
    } else if (imm != null && mAttachInfo != null && mAttachInfo.mHasWindowFocus) {
        imm.focusIn(this);
    }
    invalidate(true);
    ListenerInfo li = mListenerInfo;
    if (li != null && li.mOnFocusChangeListener != null) {
        li.mOnFocusChangeListener.onFocusChange(this, gainFocus);
    }
    if (mAttachInfo != null) {
        mAttachInfo.mKeyDispatchState.reset(this);
    }
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager) CallSuper(android.annotation.CallSuper)

Example 74 with CallSuper

use of android.annotation.CallSuper in project android_frameworks_base by ResurrectionRemix.

the class Fragment method onCreate.

/**
     * Called to do initial creation of a fragment.  This is called after
     * {@link #onAttach(Activity)} and before
     * {@link #onCreateView(LayoutInflater, ViewGroup, Bundle)}, but is not called if the fragment
     * instance is retained across Activity re-creation (see {@link #setRetainInstance(boolean)}).
     *
     * <p>Note that this can be called while the fragment's activity is
     * still in the process of being created.  As such, you can not rely
     * on things like the activity's content view hierarchy being initialized
     * at this point.  If you want to do work once the activity itself is
     * created, see {@link #onActivityCreated(Bundle)}.
     *
     * <p>If your app's <code>targetSdkVersion</code> is {@link android.os.Build.VERSION_CODES#M}
     * or lower, child fragments being restored from the savedInstanceState are restored after
     * <code>onCreate</code> returns. When targeting {@link android.os.Build.VERSION_CODES#N} or
     * above and running on an N or newer platform version
     * they are restored by <code>Fragment.onCreate</code>.</p>
     *
     * @param savedInstanceState If the fragment is being re-created from
     * a previous saved state, this is the state.
     */
@CallSuper
public void onCreate(@Nullable Bundle savedInstanceState) {
    mCalled = true;
    final Context context = getContext();
    final int version = context != null ? context.getApplicationInfo().targetSdkVersion : 0;
    if (version >= Build.VERSION_CODES.N) {
        restoreChildFragmentState(savedInstanceState, true);
        if (mChildFragmentManager != null && !mChildFragmentManager.isStateAtLeast(Fragment.CREATED)) {
            mChildFragmentManager.dispatchCreate();
        }
    }
}
Also used : Context(android.content.Context) CallSuper(android.annotation.CallSuper)

Example 75 with CallSuper

use of android.annotation.CallSuper in project android_frameworks_base by ResurrectionRemix.

the class DocumentsProvider method canonicalize.

/**
     * Implementation is provided by the parent class. Can be overridden to
     * provide additional functionality, but subclasses <em>must</em> always
     * call the superclass. If the superclass returns {@code null}, the subclass
     * may implement custom behavior.
     * <p>
     * This is typically used to resolve a subtree URI into a concrete document
     * reference, issuing a narrower single-document URI permission grant along
     * the way.
     *
     * @see DocumentsContract#buildDocumentUriUsingTree(Uri, String)
     */
@CallSuper
@Override
public Uri canonicalize(Uri uri) {
    final Context context = getContext();
    switch(mMatcher.match(uri)) {
        case MATCH_DOCUMENT_TREE:
            enforceTree(uri);
            final Uri narrowUri = buildDocumentUri(uri.getAuthority(), getDocumentId(uri));
            // Caller may only have prefix grant, so extend them a grant to
            // the narrow URI.
            final int modeFlags = getCallingOrSelfUriPermissionModeFlags(context, uri);
            context.grantUriPermission(getCallingPackage(), narrowUri, modeFlags);
            return narrowUri;
    }
    return null;
}
Also used : Context(android.content.Context) Uri(android.net.Uri) DocumentsContract.buildDocumentUri(android.provider.DocumentsContract.buildDocumentUri) DocumentsContract.isTreeUri(android.provider.DocumentsContract.isTreeUri) DocumentsContract.buildTreeDocumentUri(android.provider.DocumentsContract.buildTreeDocumentUri) Point(android.graphics.Point) CallSuper(android.annotation.CallSuper)

Aggregations

CallSuper (android.annotation.CallSuper)89 IBinder (android.os.IBinder)20 View (android.view.View)15 TextView (android.widget.TextView)15 Point (android.graphics.Point)13 Drawable (android.graphics.drawable.Drawable)13 Context (android.content.Context)10 ImageView (android.widget.ImageView)10 ListView (android.widget.ListView)10 Paint (android.graphics.Paint)8 ColorDrawable (android.graphics.drawable.ColorDrawable)8 InputMethodManager (android.view.inputmethod.InputMethodManager)8 ScrollBarDrawable (android.widget.ScrollBarDrawable)8 MainThread (android.annotation.MainThread)5 TypedArray (android.content.res.TypedArray)5 Uri (android.net.Uri)5 Parcelable (android.os.Parcelable)5 DocumentsContract.buildDocumentUri (android.provider.DocumentsContract.buildDocumentUri)5 DocumentsContract.buildTreeDocumentUri (android.provider.DocumentsContract.buildTreeDocumentUri)5 DocumentsContract.isTreeUri (android.provider.DocumentsContract.isTreeUri)5