diff --git a/README.md b/README.md
index ef0a038..7dd598c 100644
--- a/README.md
+++ b/README.md
@@ -97,7 +97,7 @@ An IBeaconDevice extends BluetoothLeDevice, so you still have access to the same
You can also lookup values and convert them to human friendly strings:
* `BluetoothClassResolver.resolveDeviceClass(int btClass)`: Will try to resolve a Blueotooth Device class
* `CompanyIdentifierResolver.getCompanyName(int companyId, String fallback)`: Will try to resolve a Company identifier to the company name
-* GattAttributeResolver.getAttributeName(String uuid, String fallback): Will try to convert a UUID to its name.
+* `GattAttributeResolver.getAttributeName(String uuid, String fallback)`: Will try to convert a UUID to its name.
**Note:** The data can be found as ODS (Open Office Spreadsheets) in the documents folder.
@@ -129,12 +129,10 @@ Author: [Alexandros Schillings](https://github.com/alt236).
* The Accuracy calculation algorithm was taken from: http://stackoverflow.com/questions/20416218/understanding-ibeacon-distancing
* The AdRecord parser was taken from: https://github.com/devunwired/accessory-samples
-* The sample application has been adapted from
+* The sample application has been adapted from Android's Bluetooth LE example
All logos are the property of their respective owners.
-The icons used for the example app were downloaded from here: [Android Design](http://developer.android.com/design/downloads/index.htm)
-
The code in this project is licensed under the Apache Software License 2.0.
Copyright (c) 2014 Alexandros Schillings.
\ No newline at end of file
diff --git a/sample_app/res/menu/main.xml b/sample_app/res/menu/main.xml
index 0aa7c7b..7b3160b 100644
--- a/sample_app/res/menu/main.xml
+++ b/sample_app/res/menu/main.xml
@@ -31,5 +31,10 @@
android:orderInCategory="101"
android:showAsAction="ifRoom|withText"
android:title="@string/menu_stop"/>
+
\ No newline at end of file
diff --git a/sample_app/res/values/strings.xml b/sample_app/res/values/strings.xml
index 7ceae33..79a171e 100644
--- a/sample_app/res/values/strings.xml
+++ b/sample_app/res/values/strings.xml
@@ -5,14 +5,13 @@
Bluetooth LE Scanner
Connected
Disconnected
- Hello world!
No data
Not supported
Off
On
Supported
Unknown characteristic
- Unknown Device
+ Unknown device
Unknown service
@@ -20,6 +19,7 @@
%sdb
+ About
Connect
Disconnect
Scan
@@ -37,4 +37,7 @@
TX Power:
UUID:
+
+ This is a sample application using the Bluetooth LE Library.\n\nGithub: https://github.com/alt236/Bluetooth-LE-Library---Android\n\nCopyright: Alexandros Schillings
+
\ No newline at end of file
diff --git a/sample_app/src/uk/co/alt236/btlescan/activities/MainActivity.java b/sample_app/src/uk/co/alt236/btlescan/activities/MainActivity.java
index 0e7e039..b17e5cb 100644
--- a/sample_app/src/uk/co/alt236/btlescan/activities/MainActivity.java
+++ b/sample_app/src/uk/co/alt236/btlescan/activities/MainActivity.java
@@ -6,11 +6,16 @@ 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 android.app.AlertDialog;
import android.app.ListActivity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
+import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
+import android.text.SpannableString;
+import android.text.method.LinkMovementMethod;
+import android.text.util.Linkify;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -44,16 +49,29 @@ public class MainActivity extends ListActivity {
}
};
- @Override
- protected void onListItemClick(ListView l, View v, int position, long id) {
- final BluetoothLeDevice device = mLeDeviceListAdapter.getItem(position);
- if (device == null) return;
+ private void displayAboutDialog(){
+ // REALLY REALLY LAZY LIKIFIED DIALOG
+ final int paddingSizeDp = 5;
+ final float scale = getResources().getDisplayMetrics().density;
+ final int dpAsPixels = (int) (paddingSizeDp * scale + 0.5f);
+ final TextView textView=new TextView(this);
+ final SpannableString text = new SpannableString(getString(R.string.about_dialog_text));
- final Intent intent = new Intent(this, DeviceDetailsActivity.class);
- intent.putExtra(DeviceDetailsActivity.EXTRA_DEVICE, device);
+ textView.setText(text);
+ textView.setAutoLinkMask(RESULT_OK);
+ textView.setMovementMethod(LinkMovementMethod.getInstance());
+ textView.setPadding(dpAsPixels, dpAsPixels, dpAsPixels, dpAsPixels);
- startActivity(intent);
+ Linkify.addLinks(text, Linkify.ALL);
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.menu_about)
+ .setCancelable(false)
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
+ public void onClick(DialogInterface dialog, int id) {}
+ })
+ .setView(textView)
+ .show();
}
@Override
@@ -82,6 +100,18 @@ public class MainActivity extends ListActivity {
return true;
}
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ final BluetoothLeDevice device = mLeDeviceListAdapter.getItem(position);
+ if (device == null) return;
+
+
+ final Intent intent = new Intent(this, DeviceDetailsActivity.class);
+ intent.putExtra(DeviceDetailsActivity.EXTRA_DEVICE, device);
+
+ startActivity(intent);
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
@@ -92,6 +122,9 @@ public class MainActivity extends ListActivity {
mScanner.scanLeDevice(-1, false);
invalidateOptionsMenu();
break;
+ case R.id.menu_about:
+ displayAboutDialog();
+ break;
}
return true;
}