@Override public int configureSurface(Surface surface, final int width, final int height, final int hal) { if (LibVlcUtil.isICSOrLater() || surface == null) return -1; if (width * height == 0) return 0; ExoVlcUtil.log(this, "configureSurface: " + width + "x" + height); final ConfigureSurfaceHolder holder = new ConfigureSurfaceHolder(surface); final Handler handler = new Handler(Looper.getMainLooper()); handler.post( new Runnable() { @Override public void run() { if (mSurface == holder.surface) { if (hal != 0) view.getHolder().setFormat(hal); view.getHolder().setFixedSize(width, height); } synchronized (holder) { holder.configured = true; holder.notifyAll(); } } }); try { synchronized (holder) { while (!holder.configured) holder.wait(); } } catch (InterruptedException e) { return 0; } return 1; }
/** * Simple friendly activity to tell the user something's wrong. * * <p>Intent parameters (all optional): runtimeError (bool) - Set to true if you want to show a * runtime error (defaults to a compatibility error) message (string) - the more detailed problem */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.not_compatible); String errorMsg = LibVlcUtil.getErrorMsg(); if (getIntent().getBooleanExtra("runtimeError", false)) if (getIntent().getStringExtra("message") != null) { errorMsg = getIntent().getStringExtra("message"); TextView tvo = (TextView) findViewById(R.id.message); tvo.setText(R.string.error_problem); } TextView tv = (TextView) findViewById(R.id.errormsg); tv.setText(getResources().getString(R.string.error_message_is) + "\n" + errorMsg); // AsyncHttpRequest asyncHttpRequest = new AsyncHttpRequest(); // asyncHttpRequest.execute(Build.MODEL, Build.DEVICE); }
@Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void onPopupMenu(View anchor, final int position) { if (!LibVlcUtil.isHoneycombOrLater()) { // Call the "classic" context menu anchor.performLongClick(); return; } PopupMenu popupMenu = new PopupMenu(getActivity(), anchor); popupMenu.getMenuInflater().inflate(R.menu.audio_list_browser, popupMenu.getMenu()); setContextMenuItems(popupMenu.getMenu(), anchor); popupMenu.setOnMenuItemClickListener( new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { return handleContextItemSelected(item, position); } }); popupMenu.show(); }