use of android.widget.VideoView in project AndroidFrame by tongxiaoyun.
the class FloatWindowUI method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
ActivityBind.getInstance().dismissFloat(FloatWindowUI.this);
VideoView vv = (VideoView) findViewById(R.id.vv);
vv.setVideoURI(Uri.parse("http://video.jiecao.fm/8/17/bGQS3BQQWUYrlzP1K4Tg4Q__.mp4"));
vv.start();
WebView video_webview = (WebView) findViewById(R.id.video_webview);
// 隐藏缩放按钮
video_webview.getSettings().setBuiltInZoomControls(true);
// 排版适应屏幕
video_webview.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
// 可任意比例缩放
video_webview.getSettings().setUseWideViewPort(true);
// setUseWideViewPort方法设置webview推荐使用的窗口。setLoadWithOverviewMode方法是设置webview加载的页面的模式。
video_webview.getSettings().setLoadWithOverviewMode(true);
video_webview.getSettings().setSavePassword(true);
// 保存表单数据
video_webview.getSettings().setSaveFormData(true);
video_webview.getSettings().setJavaScriptEnabled(true);
// 启用地理定位
video_webview.getSettings().setGeolocationEnabled(true);
// 设置定位的数据库路径
video_webview.getSettings().setGeolocationDatabasePath("/data/data/org.itri.html5webview/databases/");
video_webview.getSettings().setDomStorageEnabled(true);
video_webview.loadUrl("file:///android_asset/test.html");
}
use of android.widget.VideoView in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SetupWizardActivity method onCreate.
@Override
protected void onCreate(final Bundle savedInstanceState) {
setTheme(android.R.style.Theme_Translucent_NoTitleBar);
super.onCreate(savedInstanceState);
mImm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
mHandler = new SettingsPoolingHandler(this, mImm);
setContentView(R.layout.setup_wizard);
mSetupWizard = findViewById(R.id.setup_wizard);
if (savedInstanceState == null) {
mStepNumber = determineSetupStepNumberFromLauncher();
} else {
mStepNumber = savedInstanceState.getInt(STATE_STEP);
}
final String applicationName = getResources().getString(getApplicationInfo().labelRes);
mWelcomeScreen = findViewById(R.id.setup_welcome_screen);
final TextView welcomeTitle = (TextView) findViewById(R.id.setup_welcome_title);
welcomeTitle.setText(getString(R.string.setup_welcome_title, applicationName));
mSetupScreen = findViewById(R.id.setup_steps_screen);
final TextView stepsTitle = (TextView) findViewById(R.id.setup_title);
stepsTitle.setText(getString(R.string.setup_steps_title, applicationName));
final SetupStepIndicatorView indicatorView = (SetupStepIndicatorView) findViewById(R.id.setup_step_indicator);
mSetupStepGroup = new SetupStepGroup(indicatorView);
mStep1Bullet = (TextView) findViewById(R.id.setup_step1_bullet);
mStep1Bullet.setOnClickListener(this);
final SetupStep step1 = new SetupStep(STEP_1, applicationName, mStep1Bullet, findViewById(R.id.setup_step1), R.string.setup_step1_title, R.string.setup_step1_instruction, R.string.setup_step1_finished_instruction, R.drawable.ic_setup_step1, R.string.setup_step1_action);
final SettingsPoolingHandler handler = mHandler;
step1.setAction(new Runnable() {
@Override
public void run() {
invokeLanguageAndInputSettings();
handler.startPollingImeSettings();
}
});
mSetupStepGroup.addStep(step1);
final SetupStep step2 = new SetupStep(STEP_2, applicationName, (TextView) findViewById(R.id.setup_step2_bullet), findViewById(R.id.setup_step2), R.string.setup_step2_title, R.string.setup_step2_instruction, 0, /* finishedInstruction */
R.drawable.ic_setup_step2, R.string.setup_step2_action);
step2.setAction(new Runnable() {
@Override
public void run() {
invokeInputMethodPicker();
}
});
mSetupStepGroup.addStep(step2);
final SetupStep step3 = new SetupStep(STEP_3, applicationName, (TextView) findViewById(R.id.setup_step3_bullet), findViewById(R.id.setup_step3), R.string.setup_step3_title, R.string.setup_step3_instruction, 0, /* finishedInstruction */
R.drawable.ic_setup_step3, R.string.setup_step3_action);
step3.setAction(new Runnable() {
@Override
public void run() {
invokeSubtypeEnablerOfThisIme();
}
});
mSetupStepGroup.addStep(step3);
mWelcomeVideoUri = new Uri.Builder().scheme(ContentResolver.SCHEME_ANDROID_RESOURCE).authority(getPackageName()).path(Integer.toString(R.raw.setup_welcome_video)).build();
final VideoView welcomeVideoView = (VideoView) findViewById(R.id.setup_welcome_video);
welcomeVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(final MediaPlayer mp) {
// Now VideoView has been laid-out and ready to play, remove background of it to
// reveal the video.
welcomeVideoView.setBackgroundResource(0);
mp.setLooping(true);
}
});
welcomeVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
@Override
public boolean onError(final MediaPlayer mp, final int what, final int extra) {
Log.e(TAG, "Playing welcome video causes error: what=" + what + " extra=" + extra);
hideWelcomeVideoAndShowWelcomeImage();
return true;
}
});
mWelcomeVideoView = welcomeVideoView;
mWelcomeImageView = (ImageView) findViewById(R.id.setup_welcome_image);
mActionStart = findViewById(R.id.setup_start_label);
mActionStart.setOnClickListener(this);
mActionNext = findViewById(R.id.setup_next);
mActionNext.setOnClickListener(this);
mActionFinish = (TextView) findViewById(R.id.setup_finish);
TextViewCompatUtils.setCompoundDrawablesRelativeWithIntrinsicBounds(mActionFinish, getResources().getDrawable(R.drawable.ic_setup_finish), null, null, null);
mActionFinish.setOnClickListener(this);
}
use of android.widget.VideoView in project prebid-mobile-android by prebid.
the class AdBrowserActivityTest method onDestroyTest.
@Test
public void onDestroyTest() throws IllegalAccessException {
mIntent.putExtra(AdBrowserActivity.EXTRA_IS_VIDEO, true);
mAdBrowserActivity = Robolectric.buildActivity(AdBrowserActivity.class, mIntent).create().get();
WebView mockWebView = mock(WebView.class);
VideoView mockVideoView = mock(VideoView.class);
WhiteBox.field(AdBrowserActivity.class, "mWebView").set(mAdBrowserActivity, mockWebView);
WhiteBox.field(AdBrowserActivity.class, "mVideoView").set(mAdBrowserActivity, mockVideoView);
mAdBrowserActivity.onDestroy();
verify(mockWebView).destroy();
verify(mockVideoView).suspend();
}
use of android.widget.VideoView in project prebid-mobile-android by prebid.
the class AdBrowserActivityTest method onPauseTest.
@Test
public void onPauseTest() throws IllegalAccessException {
VideoView mockView = mock(VideoView.class);
WhiteBox.field(AdBrowserActivity.class, "mVideoView").set(mAdBrowserActivity, mockView);
mAdBrowserActivity.onPause();
verify(mockView).suspend();
}
Aggregations