Commit eed77c53 authored by Albert Vaca Cintora's avatar Albert Vaca Cintora

Revert "Stop using ClassIndex, it seems to be causing problems"

This reverts commit 7799f7e8.
parent 3b7edf2d
......@@ -34,7 +34,6 @@ import org.kde.kdeconnect.Helpers.AppsHelper;
import org.kde.kdeconnect.NetworkPacket;
import org.kde.kdeconnect.Plugins.NotificationsPlugin.NotificationReceiver;
import org.kde.kdeconnect.Plugins.Plugin;
import org.kde.kdeconnect.Plugins.PluginFactory;
import org.kde.kdeconnect.UserInterface.AlertDialogFragment;
import org.kde.kdeconnect.UserInterface.StartActivityAlertDialogFragment;
import org.kde.kdeconnect_tp.R;
......@@ -46,7 +45,8 @@ import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@PluginFactory.LoadablePlugin
//FIXME: Breaks on Android 4 because it extends OnActiveSessionsChangedListener
//@PluginFactory.LoadablePlugin
public class MprisReceiverPlugin extends Plugin implements MediaSessionManager.OnActiveSessionsChangedListener {
private final static String PACKET_TYPE_MPRIS = "kdeconnect.mpris";
......
......@@ -24,26 +24,9 @@ import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.Log;
import org.atteo.classindex.ClassIndex;
import org.atteo.classindex.IndexAnnotated;
import org.kde.kdeconnect.Device;
import org.kde.kdeconnect.Plugins.BatteryPlugin.BatteryPlugin;
import org.kde.kdeconnect.Plugins.ClibpoardPlugin.ClipboardPlugin;
import org.kde.kdeconnect.Plugins.ContactsPlugin.ContactsPlugin;
import org.kde.kdeconnect.Plugins.FindMyPhonePlugin.FindMyPhonePlugin;
import org.kde.kdeconnect.Plugins.FindRemoteDevicePlugin.FindRemoteDevicePlugin;
import org.kde.kdeconnect.Plugins.MousePadPlugin.MousePadPlugin;
import org.kde.kdeconnect.Plugins.MprisPlugin.MprisPlugin;
import org.kde.kdeconnect.Plugins.NotificationsPlugin.NotificationsPlugin;
import org.kde.kdeconnect.Plugins.PhotoPlugin.PhotoPlugin;
import org.kde.kdeconnect.Plugins.PingPlugin.PingPlugin;
import org.kde.kdeconnect.Plugins.PresenterPlugin.PresenterPlugin;
import org.kde.kdeconnect.Plugins.ReceiveNotificationsPlugin.ReceiveNotificationsPlugin;
import org.kde.kdeconnect.Plugins.RemoteKeyboardPlugin.RemoteKeyboardPlugin;
import org.kde.kdeconnect.Plugins.RunCommandPlugin.RunCommandPlugin;
import org.kde.kdeconnect.Plugins.SftpPlugin.SftpPlugin;
import org.kde.kdeconnect.Plugins.SharePlugin.SharePlugin;
import org.kde.kdeconnect.Plugins.SystemvolumePlugin.SystemVolumePlugin;
import org.kde.kdeconnect.Plugins.TelephonyPlugin.TelephonyPlugin;
import java.util.Collections;
import java.util.HashSet;
......@@ -127,36 +110,13 @@ public class PluginFactory {
private static final Map<String, PluginInfo> pluginInfo = new ConcurrentHashMap<>();
static Class pluginClasses[] = {
BatteryPlugin.class,
ClipboardPlugin.class,
ContactsPlugin.class,
FindMyPhonePlugin.class,
FindRemoteDevicePlugin.class,
MousePadPlugin.class,
MprisPlugin.class,
//MprisReceiverPlugin.class, //Breaks in Android 4
NotificationsPlugin.class,
PhotoPlugin.class,
PingPlugin.class,
PresenterPlugin.class,
ReceiveNotificationsPlugin.class,
RemoteKeyboardPlugin.class,
RunCommandPlugin.class,
SftpPlugin.class,
SharePlugin.class,
//SMSPlugin.class,
SystemVolumePlugin.class,
TelephonyPlugin.class,
};
public static PluginInfo getPluginInfo(String pluginKey) {
return pluginInfo.get(pluginKey);
}
public static void initPluginInfo(Context context) {
try {
for (Class<?> pluginClass : pluginClasses) {
for (Class<?> pluginClass : ClassIndex.getAnnotated(LoadablePlugin.class)) {
Plugin p = ((Plugin) pluginClass.newInstance());
p.setContext(context, null);
PluginInfo info = new PluginInfo(p.getDisplayName(), p.getDescription(), p.getIcon(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment