- Improved asking of RECORD_AUDIO permission.
This commit is contained in:
@@ -913,8 +913,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
RECORD_PERMISSION_REQUEST_CODE -> {
|
RECORD_PERMISSION_REQUEST_CODE -> {
|
||||||
if ((grantResults.size > 0) && (grantResults[0] != PackageManager.PERMISSION_GRANTED))
|
if ((grantResults.size > 0) && (grantResults[0] != PackageManager.PERMISSION_GRANTED))
|
||||||
Toast.makeText(applicationContext, getString(R.string.no_calls),
|
Utils.alertView(this, getString(R.string.notice),
|
||||||
Toast.LENGTH_LONG).show()
|
getString(R.string.no_calls), ::startBaresip)
|
||||||
|
else
|
||||||
startBaresip()
|
startBaresip()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,12 +50,15 @@ object Utils {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
fun alertView(context: Context, title: String, message: String) {
|
fun alertView(context: Context, title: String, message: String, action: () -> (Unit) = {}) {
|
||||||
val builder = AlertDialog.Builder(context)
|
val builder = AlertDialog.Builder(context)
|
||||||
builder.setTitle(title)
|
builder.setTitle(title)
|
||||||
.setMessage(message)
|
.setMessage(message)
|
||||||
.setPositiveButton(R.string.ok)
|
.setPositiveButton(R.string.ok)
|
||||||
{ dialog, _ -> dialog.dismiss() }
|
{ dialog, _ ->
|
||||||
|
dialog.dismiss()
|
||||||
|
action()
|
||||||
|
}
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user