Skip to content

Commit

Permalink
fixed more issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nisrulz committed Mar 6, 2017
1 parent aacadc3 commit 471f122
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 27 deletions.
1 change: 1 addition & 0 deletions app/src/main/res/layout/activity_splash.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
android:layout_height="match_parent"
android:layout_above="@+id/btn_req"
android:scaleType="center"
android:contentDescription="Logo"
android:src="@mipmap/ic_launcher"
/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,8 @@ public final String getBluetoothMAC() {
* @return true if the device has a Bluetooth LE compatible chipset
*/
public final boolean hasBluetoothLe() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
}else{
return false;
}
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2
&& context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE);
}

/**
Expand All @@ -89,10 +86,8 @@ public final boolean hasBluetoothLe() {
*/
@RequiresPermission(Manifest.permission.BLUETOOTH)
public final boolean hasBluetoothLeAdvertising() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
return hasBluetoothLe() && BluetoothAdapter.getDefaultAdapter()
.isMultipleAdvertisementSupported();
}
return false;
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& hasBluetoothLe()
&& BluetoothAdapter.getDefaultAdapter().isMultipleAdvertisementSupported();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class EasyFingerprintMod {
/**
* Instantiates a new Easy fingerprint mod.
*
* You need to declare the below permission in the manifest file to use this properly
*
* <uses-permission android:name="android.permission.USE_FINGERPRINT" />
*
* @param context
* the context
*/
Expand All @@ -48,32 +52,30 @@ public EasyFingerprintMod(final Context context) {
/**
* Is fingerprint sensor present boolean.
*
* You need to declare the below permission in the manifest file to use this properly
*
* <uses-permission android:name="android.permission.USE_FINGERPRINT" />
*
* @return the boolean
*/
@SuppressLint("NewApi")
@RequiresPermission(Manifest.permission.USE_FINGERPRINT)
public final boolean isFingerprintSensorPresent() {
if (fingerprintManager != null) {
return fingerprintManager.isHardwareDetected();
}
else {
return false;
}
return fingerprintManager != null && fingerprintManager.isHardwareDetected();
}

/**
* Are fingerprints enrolled boolean.
*
* You need to declare the below permission in the manifest file to use this properly
*
* <uses-permission android:name="android.permission.USE_FINGERPRINT" />
*
* @return the boolean
*/
@SuppressLint("NewApi")
@RequiresPermission(Manifest.permission.USE_FINGERPRINT)
public final boolean areFingerprintsEnrolled() {
if (fingerprintManager != null) {
return fingerprintManager.hasEnrolledFingerprints();
}
else {
return false;
}
return fingerprintManager != null && fingerprintManager.hasEnrolledFingerprints();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public final String getWifiSSID() {
result = null;
}

if (networkInfo.isConnected()) {
if (networkInfo != null ? networkInfo.isConnected() : false) {
final WifiManager wifiManager =
(WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
final WifiInfo connectionInfo = wifiManager.getConnectionInfo();
Expand All @@ -320,7 +320,6 @@ public final String getWifiSSID() {
return CheckValidityUtil.checkValidData(result);
}


/**
* Gets BSSID of Connected WiFi
*
Expand All @@ -344,7 +343,7 @@ public final String getWifiBSSID() {
result = null;
}

if (networkInfo.isConnected()) {
if (networkInfo != null ? networkInfo.isConnected() : false) {
final WifiManager wifiManager =
(WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
final WifiInfo connectionInfo = wifiManager.getConnectionInfo();
Expand All @@ -356,7 +355,6 @@ public final String getWifiBSSID() {
return CheckValidityUtil.checkValidData(result);
}


/**
* Gets Link Speed of Connected WiFi
*
Expand All @@ -380,7 +378,7 @@ public final String getWifiLinkSpeed() {
result = null;
}

if (networkInfo.isConnected()) {
if (networkInfo != null ? networkInfo.isConnected() : false) {
final WifiManager wifiManager =
(WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE);
final WifiInfo connectionInfo = wifiManager.getConnectionInfo();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,28 @@
import android.hardware.SensorManager;
import java.util.List;

/**
* The type Easy sensor mod.
*/
public class EasySensorMod {

private final SensorManager sensorManager;

/**
* Instantiates a new Easy sensor mod.
*
* @param context
* the context
*/
public EasySensorMod(final Context context) {
sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
}

/**
* Gets all sensors.
*
* @return the all sensors
*/
public List<Sensor> getAllSensors() {
return sensorManager.getSensorList(Sensor.TYPE_ALL);
}
Expand Down

0 comments on commit 471f122

Please sign in to comment.