mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-22 09:58:08 +00:00
Improve and fixup SendKeystrokesToHostActivity
Changes: 1. Add toolbar 2. Add device icons 3. Fix unexpected on-screen keyboard popping up when starting an activity on some Android versions 4. The distance between the device list and the text box has been reduced
This commit is contained in:
parent
b9a6681a4f
commit
e57e7b0257
@ -1,49 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
android:id="@+id/sendkeystrokes_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:keepScreenOn="true"
|
||||
android:orientation="vertical"
|
||||
android:padding="4dp">
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="org.kde.kdeconnect.Plugins.MousePadPlugin.SendKeystrokesToHostActivity">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="5dp"
|
||||
app:errorEnabled="true">
|
||||
<include layout="@layout/toolbar" android:id="@+id/toolbar_layout" />
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/textToSend"
|
||||
style="@style/Widget.MaterialComponents.TextInputEditText.FilledBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:cursorVisible="true"
|
||||
android:hint="@string/sendkeystrokes_textbox_hint"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:scrollHorizontally="true"
|
||||
android:text="" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
|
||||
<ListView
|
||||
android:id="@+id/devices_list"
|
||||
<LinearLayout
|
||||
android:id="@+id/sendkeystrokes_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:addStatesFromChildren="true"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:keepScreenOn="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="16dip"
|
||||
tools:context=".MainActivity" />
|
||||
android:descendantFocusability="beforeDescendants"
|
||||
android:focusableInTouchMode="true"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.FilledBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="4dp"
|
||||
android:layout_margin="4dp"
|
||||
app:errorEnabled="true">
|
||||
|
||||
</LinearLayout>
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/textToSend"
|
||||
style="@style/Widget.MaterialComponents.TextInputEditText.FilledBox"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:cursorVisible="true"
|
||||
android:hint="@string/sendkeystrokes_textbox_hint"
|
||||
android:inputType="text"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:scrollHorizontally="true"
|
||||
android:text="" />
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/devices_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:addStatesFromChildren="true"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="8dp"
|
||||
tools:context=".MainActivity" />
|
||||
</LinearLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
@ -20,7 +20,7 @@ import org.kde.kdeconnect.BackgroundService;
|
||||
import org.kde.kdeconnect.Device;
|
||||
import org.kde.kdeconnect.Helpers.SafeTextChecker;
|
||||
import org.kde.kdeconnect.NetworkPacket;
|
||||
import org.kde.kdeconnect.UserInterface.List.EntryItem;
|
||||
import org.kde.kdeconnect.UserInterface.List.EntryItemWithIcon;
|
||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
||||
import org.kde.kdeconnect.UserInterface.List.SectionItem;
|
||||
import org.kde.kdeconnect.UserInterface.ThemeUtil;
|
||||
@ -30,6 +30,7 @@ import org.kde.kdeconnect_tp.databinding.ActivitySendkeystrokesBinding;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SendKeystrokesToHostActivity extends AppCompatActivity {
|
||||
@ -51,6 +52,10 @@ public class SendKeystrokesToHostActivity extends AppCompatActivity {
|
||||
|
||||
binding = ActivitySendkeystrokesBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
setSupportActionBar(binding.toolbarLayout.toolbar);
|
||||
Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true);
|
||||
getSupportActionBar().setDisplayShowHomeEnabled(true);
|
||||
}
|
||||
|
||||
|
||||
@ -151,7 +156,7 @@ public class SendKeystrokesToHostActivity extends AppCompatActivity {
|
||||
for (Device d : devices) {
|
||||
if (d.isReachable() && d.isPaired()) {
|
||||
devicesList.add(d);
|
||||
items.add(new EntryItem(d.getName()));
|
||||
items.add(new EntryItemWithIcon(d.getName(), d.getIcon()));
|
||||
section.isEmpty = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user