mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-30 05:37:43 +00:00
Show a toast if keyboard input is not supported
This commit is contained in:
parent
028a2992c9
commit
4be79b52ae
@ -59,6 +59,7 @@
|
||||
<string name="remotekeyboard_multiple_connections" translatable="true">There is more than one remote keyboard connection, select the device to configure</string>
|
||||
<string name="open_mousepad">Remote input</string>
|
||||
<string name="mousepad_info">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.</string>
|
||||
<string name="mousepad_keyboard_input_not_supported">Keyboard input not supported by the paired device</string>
|
||||
<string name="mousepad_single_tap_settings_title">Set one finger tap action</string>
|
||||
<string name="mousepad_double_tap_settings_title">Set two finger tap action</string>
|
||||
<string name="mousepad_triple_tap_settings_title">Set three finger tap action</string>
|
||||
|
@ -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) {
|
||||
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user