Bug 1350842 - part4 : remove java video player.
MozReview-Commit-ID: 2VlrKOy6xSc
deleted file mode 100644
index 2be3dbac70595b4825aa40015ce3f99fda25d1da..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 2e39898be46101f0ace9f29d5a0cb267c888aa48..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
--- a/mobile/android/app/src/main/res/layout/gecko_app.xml
+++ b/mobile/android/app/src/main/res/layout/gecko_app.xml
@@ -31,21 +31,16 @@
android:layout_height="match_parent"
android:scrollbars="none"/>
<org.mozilla.gecko.FormAssistPopup android:id="@+id/form_assist_popup"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"/>
- <view class="org.mozilla.gecko.media.VideoPlayer" android:id="@+id/video_player"
- android:layout_height="match_parent"
- android:layout_width="match_parent">
- </view>
-
<FrameLayout android:id="@+id/home_screen_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ViewStub android:id="@+id/home_pager_stub"
android:layout="@layout/home_pager"
android:layout_width="match_parent"
--- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
+++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java
@@ -51,17 +51,16 @@ import org.mozilla.gecko.home.HomeConfig
import org.mozilla.gecko.home.HomeConfigPrefsBackend;
import org.mozilla.gecko.home.HomeFragment;
import org.mozilla.gecko.home.HomePager.OnUrlOpenInBackgroundListener;
import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
import org.mozilla.gecko.home.HomePanelsManager;
import org.mozilla.gecko.home.HomeScreen;
import org.mozilla.gecko.home.SearchEngine;
import org.mozilla.gecko.icons.Icons;
-import org.mozilla.gecko.media.VideoPlayer;
import org.mozilla.gecko.menu.GeckoMenu;
import org.mozilla.gecko.menu.GeckoMenuItem;
import org.mozilla.gecko.mma.MmaDelegate;
import org.mozilla.gecko.mozglue.GeckoLoader;
import org.mozilla.gecko.mozglue.SafeIntent;
import org.mozilla.gecko.notifications.NotificationHelper;
import org.mozilla.gecko.overlays.ui.ShareDialog;
import org.mozilla.gecko.permissions.Permissions;
@@ -231,17 +230,16 @@ public class BrowserApp extends GeckoApp
private static final String EOL_NOTIFIED = "eol_notified";
private BrowserSearch mBrowserSearch;
private View mBrowserSearchContainer;
public ViewGroup mBrowserChrome;
public ViewFlipper mActionBarFlipper;
public ActionModeCompatView mActionBar;
- private VideoPlayer mVideoPlayer;
private BrowserToolbar mBrowserToolbar;
private View doorhangerOverlay;
// We can't name the TabStrip class because it's not included on API 9.
private TabStripInterface mTabStrip;
private ToolbarProgressView mProgressView;
private FirstrunAnimationContainer mFirstrunAnimationContainer;
private HomeScreen mHomeScreen;
private TabsPanel mTabsPanel;
@@ -384,20 +382,16 @@ public class BrowserApp extends GeckoApp
}
return;
}
Log.d(LOGTAG, "BrowserApp.onTabChanged: " + tab.getId() + ": " + msg);
switch (msg) {
case SELECTED:
- if (mVideoPlayer.isPlaying()) {
- mVideoPlayer.stop();
- }
-
if (Tabs.getInstance().isSelectedTab(tab) && mDynamicToolbar.isEnabled()) {
final VisibilityTransition transition = (tab.getShouldShowToolbarWithoutAnimationOnFirstSelection()) ?
VisibilityTransition.IMMEDIATE : VisibilityTransition.ANIMATE;
mDynamicToolbar.setVisible(true, transition);
// The first selection has happened - reset the state.
tab.setShouldShowToolbarWithoutAnimationOnFirstSelection(false);
}
@@ -643,25 +637,16 @@ public class BrowserApp extends GeckoApp
initSwitchboard(this, intent, isInAutomation);
initTelemetryUploader(isInAutomation);
mBrowserChrome = (ViewGroup) findViewById(R.id.browser_chrome);
mActionBarFlipper = (ViewFlipper) findViewById(R.id.browser_actionbar);
mActionBar = (ActionModeCompatView) findViewById(R.id.actionbar);
- mVideoPlayer = (VideoPlayer) findViewById(R.id.video_player);
- mVideoPlayer.setFullScreenListener(new VideoPlayer.FullScreenListener() {
- @Override
- public void onFullScreenChanged(boolean fullScreen) {
- mVideoPlayer.setFullScreen(fullScreen);
- setFullScreen(fullScreen);
- }
- });
-
mBrowserToolbar = (BrowserToolbar) findViewById(R.id.browser_toolbar);
mBrowserToolbar.setTouchEventInterceptor(new TouchEventInterceptor() {
@Override
public boolean onInterceptTouchEvent(View view, MotionEvent event) {
// Manually dismiss text selection bar if it's not overlaying the toolbar.
mTextSelection.dismiss();
return false;
}
@@ -772,17 +757,16 @@ public class BrowserApp extends GeckoApp
"Menu:Update",
"Menu:Add",
"Menu:Remove",
"Menu:AddBrowserAction",
"Menu:RemoveBrowserAction",
"Menu:UpdateBrowserAction",
"LightweightTheme:Update",
"Tab:Added",
- "Video:Play",
"CharEncoding:Data",
"CharEncoding:State",
"Settings:Show",
"Updater:Launch",
"Sanitize:Finished",
"Sanitize:OpenTabs",
null);
@@ -1095,27 +1079,16 @@ public class BrowserApp extends GeckoApp
endActionMode();
return;
}
if (hideFirstrunPager(TelemetryContract.Method.BACK)) {
return;
}
- if (mVideoPlayer.isFullScreen()) {
- mVideoPlayer.setFullScreen(false);
- setFullScreen(false);
- return;
- }
-
- if (mVideoPlayer.isPlaying()) {
- mVideoPlayer.stop();
- return;
- }
-
super.onBackPressed();
}
@Override
public void onAttachedToWindow() {
final SafeIntent intent = new SafeIntent(getIntent());
// We can't show the first run experience until Gecko has finished initialization (bug 1077583).
@@ -1550,17 +1523,16 @@ public class BrowserApp extends GeckoApp
"Menu:Update",
"Menu:Add",
"Menu:Remove",
"Menu:AddBrowserAction",
"Menu:RemoveBrowserAction",
"Menu:UpdateBrowserAction",
"LightweightTheme:Update",
"Tab:Added",
- "Video:Play",
"CharEncoding:Data",
"CharEncoding:State",
"Settings:Show",
"Updater:Launch",
"Sanitize:Finished",
"Sanitize:OpenTabs",
null);
@@ -1904,24 +1876,16 @@ public class BrowserApp extends GeckoApp
if (message.getBoolean("cancelEditMode")) {
// Set the target tab to null so it does not get selected (on editing
// mode exit) in lieu of the tab that we're going to open and select.
mTargetTabForEditingMode = null;
mBrowserToolbar.cancelEdit();
}
break;
- case "Video:Play":
- if (SwitchBoard.isInExperiment(this, Experiments.HLS_VIDEO_PLAYBACK)) {
- mVideoPlayer.start(Uri.parse(message.getString("uri")));
- Telemetry.sendUIEvent(TelemetryContract.Event.SHOW,
- TelemetryContract.Method.CONTENT, "playhls");
- }
- break;
-
case "CharEncoding:Data":
final GeckoBundle[] charsets = message.getBundleArray("charsets");
final int selected = message.getInt("selected");
final String[] titleArray = new String[charsets.length];
final String[] codeArray = new String[charsets.length];
for (int i = 0; i < charsets.length; i++) {
final GeckoBundle charset = charsets[i];
--- a/mobile/android/base/java/org/mozilla/gecko/Experiments.java
+++ b/mobile/android/base/java/org/mozilla/gecko/Experiments.java
@@ -48,19 +48,16 @@ public class Experiments {
public static final String TRIPLE_READERVIEW_BOOKMARK_PROMPT = "triple-readerview-bookmark-prompt";
// Only show origin in URL bar instead of full URL (Bug 1236431)
public static final String URLBAR_SHOW_ORIGIN_ONLY = "urlbar-show-origin-only";
// Show name of organization (EV cert) instead of full URL in URL bar (Bug 1249594).
public static final String URLBAR_SHOW_EV_CERT_OWNER = "urlbar-show-ev-cert-owner";
- // Play HLS videos in a VideoView (Bug 1313391)
- public static final String HLS_VIDEO_PLAYBACK = "hls-video-playback";
-
// Show AddOns menu-item in top level menu
public static final String TOP_ADDONS_MENU = "top-addons-menu";
// Enable full bookmark management(full-page dialog, bookmark/folder modification, etc.)
public static final String FULL_BOOKMARK_MANAGEMENT = "full-bookmark-management";
// Enable Leanplum SDK
public static final String LEANPLUM = "leanplum-start";
deleted file mode 100644
--- a/mobile/android/base/java/org/mozilla/gecko/media/VideoPlayer.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.media;
-
-import android.content.Context;
-
-import android.graphics.Color;
-
-import android.net.Uri;
-
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.KeyEvent;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-
-import android.widget.ImageButton;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.MediaController;
-import android.widget.VideoView;
-
-import org.mozilla.gecko.R;
-
-public class VideoPlayer extends FrameLayout {
- private VideoView video;
- private FullScreenMediaController controller;
- private FullScreenListener fullScreenListener;
-
- private boolean isFullScreen;
-
- public VideoPlayer(Context ctx) {
- this(ctx, null);
- }
-
- public VideoPlayer(Context ctx, AttributeSet attrs) {
- this(ctx, attrs, 0);
- }
-
- public VideoPlayer(Context ctx, AttributeSet attrs, int defStyle) {
- super(ctx, attrs, defStyle);
- setFullScreen(false);
- setVisibility(View.GONE);
- }
-
- public void start(Uri uri) {
- stop();
-
- video = new VideoView(getContext());
- controller = new FullScreenMediaController(getContext());
- video.setMediaController(controller);
- controller.setAnchorView(video);
-
- video.setVideoURI(uri);
-
- FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
- FrameLayout.LayoutParams.MATCH_PARENT,
- FrameLayout.LayoutParams.WRAP_CONTENT,
- Gravity.CENTER);
-
- addView(video, layoutParams);
- setVisibility(View.VISIBLE);
-
- video.setZOrderOnTop(true);
- video.start();
- }
-
- public boolean isPlaying() {
- return video != null;
- }
-
- public void stop() {
- if (video == null) {
- return;
- }
-
- removeAllViews();
- setVisibility(View.GONE);
- video.stopPlayback();
-
- video = null;
- controller = null;
- }
-
- public void setFullScreenListener(FullScreenListener listener) {
- fullScreenListener = listener;
- }
-
- public boolean isFullScreen() {
- return isFullScreen;
- }
-
- public void setFullScreen(boolean fullScreen) {
- isFullScreen = fullScreen;
- if (fullScreen) {
- setBackgroundColor(Color.BLACK);
- } else {
- setBackgroundResource(R.color.dark_transparent_overlay);
- }
-
- if (controller != null) {
- controller.setFullScreen(fullScreen);
- }
- }
-
- @Override
- public boolean onKeyDown(int keyCode, KeyEvent event) {
- if (event.isSystem()) {
- return super.onKeyDown(keyCode, event);
- }
- return true;
- }
-
- @Override
- public boolean onKeyUp(int keyCode, KeyEvent event) {
- if (event.isSystem()) {
- return super.onKeyUp(keyCode, event);
- }
- return true;
- }
-
- @Override
- public boolean onTouchEvent(MotionEvent event) {
- super.onTouchEvent(event);
- return true;
- }
-
- @Override
- public boolean onTrackballEvent(MotionEvent event) {
- super.onTrackballEvent(event);
- return true;
- }
-
- public interface FullScreenListener {
- void onFullScreenChanged(boolean fullScreen);
- }
-
- private class FullScreenMediaController extends MediaController {
- private ImageButton mButton;
-
- public FullScreenMediaController(Context ctx) {
- super(ctx);
-
- mButton = new ImageButton(getContext());
- mButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
- mButton.setBackgroundColor(Color.TRANSPARENT);
- mButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- FullScreenMediaController.this.onFullScreenClicked();
- }
- });
-
- updateFullScreenButton(false);
- }
-
- public void setFullScreen(boolean fullScreen) {
- updateFullScreenButton(fullScreen);
- }
-
- private void updateFullScreenButton(boolean fullScreen) {
- mButton.setImageResource(fullScreen ? R.drawable.exit_fullscreen : R.drawable.fullscreen);
- }
-
- private void onFullScreenClicked() {
- if (VideoPlayer.this.fullScreenListener != null) {
- boolean fullScreen = !VideoPlayer.this.isFullScreen();
- VideoPlayer.this.fullScreenListener.onFullScreenChanged(fullScreen);
- }
- }
-
- @Override
- public void setAnchorView(final View view) {
- super.setAnchorView(view);
-
- // Add the fullscreen button here because this is where the parent class actually creates
- // the media buttons and their layout.
- //
- // http://androidxref.com/6.0.1_r10/xref/frameworks/base/core/java/android/widget/MediaController.java#239
- //
- // The media buttons are in a horizontal linear layout which is itself packed into
- // a vertical layout. The vertical layout is the only child of the FrameLayout which
- // MediaController inherits from.
- LinearLayout child = (LinearLayout) getChildAt(0);
- LinearLayout buttons = (LinearLayout) child.getChildAt(0);
-
- LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,
- LayoutParams.MATCH_PARENT);
- params.gravity = Gravity.CENTER_VERTICAL;
-
- if (mButton.getParent() != null) {
- ((ViewGroup)mButton.getParent()).removeView(mButton);
- }
-
- buttons.addView(mButton, params);
- }
- }
-}
\ No newline at end of file
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -761,17 +761,16 @@ gbjar.sources += ['java/org/mozilla/geck
'icons/storage/MemoryStorage.java',
'IntentHelper.java',
'LauncherActivity.java',
'lwt/LightweightTheme.java',
'lwt/LightweightThemeDrawable.java',
'mdns/MulticastDNSManager.java',
'media/AudioFocusAgent.java',
'media/MediaControlService.java',
- 'media/VideoPlayer.java',
'MediaCastingBar.java',
'MemoryMonitor.java',
'menu/GeckoMenu.java',
'menu/GeckoMenuInflater.java',
'menu/GeckoMenuItem.java',
'menu/GeckoSubMenu.java',
'menu/MenuItemActionBar.java',
'menu/MenuItemDefault.java',