List of usage examples for android.graphics.drawable Drawable getMinimumHeight
public int getMinimumHeight()
From source file:com.zhenlaidian.ui.InputCarNumberActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // instance = this; setContentView(R.layout.x_inputcarnumber_layout); actionBar.show();//from ww w . j a v a 2 s .c o m InitImageView(); InitTextView(); InitViewPager(); hideTypewriting(); setView(); setView1(); setView2(); sheView3(); String strcartype = getStringFromPreference("car_type"); // String strcartype = "[{\"id\":\"66\",\"name\":\"?\"},{\"id\":\"67\",\"name\":\"\"},{\"id\":\"68\",\"name\":\"\"}]"; cartype = ((TextView) findViewById(R.id.input_cartype)); if (!TextUtils.isEmpty(strcartype)) { Gson gson = new Gson(); car_type = gson.fromJson(strcartype, new TypeToken<ArrayList<CarTypeItem>>() { }.getType()); cartype.setVisibility(View.VISIBLE); cartype.setText(car_type.get(0).getName()); cartypecode = car_type.get(0).getId(); } else { cartype.setVisibility(View.GONE); } cartype.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // ? if (pow != null && pow.isShowing()) { pow.dismiss(); return; } else { Drawable d = getResources().getDrawable(R.drawable.set_collect_off); d.setBounds(0, 0, d.getMinimumWidth(), d.getMinimumHeight()); // cartype.setCompoundDrawables(null, null, d, null); initPopWindow(car_type); int[] location = new int[2]; v.getLocationOnScreen(location); pow.showAsDropDown(cartype); } } }); }
From source file:it.ndorigatti.android.view.MulticolorProgressBar.java
/** * <p>Define the drawable used to draw the progress bar in * progress mode.</p>/*from w ww.j a v a 2 s . c o m*/ * * @param d the new drawable * * @see #getProgressDrawable() */ public void setProgressDrawable(Drawable d) { boolean needUpdate; if (mProgressDrawable != null && d != mProgressDrawable) { mProgressDrawable.setCallback(null); needUpdate = true; } else { needUpdate = false; } if (d != null) { d.setCallback(this); // Make sure the ProgressBar is always tall enough int drawableHeight = d.getMinimumHeight(); if (mMaxHeight < drawableHeight) { mMaxHeight = drawableHeight; requestLayout(); } } mProgressDrawable = d; mCurrentDrawable = d; postInvalidate(); if (needUpdate) { updateDrawableBounds(getWidth(), getHeight()); updateDrawableState(); doRefreshProgress(android.R.id.progress, mProgress, false, false); doRefreshProgress(android.R.id.secondaryProgress, mSecondaryProgress, false, false); } }
From source file:com.justwayward.reader.ui.activity.ReadActivity.java
private void changedMode(boolean isNight, int position) { SharedPreferencesUtil.getInstance().putBoolean(Constant.ISNIGHT, isNight); AppCompatDelegate/*from w w w .j a va 2s . c o m*/ .setDefaultNightMode(isNight ? AppCompatDelegate.MODE_NIGHT_YES : AppCompatDelegate.MODE_NIGHT_NO); if (position >= 0) { curTheme = position; } else { curTheme = SettingManager.getInstance().getReadTheme(); } gvAdapter.select(curTheme); mPageWidget.setTheme(isNight ? ThemeManager.NIGHT : curTheme); mPageWidget.setTextColor( ContextCompat.getColor(mContext, isNight ? R.color.chapter_content_night : R.color.chapter_content_day), ContextCompat.getColor(mContext, isNight ? R.color.chapter_title_night : R.color.chapter_title_day)); mTvBookReadMode.setText(getString(isNight ? R.string.book_read_mode_day_manual_setting : R.string.book_read_mode_night_manual_setting)); Drawable drawable = ContextCompat.getDrawable(this, isNight ? R.drawable.ic_menu_mode_day_manual : R.drawable.ic_menu_mode_night_manual); drawable.setBounds(0, 0, drawable.getMinimumWidth(), drawable.getMinimumHeight()); mTvBookReadMode.setCompoundDrawables(null, drawable, null, null); ThemeManager.setReaderTheme(curTheme, mRlBookReadRoot); }
From source file:com.cm.beer.util.DrawableManager.java
/** * /* w w w.ja va 2s . c o m*/ * @param urlString * @return */ public byte[] fetchDrawableAsByteArray(String urlString) { byte[] bitmapdata = null; if (mDrawableCache.containsKey(urlString)) { if (Logger.isLogEnabled()) Logger.log("Returning Drawable from Cache:" + urlString); SoftReference<Drawable> softReference = mDrawableCache.get(urlString); if ((softReference == null) || (softReference.get() == null)) { mDrawableCache.remove(urlString); if (Logger.isLogEnabled()) Logger.log("fetchDrawable():Soft Reference has been Garbage Collected:" + urlString); } else { Drawable drawable = softReference.get(); Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); bitmapdata = stream.toByteArray(); } } if (Logger.isLogEnabled()) Logger.log("image url:" + urlString); try { // prevents multithreaded fetches for the same image mLockCache.put(urlString, urlString); if (Logger.isLogEnabled()) Logger.log("Begin Downloading:" + urlString); InputStream is = fetch(urlString); if (Logger.isLogEnabled()) Logger.log("End Downloading:" + urlString); Drawable drawable = Drawable.createFromStream(is, "src"); mDrawableCache.put(urlString, new SoftReference<Drawable>(drawable)); mLockCache.remove(urlString); if (Logger.isLogEnabled()) Logger.log("got a thumbnail drawable: " + drawable.getBounds() + ", " + drawable.getIntrinsicHeight() + "," + drawable.getIntrinsicWidth() + ", " + drawable.getMinimumHeight() + "," + drawable.getMinimumWidth()); Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap(); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream); bitmapdata = stream.toByteArray(); } catch (Throwable e) { Log.e(this.getClass().getName(), "fetchDrawable failed", e); return null; } return bitmapdata; }
From source file:com.actionbarsherlock.internal.widget.IcsProgressBar.java
/** * <p>Define the drawable used to draw the progress bar in * progress mode.</p>/*from ww w .j av a 2 s . c om*/ * * @param d the new drawable * * @see #getProgressDrawable() * @see #setIndeterminate(boolean) */ public void setProgressDrawable(Drawable d) { boolean needUpdate; if (mProgressDrawable != null && d != mProgressDrawable) { mProgressDrawable.setCallback(null); needUpdate = true; } else { needUpdate = false; } if (d != null) { d.setCallback(this); // Make sure the ProgressBar is always tall enough int drawableHeight = d.getMinimumHeight(); if (mMaxHeight < drawableHeight) { mMaxHeight = drawableHeight; requestLayout(); } } mProgressDrawable = d; if (!mIndeterminate) { mCurrentDrawable = d; postInvalidate(); } if (needUpdate) { updateDrawableBounds(getWidth(), getHeight()); updateDrawableState(); doRefreshProgress(android.R.id.progress, mProgress, false, false); doRefreshProgress(android.R.id.secondaryProgress, mSecondaryProgress, false, false); } }
From source file:io.apptik.widget.MultiSlider.java
public void setTrackDrawable(Drawable d) { boolean needUpdate; if (mTrack != null && d != mTrack) { mTrack.setCallback(null);/*from w ww . j a v a 2 s. co m*/ needUpdate = true; } else { needUpdate = false; } if (d != null) { d.setCallback(this); // if (canResolveLayoutDirection()) { // d.setLayoutDirection(getLayoutDirection()); // } // Make sure the ProgressBar is always tall enough int drawableHeight = d.getMinimumHeight(); if (mMaxHeight < drawableHeight) { mMaxHeight = drawableHeight; requestLayout(); } } mTrack = d; if (needUpdate) { updateTrackBounds(getWidth(), getHeight()); updateTrackState(); //TODO update all thumbs with their range tracks also } }
From source file:cnedu.ustcjd.widget.MultiSlider.java
/** * Manually set the track drawable/*from w ww . ja v a 2s . c o m*/ * * @param d */ public void setTrackDrawable(Drawable d) { boolean needUpdate; if (mTrack != null && d != mTrack) { mTrack.setCallback(null); needUpdate = true; } else { needUpdate = false; } if (d != null) { d.setCallback(this); // if (canResolveLayoutDirection()) { // d.setLayoutDirection(getLayoutDirection()); // } // Make sure the ProgressBar is always tall enough int drawableHeight = d.getMinimumHeight(); if (mMaxHeight < drawableHeight) { mMaxHeight = drawableHeight; requestLayout(); } } mTrack = d; if (needUpdate) { updateTrackBounds(getWidth(), getHeight()); updateTrackState(); //TODO update all thumbs with their range tracks also } }
From source file:com.huewu.pla.lib.internal.PLAListView.java
void drawOverscrollFooter(final Canvas canvas, final Drawable drawable, final Rect bounds) { final int height = drawable.getMinimumHeight(); canvas.save();//w w w .ja v a2 s .c o m canvas.clipRect(bounds); final int span = bounds.bottom - bounds.top; if (span < height) { bounds.bottom = bounds.top + height; } drawable.setBounds(bounds); drawable.draw(canvas); canvas.restore(); }
From source file:com.huewu.pla.lib.internal.PLAListView.java
void drawOverscrollHeader(final Canvas canvas, final Drawable drawable, final Rect bounds) { final int height = drawable.getMinimumHeight(); canvas.save();//from ww w . j ava2 s .co m canvas.clipRect(bounds); final int span = bounds.bottom - bounds.top; if (span < height) { bounds.top = bounds.bottom - height; } drawable.setBounds(bounds); drawable.draw(canvas); canvas.restore(); }
From source file:com.appunite.list.ListView.java
void drawOverscrollHeader(Canvas canvas, Drawable drawable, Rect bounds) { final int height = drawable.getMinimumHeight(); canvas.save();/*from ww w. jav a 2s .com*/ canvas.clipRect(bounds); final int span = bounds.bottom - bounds.top; if (span < height) { bounds.top = bounds.bottom - height; } drawable.setBounds(bounds); drawable.draw(canvas); canvas.restore(); }