Commit b05e9ab1 authored by Jonathan Almeida's avatar Jonathan Almeida Committed by Jonathan Almeida
Browse files

Closes #2968: Specify the activity name in the share item

parent 70453ef2
...@@ -62,7 +62,8 @@ class AppShareAdapter( ...@@ -62,7 +62,8 @@ class AppShareAdapter(
ShareItem( ShareItem(
resolveInfo.loadLabel(context.packageManager).toString(), resolveInfo.loadLabel(context.packageManager).toString(),
resolveInfo.loadIcon(context.packageManager), resolveInfo.loadIcon(context.packageManager),
resolveInfo.activityInfo.packageName resolveInfo.activityInfo.packageName,
resolveInfo.activityInfo.name
) )
} }
...@@ -110,7 +111,7 @@ class AppShareItemViewHolder( ...@@ -110,7 +111,7 @@ class AppShareItemViewHolder(
itemView.setOnClickListener { itemView.setOnClickListener {
Log.d("Jonathan", "${shareItem?.name} clicked.") Log.d("Jonathan", "${shareItem?.name} clicked.")
shareItem?.let { shareItem?.let {
actionEmitter.onNext(ShareAction.ShareAppClicked(it.packageName)) actionEmitter.onNext(ShareAction.ShareAppClicked(it))
} }
} }
} }
...@@ -126,4 +127,4 @@ class AppShareItemViewHolder( ...@@ -126,4 +127,4 @@ class AppShareItemViewHolder(
} }
} }
data class ShareItem(val name: String, val icon: Drawable, val packageName: String) data class ShareItem(val name: String, val icon: Drawable, val packageName: String, val activityName: String)
...@@ -25,7 +25,7 @@ sealed class ShareAction : Action { ...@@ -25,7 +25,7 @@ sealed class ShareAction : Action {
object AddNewDeviceClicked : ShareAction() object AddNewDeviceClicked : ShareAction()
data class ShareDeviceClicked(val device: Device) : ShareAction() data class ShareDeviceClicked(val device: Device) : ShareAction()
data class SendAllClicked(val devices: List<Device>) : ShareAction() data class SendAllClicked(val devices: List<Device>) : ShareAction()
data class ShareAppClicked(val packageName: String) : ShareAction() data class ShareAppClicked(val item: ShareItem) : ShareAction()
} }
class ShareComponent( class ShareComponent(
......
...@@ -126,7 +126,7 @@ class ShareFragment : AppCompatDialogFragment(), CoroutineScope { ...@@ -126,7 +126,7 @@ class ShareFragment : AppCompatDialogFragment(), CoroutineScope {
putExtra(EXTRA_TEXT, shareText) putExtra(EXTRA_TEXT, shareText)
type = "text/plain" type = "text/plain"
flags = FLAG_ACTIVITY_NEW_TASK flags = FLAG_ACTIVITY_NEW_TASK
`package` = it.packageName setClassName(it.item.packageName, it.item.activityName)
} }
startActivity(intent) startActivity(intent)
dismiss() dismiss()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment