This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void provideBluetoothMeasurement(String name, | |
String address, | |
int rssi, | |
byte[] scanRecord); | |
public void provideWifiMeasurement(List<android.net.wifi.ScanResult> scanResults); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mWifiBroadcastReceiver = new BroadcastReceiver() | |
{ | |
@Override public void onReceive(Context c, Intent intent) | |
{ | |
try | |
{ | |
// Your code here | |
} | |
catch (Throwable e) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mRttBroadcastReceiver = new BroadcastReceiver() { | |
@Override public void onReceive(Context context, Intent intent) | |
{ | |
try | |
{ | |
for (ScanResult scanResult: mWifiManager.getScanResults()) | |
{ | |
if (scanResult.is80211mcResponder()) | |
{ | |
RangingRequest.Builder rB = new RangingRequest.Builder(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ForegroundService extends Service { | |
@Override | |
public int onStartCommand(Intent intent, int flags, int startId) { | |
String input = intent.getStringExtra("inputExtra"); | |
createNotificationChannel(); | |
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, YourActivity.class), 0); | |
Notification notification = new NotificationCompat.Builder(this, CHANNEL_ID) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AvatarView extends AppCompatImageView { | |
/* | |
* Path of them image to be clipped (to be shown) | |
* */ | |
Path clipPath; | |
/* | |
* Place holder drawable (with background color and initials) | |
* */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onDraw(Canvas canvas) { | |
if (shape == RECTANGLE) { | |
canvas.drawRoundRect(rectF, cornerRadius, cornerRadius, borderPaint); | |
clipPath.addRoundRect(rectF, cornerRadius, cornerRadius, Path.Direction.CW); | |
} else { | |
canvas.drawCircle(rectF.centerX(), rectF.centerY(), (rectF.height() / 2) - borderWidth, borderPaint); | |
clipPath.addCircle(rectF.centerX(), rectF.centerY(), (rectF.height() / 2), Path.Direction.CW); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Set the canvas bounds here | |
* */ | |
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | |
int screenWidth = MeasureSpec.getSize(widthMeasureSpec); | |
int screenHeight = MeasureSpec.getSize(heightMeasureSpec); | |
rectF.set(0, 0, screenWidth, screenHeight); | |
} |