private void setColors() { if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.CallPhone) != (int)Permission.Granted) { telephoneButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings_red); telephoneButton.SetTextColor(Color.White); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) != (int)Permission.Granted) { locationButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings_red); locationButton.SetTextColor(Color.White); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera) != (int)Permission.Granted) { cameraButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings_red); cameraButton.SetTextColor(Color.White); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.SendSms) != (int)Permission.Granted) { SMSButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings_red); SMSButton.SetTextColor(Color.White); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadContacts) != (int)Permission.Granted) { contactsButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings_red); contactsButton.SetTextColor(Color.White); } }
private void checkPermissionStatus() { if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.ReadContacts) == (int)Permission.Granted) { contactsButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings); contactsButton.SetTextColor(Color.Black); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.SendSms) == (int)Permission.Granted) { SMSButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings); SMSButton.SetTextColor(Color.Black); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.Camera) == (int)Permission.Granted) { cameraButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings); cameraButton.SetTextColor(Color.Black); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessFineLocation) == (int)Permission.Granted && ContextCompat.CheckSelfPermission(this, Manifest.Permission.AccessCoarseLocation) == (int)Permission.Granted) { locationButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings); locationButton.SetTextColor(Color.Black); } if (ContextCompat.CheckSelfPermission(this, Manifest.Permission.CallPhone) == (int)Permission.Granted) { telephoneButton.SetBackgroundResource(Resource.Drawable.roundbutton_settings); telephoneButton.SetTextColor(Color.Black); } }