Commits

Daniel Nadeau committed fb80aa9 Merge

Merged in yous/holographlibrary/patch-1 (pull request #43)

Adjustments for readability

Comments (0)

Files changed (13)

 gen/
 
 # Local configuration file (sdk path, etc)
-*.properties
+local.properties
 
 # Eclipse project files
 .classpath

HoloGraphLibrary/build.gradle

         }
     }
 }
-
-dependencies {
-}

HoloGraphLibrary/src/com/echo/holographlibrary/Bar.java

     }
 
     public void setColor(int color) {
-        this.mColor = color;
+        mColor = color;
     }
 
     public int getLabelColor() {
     }
 
     public void setLabelColor(int labelColor) {
-        this.mLabelColor = labelColor;
+        mLabelColor = labelColor;
     }
 
     public int getSelectedColor() {
     }
 
     public void setName(String name) {
-        this.mName = name;
+        mName = name;
     }
 
     public float getValue() {
     }
 
     public void setValue(float value) {
-        this.mValue = value;
+        mValue = value;
     }
 
     public String getValueString() {

HoloGraphLibrary/src/com/echo/holographlibrary/BarGraph.java

     }
 
     public void setBars(ArrayList<Bar> points) {
-        this.mBars = points;
+        mBars = points;
         postInvalidate();
     }
 
     public ArrayList<Bar> getBars() {
-        return this.mBars;
+        return mBars;
     }
 
     public void setAxisColor(int axisColor) {
 
         float usableHeight;
         if (mShowBarText) {
-            this.mPaint.setTextSize(VALUE_FONT_SIZE * resources.getDisplayMetrics().scaledDensity);
-            this.mPaint.getTextBounds("$", 0, 1, mTextRect);
+            mPaint.setTextSize(VALUE_FONT_SIZE * resources.getDisplayMetrics().scaledDensity);
+            mPaint.getTextBounds("$", 0, 1, mTextRect);
             if (mShowPopup) {
                 usableHeight = getHeight() - bottomPadding
                         - Math.abs(mTextRect.top - mTextRect.bottom)
             canvas.drawLine(0,
                     getHeight() - bottomPadding + 10 * resources.getDisplayMetrics().density,
                     getWidth(),
-                    getHeight() - bottomPadding + 10 * resources.getDisplayMetrics().density, mPaint);
+                    getHeight() - bottomPadding + 10 * resources.getDisplayMetrics().density,
+                    mPaint);
         }
         float barWidth = (getWidth() - (padding * 2) * mBars.size()) / mBars.size();
 
         if (maxValue == 0) {
             maxValue = 1;
         }
-        
+
         int count = 0;
-        
-        //Calculate the maximum text size for all the axis labels
-        this.mPaint.setTextSize(AXIS_LABEL_FONT_SIZE
+
+        // Calculate the maximum text size for all the axis labels
+        mPaint.setTextSize(AXIS_LABEL_FONT_SIZE
                 * resources.getDisplayMetrics().scaledDensity);
-        for(final Bar bar : mBars) {
-        	int left = (int) ((padding * 2) * count + padding + barWidth * count);
-        	int right = (int) ((padding * 2) * count + padding + barWidth * (count + 1));
-	        float textWidth = this.mPaint.measureText(bar.getName());
-	        // Decrease text size to fit and not overlap with other labels.
-	        while (right - left + (padding * LABEL_PADDING_MULTIPLIER) < textWidth) {
-	            this.mPaint.setTextSize(this.mPaint.getTextSize() - 1);
-	            textWidth = this.mPaint.measureText(bar.getName());
-	        }
-	        count++;
+        for (final Bar bar : mBars) {
+            int left = (int) ((padding * 2) * count + padding + barWidth * count);
+            int right = (int) ((padding * 2) * count + padding + barWidth * (count + 1));
+            float textWidth = mPaint.measureText(bar.getName());
+            // Decrease text size to fit and not overlap with other labels.
+            while (right - left + (padding * LABEL_PADDING_MULTIPLIER) < textWidth) {
+                mPaint.setTextSize(mPaint.getTextSize() - 1);
+                textWidth = mPaint.measureText(bar.getName());
+            }
+            count++;
         }
-        //Save it to use later
+        // Save it to use later
         float labelTextSize = mPaint.getTextSize();
 
         count = 0;
 
             // Draw bar
             if (count == mSelectedIndex && null != mListener) {
-                this.mPaint.setColor(bar.getSelectedColor());
+                mPaint.setColor(bar.getSelectedColor());
             } else {
-                this.mPaint.setColor(bar.getColor());
+                mPaint.setColor(bar.getColor());
             }
-            canvas.drawRect(mBoundsRect, this.mPaint);
+            canvas.drawRect(mBoundsRect, mPaint);
 
             // Create selection region
             Path p = bar.getPath();
 
             // Draw x-axis label text
             if (mShowAxisLabel) {
-                this.mPaint.setColor(bar.getLabelColor());
+                mPaint.setColor(bar.getLabelColor());
                 mPaint.setTextSize(labelTextSize);
-                float textWidth = this.mPaint.measureText(bar.getName());
+                float textWidth = mPaint.measureText(bar.getName());
                 int x = (int) (((mBoundsRect.left + mBoundsRect.right) / 2) - (textWidth / 2));
                 int y = (int) (getHeight() - 3 * resources.getDisplayMetrics().scaledDensity);
-                canvas.drawText(bar.getName(), x, y, this.mPaint);
+                canvas.drawText(bar.getName(), x, y, mPaint);
             }
 
             // Draw value text
             if (mShowBarText) {
-                this.mPaint.setTextSize(VALUE_FONT_SIZE
+                mPaint.setTextSize(VALUE_FONT_SIZE
                         * resources.getDisplayMetrics().scaledDensity);
-                this.mPaint.setColor(bar.getValueColor());
-                this.mPaint.getTextBounds(bar.getValueString(), 0, 1, mTextRect);
+                mPaint.setColor(bar.getValueColor());
+                mPaint.getTextBounds(bar.getValueString(), 0, 1, mTextRect);
 
                 int boundLeft = (int) (((mBoundsRect.left + mBoundsRect.right) / 2)
-                        - (this.mPaint.measureText(bar.getValueString()) / 2)
+                        - (mPaint.measureText(bar.getValueString()) / 2)
                         - 10 * resources.getDisplayMetrics().density);
                 int boundTop = (int) (mBoundsRect.top + (mTextRect.top - mTextRect.bottom)
                         - 18 * resources.getDisplayMetrics().density);
                 int boundRight = (int) (((mBoundsRect.left + mBoundsRect.right) / 2)
-                        + (this.mPaint.measureText(bar.getValueString()) / 2)
+                        + (mPaint.measureText(bar.getValueString()) / 2)
                         + 10 * resources.getDisplayMetrics().density);
 
                 // Limit popup width to bar width
 
                 // Check cache to see if we've done this calculation before
                 if (0 > valueTextSizes.indexOfKey(bar.getValueString().length())) {
-                    while (this.mPaint.measureText(bar.getValueString()) > boundRight - boundLeft) {
-                        this.mPaint.setTextSize(this.mPaint.getTextSize() - (float) 1);
+                    while (mPaint.measureText(bar.getValueString()) > boundRight - boundLeft) {
+                        mPaint.setTextSize(mPaint.getTextSize() - (float) 1);
                     }
                     valueTextSizes.put(bar.getValueString().length(), mPaint.getTextSize());
                 } else {
-                    this.mPaint.setTextSize(valueTextSizes.get(bar.getValueString().length()));
+                    mPaint.setTextSize(valueTextSizes.get(bar.getValueString().length()));
                 }
                 canvas.drawText(bar.getValueString(),
                         (int) (((mBoundsRect.left + mBoundsRect.right) / 2)
-                                - (this.mPaint.measureText(bar.getValueString())) / 2),
+                                - (mPaint.measureText(bar.getValueString())) / 2),
                         mBoundsRect.top - (mBoundsRect.top - boundTop) / 2f
                                 + (float) Math.abs(mTextRect.top - mTextRect.bottom) / 2f * 0.7f,
-                        this.mPaint
+                        mPaint
                 );
             }
             count++;
     }
 
     public void setOnBarClickedListener(OnBarClickedListener listener) {
-        this.mListener = listener;
+        mListener = listener;
     }
 
     public interface OnBarClickedListener {

HoloGraphLibrary/src/com/echo/holographlibrary/Line.java

     }
 
     public void setUsingDips(boolean treatSizesAsDips) {
-        this.mUseDips = treatSizesAsDips;
+        mUseDips = treatSizesAsDips;
     }
 
     public int getStrokeWidth() {
         if (strokeWidth < 0) {
             throw new IllegalArgumentException("strokeWidth must not be less than zero");
         }
-        this.mStrokeWidth = strokeWidth;
+        mStrokeWidth = strokeWidth;
     }
 
     public int getColor() {
     }
 
     public void setColor(int color) {
-        this.mColor = color;
+        mColor = color;
     }
 
     public ArrayList<LinePoint> getPoints() {
     }
 
     public void setPoints(ArrayList<LinePoint> points) {
-        this.mPoints = points;
+        mPoints = points;
     }
 
     public void addPoint(LinePoint point) {
     }
 
     public void setShowingPoints(boolean showPoints) {
-        this.mShowPoints = showPoints;
+        mShowPoints = showPoints;
     }
 
 }

HoloGraphLibrary/src/com/echo/holographlibrary/LineGraph.java

         super(context, attrs, defStyleAttr);
         mDipPadding = getPixelForDip(DEFAULT_PADDING);
 
-        TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.LineGraph, 0, 0);
+        TypedArray a = context.getTheme().obtainStyledAttributes(
+                attrs, R.styleable.LineGraph, 0, 0);
         mFillColor = a.getColor(R.styleable.LineGraph_lineStrokeColor, Color.BLACK);
         mAxisColor = a.getColor(R.styleable.LineGraph_lineAxisColor, Color.LTGRAY);
         mStrokeWidth = a.getDimension(R.styleable.LineGraph_lineStrokeWidth, 2);
     }
 
     public void setUsingDips(boolean treatSizesAsDips) {
-        this.mUseDips = treatSizesAsDips;
+        mUseDips = treatSizesAsDips;
     }
 
     public void removeAllLines() {
     }
 
     public void setRangeYRatio(double rr) {
-        this.mRangeYRatio = rr;
+        mRangeYRatio = rr;
     }
 
     public double getRangeXRatio() {
     }
 
     public void setRangeXRatio(double rr) {
-        this.mRangeXRatio = rr;
+        mRangeXRatio = rr;
     }
 
     public void addPointToLine(int lineIndex, LinePoint point) {
     }
 
     public void setLineToFill(int indexOfLine) {
-        this.mLineToFill = indexOfLine;
+        mLineToFill = indexOfLine;
         postInvalidate();
     }
 
     }
 
     public void setLines(ArrayList<Line> lines) {
-        this.mLines = lines;
+        mLines = lines;
     }
 
     public Line getLine(int index) {
     }
 
     public void setOnPointClickedListener(OnPointClickedListener listener) {
-        this.mListener = listener;
+        mListener = listener;
     }
 
     public interface OnPointClickedListener {

HoloGraphLibrary/src/com/echo/holographlibrary/LinePoint.java

     }
 
     public LinePoint(float x, float y) {
-        this.mX = x;
-        this.mY = y;
+        mX = x;
+        mY = y;
     }
 
     public float getX() {
     }
 
     public void setX(float x) {
-        this.mX = x;
+        mX = x;
     }
 
     public float getY() {
     }
 
     public void setY(float y) {
-        this.mY = y;
+        mY = y;
     }
 
     public void setX(double x) {
-        this.mX = (float) x;
+        mX = (float) x;
     }
 
     public void setY(double y) {
-        this.mY = (float) y;
+        mY = (float) y;
     }
 
     public Region getRegion() {
     }
 
     public void setColor(int color) {
-        this.mColor = color;
+        mColor = color;
     }
 
     public int getSelectedColor() {

HoloGraphLibrary/src/com/echo/holographlibrary/PieGraph.java

     }
 
     public void setSlices(ArrayList<PieSlice> slices) {
-        this.mSlices = slices;
+        mSlices = slices;
         postInvalidate();
     }
 
     }
 
     public void addSlice(PieSlice slice) {
-        this.mSlices.add(slice);
+        mSlices.add(slice);
         postInvalidate();
     }
 
     public void setOnSliceClickedListener(OnSliceClickedListener listener) {
-        this.mListener = listener;
+        mListener = listener;
     }
 
     public void removeSlices() {
-        this.mSlices.clear();
+        mSlices.clear();
         postInvalidate();
     }
 

