当前位置: 首页>>代码示例>>Java>>正文


Java VideoView.requestFocus方法代码示例

本文整理汇总了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();


    }
 
开发者ID:iamjaspreetsingh,项目名称:LifeSaver,代码行数:19,代码来源:Main4Activity.java

示例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();





    }
 
开发者ID:iamjaspreetsingh,项目名称:LifeSaver,代码行数:23,代码来源:Main3Activity.java

示例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();
}
 
开发者ID:siddhantvinchurkar,项目名称:Marv,代码行数:17,代码来源:VideoFull.java

示例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();
}
 
开发者ID:EyeSeeTea,项目名称:EDSApp,代码行数:21,代码来源:VideoActivity.java

示例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();
}
 
开发者ID:EyeSeeTea,项目名称:malariapp,代码行数:26,代码来源:VideoActivity.java

示例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();
}
 
开发者ID:wavinsun,项目名称:MUtils,代码行数:18,代码来源:VideoActivity.java

示例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();
}
 
开发者ID:magnetsystems,项目名称:message-samples-android,代码行数:20,代码来源:VideoViewActivity.java

示例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();
    }
 
开发者ID:acelaya,项目名称:android-course,代码行数:17,代码来源:Main.java

示例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);
        }
    });


}
 
开发者ID:Vadammt,项目名称:Socko,代码行数:33,代码来源:DeathScreenActivity.java

示例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();
    }
}
 
开发者ID:TVGSoft,项目名称:Architecture-Android,代码行数:9,代码来源:AppBindingAdapter.java

示例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();

}
 
开发者ID:ANEDIN,项目名称:SuperHeroes-Agenda,代码行数:13,代码来源:AcercaDe.java

示例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();
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:16,代码来源:VideoViewDemo.java

示例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);
    }
}
 
开发者ID:Vavassor,项目名称:Tusky,代码行数:53,代码来源:ViewVideoActivity.java

示例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));
        }
    });
}
 
开发者ID:siddhantvinchurkar,项目名称:Marv,代码行数:61,代码来源:EasterEgg.java

示例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);

}
 
开发者ID:zhangjingpu,项目名称:youkes_vr,代码行数:60,代码来源:VideoPlayerActivity.java


注:本文中的android.widget.VideoView.requestFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。