mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-23 19:48:30 +00:00
Fixed launcher shortcuts that weren't working anymore
This commit is contained in:
parent
92957bf1d2
commit
226abd9e19
1 changed files with 51 additions and 40 deletions
|
|
@ -164,7 +164,10 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
override fun onNewIntent(intent: Intent?) {
|
override fun onNewIntent(intent: Intent?) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
|
|
||||||
if (intent != null) handleIntentParams(intent)
|
if (intent != null) {
|
||||||
|
Log.d("[Main Activity] Found new intent")
|
||||||
|
handleIntentParams(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
@ -212,7 +215,10 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
|
|
||||||
initOverlay()
|
initOverlay()
|
||||||
|
|
||||||
if (intent != null) handleIntentParams(intent)
|
if (intent != null) {
|
||||||
|
Log.d("[Main Activity] Found post create intent")
|
||||||
|
handleIntentParams(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
|
@ -252,17 +258,10 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleIntentParams(intent: Intent) {
|
private fun handleIntentParams(intent: Intent) {
|
||||||
|
Log.i("[Main Activity] Handling intent with action [${intent.action}], type [${intent.type}] and data [${intent.data}]")
|
||||||
|
|
||||||
when (intent.action) {
|
when (intent.action) {
|
||||||
Intent.ACTION_MAIN -> {
|
Intent.ACTION_MAIN -> handleMainIntent(intent)
|
||||||
val core = coreContext.core
|
|
||||||
val call = core.currentCall ?: core.calls.firstOrNull()
|
|
||||||
if (call != null) {
|
|
||||||
Log.i("[Main Activity] Launcher clicked while there is at least one active call, go to CallActivity")
|
|
||||||
val callIntent = Intent(this, org.linphone.activities.voip.CallActivity::class.java)
|
|
||||||
callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
|
||||||
startActivity(callIntent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Intent.ACTION_SEND, Intent.ACTION_SENDTO -> {
|
Intent.ACTION_SEND, Intent.ACTION_SENDTO -> {
|
||||||
if (intent.type == "text/plain") {
|
if (intent.type == "text/plain") {
|
||||||
handleSendText(intent)
|
handleSendText(intent)
|
||||||
|
|
@ -307,7 +306,16 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
handleLocusOrShortcut(locus)
|
handleLocusOrShortcut(locus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else -> {
|
else -> handleMainIntent(intent)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prevent this intent to be processed again
|
||||||
|
intent.action = null
|
||||||
|
intent.data = null
|
||||||
|
intent.extras?.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun handleMainIntent(intent: Intent) {
|
||||||
when {
|
when {
|
||||||
intent.hasExtra("ContactId") -> {
|
intent.hasExtra("ContactId") -> {
|
||||||
val id = intent.getStringExtra("ContactId")
|
val id = intent.getStringExtra("ContactId")
|
||||||
|
|
@ -333,14 +341,17 @@ class MainActivity : GenericActivity(), SnackBarActivity, NavController.OnDestin
|
||||||
args.putBoolean("Transfer", intent.getBooleanExtra("Transfer", false))
|
args.putBoolean("Transfer", intent.getBooleanExtra("Transfer", false))
|
||||||
navigateToDialer(args)
|
navigateToDialer(args)
|
||||||
}
|
}
|
||||||
|
else -> {
|
||||||
|
val core = coreContext.core
|
||||||
|
val call = core.currentCall ?: core.calls.firstOrNull()
|
||||||
|
if (call != null) {
|
||||||
|
Log.i("[Main Activity] Launcher clicked while there is at least one active call, go to CallActivity")
|
||||||
|
val callIntent = Intent(this, org.linphone.activities.voip.CallActivity::class.java)
|
||||||
|
callIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
|
||||||
|
startActivity(callIntent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent this intent to be processed again
|
|
||||||
intent.action = null
|
|
||||||
intent.data = null
|
|
||||||
intent.extras?.clear()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handleTelOrSipUri(uri: Uri) {
|
private fun handleTelOrSipUri(uri: Uri) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue