Removed RadarView and any references
This commit is contained in:
@@ -13,8 +13,8 @@
|
|||||||
android:id="@+id/gridLayout1"
|
android:id="@+id/gridLayout1"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
android:columnCount="2"
|
||||||
android:columnCount="2" >
|
android:paddingBottom="@dimen/activity_vertical_margin" >
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_column="0"
|
android:layout_column="0"
|
||||||
@@ -72,7 +72,6 @@
|
|||||||
android:id="@+id/listContainer"
|
android:id="@+id/listContainer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight=".3"
|
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<ListView
|
<ListView
|
||||||
@@ -93,13 +92,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="@android:color/holo_blue_dark" />
|
android:background="@android:color/holo_blue_dark" />
|
||||||
|
|
||||||
<uk.co.alt236.btlescan.views.RadarView
|
|
||||||
android:id="@+id/radarView"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight=".7">
|
|
||||||
</uk.co.alt236.btlescan.views.RadarView>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<color name="light_gray">#e0e0e0</color>
|
<color name="light_gray">#66e0e0e0</color>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import uk.co.alt236.btlescan.adapters.LeDeviceListAdapter;
|
|||||||
import uk.co.alt236.btlescan.containers.BluetoothLeDeviceStore;
|
import uk.co.alt236.btlescan.containers.BluetoothLeDeviceStore;
|
||||||
import uk.co.alt236.btlescan.util.BluetoothLeScanner;
|
import uk.co.alt236.btlescan.util.BluetoothLeScanner;
|
||||||
import uk.co.alt236.btlescan.util.BluetoothUtils;
|
import uk.co.alt236.btlescan.util.BluetoothUtils;
|
||||||
import uk.co.alt236.btlescan.views.RadarView;
|
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.bluetooth.BluetoothAdapter;
|
import android.bluetooth.BluetoothAdapter;
|
||||||
import android.bluetooth.BluetoothDevice;
|
import android.bluetooth.BluetoothDevice;
|
||||||
@@ -23,7 +22,6 @@ import butterknife.InjectView;
|
|||||||
public class MainActivity extends ListActivity {
|
public class MainActivity extends ListActivity {
|
||||||
@InjectView(R.id.tvBluetoothLe) TextView mTvBluetoothLeStatus;
|
@InjectView(R.id.tvBluetoothLe) TextView mTvBluetoothLeStatus;
|
||||||
@InjectView(R.id.tvBluetoothStatus) TextView mTvBluetoothStatus;
|
@InjectView(R.id.tvBluetoothStatus) TextView mTvBluetoothStatus;
|
||||||
@InjectView(R.id.radarView) RadarView mRadarView;
|
|
||||||
|
|
||||||
private BluetoothUtils mBluetoothUtils;
|
private BluetoothUtils mBluetoothUtils;
|
||||||
private BluetoothLeScanner mScanner;
|
private BluetoothLeScanner mScanner;
|
||||||
@@ -40,9 +38,7 @@ public class MainActivity extends ListActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mDeviceStore.addDevice(deviceLe);
|
mDeviceStore.addDevice(deviceLe);
|
||||||
mLeDeviceListAdapter.clear();
|
mLeDeviceListAdapter.replaceData(mDeviceStore.getDeviceList());
|
||||||
mLeDeviceListAdapter.addAll(mDeviceStore.getDeviceList());
|
|
||||||
mLeDeviceListAdapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,11 @@ public class LeDeviceListAdapter extends ArrayAdapter<BluetoothLeDevice> {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
public void replaceData(List<BluetoothLeDevice> list){
|
||||||
|
clear();
|
||||||
|
addAll(list);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int i) {
|
public long getItemId(int i) {
|
||||||
return 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user