mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-02 23:25:10 +00:00
Added a send to activity (untested at all)
This commit is contained in:
@@ -117,6 +117,18 @@
|
|||||||
android:value="org.kde.kdeconnect.UserInterface.DeviceActivity" />
|
android:value="org.kde.kdeconnect.UserInterface.DeviceActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:theme="@style/Theme.AppCompat"
|
||||||
|
android:name="org.kde.kdeconnect.Plugins.FileTransferPlugin.ShareToReceiver"
|
||||||
|
android:label="@string/share_to"
|
||||||
|
>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.SEND" />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<data android:mimeType="*/*" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
|
||||||
<service android:name="org.kde.kdeconnect.Plugins.NotificationsPlugin.NotificationReceiver"
|
<service android:name="org.kde.kdeconnect.Plugins.NotificationsPlugin.NotificationReceiver"
|
||||||
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@@ -0,0 +1,55 @@
|
|||||||
|
package org.kde.kdeconnect.Plugins.FileTransferPlugin;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ContentResolver;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import org.apache.mina.util.Base64;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
|
||||||
|
public class ShareToReceiver extends Activity {
|
||||||
|
public void onCreate(Bundle savedInstanceState)
|
||||||
|
{
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
Intent intent = getIntent();
|
||||||
|
Bundle extras = intent.getExtras();
|
||||||
|
String action = intent.getAction();
|
||||||
|
|
||||||
|
// if this is from the share menu
|
||||||
|
if (Intent.ACTION_SEND.equals(action))
|
||||||
|
{
|
||||||
|
if (extras.containsKey(Intent.EXTRA_STREAM))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Get resource path from intent callee
|
||||||
|
Uri uri = (Uri) extras.getParcelable(Intent.EXTRA_STREAM);
|
||||||
|
|
||||||
|
// Query gallery for camera picture via
|
||||||
|
// Android ContentResolver interface
|
||||||
|
ContentResolver cr = getContentResolver();
|
||||||
|
InputStream inputStream = cr.openInputStream(uri);
|
||||||
|
|
||||||
|
//TODO: Send inputStream as payload
|
||||||
|
|
||||||
|
return;
|
||||||
|
} catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.e(this.getClass().getName(), e.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (extras.containsKey(Intent.EXTRA_TEXT))
|
||||||
|
{
|
||||||
|
//TODO: Send text
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@@ -52,5 +52,7 @@
|
|||||||
<string name="mpris_previous">Previous</string>
|
<string name="mpris_previous">Previous</string>
|
||||||
<string name="mpris_next">Next</string>
|
<string name="mpris_next">Next</string>
|
||||||
<string name="mpris_volume">Volume</string>
|
<string name="mpris_volume">Volume</string>
|
||||||
|
<string name="share_to">Share To...</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user