Skip to content

Commit

Permalink
(reformating)
Browse files Browse the repository at this point in the history
  • Loading branch information
vdeconinck committed May 3, 2023
1 parent 4374524 commit 73cadd2
Showing 1 changed file with 15 additions and 24 deletions.
39 changes: 15 additions & 24 deletions Main/src/main/java/info/deconinck/inclinometer/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,22 @@ public class SplashActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_activity);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {

// 1. Check required permissions (bluetooth & GPS)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
checkPermission(Manifest.permission.BLUETOOTH_SCAN, BLUETOOTH_SCAN_REQUEST_CODE, getString(R.string.bluetooth_scan_permission_text));
checkPermission(Manifest.permission.BLUETOOTH_CONNECT, BLUETOOTH_CONNECT_REQUEST_CODE, getString(R.string.bluetooth_connect_permission_text));
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION, ACCESS_COARSE_LOCATION_REQUEST_CODE, getString(R.string.network_location_permission_text));
checkPermission(Manifest.permission.ACCESS_FINE_LOCATION, ACCESS_FINE_LOCATION_REQUEST_CODE, getString(R.string.gps_location_permission_text));
}


// 2. Start the Data Monitor activity

Intent intent;
intent = new Intent(getApplicationContext(), DataMonitorActivity.class);
startActivity(intent);
finish();
new Handler().postDelayed(() -> {
// 1. Check required permissions (bluetooth & GPS)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
checkPermission(Manifest.permission.BLUETOOTH_SCAN, BLUETOOTH_SCAN_REQUEST_CODE, getString(R.string.bluetooth_scan_permission_text));
checkPermission(Manifest.permission.BLUETOOTH_CONNECT, BLUETOOTH_CONNECT_REQUEST_CODE, getString(R.string.bluetooth_connect_permission_text));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION, ACCESS_COARSE_LOCATION_REQUEST_CODE, getString(R.string.network_location_permission_text));
checkPermission(Manifest.permission.ACCESS_FINE_LOCATION, ACCESS_FINE_LOCATION_REQUEST_CODE, getString(R.string.gps_location_permission_text));
}

// 2. Start the Data Monitor activity
Intent intent;
intent = new Intent(getApplicationContext(), DataMonitorActivity.class);
startActivity(intent);
finish();
}, 500);
}

Expand Down Expand Up @@ -131,5 +123,4 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
}
}
}

}

0 comments on commit 73cadd2

Please sign in to comment.