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 String macAddress;
|
||||
public int runningGameId;
|
||||
public String rawAppList;
|
||||
|
||||
public ComputerDetails() {
|
||||
// Use defaults
|
||||
@ -43,6 +44,7 @@ public class ComputerDetails {
|
||||
this.macAddress = details.macAddress;
|
||||
this.pairState = details.pairState;
|
||||
this.runningGameId = details.runningGameId;
|
||||
this.rawAppList = details.rawAppList;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -17,6 +17,10 @@ public class NvApp {
|
||||
this.isRunning = isRunning.equals("1");
|
||||
}
|
||||
|
||||
public void setIsRunningBoolean(boolean isRunning) {
|
||||
this.isRunning = isRunning;
|
||||
}
|
||||
|
||||
public String getAppName() {
|
||||
return this.appName;
|
||||
}
|
||||
|
@ -304,13 +304,12 @@ public class NvHTTP {
|
||||
return pm.pair(uniqueId, pin);
|
||||
}
|
||||
|
||||
public LinkedList<NvApp> getAppList() throws GfeHttpResponseException, IOException, XmlPullParserException {
|
||||
ResponseBody resp = openHttpConnection(baseUrl + "/applist?uniqueid=" + uniqueId, true);
|
||||
public static LinkedList<NvApp> getAppListByReader(Reader r) throws XmlPullParserException, IOException {
|
||||
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
|
||||
factory.setNamespaceAware(true);
|
||||
XmlPullParser xpp = factory.newPullParser();
|
||||
|
||||
xpp.setInput(new InputStreamReader(resp.byteStream()));
|
||||
xpp.setInput(r);
|
||||
int eventType = xpp.getEventType();
|
||||
LinkedList<NvApp> appList = new LinkedList<NvApp>();
|
||||
Stack<String> currentTag = new Stack<String>();
|
||||
@ -343,8 +342,17 @@ public class NvHTTP {
|
||||
eventType = xpp.next();
|
||||
}
|
||||
|
||||
resp.close();
|
||||
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();
|
||||
return appList;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user