Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add close button for android #204

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-streaming-media",
"version": "2.2.0",
"version": "2.2.1",
"description": "This plugin allows you to stream audio and video in a fullscreen, native player on iOS and Android.",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-streaming-media"
version="2.2.0">
version="2.2.1">

<name>StreamingMedia</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.widget.MediaController;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.VideoView;

public class SimpleVideoStream extends Activity implements
Expand All @@ -29,6 +30,7 @@ public class SimpleVideoStream extends Activity implements
private MediaPlayer mMediaPlayer = null;
private MediaController mMediaController = null;
private ProgressBar mProgressBar = null;
private TextView close = null;
private String mVideoUrl;
private Boolean mShouldAutoClose = true;
private boolean mControls;
Expand All @@ -52,6 +54,26 @@ protected void onCreate(Bundle savedInstanceState) {
mVideoView.setLayoutParams(relLayoutParam);
relLayout.addView(mVideoView);

// START EDIT
close = new TextView(this);
close.setText("Close");
close.setBackgroundColor(Color.BLACK);
close.getBackground().setAlpha(128);
close.setTextColor(Color.WHITE);
close.setTextSize(18);
close.setPadding(10, 10, 10, 10);
RelativeLayout.LayoutParams closeLayoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
closeLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
close.setLayoutParams(closeLayoutParams);
close.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
wrapItUp(RESULT_OK, null);
}
});
relLayout.addView(close);
close.bringToFront();
// END EDIT

// Create progress throbber
mProgressBar = new ProgressBar(this);
mProgressBar.setIndeterminate(true);
Expand Down