made the PlayVideoActivity return to its VideoItemDetailActivity when the back button is pressed, by setting its parent activity in the manifest. Also grammar fixes for existing comments

This commit is contained in:
Adam Howard 2015-11-02 21:19:18 +00:00
parent a2d5b0893d
commit 627e987bda
7 changed files with 17 additions and 20 deletions

View File

@ -68,6 +68,7 @@
<activity android:name=".PlayVideoActivity" <activity android:name=".PlayVideoActivity"
android:configChanges="orientation|keyboardHidden|screenSize" android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/FullscreenTheme" android:theme="@style/FullscreenTheme"
android:parentActivityName=".VideoItemDetailActivity"
> >
</activity> </activity>
<activity <activity

View File

@ -24,9 +24,9 @@ public interface StreamingService {
class ServiceInfo { class ServiceInfo {
public String name = ""; public String name = "";
} }
public ServiceInfo getServiceInfo(); ServiceInfo getServiceInfo();
public Extractor getExtractorInstance(); Extractor getExtractorInstance();
public SearchEngine getSearchEngineInstance(); SearchEngine getSearchEngineInstance();
/**When a VIEW_ACTION is caught this function will test if the url delivered within the calling /**When a VIEW_ACTION is caught this function will test if the url delivered within the calling
Intent was meant to be watched with this Service. Intent was meant to be watched with this Service.

View File

@ -69,7 +69,7 @@ public class VideoItemDetailActivity extends AppCompatActivity {
arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, i); arguments.putInt(VideoItemDetailFragment.STREAMING_SERVICE, i);
try { try {
currentStreamingService = i; currentStreamingService = i;
extractor = (Extractor) ServiceList.getService(i) extractor = ServiceList.getService(i)
.getExtractorInstance(); .getExtractorInstance();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

View File

@ -172,7 +172,8 @@ public class VideoItemListFragment extends ListFragment {
private void startSearch(String query, int page) { private void startSearch(String query, int page) {
currentRequestId++; currentRequestId++;
terminateThreads(); terminateThreads();
searchRunnable = new SearchRunnable(streamingService.getSearchEngineInstance(), query, page, currentRequestId); searchRunnable = new SearchRunnable(streamingService.getSearchEngineInstance(),
query, page, currentRequestId);
searchThread = new Thread(searchRunnable); searchThread = new Thread(searchRunnable);
searchThread.start(); searchThread.start();
} }
@ -227,10 +228,6 @@ public class VideoItemListFragment extends ListFragment {
} }
} }
void displayList() {
}
/** /**
* The serialization (saved instance state) Bundle key representing the * The serialization (saved instance state) Bundle key representing the
* activated item position. Only used on tablets. * activated item position. Only used on tablets.

View File

@ -199,7 +199,7 @@ public class YoutubeExtractor implements Extractor {
videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode); videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode);
} catch (Exception e) { } catch (Exception e) {
//todo: check if the following statement is true //todo: check if the following statement is true
Log.e(TAG, "Dash manifest seems not to bee available."); Log.e(TAG, "Dash manifest doesn't seem to be available.");
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -57,14 +57,14 @@ public class YoutubeSearchEngine implements SearchEngine {
int i = 0; int i = 0;
for(Element item : list.children()) { for(Element item : list.children()) {
i++; i++;
/* First we need to determine witch kind of item we are working with. /* First we need to determine which kind of item we are working with.
Youtube depicts fife different kinds if items at its search result page. These are Youtube depicts five different kinds of items on its search result page. These are
regular videos, playlists, channels, two types of video suggestions, and a no video regular videos, playlists, channels, two types of video suggestions, and a "no video
found item. Since we only want videos, we net to filter out all the others. found" item. Since we only want videos, we need to filter out all the others.
An example for this can be seen here: An example for this can be seen here:
https://www.youtube.com/results?search_query=asdf&page=1 https://www.youtube.com/results?search_query=asdf&page=1
We already applied a filter to the url, so we don't need to care about channels, and We already applied a filter to the url, so we don't need to care about channels and
playlists now. playlists now.
*/ */
@ -102,9 +102,9 @@ public class YoutubeSearchEngine implements SearchEngine {
Element te = item.select("div[class=\"yt-thumb video-thumb\"]").first() Element te = item.select("div[class=\"yt-thumb video-thumb\"]").first()
.select("img").first(); .select("img").first();
resultItem.thumbnail_url = te.attr("abs:src"); resultItem.thumbnail_url = te.attr("abs:src");
// Sometimes youtube sends links to gif files witch somehow seam to not exist // Sometimes youtube sends links to gif files which somehow seem to not exist
// anymore. Items with such gif also offer a secondary image source. So we are going // anymore. Items with such gif also offer a secondary image source. So we are going
// to use that if we caught such an item. // to use that if we've caught such an item.
if(resultItem.thumbnail_url.contains(".gif")) { if(resultItem.thumbnail_url.contains(".gif")) {
resultItem.thumbnail_url = te.attr("abs:data-thumb"); resultItem.thumbnail_url = te.attr("abs:data-thumb");
} }
@ -113,7 +113,6 @@ public class YoutubeSearchEngine implements SearchEngine {
Log.e(TAG, "GREAT FUCKING ERROR"); Log.e(TAG, "GREAT FUCKING ERROR");
} }
} }
return result; return result;
} }
} }

View File

@ -34,11 +34,11 @@ public class YoutubeService implements StreamingService {
} }
@Override @Override
public Extractor getExtractorInstance() { public Extractor getExtractorInstance() {
return (Extractor) new YoutubeExtractor(); return new YoutubeExtractor();
} }
@Override @Override
public SearchEngine getSearchEngineInstance() { public SearchEngine getSearchEngineInstance() {
return (SearchEngine) new YoutubeSearchEngine(); return new YoutubeSearchEngine();
} }
@Override @Override
public boolean acceptUrl(String videoUrl) { public boolean acceptUrl(String videoUrl) {