Removed RadarView and any references

This commit is contained in:
Alexandros Schillings
2014-03-18 15:51:54 +00:00
parent e2294ca926
commit c4023bbd5d
5 changed files with 9 additions and 103 deletions
@@ -6,7 +6,6 @@ import uk.co.alt236.btlescan.adapters.LeDeviceListAdapter;
import uk.co.alt236.btlescan.containers.BluetoothLeDeviceStore;
import uk.co.alt236.btlescan.util.BluetoothLeScanner;
import uk.co.alt236.btlescan.util.BluetoothUtils;
import uk.co.alt236.btlescan.views.RadarView;
import android.app.ListActivity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -23,7 +22,6 @@ import butterknife.InjectView;
public class MainActivity extends ListActivity {
@InjectView(R.id.tvBluetoothLe) TextView mTvBluetoothLeStatus;
@InjectView(R.id.tvBluetoothStatus) TextView mTvBluetoothStatus;
@InjectView(R.id.radarView) RadarView mRadarView;
private BluetoothUtils mBluetoothUtils;
private BluetoothLeScanner mScanner;
@@ -40,9 +38,7 @@ public class MainActivity extends ListActivity {
@Override
public void run() {
mDeviceStore.addDevice(deviceLe);
mLeDeviceListAdapter.clear();
mLeDeviceListAdapter.addAll(mDeviceStore.getDeviceList());
mLeDeviceListAdapter.notifyDataSetChanged();
mLeDeviceListAdapter.replaceData(mDeviceStore.getDeviceList());
}
});
}
@@ -34,6 +34,11 @@ public class LeDeviceListAdapter extends ArrayAdapter<BluetoothLeDevice> {
// }
// }
public void replaceData(List<BluetoothLeDevice> list){
clear();
addAll(list);
}
@Override
public long getItemId(int i) {
return i;
@@ -1,87 +0,0 @@
package uk.co.alt236.btlescan.views;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class RadarView extends View{
private Paint mRadarBackgroundPaint;
private Paint mViewBackgroundPaint;
private int mWidth;
private int mHeight;
public RadarView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
mRadarBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mRadarBackgroundPaint.setColor(0xff101010);
mRadarBackgroundPaint.setStyle(Style.FILL);
mViewBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mViewBackgroundPaint.setColor(Color.BLACK);
mViewBackgroundPaint.setStyle(Style.FILL);
}
public RadarView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public RadarView(Context context) {
super(context);
init();
}
private int getSmallestDimension(){
if(mWidth > mHeight){
return mHeight;
} else {
return mWidth;
}
}
@Override
public void onSizeChanged (int w, int h, int oldw, int oldh){
super.onSizeChanged(w, h, oldw, oldh);
mWidth = w;
mHeight = h;
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Log.d("TAG", "~ ONDRAW!");
Log.d("TAG", "~ getLeft! " + getLeft());
Log.d("TAG", "~ getTop! " + getTop());
Log.d("TAG", "~ getRight! " + getRight());
Log.d("TAG", "~ getBottom! " + getBottom());
Log.d("TAG", "~ width! " + mWidth);
Log.d("TAG", "~ height! " + mHeight);
final int smallestDim = getSmallestDimension();
canvas.drawRect(
getLeft(),
getTop(),
getRight(),
getBottom(),
mViewBackgroundPaint);
canvas.drawCircle(
getLeft() + (mWidth / 2f),
getTop() + (mHeight / 2f),
smallestDim / 2f,
mRadarBackgroundPaint);
}
}