Java Code Examples for android.util.FloatMath#floor()
The following examples show how to use
android.util.FloatMath#floor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitmapUtils.java From android-open-project-demo with Apache License 2.0 | 6 votes |
public static Bitmap getSampledBitmap(String filePath, int reqWidth, int reqHeight) { Options options = new Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, options); // Raw height and width of image final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight || width > reqWidth) { if (width > height) { inSampleSize = (int)FloatMath.floor(((float)height / reqHeight)+0.5f); //Math.round((float)height / (float)reqHeight); } else { inSampleSize = (int)FloatMath.floor(((float)width / reqWidth)+0.5f); //Math.round((float)width / (float)reqWidth); } } options.inSampleSize = inSampleSize; options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(filePath, options); }
Example 2
Source File: BitmapUtils.java From LB-Launcher with Apache License 2.0 | 5 votes |
public static int computeSampleSizeLarger(float scale) { int initialSize = (int) FloatMath.floor(1f / scale); if (initialSize <= 1) return 1; return initialSize <= 8 ? Utils.prevPowerOf2(initialSize) : initialSize / 8 * 8; }
Example 3
Source File: AmbilWarnaPrefWidgetView.java From Pi-Locker with GNU General Public License v2.0 | 5 votes |
public AmbilWarnaPrefWidgetView(Context context, AttributeSet attrs) { super(context, attrs); float density = context.getResources().getDisplayMetrics().density; rectSize = FloatMath.floor(24.f * density + 0.5f); strokeWidth = FloatMath.floor(1.f * density + 0.5f); paint = new Paint(); paint.setColor(0xffffffff); paint.setStyle(Style.STROKE); paint.setStrokeWidth(strokeWidth); }
Example 4
Source File: AmbilWarnaPrefWidgetView.java From xposed-whatsapp with MIT License | 5 votes |
public AmbilWarnaPrefWidgetView(Context context, AttributeSet attrs) { super(context, attrs); float density = context.getResources().getDisplayMetrics().density; rectSize = FloatMath.floor(24.f * density + 0.5f); strokeWidth = FloatMath.floor(1.f * density + 0.5f); paint = new Paint(); paint.setColor(0xffffffff); paint.setStyle(Style.STROKE); paint.setStrokeWidth(strokeWidth); }
Example 5
Source File: BitmapUtils.java From android-project-wo2b with Apache License 2.0 | 5 votes |
public static Bitmap getSampledBitmap(String filePath, int reqWidth, int reqHeight) { Options options = new Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, options); // Raw height and width of image final int height = options.outHeight; final int width = options.outWidth; int inSampleSize = 1; if (height > reqHeight || width > reqWidth) { if (width > height) { inSampleSize = (int)FloatMath.floor(((float)height / reqHeight)+0.5f); //Math.round((float)height / (float)reqHeight); } else { inSampleSize = (int)FloatMath.floor(((float)width / reqWidth)+0.5f); //Math.round((float)width / (float)reqWidth); } } options.inSampleSize = inSampleSize; options.inJustDecodeBounds = false; return BitmapFactory.decodeFile(filePath, options); }
Example 6
Source File: PullToRefreshWebView.java From android-project-wo2b with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 7
Source File: PullToRefreshWebView.java From GifAssistant with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 8
Source File: PullToRefreshWebView.java From Favorite-Android-Client with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 9
Source File: PullToRefreshWebView.java From SweetMusicPlayer with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 10
Source File: PullToRefreshWebView.java From ONE-Unofficial with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 11
Source File: PullToRefreshWebView.java From MiBandDecompiled with Apache License 2.0 | 4 votes |
protected boolean isReadyForPullEnd() { float f = FloatMath.floor((float)((WebView)l).getContentHeight() * ((WebView)l).getScale()); return (float)((WebView)l).getScrollY() >= f - (float)((WebView)l).getHeight(); }
Example 12
Source File: PullToRefreshWebView.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 13
Source File: StrokeFont.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
@Override protected void updateTextBounds(final String pCharacterAsString) { this.mStrokePaint.getTextBounds(pCharacterAsString, 0, 1, this.mTextBounds); final int inset = -(int)FloatMath.floor(this.mStrokeWidth * 0.5f); this.mTextBounds.inset(inset, inset); }
Example 14
Source File: PullToRefreshWebView.java From bmob-android-demo-paging with GNU General Public License v3.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 15
Source File: PullToRefreshWebView.java From LbaizxfPulltoRefresh with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 16
Source File: PullToRefreshWebView.java From iSCAU-Android with GNU General Public License v3.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 17
Source File: PullToRefreshWebView.java From PullToRefresh-PinnedSection-ListView with MIT License | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 18
Source File: PullToRefreshWebView.java From handmarkPulltorefreshLibrary with Apache License 2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 19
Source File: PullToRefreshWebView.java From zen4android with MIT License | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }
Example 20
Source File: PullToRefreshWebView.java From FanXin-based-HuanXin with GNU General Public License v2.0 | 4 votes |
@Override protected boolean isReadyForPullEnd() { float exactContentHeight = FloatMath.floor(mRefreshableView.getContentHeight() * mRefreshableView.getScale()); return mRefreshableView.getScrollY() >= (exactContentHeight - mRefreshableView.getHeight()); }