Methods Summary |
---|
public void | cancel()Close the view if it's showing.
if (localLOGV) Log.v(TAG, "HIDE: " + this);
mHandler.post(mHide);
|
public int | getGravity()Get the location at which the notification should appear on the screen.
return mGravity;
|
public float | getHorizontalMargin()Return the horizontal margin.
return mHorizontalMargin;
|
public float | getVerticalMargin()Return the vertical margin.
return mVerticalMargin;
|
public android.view.View | getView()Return the view.
return mNextView;
|
public int | getXOffset()Return the X offset in pixels to apply to the gravity's location.
return mX;
|
public int | getYOffset()Return the Y offset in pixels to apply to the gravity's location.
return mY;
|
private synchronized void | handleHide()
if (localLOGV) Log.v(TAG, "HANDLE HIDE: " + this + " mView=" + mView);
if (mView != null) {
// note: checking parent() just to make sure the view has
// been added... i have seen cases where we get here when
// the view isn't yet added, so let's try not to crash.
if (mView.getParent() != null) {
if (localLOGV) Log.v(
TAG, "REMOVE! " + mView + " in " + this);
mWM.removeView(mView);
}
mView = null;
}
|
private synchronized void | handleShow()
if (localLOGV) Log.v(TAG, "HANDLE SHOW: " + this + " mView=" + mView
+ " mNextView=" + mNextView);
if (mView != mNextView) {
// remove the old view if necessary
handleHide();
mView = mNextView;
final int gravity = mGravity;
mParams.gravity = gravity;
if ((gravity & Gravity.HORIZONTAL_GRAVITY_MASK) == Gravity.FILL_HORIZONTAL) {
mParams.horizontalWeight = 1.0f;
}
if ((gravity & Gravity.VERTICAL_GRAVITY_MASK) == Gravity.FILL_VERTICAL) {
mParams.verticalWeight = 1.0f;
}
mParams.x = mX;
mParams.y = mY;
mParams.verticalMargin = mVerticalMargin;
mParams.horizontalMargin = mHorizontalMargin;
if (mView.getParent() != null) {
if (localLOGV) Log.v(
TAG, "REMOVE! " + mView + " in " + this);
mWM.removeView(mView);
}
if (localLOGV) Log.v(TAG, "ADD! " + mView + " in " + this);
mWM.addView(mView, mParams);
}
|
public static com.android.camera.OnScreenHint | makeText(android.content.Context context, java.lang.CharSequence text)Make a standard hint that just contains a text view.
OnScreenHint result = new OnScreenHint(context);
LayoutInflater inflate = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflate.inflate(R.layout.on_screen_hint, null);
TextView tv = (TextView)v.findViewById(R.id.message);
tv.setText(text);
result.mNextView = v;
return result;
|
public static com.android.camera.OnScreenHint | makeText(android.content.Context context, int resId)Make a standard hint that just contains a text view with the text from a resource.
return makeText(context, context.getResources().getText(resId));
|
public void | setGravity(int gravity, int xOffset, int yOffset)Set the location at which the notification should appear on the screen.
mGravity = gravity;
mX = xOffset;
mY = yOffset;
|
public void | setMargin(float horizontalMargin, float verticalMargin)Set the margins of the view.
mHorizontalMargin = horizontalMargin;
mVerticalMargin = verticalMargin;
|
public void | setText(int resId)Update the text in a OnScreenHint that was previously created using one of the makeText() methods.
setText(mContext.getText(resId));
|
public void | setText(java.lang.CharSequence s)Update the text in a OnScreenHint that was previously created using one of the makeText() methods.
if (mNextView == null) {
throw new RuntimeException("This OnScreenHint was not created with OnScreenHint.makeText()");
}
TextView tv = (TextView) mNextView.findViewById(R.id.message);
if (tv == null) {
throw new RuntimeException("This OnScreenHint was not created with OnScreenHint.makeText()");
}
tv.setText(s);
|
public void | setView(android.view.View view)Set the view to show.
mNextView = view;
|
public void | show()Show the view on the screen.
if (mNextView == null) {
throw new RuntimeException("setView must have been called");
}
if (localLOGV) Log.v(TAG, "SHOW: " + this);
mHandler.post(mShow);
|