29 lines
915 B
Kotlin
29 lines
915 B
Kotlin
package com.mozilla.send.sendandroid
|
|
|
|
|
|
import android.support.v7.app.AppCompatActivity
|
|
import android.os.Bundle
|
|
import android.content.Intent
|
|
import android.util.Log
|
|
import android.net.Uri
|
|
|
|
class IntentActivity : AppCompatActivity() {
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
super.onCreate(savedInstanceState)
|
|
val intent = getIntent()
|
|
val action = intent.getAction()
|
|
val type = intent.getType()
|
|
if (Intent.ACTION_SEND.equals(action) && type != null) {
|
|
if ("text/plain".equals(type)) {
|
|
val sharedText = intent.getStringExtra(Intent.EXTRA_TEXT)
|
|
Log.w("INTENT", "text/plain " + sharedText);
|
|
} else if (type.startsWith("image/")) {
|
|
val imageUri = intent.getParcelableExtra(Intent.EXTRA_STREAM) as Uri
|
|
|
|
Log.w("INTENT", "image/ " + imageUri);
|
|
}
|
|
}
|
|
}
|
|
}
|