use of com.odysee.app.listener.FilePickerListener in project odysee-android by OdyseeTeam.
the class MainActivity method onActivityResult.
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_FILE_PICKER) {
startingFilePickerActivity = false;
if (resultCode == RESULT_OK && data != null) {
Uri fileUri = data.getData();
String filePath = Helper.getRealPathFromURI_API19(this, fileUri);
for (FilePickerListener listener : filePickerListeners) {
listener.onFilePicked(filePath);
}
} else {
for (FilePickerListener listener : filePickerListeners) {
listener.onFilePickerCancelled();
}
}
} else if (requestCode == REQUEST_SIMPLE_SIGN_IN || requestCode == REQUEST_WALLET_SYNC_SIGN_IN) {
if (resultCode == RESULT_OK) {
// user signed in
if (requestCode == REQUEST_WALLET_SYNC_SIGN_IN) {
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
sp.edit().putBoolean(MainActivity.PREFERENCE_KEY_INTERNAL_WALLET_SYNC_ENABLED, true).apply();
WalletFragment f = (WalletFragment) getSupportFragmentManager().findFragmentByTag("WALLET");
if (f != null) {
f.onWalletSyncEnabled();
}
scheduleWalletSyncTask();
}
}
} else if (requestCode == REQUEST_VIDEO_CAPTURE || requestCode == REQUEST_TAKE_PHOTO) {
if (resultCode == RESULT_OK) {
PublishFragment publishFragment = null;
PublishFragment f = (PublishFragment) getSupportFragmentManager().findFragmentByTag("PUBLISH");
if (f != null) {
publishFragment = (PublishFragment) f;
}
Map<String, Object> params = new HashMap<>();
params.put("directFilePath", cameraOutputFilename);
if (publishFragment != null) {
params.put("suggestedUrl", publishFragment.getSuggestedPublishUrl());
}
// openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
}
cameraOutputFilename = null;
}
}
Aggregations