Android Open Source - infinitep Element Background






From Project

Back to project page infinitep.

License

The source code is released under:

Apache License

If you think the Android project infinitep listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package es.daconstenla.infinip.customcomponents.pieces;
//ww  w. j  a va  2 s  . com
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import es.daconstenla.infinip.R;

public class ElementBackground extends View{

  private int mPaddingTop = 15;
  private int mPaddingLeft = 15;
  private int mPaddingRight = 15;
  private int mPaddingBottom = 15;
  
  //private RectF mExternalContainer = new RectF();
  private RectF mInternalContainer = new RectF();
  private RectF mInternalContainerBorder = new RectF();
  
  //private Paint mExternalContainerFill;
  private Paint mInternalContainerFill;
  private Paint mInternalContainerBorderStroke;
  private int mShadowSize = 3;
  
  public ElementBackground(Context context, AttributeSet attrs) { 
    super(context,attrs); 
    __init__();
  }
  public ElementBackground(Context context) { 
    super(context); 
    __init__();
  }
  
  private void __init__() {
    Resources res = getResources();
    
    //mExternalContainerFill = new Paint();
    //mExternalContainerFill.setStyle(Style.FILL);
    //mExternalContainerFill.setColor(res.getColor(R.color.customGreyLight2));
    
    mInternalContainerBorderStroke = new Paint();
    mInternalContainerBorderStroke.setStyle(Style.FILL);
    mInternalContainerBorderStroke.setColor(res.getColor(R.color.backgroundGraphBorder));
    
    mInternalContainerFill = new Paint();
    mInternalContainerFill.setStyle(Style.FILL);
    mInternalContainerFill.setColor(res.getColor(R.color.backgroundGraph)); 
    
  }

  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
      super.onSizeChanged(w, h, oldw, oldh);
      
      int heh = h-mPaddingBottom;
      int wiw = w-mPaddingRight;
      
      //mExternalContainer = new RectF(0,0,w,h);
      mInternalContainer = new RectF(mPaddingLeft,mPaddingTop,wiw,heh);
      mInternalContainerBorder = new RectF(mPaddingLeft,mPaddingTop,wiw+mShadowSize,heh+mShadowSize );
      
      this.layout(0, 0, w, h);
  }
  
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    //if(mExternalContainer!=null && mInternalContainerBorder!=null && mInternalContainer !=null){
    //canvas.drawRect(mExternalContainer, mExternalContainerFill);
    canvas.drawRect(mInternalContainerBorder, mInternalContainerBorderStroke);
    canvas.drawRect(mInternalContainer, mInternalContainerFill);
    //}
  }
  
  public void setPadding(int left, int top, int right, int bottom){
    mPaddingLeft = left;
    mPaddingBottom = bottom;
    mPaddingRight = right;
    mPaddingTop = top;
  }
  public void setShadowSize(int size){
    mShadowSize = size;
  }
  
  public RectF getRectInternalAvailable(){
    RectF ret = new RectF(
        mInternalContainer.left+mPaddingLeft, 
        mInternalContainer.top+mPaddingTop, 
        mInternalContainer.right-mPaddingRight, 
        mInternalContainer.bottom-mPaddingBottom);
    return ret;
  }
}




Java Source Code List

com.example.databasetest.FullscreenActivity.java
com.example.databasetest.util.SystemUiHiderBase.java
com.example.databasetest.util.SystemUiHiderHoneycomb.java
com.example.databasetest.util.SystemUiHider.java
com.example.datatest.MainActivity.java
com.example.datatest.database.InfinitepHelper.java
com.example.datatest.database.MovementRaw.java
com.example.datatest.database.MovementSummary.java
com.example.datatest.database.TableMovementRaw.java
com.example.datatest.database.TableMovementSummary.java
com.example.datatest.databaseTest.DatabaseTester.java
com.example.datatest.util.Utils.java
es.daconstenla.infinip.activity.CalendarActivity.java
es.daconstenla.infinip.activity.DayActivity.java
es.daconstenla.infinip.activity.MainActivity.java
es.daconstenla.infinip.activity.RangeActivity.java
es.daconstenla.infinip.activity.SettingsActivity.java
es.daconstenla.infinip.activity.SplashActivity.java
es.daconstenla.infinip.activity.SyncActivity.java
es.daconstenla.infinip.customcomponents.HorizontalGraph.java
es.daconstenla.infinip.customcomponents.InformationBox.java
es.daconstenla.infinip.customcomponents.MonthFragmentTest.java
es.daconstenla.infinip.customcomponents.MonthFragment.java
es.daconstenla.infinip.customcomponents.MonthView.java
es.daconstenla.infinip.customcomponents.MyFragmentMonthAdapter.java
es.daconstenla.infinip.customcomponents.events.OnSwipeTouchListener.java
es.daconstenla.infinip.customcomponents.pieces.ElementBackground.java
es.daconstenla.infinip.customcomponents.pieces.HorGraphBar.java
es.daconstenla.infinip.customcomponents.pieces.ItemCalendarDay.java
es.daconstenla.infinip.customcomponents.pieces.data.BarElementData.java
es.daconstenla.infinip.customcomponents.pieces.data.ColorMyCustom.java
es.daconstenla.infinip.customcomponents.pieces.data.CustomScrollView.java
es.daconstenla.infinip.customcomponents.pieces.data.ItemHorizontalBar.java
es.daconstenla.infinip.database.InfinitepHelper.java
es.daconstenla.infinip.database.MovementRaw.java
es.daconstenla.infinip.database.MovementSummary.java
es.daconstenla.infinip.database.TableMovementRaw.java
es.daconstenla.infinip.database.TableMovementSummary.java
es.daconstenla.infinip.database.utils.Utils.java
es.daconstenla.infinip.unused.AutoResizeTextView.java