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"
android:configChanges="orientation|keyboardHidden|screenSize"
android:theme="@style/FullscreenTheme"
android:parentActivityName=".VideoItemDetailActivity"
>
</activity>
<activity

View File

@ -24,9 +24,9 @@ public interface StreamingService {
class ServiceInfo {
public String name = "";
}
public ServiceInfo getServiceInfo();
public Extractor getExtractorInstance();
public SearchEngine getSearchEngineInstance();
ServiceInfo getServiceInfo();
Extractor getExtractorInstance();
SearchEngine getSearchEngineInstance();
/**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.

View File

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

View File

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

View File

@ -199,7 +199,7 @@ public class YoutubeExtractor implements Extractor {
videoInfo.audioStreams = parseDashManifest(dashManifest, decryptionCode);
} catch (Exception e) {
//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();
}

View File

@ -57,14 +57,14 @@ public class YoutubeSearchEngine implements SearchEngine {
int i = 0;
for(Element item : list.children()) {
i++;
/* First we need to determine witch kind of item we are working with.
Youtube depicts fife different kinds if items at its search result page. These are
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.
/* First we need to determine which kind of item we are working with.
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
found" item. Since we only want videos, we need to filter out all the others.
An example for this can be seen here:
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.
*/
@ -102,9 +102,9 @@ public class YoutubeSearchEngine implements SearchEngine {
Element te = item.select("div[class=\"yt-thumb video-thumb\"]").first()
.select("img").first();
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
// 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")) {
resultItem.thumbnail_url = te.attr("abs:data-thumb");
}
@ -113,7 +113,6 @@ public class YoutubeSearchEngine implements SearchEngine {
Log.e(TAG, "GREAT FUCKING ERROR");
}
}
return result;
}
}

View File

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