Android Open Source - infinitep Hor Graph Bar






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 va2s .c  om*/
import java.util.ArrayList;
import java.util.List;

import es.daconstenla.infinip.customcomponents.pieces.data.ItemHorizontalBar;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.RectF;
import android.view.View;

// TODO TODO change to this external class, refactor!

public class HorGraphBar extends View{

  public static float mHourTextSize = 1.0f;
  public static float mTextMargin = 1.2f;
  public static float mGraphPosition = 0.0f;
  public boolean mDisplayHours = true;
  private List<ItemHorizontalBar> mData = new ArrayList<ItemHorizontalBar>();
  
  private RectF tRectB;
  private RectF tRectS;
  boolean shadowRight = false;
  

  public HorGraphBar(Context context) { 
    super(context); 
    tRectB = new RectF();
    tRectS = new RectF();
  }
  
  public void setPosition(float pos){
    mGraphPosition = pos;
  }
  
  @Override
  protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    
    shadowRight = false;
    float shadowSize = 2;
    float textSizeWithMargin = mHourTextSize*mTextMargin; // TODO puede que necesite ms
    
    boolean breakable = false;
    /*
    for(ItemHorizontalBar it : mData){
      
      tRectB.set(it.mRect);
      tRectB.left -= mGraphPosition;
      tRectB.right -= mGraphPosition;
      if(mDisplayHours) tRectB.bottom -= textSizeWithMargin;
      
      if(tRectB.right>mGraphContainer.right){
        breakable = true;
        shadowRight = true;
      }
      
      if( ( tRectB.left >= mGraphContainer.left && tRectB.right <= mGraphContainer.right ) 
          || ( tRectB.left < mGraphContainer.left && tRectB.right>mGraphContainer.left )
          || ( tRectB.right > mGraphContainer.right && tRectB.left < mGraphContainer.right ) ){
        if( tRectB.left < mGraphContainer.left && tRectB.right>mGraphContainer.left ){
          tRectB.left = mGraphContainer.left;
        }
        if( tRectB.right > mGraphContainer.right && tRectB.left < mGraphContainer.right ){
          tRectB.right = mGraphContainer.right;
        }
        canvas.drawRect(tRectB, it.mPaint);
        tRectS = tRectB;
        tRectS.top = tRectS.bottom-mHeightBorder;
        canvas.drawRect(tRectS, it.mPaintB);
        
        //Log.v("HorGraphBar > onDraw","r : "+tRectB.left+ " -> "+tRectB.right);
      }
    
      if(breakable) break;
    }
    if( shadowRight ){
      tRectS.set(mGraphContainer);
      tRectS.left = tRectS.right-shadowSize;
      canvas.drawRect(tRectS, mShadowMoreGraphAvailable);
    }
    if(getFirstItem().mRect.left < mGraphPosition){
      tRectS.set(mGraphContainer);
      tRectS.right = tRectS.left+shadowSize;
      canvas.drawRect(tRectS, mShadowMoreGraphAvailable);
    }
    
    if(mDisplayHours){

      for(int i = 0 ; i < mHourTextPosition.size() ; i++){
      
        if(mHourTextPosition.get(i)-mGraphPosition <= mGraphContainer.right && mHourTextPosition.get(i)-mGraphPosition >= mGraphContainer.left){
          canvas.drawText(mHourTextString.get(i),mHourTextPosition.get(i)-mGraphPosition,mGraphContainer.bottom,mHourTextPaint);
          //Log.v("HorGraphBar > onDraw","t : "+(mHourTextPosition.get(i)-mGraphPosition)+ "");
        }
        

        //TODO
        //TODO
        //TODO
        //TODO
        //TODO
      }
      
    }*/
  }
  @Override
  protected void onSizeChanged(int w, int h, int oldw, int oldh) {
    // TODO Auto-generated method stub
    /*super.onSizeChanged(w, h, oldw, oldh);
    if(mGraphContainer.right != w || mGraphContainer.bottom != h){
      mGraphContainer.right = w;
      mGraphContainer.bottom = h;
      onDataChanged();
    }*/
  }
      
}




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