Bugs fixed in proximity, adjusting layout for smaller screens
@@ -85,7 +85,6 @@ public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private ImageView iconView;
|
||||
private TextView nameView;
|
||||
private TextView addressView;
|
||||
private TextView batteryView;
|
||||
@@ -94,7 +93,6 @@ public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder
|
||||
public ViewHolder(final View itemView) {
|
||||
super(itemView);
|
||||
|
||||
iconView = (ImageView) itemView.findViewById(R.id.icon);
|
||||
nameView = (TextView) itemView.findViewById(R.id.name);
|
||||
addressView = (TextView) itemView.findViewById(R.id.address);
|
||||
batteryView = (TextView) itemView.findViewById(R.id.battery);
|
||||
@@ -119,24 +117,14 @@ public class DeviceAdapter extends RecyclerView.Adapter<DeviceAdapter.ViewHolder
|
||||
final int position = getAdapterPosition();
|
||||
final BluetoothDevice device = mDevices.get(position);
|
||||
mService.disconnect(device);
|
||||
// The device might have not been connected, so there will be no callback
|
||||
onDeviceRemoved(device);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void bind(final BluetoothDevice device) {
|
||||
final int state = mService.getConnectionState(device);
|
||||
switch (state) {
|
||||
case BluetoothGatt.STATE_DISCONNECTED:
|
||||
case BluetoothGatt.STATE_DISCONNECTING:
|
||||
DrawableCompat.setTint(iconView.getDrawable(), ContextCompat.getColor(iconView.getContext(), android.R.color.black));
|
||||
break;
|
||||
case BluetoothGatt.STATE_CONNECTING:
|
||||
DrawableCompat.setTint(iconView.getDrawable(), ContextCompat.getColor(iconView.getContext(), R.color.actionBarColor));
|
||||
break;
|
||||
case BluetoothGatt.STATE_CONNECTED:
|
||||
DrawableCompat.setTint(iconView.getDrawable(), ContextCompat.getColor(iconView.getContext(), R.color.actionBarColorDark));
|
||||
break;
|
||||
}
|
||||
|
||||
String name = device.getName();
|
||||
if (TextUtils.isEmpty(name))
|
||||
|
||||
@@ -38,10 +38,8 @@ import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import no.nordicsemi.android.log.LogContract;
|
||||
import no.nordicsemi.android.nrftoolbox.FeaturesActivity;
|
||||
@@ -170,7 +168,6 @@ public class ProximityService extends BleMulticonnectProfileService implements P
|
||||
|
||||
@Override
|
||||
protected void onBluetoothEnabled() {
|
||||
super.onBluetoothEnabled();
|
||||
// Start the GATT Server only if Bluetooth is enabled
|
||||
mServerManager = new ProximityServerManager(this);
|
||||
mServerManager.setLogger(mBinder);
|
||||
@@ -188,6 +185,7 @@ public class ProximityService extends BleMulticonnectProfileService implements P
|
||||
super.onBluetoothDisabled();
|
||||
if (mServerManager != null) {
|
||||
mServerManager.closeGattServer();
|
||||
mServerManager = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 276 B After Width: | Height: | Size: 249 B |
|
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 228 B |
|
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1005 B After Width: | Height: | Size: 1.4 KiB |
@@ -21,6 +21,7 @@
|
||||
~ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?android:attr/listPreferredItemHeightSmall"
|
||||
android:paddingBottom="2dp"
|
||||
@@ -29,13 +30,6 @@
|
||||
android:paddingTop="2dp"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/ic_proximity_tag"
|
||||
android:layout_marginRight="8dp"/>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
@@ -46,6 +40,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="marquee"
|
||||
android:layout_toRightOf="@+id/icon"
|
||||
android:gravity="center_vertical"
|
||||
android:lines="1"
|
||||
android:textSize="20sp"
|
||||
@@ -56,7 +51,6 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="12sp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_below="@+id/name"
|
||||
android:lines="1"/>
|
||||
|
||||
@@ -69,7 +63,7 @@
|
||||
android:gravity="center"
|
||||
android:layout_toRightOf="@+id/address"
|
||||
android:drawableLeft="@drawable/ic_battery"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:visibility="gone"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -79,6 +73,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/actionBarColorDark"
|
||||
app:backgroundTint="@color/actionBarColorDark"
|
||||
android:src="@drawable/ic_stat_notify_proximity_find"
|
||||
android:visibility="gone"/>
|
||||
|
||||
@@ -87,6 +82,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:backgroundTint="@color/orange"
|
||||
app:backgroundTint="@color/orange"
|
||||
android:src="@drawable/ic_action_disconnect"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
<string name="proximity_devices_title">YOUR TAGS</string>
|
||||
<string name="proximity_enable_server">GATT Server enabled</string>
|
||||
|
||||
<string name="proximity_about_text">PROXIMITY profile allows you to connect to your Proximity sensor.
|
||||
\nYou can find your valuables attached with Proximity tag by pressing FindMe button on screen and you can find your phone by pressing relevant button on your tag.
|
||||
\n\nYou may close this activity when connected without being disconnected from the sensor. A notification will be shown.</string>
|
||||
<string name="proximity_about_text">PROXIMITY profile allows you to connect to multiple Proximity sensors.
|
||||
\nYou can find your valuables attached with Proximity tag by pressing the Locate button next to your device.
|
||||
You can also find your phone by pressing relevant button on your tag.
|
||||
\n\nYou may close this activity when connected without being disconnected from the sensors. A notification will be shown.</string>
|
||||
</resources>
|
||||