List of usage examples for android.graphics RectF RectF
public RectF(float left, float top, float right, float bottom)
From source file:com.goliathonline.android.kegbot.ui.DrinkDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_drink_detail, null); mTabHost = (TabHost) mRootView.findViewById(android.R.id.tabhost); mTabHost.setup();//from w w w. j a v a2s . c om mTitle = (TextView) mRootView.findViewById(R.id.drink_title); mSubtitle = (TextView) mRootView.findViewById(R.id.drink_subtitle); mStarred = (CompoundButton) mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); // Larger target triggers star toggle final View starParent = mRootView.findViewById(R.id.header_drink); FractionalTouchDelegate.setupDelegate(starParent, mStarred, new RectF(0.6f, 0f, 1f, 0.8f)); mAbstract = (TextView) mRootView.findViewById(R.id.session_abstract); mRequirements = (TextView) mRootView.findViewById(R.id.drink_pour_details); setupSummaryTab(); setupNotesTab(); setupLinksTab(); return mRootView; }
From source file:com.google.android.apps.iosched.ui.SessionDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_session_detail, null); mTabHost = (TabHost) mRootView.findViewById(android.R.id.tabhost); mTabHost.setup();//w ww. ja va2s . c o m mTitle = (TextView) mRootView.findViewById(R.id.session_title); mSubtitle = (TextView) mRootView.findViewById(R.id.session_subtitle); mStarred = (CompoundButton) mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); // Larger target triggers star toggle final View starParent = mRootView.findViewById(R.id.header_session); FractionalTouchDelegate.setupDelegate(starParent, mStarred, new RectF(0.6f, 0f, 1f, 0.8f)); mAbstract = (TextView) mRootView.findViewById(R.id.session_abstract); mRequirements = (TextView) mRootView.findViewById(R.id.session_requirements); setupSummaryTab(); setupNotesTab(); setupLinksTab(); return mRootView; }
From source file:org.dalmasso.ietfsched.ui.SessionDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_session_detail, null); mTabHost = (TabHost) mRootView.findViewById(android.R.id.tabhost); mTabHost.setup();/*from w w w .ja v a 2 s . co m*/ mTitle = (TextView) mRootView.findViewById(R.id.session_title); mSubtitle = (TextView) mRootView.findViewById(R.id.session_subtitle); mStarred = (CompoundButton) mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); // Larger target triggers star toggle final View starParent = mRootView.findViewById(R.id.header_session); FractionalTouchDelegate.setupDelegate(starParent, mStarred, new RectF(0.6f, 0f, 1f, 0.8f)); mAbstract = (TextView) mRootView.findViewById(R.id.session_abstract); // mRequirements = (TextView) mRootView.findViewById(R.id.session_requirements); setupLinksTab(); setupNotesTab(); setupSummaryTab(); return mRootView; }
From source file:net.peterkuterna.android.apps.devoxxfrsched.ui.SessionDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_session_detail, null); mTabs = (ScrollableTabs) mRootView.findViewById(R.id.viewpagerheader_session_detail); mViewPager = (ViewPager) mRootView.findViewById(R.id.viewpager_session_detail); mViewPager.setPageMargin(getResources().getDimensionPixelSize(R.dimen.viewpager_page_margin)); mViewPager.setPageMarginDrawable(R.drawable.viewpager_margin); mTitle = (TextView) mRootView.findViewById(R.id.session_title); mSubtitle = (TextView) mRootView.findViewById(R.id.session_subtitle); mStarred = (CompoundButton) mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true);/*from w w w . j a va2 s . c om*/ mStarred.setClickable(true); // Larger target triggers star toggle final View starParent = mRootView.findViewById(R.id.header_session); FractionalTouchDelegate.setupDelegate(starParent, mStarred, new RectF(0.6f, 0f, 1f, 0.8f)); return mRootView; }
From source file:com.iped.ipcam.bitmapfun.ImageDetailFragment.java
protected void center(boolean horizontal, boolean vertical) { Matrix m = new Matrix(); m.set(matrix);//from w w w.jav a2 s. co m RectF rect = new RectF(0, 0, bitmap.getWidth(), bitmap.getHeight()); m.mapRect(rect); float height = rect.height(); float width = rect.width(); float deltaX = 0, deltaY = 0; if (vertical) { int screenHeight = dm.heightPixels; if (height <= screenHeight) { deltaY = (screenHeight - height) / 2 - rect.top; } else if (rect.top > 0) { deltaY = -rect.top; } else if (rect.bottom < screenHeight) { deltaY = screenHeight - rect.bottom; } } if (horizontal) { int screenWidth = dm.widthPixels; if (width <= screenWidth) { deltaX = (screenWidth - width) / 2 - rect.left; } else if (rect.left > 0) { deltaX = -rect.left; } else if (rect.right < screenWidth) { deltaX = screenWidth - rect.right; } } matrix.postTranslate(deltaX, deltaY); }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_session_detail, null); mTitle = (TextView) mRootView.findViewById(R.id.session_title); mSubtitle = (TextView) mRootView.findViewById(R.id.session_subtitle); // Larger target triggers plus one button mPlusOneButton = (PlusOneButton) mRootView.findViewById(R.id.plus_one_button); View headerView = mRootView.findViewById(R.id.header_session); FractionalTouchDelegate.setupDelegate(headerView, mPlusOneButton, new RectF(0.6f, 0f, 1f, 1.0f)); mAbstract = (TextView) mRootView.findViewById(R.id.session_abstract); mRequirements = (TextView) mRootView.findViewById(R.id.session_requirements); mAddScheduleButton = (CheckableLinearLayout) mRootView.findViewById(R.id.add_schedule_button); mAddScheduleButton.setOnClickListener(new OnClickListener() { @Override/*w w w . j a v a2 s.com*/ public void onClick(View view) { setSessionStarred(!mStarred, true); } }); mAddScheduleButton.setVisibility(View.GONE); if (mVariableHeightHeader) { ViewGroup.LayoutParams layoutParams = headerView.getLayoutParams(); layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT; headerView.setLayoutParams(layoutParams); } setupCustomScrolling(mRootView); return mRootView; }
From source file:com.android.mail.ui.FolderDisplayer.java
public static void drawFolder(Canvas canvas, float x, float y, int width, int height, String name, int fgColor, int bgColor, FolderDisplayer.FolderDrawableResources res, BidiFormatter formatter, Paint paint) { canvas.save();//from w ww .j a va 2 s. com canvas.translate(x, y + res.folderVerticalOffset); // Draw the box. paint.setColor(bgColor); paint.setStyle(Paint.Style.FILL); final RectF rect = new RectF(0, 0, width, height); canvas.drawRoundRect(rect, res.folderRoundedCornerRadius, res.folderRoundedCornerRadius, paint); // Draw the text based on the language locale and layout direction. paint.setColor(fgColor); paint.setStyle(Paint.Style.FILL); // Compute the text/gradient indices final int textLength = (int) paint.measureText(name); final int gradientX0; final int gradientX1; final int textX; /*************************************************************************************************** * width - the actual folder chip rectangle. * * textLength - the length of the folder's full name (can be longer than * * the actual chip, which is what overflow gradient is for). * * innerPadding - the padding between the text and the chip edge. * * overflowPadding - the padding between start of overflow and the chip edge. * * * * * * text is in a RTL language * * * * index-0 * * |<---------------------------- width ---------------------------->| * * |<-------------------------textLength------------------>| | * * | |<----- overflowPadding ----->| | * * | |<- innerPadding ->|<-------->|<--------->|<- horizontalPadding ->| * * textX gX1 gX0 * * * * * * text is in a LTR language. * * * * index-0 * * |<------------------------------ width ------------------------------->| * * | |<-------------------------textLength-------------------->| * * | |<-------- overflowPadding ------->| * * |<- horizontalPadding ->|<--------->|<-------->|<- horizontalPadding ->| * * textX gX0 gX1 * * * **************************************************************************************************/ if (formatter.isRtl(name)) { gradientX0 = res.overflowGradientPadding; gradientX1 = res.folderHorizontalPadding; textX = width - res.folderHorizontalPadding - textLength; } else { gradientX0 = width - res.overflowGradientPadding; gradientX1 = width - res.folderHorizontalPadding; textX = res.folderHorizontalPadding; } // Draw the text and the possible overflow gradient // Overflow happens when the text is longer than the chip width minus side paddings. if (textLength > width - 2 * res.folderHorizontalPadding) { final Shader shader = new LinearGradient(gradientX0, 0, gradientX1, 0, fgColor, Utils.getTransparentColor(fgColor), Shader.TileMode.CLAMP); paint.setShader(shader); } final int textY = height / 2 - (int) (paint.descent() + paint.ascent()) / 2; canvas.drawText(name, textX, textY, paint); paint.setShader(null); canvas.restore(); }
From source file:com.google.android.apps.iosched2.ui.SessionDetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_session_detail, null); mTabHost = (TabHost) mRootView.findViewById(android.R.id.tabhost); mTabHost.setup();//from w ww. jav a 2 s .co m mTitle = (TextView) mRootView.findViewById(R.id.session_title); mSubtitle = (TextView) mRootView.findViewById(R.id.session_subtitle); mStarred = (CompoundButton) mRootView.findViewById(R.id.star_button); mStarred.setFocusable(true); mStarred.setClickable(true); // Larger target triggers star toggle final View starParent = mRootView.findViewById(R.id.header_session); FractionalTouchDelegate.setupDelegate(starParent, mStarred, new RectF(0.6f, 0f, 1f, 0.8f)); mAbstract = (TextView) mRootView.findViewById(R.id.session_abstract); mRequirements = (TextView) mRootView.findViewById(R.id.session_requirements); mLevel = (TextView) mRootView.findViewById(R.id.session_level); setupSummaryTab(); setupNotesTab(); setupLinksTab(); return mRootView; }
From source file:com.test.slidebutton.SlideButton.java
public void initDrawingVal() { int width = getMeasuredWidth(); int height = getMeasuredHeight(); rectfBack = new RectF(0, 0, width, height); rectfSlider = new RectF(); silderWidth = height - 2 * RIM_SIZE; if (shape == SHAPE_RECT_CIRCLE) { backArcRadius = height / 5;/* w w w .ja v a 2 s.c o m*/ sliderArcRadius = silderWidth / 5; } else if (shape == SHAPE_CIRCLE) { backArcRadius = height / 2; sliderArcRadius = silderWidth / 2; } else { backArcRadius = 0; sliderArcRadius = 0; } min_left = RIM_SIZE; max_left = width - RIM_SIZE - silderWidth; if (isOpen) { sliderCurrentLeft = max_left; alpha = 255; } else { sliderCurrentLeft = RIM_SIZE; alpha = 0; } sliderMoveStartLeft = sliderCurrentLeft; }
From source file:com.valtech.androidtoolkit.view.indicator.RectPageIndicator.java
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (mViewPager == null) { return;/* w w w . ja v a2 s. c om*/ } final int count = mViewPager.getAdapter().getCount(); if (count == 0) { return; } if (mCurrentPage >= count) { setCurrentItem(count - 1); return; } float dX; float dY; for (int iLoop = 0; iLoop < count; iLoop++) { dX = iLoop * rectSize; dY = 0; canvas.drawRect(new RectF(dX, dY, dX + rectSize, dY + 10), mPaintPageFill); canvas.drawRect(new RectF(dX, dY, dX + rectSize, dY + 10), mPaintStroke); } float cx = (mSnap ? mSnapPage : mCurrentPage); if (!mSnap && (mPageSize != 0)) { cx += (mCurrentOffset * 1.0f / mPageSize); } cx = ((mCurrentOffset * 1.0f) / width) * rectSize; dX = (mCurrentPage * rectSize) + cx; dY = 0; canvas.drawRect(new RectF(dX, dY, dX + rectSize, dY + 10), mPaintFill); }