Search in sources :

Example 11 with OnAttachStateChangeListener

use of android.view.View.OnAttachStateChangeListener in project android_frameworks_base by DirtyUnicorns.

the class SpTexts method add.

public int add(final TextView text) {
    if (text == null)
        return 0;
    final Resources res = mContext.getResources();
    final float fontScale = res.getConfiguration().fontScale;
    final float density = res.getDisplayMetrics().density;
    final float px = text.getTextSize();
    final int sp = (int) (px / fontScale / density);
    mTexts.put(text, sp);
    text.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {

        @Override
        public void onViewDetachedFromWindow(View v) {
        }

        @Override
        public void onViewAttachedToWindow(View v) {
            setTextSizeH(text, sp);
        }
    });
    return sp;
}
Also used : OnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener) Resources(android.content.res.Resources) TextView(android.widget.TextView) View(android.view.View)

Example 12 with OnAttachStateChangeListener

use of android.view.View.OnAttachStateChangeListener in project android_frameworks_base by AOSPA.

the class SpTexts method add.

public int add(final TextView text) {
    if (text == null)
        return 0;
    final Resources res = mContext.getResources();
    final float fontScale = res.getConfiguration().fontScale;
    final float density = res.getDisplayMetrics().density;
    final float px = text.getTextSize();
    final int sp = (int) (px / fontScale / density);
    mTexts.put(text, sp);
    text.addOnAttachStateChangeListener(new OnAttachStateChangeListener() {

        @Override
        public void onViewDetachedFromWindow(View v) {
        }

        @Override
        public void onViewAttachedToWindow(View v) {
            setTextSizeH(text, sp);
        }
    });
    return sp;
}
Also used : OnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener) Resources(android.content.res.Resources) TextView(android.widget.TextView) View(android.view.View)

Example 13 with OnAttachStateChangeListener

use of android.view.View.OnAttachStateChangeListener in project android_frameworks_base by AOSPA.

the class TileService method showDialog.

/**
     * Used to show a dialog.
     *
     * This will collapse the Quick Settings panel and show the dialog.
     *
     * @param dialog Dialog to show.
     *
     * @see #isLocked()
     */
public final void showDialog(Dialog dialog) {
    dialog.getWindow().getAttributes().token = mToken;
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_QS_DIALOG);
    dialog.getWindow().getDecorView().addOnAttachStateChangeListener(new OnAttachStateChangeListener() {

        @Override
        public void onViewAttachedToWindow(View v) {
        }

        @Override
        public void onViewDetachedFromWindow(View v) {
            try {
                mService.onDialogHidden(mTileToken);
            } catch (RemoteException e) {
            }
        }
    });
    dialog.show();
    try {
        mService.onShowDialog(mTileToken);
    } catch (RemoteException e) {
    }
}
Also used : OnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener) RemoteException(android.os.RemoteException) View(android.view.View)

Example 14 with OnAttachStateChangeListener

use of android.view.View.OnAttachStateChangeListener in project android_frameworks_base by ResurrectionRemix.

the class TileService method showDialog.

/**
     * Used to show a dialog.
     *
     * This will collapse the Quick Settings panel and show the dialog.
     *
     * @param dialog Dialog to show.
     *
     * @see #isLocked()
     */
public final void showDialog(Dialog dialog) {
    dialog.getWindow().getAttributes().token = mToken;
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_QS_DIALOG);
    dialog.getWindow().getDecorView().addOnAttachStateChangeListener(new OnAttachStateChangeListener() {

        @Override
        public void onViewAttachedToWindow(View v) {
        }

        @Override
        public void onViewDetachedFromWindow(View v) {
            try {
                mService.onDialogHidden(mTileToken);
            } catch (RemoteException e) {
            }
        }
    });
    dialog.show();
    try {
        mService.onShowDialog(mTileToken);
    } catch (RemoteException e) {
    }
}
Also used : OnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener) RemoteException(android.os.RemoteException) View(android.view.View)

Aggregations

View (android.view.View)14 OnAttachStateChangeListener (android.view.View.OnAttachStateChangeListener)14 Resources (android.content.res.Resources)5 RemoteException (android.os.RemoteException)5 TextView (android.widget.TextView)5 ViewGroup (android.view.ViewGroup)2 Context (android.content.Context)1 ViewStub (android.view.ViewStub)1 TabModel (org.chromium.chrome.browser.tabmodel.TabModel)1 FindToolbarObserver (org.chromium.chrome.browser.widget.findinpage.FindToolbarObserver)1