mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-02 15:15:09 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
db3f8f7f74 | ||
|
60ecec9751 | ||
|
6cf0ef79b2 | ||
|
2d55f282a8 | ||
|
5ef7154d5e | ||
|
1c137d5ca8 |
@@ -2,8 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
package="org.kde.kdeconnect_tp"
|
package="org.kde.kdeconnect_tp"
|
||||||
android:versionCode="11900"
|
android:versionCode="11910"
|
||||||
android:versionName="1.19">
|
android:versionName="1.19.1">
|
||||||
|
|
||||||
<supports-screens
|
<supports-screens
|
||||||
android:anyDensity="true"
|
android:anyDensity="true"
|
||||||
@@ -405,7 +405,7 @@
|
|||||||
<action android:name="android.service.quicksettings.action.QS_TILE" />
|
<action android:name="android.service.quicksettings.action.QS_TILE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service android:name="org.kde.kdeconnect.Plugins.RunCommandPlugin.RunCommandControlsProviderService" android:label="@string/kde_connect"
|
<service android:name="org.kde.kdeconnect.Plugins.RunCommandPlugin.RunCommandControlsProviderService" android:label="@string/kde_connect"
|
||||||
android:permission="android.permission.BIND_CONTROLS">
|
android:permission="android.permission.BIND_CONTROLS">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@@ -138,7 +138,7 @@ Provider<String> gitHashProvider = project.provider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
coroutines_version = '1.5.0'
|
coroutines_version = '1.6.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
tools:context="org.kde.kdeconnect.Plugins.MprisPlugin.MprisActivity">
|
|
||||||
|
|
||||||
<include layout="@layout/toolbar" android:id="@+id/toolbar_layout" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingBottom="25dp"
|
|
||||||
android:paddingLeft="25dp"
|
|
||||||
android:paddingRight="25dp"
|
|
||||||
android:paddingTop="25dp"
|
|
||||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/album_art"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginRight="25dp"
|
|
||||||
android:layout_marginEnd="25dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:contentDescription="@string/mpris_coverart_description"
|
|
||||||
android:scaleType="fitCenter" />
|
|
||||||
|
|
||||||
<include
|
|
||||||
layout="@layout/mpris_control"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="1" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
|
@@ -377,6 +377,10 @@
|
|||||||
<string name="konqi">Konqi</string>
|
<string name="konqi">Konqi</string>
|
||||||
<string name="rise_up">Levantar</string>
|
<string name="rise_up">Levantar</string>
|
||||||
<string name="rise_down">Bajar</string>
|
<string name="rise_down">Bajar</string>
|
||||||
|
<string name="click_here_to_type">Pulse para escribir</string>
|
||||||
|
<string name="clear_compose">Borrar</string>
|
||||||
|
<string name="send_compose">Enviar</string>
|
||||||
|
<string name="open_compose_send">Componer texto</string>
|
||||||
<string name="app_description">Aplicación multi-plataforma que permite a sus dispositivos comunicarse (por ejemplo entre su teléfono y su equipo)</string>
|
<string name="app_description">Aplicación multi-plataforma que permite a sus dispositivos comunicarse (por ejemplo entre su teléfono y su equipo)</string>
|
||||||
<string name="about_kde_about"><h1>Acerca de</h1> <p>KDE es una comunidad global de ingenieros software, artistas, escritores, traductores y creadores que siguen el desarrollo de <a href=https://www.gnu.org/philosophy/free-sw.html>Software Libre</a>. KDE produce el entorno de escritorio Plasma, cientos de aplicaciones y todas las librerías en las que se basan.</p> <p>KDE es una empresa colaborativa: no hay una entidad única que controla sus productos o su dirección. En su lugar, trabajamos de manera conjunta para conseguir la meta común de construir el mejor software libre posible. Todo el mundo es bienvenido a <a href=https://community.kde.org/Get_Involved>unirse y contribuir</a> a KDE, incluido usted.</p> Visite <a href=https://www.kde.org/>https://www.kde.org/</a> para más información sobre la comunidad KDE y el software que creamos.</string>
|
<string name="about_kde_about"><h1>Acerca de</h1> <p>KDE es una comunidad global de ingenieros software, artistas, escritores, traductores y creadores que siguen el desarrollo de <a href=https://www.gnu.org/philosophy/free-sw.html>Software Libre</a>. KDE produce el entorno de escritorio Plasma, cientos de aplicaciones y todas las librerías en las que se basan.</p> <p>KDE es una empresa colaborativa: no hay una entidad única que controla sus productos o su dirección. En su lugar, trabajamos de manera conjunta para conseguir la meta común de construir el mejor software libre posible. Todo el mundo es bienvenido a <a href=https://community.kde.org/Get_Involved>unirse y contribuir</a> a KDE, incluido usted.</p> Visite <a href=https://www.kde.org/>https://www.kde.org/</a> para más información sobre la comunidad KDE y el software que creamos.</string>
|
||||||
<string name="about_kde_report_bugs_or_wishes"><h1>Reporte errores o deseos</h1> <p>El software siempre puede ser mejorado y el equipo de KDE está preparado para ello. Sin embargo, usted - el usuario - debe comunicarnos cuando algo no funciona como es esperado o que puede ser mejorado. </p> <p> KDE tiene un sistema de traqueo de errores. Visite <a href=https://bugs.kde.org/>https://bugs.kde.org/</a> o use el botón «Informar de fallo» en la ventana «Acerca de» para reportar errores.</p> Si tiene una sugerencia de mejora entonces use el sistema de traqueo de errores para registrar su sugerencia. Asegúrese de que usa la severidad «Lista de deseos».</string>
|
<string name="about_kde_report_bugs_or_wishes"><h1>Reporte errores o deseos</h1> <p>El software siempre puede ser mejorado y el equipo de KDE está preparado para ello. Sin embargo, usted - el usuario - debe comunicarnos cuando algo no funciona como es esperado o que puede ser mejorado. </p> <p> KDE tiene un sistema de traqueo de errores. Visite <a href=https://bugs.kde.org/>https://bugs.kde.org/</a> o use el botón «Informar de fallo» en la ventana «Acerca de» para reportar errores.</p> Si tiene una sugerencia de mejora entonces use el sistema de traqueo de errores para registrar su sugerencia. Asegúrese de que usa la severidad «Lista de deseos».</string>
|
||||||
@@ -394,4 +398,5 @@
|
|||||||
<string name="saikrishna_arcot_task">Soporte para usar el teclado en el complemento de entrada remota, arreglos y mejoras generales</string>
|
<string name="saikrishna_arcot_task">Soporte para usar el teclado en el complemento de entrada remota, arreglos y mejoras generales</string>
|
||||||
<string name="everyone_else">Todos los demás que han contribuido a KDE Connect a lo largo de su historia</string>
|
<string name="everyone_else">Todos los demás que han contribuido a KDE Connect a lo largo de su historia</string>
|
||||||
<string name="send_clipboard">Enviar al portapapeles</string>
|
<string name="send_clipboard">Enviar al portapapeles</string>
|
||||||
|
<string name="tap_to_execute">Pulse para ejecutar</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
@@ -281,7 +281,7 @@ public class BluetoothLinkProvider extends BaseLinkProvider {
|
|||||||
@TargetApi(value = Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
|
@TargetApi(value = Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String action = intent.getAction();
|
String action = intent.getAction();
|
||||||
if (action.equals(BluetoothDevice.ACTION_UUID)) {
|
if (BluetoothDevice.ACTION_UUID.equals(action)) {
|
||||||
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
|
||||||
Parcelable[] activeUuids = intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);
|
Parcelable[] activeUuids = intent.getParcelableArrayExtra(BluetoothDevice.EXTRA_UUID);
|
||||||
|
|
||||||
|
@@ -395,7 +395,7 @@ public class TelephonyHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ApnSetting() {};
|
private ApnSetting() {}
|
||||||
|
|
||||||
public Uri getMmsc() {
|
public Uri getMmsc() {
|
||||||
return mmscUri;
|
return mmscUri;
|
||||||
|
@@ -15,7 +15,7 @@ public class ASUUtils {
|
|||||||
* Implementation of SignalStrength.toLevel usable from API Level 7+
|
* Implementation of SignalStrength.toLevel usable from API Level 7+
|
||||||
*/
|
*/
|
||||||
public static int signalStrengthToLevel(SignalStrength signalStrength) {
|
public static int signalStrengthToLevel(SignalStrength signalStrength) {
|
||||||
int level = 0;
|
int level;
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
level = signalStrength.getLevel();
|
level = signalStrength.getLevel();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -229,7 +229,7 @@ public class ConnectivityReportPlugin extends Plugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPacketReceived(NetworkPacket np) {
|
public boolean onPacketReceived(NetworkPacket np) {
|
||||||
if (np.getType() == PACKET_TYPE_CONNECTIVITY_REPORT_REQUEST) {
|
if (PACKET_TYPE_CONNECTIVITY_REPORT_REQUEST.equals(np.getType())) {
|
||||||
Log.i("ConnectivityReport", "Requested");
|
Log.i("ConnectivityReport", "Requested");
|
||||||
serializeSignalStrengths();
|
serializeSignalStrengths();
|
||||||
device.sendPacket(connectivityInfo);
|
device.sendPacket(connectivityInfo);
|
||||||
|
@@ -55,7 +55,6 @@ public class FindMyPhonePlugin extends Plugin {
|
|||||||
case Tablet:
|
case Tablet:
|
||||||
return context.getString(R.string.findmyphone_title_tablet);
|
return context.getString(R.string.findmyphone_title_tablet);
|
||||||
case Phone:
|
case Phone:
|
||||||
return context.getString(R.string.findmyphone_title);
|
|
||||||
default:
|
default:
|
||||||
return context.getString(R.string.findmyphone_title);
|
return context.getString(R.string.findmyphone_title);
|
||||||
}
|
}
|
||||||
|
@@ -152,6 +152,7 @@ public class PointerAccelerationProfileFactory {
|
|||||||
public static PointerAccelerationProfile getProfileWithName(String name) {
|
public static PointerAccelerationProfile getProfileWithName(String name) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case "noacceleration":
|
case "noacceleration":
|
||||||
|
default:
|
||||||
return new DefaultProfile();
|
return new DefaultProfile();
|
||||||
case "weaker":
|
case "weaker":
|
||||||
return new PolynomialProfile(0.25f);
|
return new PolynomialProfile(0.25f);
|
||||||
@@ -163,8 +164,6 @@ public class PointerAccelerationProfileFactory {
|
|||||||
return new PolynomialProfile(1.5f);
|
return new PolynomialProfile(1.5f);
|
||||||
case "stronger":
|
case "stronger":
|
||||||
return new PolynomialProfile(2.0f);
|
return new PolynomialProfile(2.0f);
|
||||||
default:
|
|
||||||
return new DefaultProfile();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -77,9 +77,7 @@ public class MprisActivity extends AppCompatActivity {
|
|||||||
TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(
|
TabLayoutMediator tabLayoutMediator = new TabLayoutMediator(
|
||||||
activityMprisBinding.mprisTabs,
|
activityMprisBinding.mprisTabs,
|
||||||
activityMprisBinding.mprisPager,
|
activityMprisBinding.mprisPager,
|
||||||
(tab, position) -> {
|
(tab, position) -> tab.setText(mprisPagerAdapter.getTitle(position))
|
||||||
tab.setText(mprisPagerAdapter.getTitle(position));
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
activityMprisBinding.mprisTabs.getSelectedTabPosition();
|
activityMprisBinding.mprisTabs.getSelectedTabPosition();
|
||||||
|
@@ -427,11 +427,7 @@ public class MprisMediaSession implements SharedPreferences.OnSharedPreferenceCh
|
|||||||
mediaSession.setPlaybackState(playbackState.build());
|
mediaSession.setPlaybackState(playbackState.build());
|
||||||
|
|
||||||
//Only allow deletion if no music is notificationPlayer
|
//Only allow deletion if no music is notificationPlayer
|
||||||
if (notificationPlayer.isPlaying()) {
|
notification.setOngoing(notificationPlayer.isPlaying());
|
||||||
notification.setOngoing(true);
|
|
||||||
} else {
|
|
||||||
notification.setOngoing(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Use the MediaStyle notification, so it feels like other media players. That also allows adding actions
|
//Use the MediaStyle notification, so it feels like other media players. That also allows adding actions
|
||||||
MediaStyle mediaStyle = new MediaStyle();
|
MediaStyle mediaStyle = new MediaStyle();
|
||||||
|
@@ -80,7 +80,7 @@ public class MprisPlugin extends Plugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean isSpotify() {
|
boolean isSpotify() {
|
||||||
return getPlayer().toLowerCase().equals("spotify");
|
return getPlayer().equalsIgnoreCase("spotify");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLoopStatus() {
|
public String getLoopStatus() {
|
||||||
|
@@ -117,8 +117,8 @@ public class RemoteKeyboardPlugin extends Plugin implements SharedPreferences.On
|
|||||||
PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this);
|
PreferenceManager.getDefaultSharedPreferences(context).registerOnSharedPreferenceChangeListener(this);
|
||||||
|
|
||||||
final boolean editingOnly = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.remotekeyboard_editing_only), true);
|
final boolean editingOnly = PreferenceManager.getDefaultSharedPreferences(context).getBoolean(context.getString(R.string.remotekeyboard_editing_only), true);
|
||||||
if (RemoteKeyboardService.instance != null)
|
final boolean visible = RemoteKeyboardService.instance != null && RemoteKeyboardService.instance.visible;
|
||||||
notifyKeyboardState(editingOnly ? RemoteKeyboardService.instance.visible : true);
|
notifyKeyboardState(!editingOnly || visible);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -414,7 +414,8 @@ public class RemoteKeyboardPlugin extends Plugin implements SharedPreferences.On
|
|||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
||||||
if (key.equals(context.getString(R.string.remotekeyboard_editing_only))) {
|
if (key.equals(context.getString(R.string.remotekeyboard_editing_only))) {
|
||||||
final boolean editingOnly = sharedPreferences.getBoolean(context.getString(R.string.remotekeyboard_editing_only), true);
|
final boolean editingOnly = sharedPreferences.getBoolean(context.getString(R.string.remotekeyboard_editing_only), true);
|
||||||
notifyKeyboardState(editingOnly ? RemoteKeyboardService.instance.visible : true);
|
final boolean visible = RemoteKeyboardService.instance != null && RemoteKeyboardService.instance.visible;
|
||||||
|
notifyKeyboardState(!editingOnly || visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -140,7 +140,9 @@ class RunCommandControlsProviderService : ControlsProviderService() {
|
|||||||
private fun getAllCommandsList(): List<CommandEntryWithDevice> {
|
private fun getAllCommandsList(): List<CommandEntryWithDevice> {
|
||||||
val commandList = mutableListOf<CommandEntryWithDevice>()
|
val commandList = mutableListOf<CommandEntryWithDevice>()
|
||||||
|
|
||||||
for (device in BackgroundService.getInstance().devices.values) {
|
val service = BackgroundService.getInstance() ?: return commandList
|
||||||
|
|
||||||
|
for (device in service.devices.values) {
|
||||||
if (!device.isReachable) {
|
if (!device.isReachable) {
|
||||||
commandList.addAll(getSavedCommandsList(device))
|
commandList.addAll(getSavedCommandsList(device))
|
||||||
continue
|
continue
|
||||||
|
@@ -511,7 +511,7 @@ public class SMSPlugin extends Plugin {
|
|||||||
private boolean handleRequestSingleConversation(NetworkPacket packet) {
|
private boolean handleRequestSingleConversation(NetworkPacket packet) {
|
||||||
SMSHelper.ThreadID threadID = new SMSHelper.ThreadID(packet.getLong("threadID"));
|
SMSHelper.ThreadID threadID = new SMSHelper.ThreadID(packet.getLong("threadID"));
|
||||||
|
|
||||||
Long rangeStartTimestamp = packet.getLong("rangeStartTimestamp", -1);
|
long rangeStartTimestamp = packet.getLong("rangeStartTimestamp", -1);
|
||||||
Long numberToGet = packet.getLong("numberToRequest", -1);
|
Long numberToGet = packet.getLong("numberToRequest", -1);
|
||||||
|
|
||||||
if (numberToGet < 0) {
|
if (numberToGet < 0) {
|
||||||
|
@@ -99,7 +99,7 @@ public class AndroidSafFileSystemView implements FileSystemView {
|
|||||||
String treeDocumentId = DocumentsContract.getTreeDocumentId(treeUri);
|
String treeDocumentId = DocumentsContract.getTreeDocumentId(treeUri);
|
||||||
File nameWithoutRootFile = new File(nameWithoutRoot);
|
File nameWithoutRootFile = new File(nameWithoutRoot);
|
||||||
String parentSuffix = nameWithoutRootFile.getParent();
|
String parentSuffix = nameWithoutRootFile.getParent();
|
||||||
String parentDocumentId = treeDocumentId + (parentSuffix.equals("/") ? "" : parentSuffix);
|
String parentDocumentId = treeDocumentId + ("/".equals(parentSuffix) ? "" : parentSuffix);
|
||||||
|
|
||||||
Uri parentUri = DocumentsContract.buildDocumentUriUsingTree(treeUri, parentDocumentId);
|
Uri parentUri = DocumentsContract.buildDocumentUriUsingTree(treeUri, parentDocumentId);
|
||||||
|
|
||||||
|
@@ -277,7 +277,7 @@ public class StoragePreferenceDialogFragment extends PreferenceDialogFragmentCom
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FileSeparatorCharFilter implements InputFilter {
|
private static class FileSeparatorCharFilter implements InputFilter {
|
||||||
//TODO: Add more chars to refuse?
|
//TODO: Add more chars to refuse?
|
||||||
//https://www.cyberciti.biz/faq/linuxunix-rules-for-naming-file-and-directory-names/
|
//https://www.cyberciti.biz/faq/linuxunix-rules-for-naming-file-and-directory-names/
|
||||||
String notAllowed = "/\\><|:&?*";
|
String notAllowed = "/\\><|:&?*";
|
||||||
|
@@ -214,7 +214,7 @@ public class CustomDevicesActivity extends AppCompatActivity implements CustomDe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DeletedCustomDevice {
|
private static class DeletedCustomDevice {
|
||||||
@NonNull String hostnameOrIP;
|
@NonNull String hostnameOrIP;
|
||||||
int position;
|
int position;
|
||||||
|
|
||||||
|
@@ -8,7 +8,6 @@ package org.kde.kdeconnect.UserInterface;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
@@ -24,22 +23,16 @@ import androidx.appcompat.app.AlertDialog;
|
|||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.klinker.android.send_message.Utils;
|
|
||||||
|
|
||||||
import org.kde.kdeconnect.BackgroundService;
|
import org.kde.kdeconnect.BackgroundService;
|
||||||
import org.kde.kdeconnect.Device;
|
import org.kde.kdeconnect.Device;
|
||||||
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
|
import org.kde.kdeconnect.Helpers.SecurityHelpers.SslHelper;
|
||||||
import org.kde.kdeconnect.Helpers.TelephonyHelper;
|
|
||||||
import org.kde.kdeconnect.NetworkPacket;
|
|
||||||
import org.kde.kdeconnect.Plugins.BatteryPlugin.BatteryPlugin;
|
import org.kde.kdeconnect.Plugins.BatteryPlugin.BatteryPlugin;
|
||||||
import org.kde.kdeconnect.Plugins.BatteryPlugin.DeviceBatteryInfo;
|
import org.kde.kdeconnect.Plugins.BatteryPlugin.DeviceBatteryInfo;
|
||||||
import org.kde.kdeconnect.Plugins.Plugin;
|
import org.kde.kdeconnect.Plugins.Plugin;
|
||||||
import org.kde.kdeconnect.Plugins.SMSPlugin.SMSPlugin;
|
|
||||||
import org.kde.kdeconnect.UserInterface.List.FailedPluginListItem;
|
import org.kde.kdeconnect.UserInterface.List.FailedPluginListItem;
|
||||||
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
import org.kde.kdeconnect.UserInterface.List.ListAdapter;
|
||||||
import org.kde.kdeconnect.UserInterface.List.PluginItem;
|
import org.kde.kdeconnect.UserInterface.List.PluginItem;
|
||||||
import org.kde.kdeconnect.UserInterface.List.PluginListHeaderItem;
|
import org.kde.kdeconnect.UserInterface.List.PluginListHeaderItem;
|
||||||
import org.kde.kdeconnect.UserInterface.List.SetDefaultAppPluginListItem;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
import org.kde.kdeconnect_tp.databinding.ActivityDeviceBinding;
|
import org.kde.kdeconnect_tp.databinding.ActivityDeviceBinding;
|
||||||
import org.kde.kdeconnect_tp.databinding.ViewPairErrorBinding;
|
import org.kde.kdeconnect_tp.databinding.ViewPairErrorBinding;
|
||||||
@@ -48,7 +41,6 @@ import org.kde.kdeconnect_tp.databinding.ViewPairRequestBinding;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.ConcurrentModificationException;
|
import java.util.ConcurrentModificationException;
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
|
||||||
@@ -277,7 +269,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void refreshUI() {
|
private void refreshUI() {
|
||||||
if (device == null || binding == null || binding.getRoot() == null) {
|
if (device == null || binding == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -366,7 +358,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void pairingFailed(final String error) {
|
public void pairingFailed(final String error) {
|
||||||
mActivity.runOnUiThread(() -> {
|
mActivity.runOnUiThread(() -> {
|
||||||
if (binding == null || binding.getRoot() == null) return;
|
if (binding == null) return;
|
||||||
binding.pairMessage.setText(error);
|
binding.pairMessage.setText(error);
|
||||||
binding.pairVerification.setText("");
|
binding.pairVerification.setText("");
|
||||||
binding.pairVerification.setVisibility(View.GONE);
|
binding.pairVerification.setVisibility(View.GONE);
|
||||||
@@ -380,7 +372,7 @@ public class DeviceFragment extends Fragment {
|
|||||||
@Override
|
@Override
|
||||||
public void unpaired() {
|
public void unpaired() {
|
||||||
mActivity.runOnUiThread(() -> {
|
mActivity.runOnUiThread(() -> {
|
||||||
if (binding == null || binding.getRoot() == null) return;
|
if (binding == null) return;
|
||||||
binding.pairMessage.setText(R.string.device_not_paired);
|
binding.pairMessage.setText(R.string.device_not_paired);
|
||||||
binding.pairVerification.setVisibility(View.GONE);
|
binding.pairVerification.setVisibility(View.GONE);
|
||||||
binding.pairProgress.setVisibility(View.GONE);
|
binding.pairProgress.setVisibility(View.GONE);
|
||||||
|
@@ -17,24 +17,19 @@ import org.kde.kdeconnect.Plugins.Plugin;
|
|||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
import org.kde.kdeconnect_tp.databinding.ListItemWithIconEntryBinding;
|
import org.kde.kdeconnect_tp.databinding.ListItemWithIconEntryBinding;
|
||||||
|
|
||||||
public class PluginItem implements ListAdapter.Item {
|
public class PluginItem extends EntryItemWithIcon {
|
||||||
private final Plugin plugin;
|
|
||||||
private final View.OnClickListener clickListener;
|
private final View.OnClickListener clickListener;
|
||||||
|
|
||||||
public PluginItem(Plugin p, View.OnClickListener clickListener) {
|
public PluginItem(Plugin p, View.OnClickListener clickListener) {
|
||||||
this.plugin = p;
|
super(p.getActionName(), p.getIcon());
|
||||||
this.clickListener = clickListener;
|
this.clickListener = clickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public View inflateView(@NonNull LayoutInflater layoutInflater) {
|
public View inflateView(@NonNull LayoutInflater layoutInflater) {
|
||||||
final ListItemWithIconEntryBinding binding = ListItemWithIconEntryBinding.inflate(layoutInflater);
|
final View root = super.inflateView(layoutInflater);
|
||||||
|
root.setOnClickListener(clickListener);
|
||||||
binding.listItemEntryTitle.setText(plugin.getActionName());
|
return root;
|
||||||
binding.listItemEntryIcon.setImageDrawable(plugin.getIcon());
|
|
||||||
binding.getRoot().setOnClickListener(clickListener);
|
|
||||||
|
|
||||||
return binding.getRoot();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -77,8 +77,8 @@ public class MainActivity extends AppCompatActivity implements SharedPreferences
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
ThemeUtil.setUserPreferredTheme(this);
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
ThemeUtil.setUserPreferredTheme(this); // Workaround: If the activity starts in landscape orientation and we call this before super.onCreate, the PluginItem entries appears with white on white background
|
||||||
|
|
||||||
final ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
|
final ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||||
setContentView(binding.getRoot());
|
setContentView(binding.getRoot());
|
||||||
|
Reference in New Issue
Block a user