Search in sources :

Example 11 with MainActivity

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);
    }
}
Also used : MainActivity(com.odysee.app.MainActivity)

Example 12 with MainActivity

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);
    }
}
Also used : Context(android.content.Context) Handler(android.os.Handler) ClaimResultHandler(com.odysee.app.tasks.claim.ClaimResultHandler) ClaimListResultHandler(com.odysee.app.tasks.claim.ClaimListResultHandler) MainActivity(com.odysee.app.MainActivity)

Example 13 with MainActivity

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);
    }
}
Also used : Context(android.content.Context) Intent(android.content.Intent) MainActivity(com.odysee.app.MainActivity)

Example 14 with MainActivity

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);
}
Also used : PublishClaimTask(com.odysee.app.tasks.claim.PublishClaimTask) Context(android.content.Context) ClaimResultHandler(com.odysee.app.tasks.claim.ClaimResultHandler) Bundle(android.os.Bundle) LogPublishTask(com.odysee.app.tasks.lbryinc.LogPublishTask) Intent(android.content.Intent) MainActivity(com.odysee.app.MainActivity) Claim(com.odysee.app.model.Claim) JSONException(org.json.JSONException)

Example 15 with MainActivity

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);
    }
}
Also used : Context(android.content.Context) HashMap(java.util.HashMap) MainActivity(com.odysee.app.MainActivity)

Aggregations

MainActivity (com.odysee.app.MainActivity)138 Context (android.content.Context)119 Claim (com.odysee.app.model.Claim)39 View (android.view.View)31 TextView (android.widget.TextView)30 RecyclerView (androidx.recyclerview.widget.RecyclerView)26 AttributeProviderContext (org.commonmark.renderer.html.AttributeProviderContext)25 ArrayList (java.util.ArrayList)21 TrackSelectionOverride (com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride)19 ImageView (android.widget.ImageView)18 SuppressLint (android.annotation.SuppressLint)15 AdapterView (android.widget.AdapterView)14 NestedScrollView (androidx.core.widget.NestedScrollView)14 JSONException (org.json.JSONException)13 JSONObject (org.json.JSONObject)13 SolidIconView (com.odysee.app.ui.controls.SolidIconView)12 HashMap (java.util.HashMap)12 ClaimListAdapter (com.odysee.app.adapter.ClaimListAdapter)11 ApiCallException (com.odysee.app.exceptions.ApiCallException)11 WebView (android.webkit.WebView)10