本文整理汇总了Java中android.widget.VideoView.requestFocus方法的典型用法代码示例。如果您正苦于以下问题:Java VideoView.requestFocus方法的具体用法?Java VideoView.requestFocus怎么用?Java VideoView.requestFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.VideoView
的用法示例。
在下文中一共展示了VideoView.requestFocus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: go
import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
VideoView v=(VideoView)findViewById(R.id.videoView) ;
final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar3);
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
p.setVisibility(View.GONE);
}
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/flood.mp4?alt=media&token=179d7e4e-7171-4a87-b1f8-b1fc3d976c60";
Uri uri=Uri.parse(s);
v.setVideoURI(uri);
v.setVideoPath(s);
v.requestFocus();
v.start();
}
示例2: go
import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar2);
VideoView v=(VideoView)findViewById(R.id.videoView2) ;
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
p.setVisibility(View.GONE);
}
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/earthquake.mp4?alt=media&token=98993371-823d-4b81-adc7-d9d87ec841a9";
Uri uri=Uri.parse(s);
v.setVideoURI(uri);
v.setVisibility(View.VISIBLE);
v.setVideoPath(s);
v.requestFocus();
v.start();
}
示例3: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_full);
videofull=(VideoView)findViewById(R.id.videofull);
videofull.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
videofull.setMediaController(new MediaController(VideoFull.this));
videofull.start();
videofull.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
videofull.requestFocus();
}
示例4: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferencesState.getInstance().loadsLanguageInActivity();
setContentView(R.layout.video_activity);
//Displays a video file.
MediaController mediaController = new MediaController(VideoActivity.this);
mVideoView = (VideoView)findViewById(R.id.videoview);
String videoPathParam = getIntent().getStringExtra(VIDEO_PATH_PARAM);
mVideoView.setVideoPath(videoPathParam);
mVideoView.setMediaController(mediaController);
mediaController.setAnchorView(mVideoView);
mVideoView.requestFocus();
if (savedInstanceState != null) {
mVideoView.seekTo(savedInstanceState.getInt("video",0));
}
mVideoView.start();
}
示例5: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferencesState.getInstance().initalizateActivityDependencies();
setContentView(R.layout.video_activity);
//Displays a video file.
MediaController mediaController = new MediaController(VideoActivity.this);
mVideoView = (VideoView) findViewById(R.id.videoview);
String videoPathParam = getIntent().getStringExtra(VIDEO_PATH_PARAM);
File file = new File(videoPathParam);
if (file.exists()) {
mVideoView.setVideoPath(videoPathParam);
} else {
mVideoView.setVideoURI(FileIOUtils.getRawUri(videoPathParam));
}
mVideoView.setMediaController(mediaController);
mediaController.setAnchorView(mVideoView);
mVideoView.requestFocus();
if (savedInstanceState != null) {
mVideoView.seekTo(savedInstanceState.getInt("video", 0));
}
mVideoView.start();
}
示例6: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mVideoContainer = new VideoContainer(this);
this.setContentView(mVideoContainer);
VideoView videoView = mVideoContainer.getVideoView();
mExtra = new VideoExtra();
if (mExtra.getFrom(getIntent())) {
videoView.setVideoURI(Uri.parse(mExtra.mUrl));
if (mExtra.mAutoPlay) {
videoView.start();
}
}
videoView.requestFocus();
}
示例7: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_view);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
String imageUrl = getIntent().getStringExtra("videoUrl");
Uri uri = Uri.parse(imageUrl);
vidMessageVideo = (VideoView)findViewById(R.id.vidMessageVideo);
vidMessageVideo.setMediaController(new MediaController(this));
vidMessageVideo.setVideoURI(uri);
vidMessageVideo.requestFocus();
vidMessageVideo.start();
}
示例8: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView v = (VideoView) findViewById(R.id.videoView);
// v.setVideoPath("/sdcard/video.mp4");
v.setVideoURI(Uri.parse(String.format(
"android.resource://%s/%s",
getPackageName(),
R.raw.video
)));
v.setMediaController(new MediaController(this));
v.requestFocus();
v.start();
}
示例9: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_deathscreen);
getWindow().getDecorView().setSystemUiVisibility(Tools.Fullscreen());
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
VideoView videoView = (VideoView) findViewById(R.id.deathscreen);
videoView.setMediaController(new MediaController(this));
videoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.sockos_tod));
videoView.requestFocus();
videoView.start();
final Button restart = (Button) findViewById(R.id.deathscreenbutton);
restart.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(DeathScreenActivity.this,
Stage1Activity.class);
openView(i);
}
});
}
示例10: loadVideo
import android.widget.VideoView; //导入方法依赖的package包/类
@BindingAdapter(value = {"videoUrl"})
public static void loadVideo(VideoView videoView, String url) {
if (url != null) {
videoView.setVideoURI(Uri.parse(url));
videoView.requestFocus();
videoView.start();
}
}
示例11: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_acerca_de);
Uri video = Uri.parse("android.resource://com.pac.myapp/raw/master");
intro= (VideoView) findViewById(R.id.videoView1);
Uri url = Uri.parse("android.resource://com.example.informacion/" + R.raw.lego);
intro.setVideoURI(url);
intro.requestFocus();
intro.start();
}
示例12: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.videoview);
mVideoView = (VideoView) findViewById(R.id.surface_view);
/*
* Alternatively, you can use mVideoView.setVideoPath(<path>);
*/
mVideoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() +
"/" + R.raw.videoviewdemo));
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
}
示例13: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_video);
final ProgressBar progressBar = findViewById(R.id.video_progress);
VideoView videoView = findViewById(R.id.video_player);
toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ActionBar bar = getSupportActionBar();
if (bar != null) {
bar.setTitle(null);
bar.setDisplayHomeAsUpEnabled(true);
bar.setDisplayShowHomeEnabled(true);
}
String url = getIntent().getStringExtra("url");
videoView.setVideoPath(url);
MediaController controller = new MediaController(this);
controller.setMediaPlayer(videoView);
videoView.setMediaController(controller);
videoView.requestFocus();
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
progressBar.setVisibility(View.GONE);
mp.setLooping(true);
hideToolbarAfterDelay();
}
});
videoView.start();
videoView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
handler.removeCallbacksAndMessages(null);
toolbar.animate().cancel();
toolbar.setAlpha(1);
toolbar.setVisibility(View.VISIBLE);
hideToolbarAfterDelay();
}
return false;
}
});
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().setStatusBarColor(Color.BLACK);
}
}
示例14: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_easter_egg);
mVisible = true;
mControlsView = findViewById(R.id.fullscreen_content_controls);
mContentView = findViewById(R.id.fullscreen_content);
videoView=(VideoView)findViewById(R.id.videoView);
videoView.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
videoView.start();
videoView.setMediaController(null);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
videoView.requestFocus();
marv=(TextView)findViewById(R.id.fullscreen_content);
final ArrayList<Bitmap> bArray=new ArrayList<Bitmap>();
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid1));
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid2));
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid3));
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid4));
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid5));
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid6));
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid7));
bArray.add(BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.vid8));
final Handler h = new Handler();
final int delay = 400;
h.postDelayed(new Runnable() {
public void run(){
Bitmap b=bArray.get(bmp);if(bmp>=7){bmp=0;}else{bmp++;}
int color=Palette.generate(b).getVibrantColor(getResources().getColor(R.color.colorAccent));
marv.setTextColor(color);
h.postDelayed(this, delay);
}
}, delay);
// Set up the user interaction to manually show or hide the system UI.
mContentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
toggle();
}
});
// Upon interacting with UI controls, delay any scheduled hide()
// operations to prevent the jarring behavior of controls going away
// while interacting with the UI.
findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
findViewById(R.id.dummy_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(EasterEgg.this,SettingsActivity.class));
}
});
}
示例15: loadVideo
import android.widget.VideoView; //导入方法依赖的package包/类
private void loadVideo() {
// ~~~ 获取播放地址和标题
Intent intent = getIntent();
mPath = intent.getStringExtra("play");
mTitle = intent.getStringExtra("title");
if(mTitle==null){
mTitle="";
}
if (mPath==null||TextUtils.isEmpty(mPath)) {
return;
//mPath = "http://youkes.oss.aliyuncs.com/video/01_llama_drama_1080p.mp4";
} else if (intent.getData() != null) {
//mPath = intent.getData().toString();
}
//mPath = "http://youkes.oss.aliyuncs.com/video/01_llama_drama_1080p.mp4";
// ~~~ 绑定控件
setContentView(R.layout.videoview);
mVideoView = (VideoView) findViewById(R.id.surface_view);
mVolumeBrightnessLayout = findViewById(R.id.operation_volume_brightness);
mOperationBg = (ImageView) findViewById(R.id.operation_bg);
mOperationPercent = (ImageView) findViewById(R.id.operation_percent);
mLoadingView = findViewById(R.id.video_loading);
// ~~~ 绑定事件
mVideoView.setOnCompletionListener(this);
mVideoView.setOnInfoListener(this);
mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mLoadingView.setVisibility(View.GONE);
startPlayer();
}
});
// ~~~ 绑定数据
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mMaxVolume = mAudioManager
.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
if (mPath.startsWith("http:"))
mVideoView.setVideoURI(Uri.parse(mPath));
else
mVideoView.setVideoPath(mPath);
// 设置显示名称
mMediaController = new MediaController(this);
//mMediaController.setFileName(mTitle);
mVideoView.setMediaController(mMediaController);
mVideoView.requestFocus();
mGestureDetector = new GestureDetector(this, new MyGestureListener());
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}