mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-19 11:03:01 +00:00
Display machines as they are being refreshed
This commit is contained in:
parent
2df2f850d5
commit
21e46a5c3b
@ -110,7 +110,10 @@ public class PcView extends Activity {
|
|||||||
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
public void onItemClick(AdapterView<?> arg0, View arg1, int pos,
|
||||||
long id) {
|
long id) {
|
||||||
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(pos);
|
||||||
if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
if (computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
else if (computer.details.reachability == ComputerDetails.Reachability.OFFLINE) {
|
||||||
// Open the context menu if a PC is offline
|
// Open the context menu if a PC is offline
|
||||||
openContextMenu(arg1);
|
openContextMenu(arg1);
|
||||||
}
|
}
|
||||||
@ -235,7 +238,8 @@ public class PcView extends Activity {
|
|||||||
|
|
||||||
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
|
||||||
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(info.position);
|
ComputerObject computer = (ComputerObject) pcGridAdapter.getItem(info.position);
|
||||||
if (computer == null || computer.details == null) {
|
if (computer == null || computer.details == null ||
|
||||||
|
computer.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
||||||
startComputerUpdates();
|
startComputerUpdates();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,8 @@ public class ComputerDatabaseManager {
|
|||||||
details.macAddress = c.getString(4);
|
details.macAddress = c.getString(4);
|
||||||
|
|
||||||
// This signifies we don't have dynamic state (like pair state)
|
// This signifies we don't have dynamic state (like pair state)
|
||||||
details.state = ComputerDetails.State.UNKNOWN;
|
details.state = ComputerDetails.State.UNKNOWN;
|
||||||
|
details.reachability = ComputerDetails.Reachability.UNKNOWN;
|
||||||
|
|
||||||
// If a field is corrupt or missing, skip the database entry
|
// If a field is corrupt or missing, skip the database entry
|
||||||
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
||||||
@ -107,7 +108,8 @@ public class ComputerDatabaseManager {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
computerList.add(details);
|
|
||||||
|
computerList.add(details);
|
||||||
}
|
}
|
||||||
|
|
||||||
c.close();
|
c.close();
|
||||||
@ -152,6 +154,9 @@ public class ComputerDatabaseManager {
|
|||||||
|
|
||||||
c.close();
|
c.close();
|
||||||
|
|
||||||
|
details.state = ComputerDetails.State.UNKNOWN;
|
||||||
|
details.reachability = ComputerDetails.Reachability.UNKNOWN;
|
||||||
|
|
||||||
// If a field is corrupt or missing, delete the database entry
|
// If a field is corrupt or missing, delete the database entry
|
||||||
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
if (details.uuid == null || details.localIp == null || details.remoteIp == null ||
|
||||||
details.macAddress == null) {
|
details.macAddress == null) {
|
||||||
|
@ -151,6 +151,9 @@ public class ComputerManagerService extends Service {
|
|||||||
for (ComputerDetails computer : computerList) {
|
for (ComputerDetails computer : computerList) {
|
||||||
// This polling thread might already be there
|
// This polling thread might already be there
|
||||||
if (!pollingThreads.containsKey(computer)) {
|
if (!pollingThreads.containsKey(computer)) {
|
||||||
|
// Report this computer initially
|
||||||
|
listener.notifyComputerUpdated(computer);
|
||||||
|
|
||||||
Thread t = createPollingThread(computer);
|
Thread t = createPollingThread(computer);
|
||||||
pollingThreads.put(computer, t);
|
pollingThreads.put(computer, t);
|
||||||
t.start();
|
t.start();
|
||||||
|
@ -50,6 +50,13 @@ public class PcGridAdapter extends GenericGridAdapter<PcView.ComputerObject> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean populateOverlayView(ImageView overlayView, PcView.ComputerObject obj) {
|
public boolean populateOverlayView(ImageView overlayView, PcView.ComputerObject obj) {
|
||||||
|
if (obj.details.reachability == ComputerDetails.Reachability.UNKNOWN) {
|
||||||
|
// Still refreshing this PC so display the overlay
|
||||||
|
overlayView.setImageResource(R.drawable.image_loading);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No overlay
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,9 @@
|
|||||||
</ImageView>
|
</ImageView>
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/grid_overlay"
|
android:id="@+id/grid_overlay"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_marginTop="15dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_marginLeft="65dp"
|
||||||
|
android:layout_marginRight="20dp"
|
||||||
android:layout_width="50dp"
|
android:layout_width="50dp"
|
||||||
android:layout_height="50dp">
|
android:layout_height="50dp">
|
||||||
</ImageView>
|
</ImageView>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user