本文整理汇总了Java中android.view.SurfaceView类的典型用法代码示例。如果您正苦于以下问题:Java SurfaceView类的具体用法?Java SurfaceView怎么用?Java SurfaceView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SurfaceView类属于android.view包,在下文中一共展示了SurfaceView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initPlayer
import android.view.SurfaceView; //导入依赖的package包/类
private void initPlayer() {
mLoadingView = findViewById(R.id.LoadingView);
bgImage = (ImageView) findViewById(R.id.bgImg);
mSurfaceView = (SurfaceView) findViewById(R.id.surfaceView);
mSurfaceView.setOnTouchListener(this);
try {
mPlayBean = (FirstBean.RoomBean.ListBean) getIntent().getSerializableExtra("playBean");
} catch (ClassCastException e) {
mPlayBean1 = (OtherBean.DataBean) getIntent().getSerializableExtra("playBean");
}
mCodec = getIntent().getIntExtra("mediaCodec", 0);
}
示例2: LivePlayerHolder
import android.view.SurfaceView; //导入依赖的package包/类
public LivePlayerHolder(BaseTvShowActivity mActivity, SurfaceView surfaceView, Integer codec, String mVideoPath) {
this.mActivity = mActivity;
this.codec = codec;
this.mVideoPath = mVideoPath;
this.mSurfaceView = surfaceView;
//init
mSurfaceView.getHolder().addCallback(mCallback);
mAVOptions = new AVOptions();
mAVOptions.setInteger(AVOptions.KEY_PREPARE_TIMEOUT, 10 * 1000);
mAVOptions.setInteger(AVOptions.KEY_GET_AV_FRAME_TIMEOUT, 10 * 1000);
mAVOptions.setInteger(AVOptions.KEY_LIVE_STREAMING, 1);
mAVOptions.setInteger(AVOptions.KEY_DELAY_OPTIMIZATION, 1);
mAVOptions.setInteger(AVOptions.KEY_MEDIACODEC, codec);
// whether start play automatically after prepared, default value is 1
mAVOptions.setInteger(AVOptions.KEY_START_ON_PREPARED, 0);
AudioManager audioManager = (AudioManager) App.getAppContext().getSystemService(Context.AUDIO_SERVICE);
audioManager.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN);
}
示例3: initView
import android.view.SurfaceView; //导入依赖的package包/类
private void initView(){
face1Result = (ImageView) findViewById(R.id.face1);
btnToggleCamera = (ImageButton) findViewById(R.id.btnToggleCamera);
btnGetFace = (ImageButton) findViewById(R.id.btnGetFace);
btnGetInto = (Button) findViewById(R.id.btnGetInto);
btnSignup =(Button) findViewById(R.id.btnsignup);
surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
surfaceHolder = surfaceView.getHolder();
mGlobal = (Global) getApplicationContext();
mInterface = new CameraInterface(MainActivity.this);
executor = Executors.newSingleThreadExecutor();
loader = Global.loader;
faceView = (FaceView) findViewById(R.id.face_view);
faceView = (FaceView) findViewById(R.id.face_view);
}
示例4: onCreate
import android.view.SurfaceView; //导入依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFormat(PixelFormat.TRANSLUCENT); // 使得窗口支持透明度
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.nim_capture_video_activity);
setTitle(R.string.video_record);
parseIntent();
findViews();
initActionBar();
setViewsListener();
updateRecordUI();
getVideoPreviewSize();
surfaceview = (SurfaceView) this.findViewById(R.id.videoView);
SurfaceHolder holder = surfaceview.getHolder();
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
holder.addCallback(this);
resizeSurfaceView();
}
示例5: onPause
import android.view.SurfaceView; //导入依赖的package包/类
@Override
protected void onPause() {
if (handler != null) {
handler.quitSynchronously();
handler = null;
}
inactivityTimer.onPause();
ambientLightManager.stop();
cameraManager.closeDriver();
if (!hasSurface) {
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
surfaceHolder.removeCallback(this);
}
super.onPause();
}
示例6: initViews
import android.view.SurfaceView; //导入依赖的package包/类
private void initViews() {
btnPublish = (ImageButton) findViewById(R.id.publish);
btnSwitch = (ImageButton) findViewById(R.id.swCam);
btnBack = (ImageButton) findViewById(R.id.back);
txtState = (TextView) findViewById(R.id.state);
mCameraView = (SurfaceView) findViewById(R.id.preview);
mMessagesView = (RecyclerView) findViewById(R.id.push_messages_receive_layout);
linearLayoutManager = new LinearLayoutManager(this);
linearLayoutManager.setStackFromEnd(true);
mMessagesView.setLayoutManager(linearLayoutManager);
mMessagesView.setAdapter(mAdapter);
mCameraView.getHolder().addCallback(this);
btnPublish.setOnClickListener(this);
btnSwitch.setOnClickListener(this);
btnBack.setOnClickListener(this);
}
示例7: notifyUiChanged
import android.view.SurfaceView; //导入依赖的package包/类
@Override
public void notifyUiChanged(HashMap<Integer, SurfaceView> uids, int uidExcluded, HashMap<Integer, Integer> status, HashMap<Integer, Integer> volume) {
mUsers.clear();
for (HashMap.Entry<Integer, SurfaceView> entry : uids.entrySet()) {
log.debug("notifyUiChanged " + entry.getKey() + " " + uidExcluded);
if (entry.getKey() != uidExcluded) {
entry.getValue().setZOrderOnTop(true);
entry.getValue().setZOrderMediaOverlay(true);
mUsers.add(new VideoStatusData(entry.getKey(), entry.getValue(), VideoStatusData.DEFAULT_STATUS, VideoStatusData.DEFAULT_VOLUME));
}
}
notifyDataSetChanged();
}
示例8: Holder
import android.view.SurfaceView; //导入依赖的package包/类
Holder(int adapterPosition, View rootView) {
super(adapterPosition, rootView);
FlingRelativeLayout flingRelativeLayout = (FlingRelativeLayout) rootView.findViewById(R.id.fling_root_view);
flingRelativeLayout.setOnClickListener(v -> toggleFullscreen());
flingRelativeLayout.setOnSingleFlingListener(new CloseOnFlingListener(rootView.getContext()) {
@Override
public boolean onVerticalFling(float distanceByY) {
goBack();
return true;
}
});
mSurfaceView = (SurfaceView) rootView.findViewById(R.id.surface_view);
mSurfaceHolder = mSurfaceView.getHolder();
mSurfaceHolder.addCallback(this);
mAspectRatioLayout = (AlternativeAspectRatioFrameLayout) rootView.findViewById(R.id.aspect_ratio_layout);
mProgressBar = (ProgressBar) rootView.findViewById(R.id.preparing_progress_bar);
}
示例9: onCreate
import android.view.SurfaceView; //导入依赖的package包/类
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_capture);
scanPreview = (SurfaceView) findViewById(R.id.capture_preview);
scanContainer = (RelativeLayout) findViewById(R.id.capture_container);
scanCropView = (RelativeLayout) findViewById(R.id.capture_crop_view);
scanLine = (ImageView) findViewById(R.id.capture_scan_line);
inactivityTimer = new InactivityTimer(this);
beepManager = new BeepManager(this);
TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0.0f, Animation
.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.9f);
animation.setDuration(4500);
animation.setRepeatCount(-1);
animation.setRepeatMode(Animation.RESTART);
scanLine.startAnimation(animation);
}
示例10: initViews
import android.view.SurfaceView; //导入依赖的package包/类
/**
*
*/
@Override
public void initViews() {
View fragView = _sendFragment.getView();
if (fragView == null) return;
_amountEdit = (EditText) fragView.findViewById(R.id.send_amount_textview);
_addressEdit = (EditText) fragView.findViewById(R.id.send_address_input);
_maxTextView = (TextView) fragView.findViewById(R.id.send_max_textview);
_sendBtn = (CircleImageView) fragView.findViewById(R.id.send_btn_id);
_surfaceView = (SurfaceView) fragView.findViewById(R.id.send_camera_preview);
_maxTextView.setOnClickListener(this);
_sendBtn.setOnClickListener(this);
_addressEdit.addTextChangedListener(this);
_amountEdit.addTextChangedListener(this);
System.out.println("listeners setup");
}
示例11: onCreate
import android.view.SurfaceView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_movie_surface);
mSurfaceView = (SurfaceView) findViewById(R.id.playMovie_surface);
mSurfaceView.getHolder().addCallback(this);
// Populate file-selection spinner.
Spinner spinner = (Spinner) findViewById(R.id.playMovieFile_spinner);
// Need to create one of these fancy ArrayAdapter thingies, and specify the generic layout
// for the widget itself.
mMovieFiles = MiscUtils.getFiles(getFilesDir(), "*.mp4");
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, mMovieFiles);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
// Apply the adapter to the spinner.
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
updateControls();
}
示例12: onPause
import android.view.SurfaceView; //导入依赖的package包/类
@Override
protected void onPause() {
if (handler != null) {
handler.quitSynchronously();
handler = null;
}
inactivityTimer.onPause();
ambientLightManager.stop();
beepManager.close();
cameraManager.closeDriver();
if (!hasSurface) {
SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
SurfaceHolder surfaceHolder = surfaceView.getHolder();
surfaceHolder.removeCallback(this);
}
super.onPause();
}
示例13: onJoinChannelSuccess
import android.view.SurfaceView; //导入依赖的package包/类
@Override
public void onJoinChannelSuccess(final String channel, final int uid, final int elapsed) {
runOnUiThread(new Runnable() {
@Override
public void run() {
if (isFinishing()) {
return;
}
if (mUidsList.containsKey(uid)) {
log.debug("already added to UI, ignore it " + (uid & 0xFFFFFFFFL) + " " + mUidsList.get(uid));
return;
}
final boolean isBroadcaster = isBroadcaster();
log.debug("onJoinChannelSuccess " + channel + " " + uid + " " + elapsed + " " + isBroadcaster);
worker().getEngineConfig().mUid = uid;
SurfaceView surfaceV = mUidsList.remove(0);
if (surfaceV != null) {
mUidsList.put(uid, surfaceV);
}
}
});
}
示例14: initViewContainer
import android.view.SurfaceView; //导入依赖的package包/类
public void initViewContainer(Context context, int localUid, HashMap<Integer, SurfaceView> uids) {
boolean newCreated = initAdapter(localUid, uids);
if (!newCreated) {
mGridVideoViewContainerAdapter.setLocalUid(localUid);
mGridVideoViewContainerAdapter.customizedInit(uids, true);
}
this.setAdapter(mGridVideoViewContainerAdapter);
int count = uids.size();
if (count <= 2) { // only local full view or or with one peer
this.setLayoutManager(new LinearLayoutManager(context, RecyclerView.VERTICAL, false));
} else if (count > 2 && count <= 4) {
this.setLayoutManager(new GridLayoutManager(context, 2, RecyclerView.VERTICAL, false));
}
mGridVideoViewContainerAdapter.notifyDataSetChanged();
}
示例15: onCreateView
import android.view.SurfaceView; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
Bundle bundle = getArguments();
View view = null;
if (bundle != null) {
int layoutId = bundle.getInt(CodeUtils.LAYOUT_ID);
if (layoutId != -1) {
view = inflater.inflate(layoutId, null);
}
}
if (view == null) {
view = inflater.inflate(R.layout.fragment_capture_view, null);
}
viewfinderView = (ViewfinderView) view.findViewById(R.id.viewfinder_view);
surfaceView = (SurfaceView) view.findViewById(R.id.preview_view);
surfaceHolder = surfaceView.getHolder();
return view;
}