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;
}
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;
}
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) {
}
}
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) {
}
}
Aggregations