Skip to content

Commit 6d5b4c1

Browse files
committedAug 18, 2021
second set of java style and logic changes
1 parent 1241a38 commit 6d5b4c1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+126
-269
lines changed
 

‎src/main/java/com/echo/holographlibrary/BarGraph.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public class BarGraph extends View {
4747

4848
private ArrayList<Bar> mBars = new ArrayList<>();
4949
private final Paint mPaint = new Paint();
50-
private Rect mRectangle = null;
5150
private boolean mShowBarText = true;
5251
private boolean mShowAxis = true;
5352
private int mIndexSelected = -1;
@@ -57,7 +56,7 @@ public class BarGraph extends View {
5756

5857
private int popupImageID;
5958

60-
private Context mContext;
59+
private final Context mContext;
6160

6261

6362
/**
@@ -150,8 +149,8 @@ public void onDraw(Canvas ca) {
150149
maxValue = bar.getValue();
151150
}
152151
}
153-
154-
mRectangle = new Rect();
152+
153+
Rect mRectangle = new Rect();
155154

156155
int count = 0;
157156
for (final Bar bar : mBars) {
@@ -176,7 +175,7 @@ public void onDraw(Canvas ca) {
176175
// Draw x-axis label text
177176
if (mShowAxis){
178177
this.mPaint.setTextSize(AXIS_LABEL_FONT_SIZE * mContext.getResources().getDisplayMetrics().scaledDensity);
179-
int x = (int)(((mRectangle.left+mRectangle.right)/2)-(this.mPaint.measureText(bar.getName())/2));
178+
int x = (int)(((mRectangle.left+ mRectangle.right)/2)-(this.mPaint.measureText(bar.getName())/2));
180179
int y = (int) (getHeight()-3 * mContext.getResources().getDisplayMetrics().scaledDensity);
181180
canvas.drawText(bar.getName(), x, y, this.mPaint);
182181
}
@@ -188,13 +187,13 @@ public void onDraw(Canvas ca) {
188187
Rect r2 = new Rect();
189188
this.mPaint.getTextBounds(bar.getValueString(), 0, 1, r2);
190189

191-
int boundLeft = (int) (((mRectangle.left+mRectangle.right)/2)-(this.mPaint.measureText(bar.getValueString())/2)-5 * mContext.getResources().getDisplayMetrics().density);
190+
int boundLeft = (int) (((mRectangle.left+ mRectangle.right)/2)-(this.mPaint.measureText(bar.getValueString())/2)-5 * mContext.getResources().getDisplayMetrics().density);
192191
int boundTop = (int) (mRectangle.top+(r2.top-r2.bottom)-18 * mContext.getResources().getDisplayMetrics().density);
193-
int boundRight = (int)(((mRectangle.left+mRectangle.right)/2)+(this.mPaint.measureText(bar.getValueString())/2)+5 * mContext.getResources().getDisplayMetrics().density);
192+
int boundRight = (int)(((mRectangle.left+ mRectangle.right)/2)+(this.mPaint.measureText(bar.getValueString())/2)+5 * mContext.getResources().getDisplayMetrics().density);
194193
popup.setBounds(boundLeft, boundTop, boundRight, mRectangle.top);
195194
popup.draw(canvas);
196195

197-
canvas.drawText(bar.getValueString(), (int)(((mRectangle.left+mRectangle.right)/2)-(this.mPaint.measureText(bar.getValueString()))/2), mRectangle.top-(mRectangle.top - boundTop)/2f+(float)Math.abs(r2.top-r2.bottom)/2f*0.7f, this.mPaint);
196+
canvas.drawText(bar.getValueString(), (int)(((mRectangle.left+ mRectangle.right)/2)-(this.mPaint.measureText(bar.getValueString()))/2), mRectangle.top-(mRectangle.top - boundTop)/2f+(float)Math.abs(r2.top-r2.bottom)/2f*0.7f, this.mPaint);
198197
}
199198
if (mIndexSelected == count && mListener != null) {
200199
this.mPaint.setColor(Color.parseColor("#33B5E5"));

‎src/main/java/dk/aau/netsec/hostage/AMQPListener.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public class AMQPListener extends Listener {
1818
private Thread serverThread;
1919
private ConnectionRegister conReg;
2020
private boolean running = false;
21-
private final int defaultPort =5672;
2221

2322
private static final Semaphore mutex = new Semaphore(1);
2423
/**
@@ -103,6 +102,7 @@ private boolean notifyUI(boolean running){
103102
public void stop() { stopServer();}
104103

105104
public void stopServer(){
105+
int defaultPort = 5672;
106106
if(super.getPort() == defaultPort) {
107107
AMQP.stopBroker();
108108
if(serverThread!=null)

0 commit comments

Comments
 (0)
Please sign in to comment.