Added runcommandplugin widget
ClosedPublic

Authored by menasshock on Apr 25 2018, 12:52 AM.

Details

Summary

A simple widget to execute commands from android desktop

Test Plan

Add the widget and execute commands from it.
By default, the selected device is the first device in the device list.
The selected device can be changed via the widget title.
If there is no commands, the widget show an empty list
If there is no connected device, show the message located in @string/unreachable_description

Diff Detail

Repository
R225 KDE Connect - Android application
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
menasshock created this revision.Apr 25 2018, 12:52 AM
menasshock created this object with visibility "KDE Connect (Project)".
menasshock created this object with edit policy "KDE Connect (Project)".
Restricted Application added a project: KDE Connect. · View Herald TranscriptApr 25 2018, 12:52 AM
menasshock requested review of this revision.Apr 25 2018, 12:52 AM

Thanks for the patch!
Sorry for keeping you hanging so long, but reviews are quite slow in general atm. I will test and give you some feedback next week

nicolasfella requested changes to this revision.May 10 2018, 5:04 PM

Please exclude the changes in build.gradle from the patch

This revision now requires changes to proceed.May 10 2018, 5:04 PM
Restricted Application added a subscriber: kdeconnect. · View Herald TranscriptMay 10 2018, 5:04 PM
menasshock updated this revision to Diff 33963.May 10 2018, 8:21 PM

Removed build.gradle from the patch

nicolasfella requested changes to this revision.May 10 2018, 8:59 PM

Working pretty good so far.
The command list does not seem to get updated when switching the selected device.
Some design nitpicks as inline comments.
Please respect the coding style of the rest of the project, i.e. no spaces inside braces. We are using the standard settings of Android Studio, so you can use the builtin formatter.

res/layout/widget_remotecommandplugin.xml
5

The transparent background is weird IMHO, it makes the command text hardly readable

14

I would like a little bit of padding below and above

36

Some padding to the left to make it symmetrical

src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandPlugin.java
48

Coding style, no spaces inside <>.
Apply everywhere

122

Lambda

src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidget.java
42

Lambda

85

Lambda

122

I don't think it's necessary to include the phones name here. In my case it results in "OnePlus@nico@neon", two time @ is too much

151

Lambda

src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidgetDeviceSelector.java
31

Lambda

52

Lambda?

64

You can use lambda here

This revision now requires changes to proceed.May 10 2018, 8:59 PM
menasshock updated this revision to Diff 33999.May 11 2018, 5:40 PM
menasshock marked 12 inline comments as done.

Code formatted according to the default Android Studio CodeStyle, and lambda applyed everywhere

menasshock updated this revision to Diff 36369.Jun 20 2018, 3:13 AM

Update command list when the selected device is changed.

nicolasfella added inline comments.Jun 20 2018, 6:58 AM
src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidgetDataProviderService.java
13

Coding style, no spaces inside parentheses

src/org/kde/kdeconnect/Plugins/RunCommandPlugin/RunCommandWidgetDeviceSelector.java
32

deviceItems

34

I think we should filter out devices that are not paired

nicolasfella changed the visibility from "KDE Connect (Project)" to "Public (No Login Required)".Jun 20 2018, 6:58 AM
nicolasfella changed the edit policy from "KDE Connect (Project)" to "All Users".
menasshock updated this revision to Diff 36390.Jun 20 2018, 3:56 PM
menasshock marked 3 inline comments as done.

Filtered out devices that are not paired

  • ArrayList<ListAdapter.Item> commandItems; renamed to deviceItems
  • Coding style

Another minor issue I found: When the device turns unreachable the command list is still shown instead of the unreachable message. You might be able to use DeviceListChangedCallback from Backgroundservice to work on this

Show unreachable message when the selected device turns unreachable

albertvaka accepted this revision.Jul 26 2018, 5:43 PM

Looks cool, thanks!

I just have a small improvement suggestion: the device selected by default is the first in the list, even if it's not paired. If there are paired devices, you could select by default the first *paired* device. You can't select a device that is not paired after clicking the device name anyway, so it should not be selected by default.

Another nitpicky thing: maybe the title bar could be smaller? It takes up some real state that could be used for the actual command list.

Apart from these, it looks very good. Let me know if/when you make this changes and want to get this merged, since I see you don't have commit rights.

nicolasfella requested changes to this revision.Jul 27 2018, 6:31 AM

I'm having trouble applying your patch. Can you please upload it again using arc? It makes our and your life easier. See https://community.kde.org/Infrastructure/Phabricator#Using_Arcanist_to_post_patches for instructions

This revision now requires changes to proceed.Jul 27 2018, 6:31 AM

I'm having trouble applying your patch. Can you please upload it again using arc? It makes our and your life easier. See https://community.kde.org/Infrastructure/Phabricator#Using_Arcanist_to_post_patches for instructions

I had to export the patch file and then apply it.

I get

error: patch failed: AndroidManifest.xml:30
error: AndroidManifest.xml: patch does not apply
menasshock updated this revision to Diff 38737.Jul 30 2018, 2:02 AM

I just updated the project and generated the diff again

nicolasfella resigned from this revision.Jul 30 2018, 10:37 AM

Thanks, I was able to apply the patch

This revision is now accepted and ready to land.Jul 30 2018, 10:38 AM

I still can't apply the patch using arc, I have to download and apply the diff. When I do so the commit message with the description is lost, so I can't merge this. Can you @nicolasfella push it if arc works for you?

I still can't apply the patch using arc, I have to download and apply the diff. When I do so the commit message with the description is lost, so I can't merge this. Can you @nicolasfella push it if arc works for you?

Arc still does not work for me, but I can download and apply it, I couldn't do that before

This revision was automatically updated to reflect the committed changes.

arc land adds the commit message automatically ;)