2012-07-13 11:06:24 -07:00
|
|
|
/* 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;
|
|
|
|
|
2012-08-02 10:33:44 -07:00
|
|
|
import org.mozilla.gecko.util.ActivityResultHandler;
|
|
|
|
|
2012-07-13 11:06:24 -07:00
|
|
|
import android.app.Activity;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.provider.MediaStore;
|
|
|
|
import android.util.Log;
|
|
|
|
|
2013-05-09 18:48:00 -07:00
|
|
|
import java.util.Queue;
|
2012-07-27 17:53:54 -07:00
|
|
|
|
2012-07-13 11:06:24 -07:00
|
|
|
class CameraVideoResultHandler implements ActivityResultHandler {
|
|
|
|
private static final String LOGTAG = "GeckoCameraVideoResultHandler";
|
|
|
|
|
2013-05-09 18:48:00 -07:00
|
|
|
private final Queue<String> mFilePickerResult;
|
2012-07-13 11:06:24 -07:00
|
|
|
|
2013-05-09 18:48:00 -07:00
|
|
|
CameraVideoResultHandler(Queue<String> resultQueue) {
|
2012-07-13 11:06:24 -07:00
|
|
|
mFilePickerResult = resultQueue;
|
|
|
|
}
|
|
|
|
|
2013-02-26 21:48:00 -08:00
|
|
|
@Override
|
2012-07-13 11:06:24 -07:00
|
|
|
public void onActivityResult(int resultCode, Intent data) {
|
2013-05-09 18:48:00 -07:00
|
|
|
if (data == null || resultCode != Activity.RESULT_OK) {
|
|
|
|
mFilePickerResult.offer("");
|
|
|
|
return;
|
2012-07-13 11:06:24 -07:00
|
|
|
}
|
2013-05-09 18:48:00 -07:00
|
|
|
|
|
|
|
Cursor cursor = GeckoApp.mAppContext.managedQuery(data.getData(),
|
|
|
|
new String[] { MediaStore.Video.Media.DATA },
|
|
|
|
null,
|
|
|
|
null,
|
|
|
|
null);
|
|
|
|
cursor.moveToFirst();
|
|
|
|
mFilePickerResult.offer(cursor.getString(
|
|
|
|
cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA)));
|
2012-07-13 11:06:24 -07:00
|
|
|
}
|
|
|
|
}
|