use of android.graphics.drawable.Drawable in project AndroidTraining by mixi-inc.
the class IcsListPopupWindow method setContentWidth.
public void setContentWidth(int width) {
Drawable popupBackground = mPopup.getBackground();
if (popupBackground != null) {
popupBackground.getPadding(mTempRect);
mDropDownWidth = mTempRect.left + mTempRect.right + width;
} else {
mDropDownWidth = width;
}
}
use of android.graphics.drawable.Drawable in project AndroidTraining by mixi-inc.
the class IcsProgressBar method tileifyIndeterminate.
/**
* Convert a AnimationDrawable for use as a barberpole animation.
* Each frame of the animation is wrapped in a ClipDrawable and
* given a tiling BitmapShader.
*/
private Drawable tileifyIndeterminate(Drawable drawable) {
if (drawable instanceof AnimationDrawable) {
AnimationDrawable background = (AnimationDrawable) drawable;
final int N = background.getNumberOfFrames();
AnimationDrawable newBg = new AnimationDrawable();
newBg.setOneShot(background.isOneShot());
for (int i = 0; i < N; i++) {
Drawable frame = tileify(background.getFrame(i), true);
frame.setLevel(10000);
newBg.addFrame(frame, background.getDuration(i));
}
newBg.setLevel(10000);
drawable = newBg;
}
return drawable;
}
use of android.graphics.drawable.Drawable in project AndroidTraining by mixi-inc.
the class IcsProgressBar method onMeasure.
@Override
protected synchronized void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
Drawable d = mCurrentDrawable;
int dw = 0;
int dh = 0;
if (d != null) {
dw = Math.max(mMinWidth, Math.min(mMaxWidth, d.getIntrinsicWidth()));
dh = Math.max(mMinHeight, Math.min(mMaxHeight, d.getIntrinsicHeight()));
}
updateDrawableState();
dw += getPaddingLeft() + getPaddingRight();
dh += getPaddingTop() + getPaddingBottom();
if (IS_HONEYCOMB) {
setMeasuredDimension(View.resolveSizeAndState(dw, widthMeasureSpec, 0), View.resolveSizeAndState(dh, heightMeasureSpec, 0));
} else {
setMeasuredDimension(View.resolveSize(dw, widthMeasureSpec), View.resolveSize(dh, heightMeasureSpec));
}
}
use of android.graphics.drawable.Drawable in project AndroidTraining by mixi-inc.
the class SearchView method getDecoratedHint.
private CharSequence getDecoratedHint(CharSequence hintText) {
// If the field is always expanded, then don't add the search icon to the hint
if (!mIconifiedByDefault)
return hintText;
// for the icon
SpannableStringBuilder ssb = new SpannableStringBuilder(" ");
ssb.append(hintText);
Drawable searchIcon = getContext().getResources().getDrawable(getSearchIconId());
int textSize = (int) (mQueryTextView.getTextSize() * 1.25);
searchIcon.setBounds(0, 0, textSize, textSize);
ssb.setSpan(new ImageSpan(searchIcon), 1, 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return ssb;
}
use of android.graphics.drawable.Drawable in project k-9 by k9mail.
the class OpenPgpAppPreference method addLegacyProvider.
public void addLegacyProvider(String packageName, String simpleName, int iconRes) {
Drawable icon = getContext().getResources().getDrawable(iconRes);
mLegacyList.add(new OpenPgpProviderEntry(packageName, simpleName, icon));
}
Aggregations