use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFormFragment method onStart.
@Override
public void onStart() {
super.onStart();
MainActivity activity = (MainActivity) getContext();
if (activity != null) {
activity.hideSearchBar();
activity.addFilePickerListener(this);
activity.addWalletBalanceListener(this);
activity.setActionBarTitle(editMode ? R.string.edit_content : R.string.new_publish);
}
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFormFragment method cancelOnFatalCondition.
private void cancelOnFatalCondition(String message) {
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
activity.showError(message);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
activity.onBackPressed();
}
}, 100);
}
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFormFragment method launchFilePicker.
private void launchFilePicker() {
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity.startingFilePickerActivity = true;
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.setType("image/*");
((MainActivity) context).startActivityForResult(Intent.createChooser(intent, getString(R.string.select_thumbnail)), MainActivity.REQUEST_FILE_PICKER);
}
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFormFragment method publishClaim.
private void publishClaim(Claim claim) {
String finalFilePath = transcodedFilePath;
if (Helper.isNullOrEmpty(finalFilePath)) {
finalFilePath = currentGalleryItem != null ? currentGalleryItem.getFilePath() : currentFilePath;
}
saveInProgress = true;
PublishClaimTask task = new PublishClaimTask(claim, finalFilePath, progressPublish, new ClaimResultHandler() {
@Override
public void beforeStart() {
preSave();
}
@Override
public void onSuccess(Claim claimResult) {
postSave();
// Run the logPublish task
if (!BuildConfig.DEBUG) {
claimResult.setSigningChannel(claim.getSigningChannel());
LogPublishTask logPublish = new LogPublishTask(claimResult);
logPublish.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
// publish done
Bundle bundle = new Bundle();
bundle.putString("claim_id", claimResult.getClaimId());
bundle.putString("claim_name", claimResult.getName());
LbryAnalytics.logEvent(editMode ? LbryAnalytics.EVENT_PUBLISH_UPDATE : LbryAnalytics.EVENT_PUBLISH, bundle);
Context context = getContext();
if (context instanceof MainActivity) {
MainActivity activity = (MainActivity) context;
activity.showMessage(R.string.publish_successful);
activity.sendBroadcast(new Intent(MainActivity.ACTION_PUBLISH_SUCCESSFUL));
}
}
@Override
public void onError(Exception error) {
showError(error.getMessage());
postSave();
}
});
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
use of com.odysee.app.MainActivity in project odysee-android by OdyseeTeam.
the class PublishFragment method onFilePicked.
@Override
public void onFilePicked(String filePath) {
Context context = getContext();
if (context instanceof MainActivity) {
Map<String, Object> params = new HashMap<>();
params.put("directFilePath", filePath);
params.put("suggestedUrl", getSuggestedPublishUrl());
// ((MainActivity) context).openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);
}
}
Aggregations