HoloGraphLibrary/src/com/echo/holographlibrary/PieSlice.java

     }
 
     public void setTitle(String title) {
-        this.mTitle = title;
+        mTitle = title;
     }
 
     public int getColor() {
     }
 
     public void setColor(int color) {
-        this.mColor = color;
+        mColor = color;
     }
 
     public int getSelectedColor() {
     }
 
     public void setValue(float value) {
-        this.mValue = value;
+        mValue = value;
     }
 
     public Path getPath() {

HoloGraphLibrarySample/src/com/echo/holographlibrarysample/BarFragment.java

 public class BarFragment extends Fragment {
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
         final View v = inflater.inflate(R.layout.fragment_bargraph, container, false);
         final Resources resources = getResources();
         ArrayList<Bar> aBars = new ArrayList<Bar>();

HoloGraphLibrarySample/src/com/echo/holographlibrarysample/LineFragment.java

 public class LineFragment extends Fragment {
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
         final View v = inflater.inflate(R.layout.fragment_linegraph, container, false);
         final Resources resources = getResources();
         Line l = new Line();

HoloGraphLibrarySample/src/com/echo/holographlibrarysample/MainActivity.java

         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);
 
-        final ActionBar actionBar = this.getSupportActionBar();
+        final ActionBar actionBar = getSupportActionBar();
         actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
 
         mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
 
-        mViewPager = (ViewPager) this.findViewById(R.id.view_pager);
+        mViewPager = (ViewPager) findViewById(R.id.view_pager);
         mViewPager.setAdapter(mSectionsPagerAdapter);
         mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
             @Override

HoloGraphLibrarySample/src/com/echo/holographlibrarysample/PieFragment.java

 public class PieFragment extends Fragment {
 
     @Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+    public View onCreateView(LayoutInflater inflater, ViewGroup container,
+                             Bundle savedInstanceState) {
         final View v = inflater.inflate(R.layout.fragment_piegraph, container, false);
         final Resources resources = getResources();
         final PieGraph pg = (PieGraph) v.findViewById(R.id.piegraph);