Bug 877248 - Use a TextureView and setAlpha to make preview invisible. r=blassey

This commit is contained in:
Gian-Carlo Pascutto
2013-07-01 08:01:57 +02:00
parent 0ac9ab6089
commit 380ca1262b
4 changed files with 97 additions and 15 deletions

View File

@@ -69,6 +69,7 @@ import android.view.ContextThemeWrapper;
import android.view.HapticFeedbackConstants;
import android.view.Surface;
import android.view.SurfaceView;
import android.view.TextureView;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.webkit.MimeTypeMap;
@@ -1981,7 +1982,7 @@ public class GeckoAppShell
public void disableCameraView();
public void addAppStateListener(AppStateListener listener);
public void removeAppStateListener(AppStateListener listener);
public SurfaceView getCameraView();
public View getCameraView();
public void notifyWakeLockChanged(String topic, String state);
public FormAssistPopup getFormAssistPopup();
public boolean areTabsShown();
@@ -2070,12 +2071,18 @@ public class GeckoAppShell
}
try {
if (getGeckoInterface() != null)
sCamera.setPreviewDisplay(getGeckoInterface().getCameraView().getHolder());
if (getGeckoInterface() != null) {
View cameraView = getGeckoInterface().getCameraView();
if (cameraView instanceof SurfaceView) {
sCamera.setPreviewDisplay(((SurfaceView)cameraView).getHolder());
} else if (cameraView instanceof TextureView) {
sCamera.setPreviewTexture(((TextureView)cameraView).getSurfaceTexture());
}
}
} catch(IOException e) {
Log.w(LOGTAG, "Error setPreviewDisplay:", e);
Log.w(LOGTAG, "Error setPreviewXXX:", e);
} catch(RuntimeException e) {
Log.w(LOGTAG, "Error setPreviewDisplay:", e);
Log.w(LOGTAG, "Error setPreviewXXX:", e);
}
sCamera.setParameters(params);