This repository has been archived by the owner on Feb 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9ca2e3
commit 99a67ce
Showing
8 changed files
with
96 additions
and
56 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
app/src/main/java/de/markhaehnel/rbtv/rocketbeanstv/ChannelInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package de.markhaehnel.rbtv.rocketbeanstv; | ||
|
||
public class ChannelInfo { | ||
ChannelInfo(String i_currentShow, String i_viewerCount) { | ||
currentShow = i_currentShow; | ||
viewerCount = i_viewerCount; | ||
} | ||
|
||
public String currentShow = ""; | ||
public String viewerCount = ""; | ||
} |
32 changes: 32 additions & 0 deletions
32
app/src/main/java/de/markhaehnel/rbtv/rocketbeanstv/GetChannelInfoTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package de.markhaehnel.rbtv.rocketbeanstv; | ||
|
||
import android.os.AsyncTask; | ||
import org.json.JSONException; | ||
import org.json.JSONObject; | ||
|
||
public class GetChannelInfoTask extends AsyncTask<Void, ChannelInfo, String> { | ||
protected String doInBackground(Void... voids) { | ||
while (true) { | ||
try { | ||
try { | ||
String response = HttpRequest.get("https://api.twitch.tv/kraken/streams/rocketbeanstv").body(); | ||
JSONObject json = new JSONObject(response).getJSONObject("stream"); | ||
JSONObject channel = json.getJSONObject("channel"); | ||
publishProgress(new ChannelInfo(channel.getString("status"), json.getString("viewers") + " Zuschauer")); | ||
} catch (JSONException e) { | ||
e.printStackTrace(); | ||
} | ||
Thread.sleep(15000); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
|
||
protected void onProgressUpdate(ChannelInfo... infos) { | ||
ChannelInfo info = infos[0]; | ||
if (info.currentShow.length() != 0) { | ||
MainActivity.getInstance().setInfoOverlay(info); | ||
} | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
app/src/main/java/de/markhaehnel/rbtv/rocketbeanstv/GetCurrentShowTask.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters