Last active
August 29, 2015 13:57
-
-
Save UweTrottmann/9871561 to your computer and use it in GitHub Desktop.
Preview of com.battlelancer.seriesguide.api.Intents class.
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
/* | |
* Copyright 2014 Uwe Trottmann | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, | |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
* See the License for the specific language governing permissions and | |
* limitations under the License. | |
*/ | |
package com.battlelancer.seriesguide.api; | |
import android.content.Intent; | |
/** | |
* Helper methods to view shows or episodes within SeriesGuide. | |
*/ | |
public class Intents { | |
public static final String ACTION_VIEW_EPISODE | |
= "com.battlelancer.seriesguide.api.action.VIEW_EPISODE"; | |
public static final String ACTION_VIEW_SHOW | |
= "com.battlelancer.seriesguide.api.action.VIEW_SHOW"; | |
public static final String EXTRA_TVDBID = "tvdbid"; | |
/** | |
* Builds an implicit {@link android.content.Intent} to view an episode in SeriesGuide. Make | |
* sure to check with {@link Intent#resolveActivity(android.content.pm.PackageManager)} if | |
* SeriesGuide (or another app capable of handling this intent) is available. | |
*/ | |
public static Intent buildViewEpisodeIntent(int episodeTvdbId) { | |
return new Intent(ACTION_VIEW_EPISODE) | |
.putExtra(EXTRA_TVDBID, episodeTvdbId) | |
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) | |
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
} | |
/** | |
* Builds an implicit {@link android.content.Intent} to view an episode in SeriesGuide. Make | |
* sure to check with {@link Intent#resolveActivity(android.content.pm.PackageManager)} if | |
* SeriesGuide (or another app capable of handling this intent) is available. | |
*/ | |
public static Intent buildViewShowIntent(int showTvdbId) { | |
return new Intent(ACTION_VIEW_SHOW) | |
.putExtra(EXTRA_TVDBID, showTvdbId) | |
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET) | |
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment