This repository has been archived by the owner on Apr 11, 2023. It is now read-only.
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
Showing
13 changed files
with
272 additions
and
47 deletions.
There are no files selected for viewing
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
36 changes: 36 additions & 0 deletions
36
app/src/main/java/pro/bostrot/dtubeviewer/CastOptionsProvider.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,36 @@ | ||
package pro.bostrot.dtubeviewer; | ||
|
||
import android.content.Context; | ||
|
||
import com.google.android.gms.cast.framework.CastOptions; | ||
import com.google.android.gms.cast.framework.OptionsProvider; | ||
import com.google.android.gms.cast.framework.SessionProvider; | ||
import com.google.android.gms.cast.framework.media.CastMediaOptions; | ||
import com.google.android.gms.cast.framework.media.NotificationOptions; | ||
|
||
import java.util.List; | ||
|
||
public class CastOptionsProvider implements OptionsProvider { | ||
|
||
@Override | ||
public CastOptions getCastOptions(Context context) { | ||
NotificationOptions notificationOptions = new NotificationOptions.Builder() | ||
.setTargetActivityClassName(ExpandedControlsActivity.class.getName()) | ||
.build(); | ||
CastMediaOptions mediaOptions = new CastMediaOptions.Builder() | ||
.setNotificationOptions(notificationOptions) | ||
.setExpandedControllerActivityClassName(ExpandedControlsActivity.class.getName()) | ||
.build(); | ||
|
||
return new CastOptions.Builder() | ||
.setResumeSavedSession(false) | ||
.setReceiverApplicationId(context.getString(R.string.app_id)) | ||
.setCastMediaOptions(mediaOptions) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public List<SessionProvider> getAdditionalSessionProviders(Context context) { | ||
return null; | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
app/src/main/java/pro/bostrot/dtubeviewer/ExpandedControlsActivity.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,17 @@ | ||
package pro.bostrot.dtubeviewer; | ||
|
||
import android.view.Menu; | ||
|
||
import com.google.android.gms.cast.framework.CastButtonFactory; | ||
import com.google.android.gms.cast.framework.media.widget.ExpandedControllerActivity; | ||
|
||
public class ExpandedControlsActivity extends ExpandedControllerActivity { | ||
|
||
@Override | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
super.onCreateOptionsMenu(menu); | ||
getMenuInflater().inflate(R.menu.expanded_controller, menu); | ||
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_menu_item); | ||
return true; | ||
} | ||
} |
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
Oops, something went wrong.