mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2025-07-23 21:12:44 +00:00
Add some new common functions for app list caching
This commit is contained in:
parent
8235717502
commit
9988330613
@ -21,6 +21,7 @@ public class ComputerDetails {
|
|||||||
public PairingManager.PairState pairState;
|
public PairingManager.PairState pairState;
|
||||||
public String macAddress;
|
public String macAddress;
|
||||||
public int runningGameId;
|
public int runningGameId;
|
||||||
|
public String rawAppList;
|
||||||
|
|
||||||
public ComputerDetails() {
|
public ComputerDetails() {
|
||||||
// Use defaults
|
// Use defaults
|
||||||
@ -43,6 +44,7 @@ public class ComputerDetails {
|
|||||||
this.macAddress = details.macAddress;
|
this.macAddress = details.macAddress;
|
||||||
this.pairState = details.pairState;
|
this.pairState = details.pairState;
|
||||||
this.runningGameId = details.runningGameId;
|
this.runningGameId = details.runningGameId;
|
||||||
|
this.rawAppList = details.rawAppList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,6 +17,10 @@ public class NvApp {
|
|||||||
this.isRunning = isRunning.equals("1");
|
this.isRunning = isRunning.equals("1");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIsRunningBoolean(boolean isRunning) {
|
||||||
|
this.isRunning = isRunning;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAppName() {
|
public String getAppName() {
|
||||||
return this.appName;
|
return this.appName;
|
||||||
}
|
}
|
||||||
|
@ -304,13 +304,12 @@ public class NvHTTP {
|
|||||||
return pm.pair(uniqueId, pin);
|
return pm.pair(uniqueId, pin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LinkedList<NvApp> getAppList() throws GfeHttpResponseException, IOException, XmlPullParserException {
|
public static LinkedList<NvApp> getAppListByReader(Reader r) throws XmlPullParserException, IOException {
|
||||||
ResponseBody resp = openHttpConnection(baseUrl + "/applist?uniqueid=" + uniqueId, true);
|
|
||||||
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
||||||
factory.setNamespaceAware(true);
|
factory.setNamespaceAware(true);
|
||||||
XmlPullParser xpp = factory.newPullParser();
|
XmlPullParser xpp = factory.newPullParser();
|
||||||
|
|
||||||
xpp.setInput(new InputStreamReader(resp.byteStream()));
|
xpp.setInput(r);
|
||||||
int eventType = xpp.getEventType();
|
int eventType = xpp.getEventType();
|
||||||
LinkedList<NvApp> appList = new LinkedList<NvApp>();
|
LinkedList<NvApp> appList = new LinkedList<NvApp>();
|
||||||
Stack<String> currentTag = new Stack<String>();
|
Stack<String> currentTag = new Stack<String>();
|
||||||
@ -342,9 +341,18 @@ public class NvHTTP {
|
|||||||
}
|
}
|
||||||
eventType = xpp.next();
|
eventType = xpp.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return appList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppListRaw() throws MalformedURLException, IOException {
|
||||||
|
return openHttpConnectionToString(baseUrl + "/applist?uniqueid=" + uniqueId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LinkedList<NvApp> getAppList() throws GfeHttpResponseException, IOException, XmlPullParserException {
|
||||||
|
ResponseBody resp = openHttpConnection(baseUrl + "/applist?uniqueid=" + uniqueId, true);
|
||||||
|
LinkedList<NvApp> appList = getAppListByReader(new InputStreamReader(resp.byteStream()));
|
||||||
resp.close();
|
resp.close();
|
||||||
|
|
||||||
return appList;
|
return appList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user