mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-08-28 20:57:42 +00:00
Simplify code in createPluginList
This commit is contained in:
parent
260abb192c
commit
1ffcaba71c
@ -48,13 +48,11 @@ import org.kde.kdeconnect.UserInterface.List.CustomItem;
|
|||||||
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.SmallEntryItem;
|
|
||||||
import org.kde.kdeconnect_tp.R;
|
import org.kde.kdeconnect_tp.R;
|
||||||
|
|
||||||
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.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import butterknife.BindView;
|
import butterknife.BindView;
|
||||||
@ -404,7 +402,8 @@ public class DeviceFragment extends Fragment {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private void createPluginsList(ConcurrentHashMap<String, Plugin> plugins, int headerText, FailedPluginListItem.Action action) {
|
private void createPluginsList(ConcurrentHashMap<String, Plugin> plugins, int headerText, FailedPluginListItem.Action action) {
|
||||||
if (!plugins.isEmpty()) {
|
if (plugins.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
TextView header = new TextView(mActivity);
|
TextView header = new TextView(mActivity);
|
||||||
header.setPadding(
|
header.setPadding(
|
||||||
@ -418,17 +417,12 @@ public class DeviceFragment extends Fragment {
|
|||||||
header.setText(headerText);
|
header.setText(headerText);
|
||||||
|
|
||||||
pluginListItems.add(new CustomItem(header));
|
pluginListItems.add(new CustomItem(header));
|
||||||
for (Map.Entry<String, Plugin> entry : plugins.entrySet()) {
|
|
||||||
String pluginKey = entry.getKey();
|
for (Plugin plugin : plugins.values()) {
|
||||||
final Plugin plugin = entry.getValue();
|
if (!device.isPluginEnabled(plugin.getPluginKey())) {
|
||||||
if (device.isPluginEnabled(pluginKey)) {
|
continue;
|
||||||
if (plugin == null) {
|
}
|
||||||
pluginListItems.add(new SmallEntryItem(pluginKey));
|
|
||||||
} else {
|
|
||||||
pluginListItems.add(new FailedPluginListItem(plugin, action));
|
pluginListItems.add(new FailedPluginListItem(plugin, action));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user