diff --git a/res/values/strings.xml b/res/values/strings.xml
index 9f8cd101..111101ef 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -59,6 +59,7 @@
There is more than one remote keyboard connection, select the device to configure
Remote input
Move a finger on the screen to move the mouse cursor. Tap for a click, and use two/three fingers for right and middle buttons. Use 2 fingers to scroll. Use a long press to drag\'n drop.
+ Keyboard input not supported by the paired device
Set one finger tap action
Set two finger tap action
Set three finger tap action
diff --git a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java
index 45242655..97dc2c47 100644
--- a/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java
+++ b/src/org/kde/kdeconnect/Plugins/MousePadPlugin/MousePadActivity.java
@@ -19,6 +19,7 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
+import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
@@ -171,13 +172,6 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_mousepad, menu);
-
- BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, plugin -> {
- if (!plugin.isKeyboardEnabled()) {
- menu.removeItem(R.id.menu_show_keyboard);
- }
- });
-
return true;
}
@@ -191,12 +185,24 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
sendMiddleClick();
return true;
} else if (id == R.id.menu_show_keyboard) {
- showKeyboard();
+ BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, plugin -> {
+ if (plugin.isKeyboardEnabled()) {
+ showKeyboard();
+ } else {
+ Toast toast = Toast.makeText(this, R.string.mousepad_keyboard_input_not_supported, Toast.LENGTH_SHORT);
+ toast.show();
+ }
+ });
return true;
} else if (id == R.id.menu_open_compose_send) {
- Intent intent = new Intent(this, ComposeSendActivity.class);
- intent.putExtra("org.kde.kdeconnect.Plugins.MousePadPlugin.deviceId", deviceId);
- startActivity(intent);
+ BackgroundService.RunWithPlugin(this, deviceId, MousePadPlugin.class, plugin -> {
+ if (plugin.isKeyboardEnabled()) {
+ showCompose();
+ } else {
+ Toast toast = Toast.makeText(this, R.string.mousepad_keyboard_input_not_supported, Toast.LENGTH_SHORT);
+ toast.show();
+ }
+ });
return true;
} else {
return super.onOptionsItemSelected(item);
@@ -397,6 +403,12 @@ public class MousePadActivity extends AppCompatActivity implements GestureDetect
imm.toggleSoftInputFromWindow(keyListenerView.getWindowToken(), 0, 0);
}
+ private void showCompose() {
+ Intent intent = new Intent(this, ComposeSendActivity.class);
+ intent.putExtra("org.kde.kdeconnect.Plugins.MousePadPlugin.deviceId", deviceId);
+ startActivity(intent);
+ }
+
@Override
public boolean onSupportNavigateUp() {
super.onBackPressed();