Search in sources :

Example 41 with VideoView

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");
}
Also used : VideoView(android.widget.VideoView) WebView(android.webkit.WebView)

Example 42 with VideoView

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);
}
Also used : VideoView(android.widget.VideoView) Uri(android.net.Uri) TextView(android.widget.TextView) MediaPlayer(android.media.MediaPlayer)

Example 43 with VideoView

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();
}
Also used : VideoView(android.widget.VideoView) WebView(android.webkit.WebView) Test(org.junit.Test)

Example 44 with VideoView

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();
}
Also used : VideoView(android.widget.VideoView) Test(org.junit.Test)

Aggregations

VideoView (android.widget.VideoView)44 View (android.view.View)25 MediaPlayer (android.media.MediaPlayer)13 TextView (android.widget.TextView)12 FrameLayout (android.widget.FrameLayout)10 ImageView (android.widget.ImageView)9 Uri (android.net.Uri)8 Button (android.widget.Button)7 Bitmap (android.graphics.Bitmap)6 LinearLayout (android.widget.LinearLayout)6 MediaController (android.widget.MediaController)6 Intent (android.content.Intent)5 WebView (android.webkit.WebView)5 MotionEvent (android.view.MotionEvent)3 OnClickListener (android.view.View.OnClickListener)3 AdapterView (android.widget.AdapterView)3 FileOutputStream (java.io.FileOutputStream)3 KeyEvent (android.view.KeyEvent)2 AutoCompleteTextView (android.widget.AutoCompleteTextView)2 HorizontalScrollView (android.widget.HorizontalScrollView)2