Search in sources :

Example 1 with Language

use of com.odysee.app.model.Language in project odysee-android by OdyseeTeam.

the class LanguageSpinnerAdapter method createView.

private View createView(int position, View convertView, ViewGroup parent) {
    Language item = getItem(position);
    View view = inflater.inflate(layoutResourceId, parent, false);
    TextView label = view.findViewById(R.id.item_display_name);
    label.setText(item != null ? item.getStringResourceId() : 0);
    return view;
}
Also used : Language(com.odysee.app.model.Language) TextView(android.widget.TextView) TextView(android.widget.TextView) View(android.view.View)

Example 2 with Language

use of com.odysee.app.model.Language in project odysee-android by OdyseeTeam.

the class PublishFormFragment method buildPublishClaim.

private Claim buildPublishClaim() {
    Claim claim = new Claim();
    claim.setName(Helper.getValue(inputAddress.getText()));
    claim.setAmount(Helper.getValue(inputDeposit.getText()));
    Claim.StreamMetadata metadata = new Claim.StreamMetadata();
    metadata.setTitle(Helper.getValue(inputTitle.getText()));
    metadata.setDescription(Helper.getValue(inputDescription.getText()));
    metadata.setTags(Helper.getTagsForTagObjects(addedTagsAdapter.getTags()));
    Claim selectedChannel = (Claim) channelSpinner.getSelectedItem();
    if (selectedChannel != null && !selectedChannel.isPlaceholder() && !selectedChannel.isPlaceholderAnonymous()) {
        claim.setSigningChannel(selectedChannel);
    }
    if (switchPrice.isChecked()) {
        Fee fee = new Fee();
        fee.setCurrency((String) priceCurrencySpinner.getSelectedItem());
        fee.setAmount(Helper.getValue(inputPrice.getText()));
        metadata.setFee(fee);
    }
    if (!Helper.isNullOrEmpty(uploadedThumbnailUrl)) {
        Claim.Resource thumbnail = new Claim.Resource();
        thumbnail.setUrl(uploadedThumbnailUrl);
        metadata.setThumbnail(thumbnail);
    }
    Language selectedLanguage = (Language) languageSpinner.getSelectedItem();
    if (selectedLanguage != null) {
        metadata.setLanguages(Arrays.asList(selectedLanguage.getCode()));
    }
    License selectedLicense = (License) licenseSpinner.getSelectedItem();
    if (selectedLicense != null) {
        boolean otherLicense = Arrays.asList(Predefined.LICENSE_COPYRIGHTED.toLowerCase(), Predefined.LICENSE_OTHER.toLowerCase()).contains(selectedLicense.getName().toLowerCase());
        metadata.setLicense(otherLicense ? Helper.getValue(inputOtherLicenseDescription.getText()) : selectedLicense.getName());
        metadata.setLicenseUrl(selectedLicense.getUrl());
    }
    // set release time from current claim (on edit)
    if (currentClaim != null) {
        Claim.StreamMetadata currentMetadata = (Claim.StreamMetadata) currentClaim.getValue();
        metadata.setReleaseTime(currentMetadata.getReleaseTime());
        if (metadata.getReleaseTime() == 0) {
            metadata.setReleaseTime(currentClaim.getTimestamp());
        }
        claim.setTimestamp(currentClaim.getTimestamp());
    }
    claim.setValueType(Claim.TYPE_STREAM);
    claim.setValue(metadata);
    return claim;
}
Also used : Language(com.odysee.app.model.Language) Fee(com.odysee.app.model.Fee) License(com.odysee.app.model.License) Claim(com.odysee.app.model.Claim)

Aggregations

Language (com.odysee.app.model.Language)2 View (android.view.View)1 TextView (android.widget.TextView)1 Claim (com.odysee.app.model.Claim)1 Fee (com.odysee.app.model.Fee)1 License (com.odysee.app.model.License)1