From fafb20b39a7e60a9f4008b25bc4458ad79ae2a20 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Thu, 21 May 2020 16:24:37 +0100 Subject: [PATCH] publish editing --- app/build.gradle | 4 +- .../adapter/InlineChannelSpinnerAdapter.java | 10 ++ .../adapter/LanguageSpinnerAdapter.java | 42 +++++++ .../adapter/LicenseSpinnerAdapter.java | 42 +++++++ .../browser/tasks/claim/PublishClaimTask.java | 15 ++- .../browser/ui/channel/ChannelFragment.java | 9 +- .../ui/following/FileViewFragment.java | 8 +- .../ui/publish/PublishFormFragment.java | 114 +++++++++++++++--- .../browser/ui/publish/PublishesFragment.java | 7 +- .../io/lbry/browser/utils/Predefined.java | 48 ++++++++ .../main/res/layout/fragment_publish_form.xml | 7 +- .../main/res/layout/spinner_item_generic.xml | 16 +++ app/src/main/res/values/strings.xml | 2 +- 13 files changed, 285 insertions(+), 39 deletions(-) create mode 100644 app/src/main/java/io/lbry/browser/adapter/LanguageSpinnerAdapter.java create mode 100644 app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java create mode 100644 app/src/main/res/layout/spinner_item_generic.xml diff --git a/app/build.gradle b/app/build.gradle index 5f0e2a56..554d69a3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { applicationId "io.lbry.browser" minSdkVersion 21 targetSdkVersion 29 - versionCode 1502 - versionName "0.15.2" + versionCode 1503 + versionName "0.15.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } diff --git a/app/src/main/java/io/lbry/browser/adapter/InlineChannelSpinnerAdapter.java b/app/src/main/java/io/lbry/browser/adapter/InlineChannelSpinnerAdapter.java index 2a2da905..9924a67a 100644 --- a/app/src/main/java/io/lbry/browser/adapter/InlineChannelSpinnerAdapter.java +++ b/app/src/main/java/io/lbry/browser/adapter/InlineChannelSpinnerAdapter.java @@ -41,6 +41,16 @@ public class InlineChannelSpinnerAdapter extends ArrayAdapter { } } + public int getItemPosition(Claim item) { + for (int i = 0; i < channels.size(); i++) { + Claim channel = channels.get(i); + if (item.getClaimId().equalsIgnoreCase(channel.getClaimId())) { + return i; + } + } + return -1; + } + @Override public View getDropDownView(int position, View view, ViewGroup parent) { return createView(position, view, parent); diff --git a/app/src/main/java/io/lbry/browser/adapter/LanguageSpinnerAdapter.java b/app/src/main/java/io/lbry/browser/adapter/LanguageSpinnerAdapter.java new file mode 100644 index 00000000..eb4decf9 --- /dev/null +++ b/app/src/main/java/io/lbry/browser/adapter/LanguageSpinnerAdapter.java @@ -0,0 +1,42 @@ +package io.lbry.browser.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import io.lbry.browser.R; +import io.lbry.browser.model.Language; +import io.lbry.browser.utils.Predefined; + +public class LanguageSpinnerAdapter extends ArrayAdapter { + private int layoutResourceId; + private LayoutInflater inflater; + + public LanguageSpinnerAdapter(Context context, int resource) { + super(context, resource, 0, Predefined.PUBLISH_LANGUAGES); + inflater = LayoutInflater.from(context); + layoutResourceId = resource; + } + + @Override + public View getDropDownView(int position, View view, @NonNull ViewGroup parent) { + return createView(position, view, parent); + } + @Override + public View getView(int position, View view, @NonNull ViewGroup parent) { + return createView(position, view, parent); + } + 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; + } +} \ No newline at end of file diff --git a/app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java b/app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java new file mode 100644 index 00000000..49f75c13 --- /dev/null +++ b/app/src/main/java/io/lbry/browser/adapter/LicenseSpinnerAdapter.java @@ -0,0 +1,42 @@ +package io.lbry.browser.adapter; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +import androidx.annotation.NonNull; + +import io.lbry.browser.R; +import io.lbry.browser.model.License; +import io.lbry.browser.utils.Predefined; + +public class LicenseSpinnerAdapter extends ArrayAdapter { + private int layoutResourceId; + private LayoutInflater inflater; + + public LicenseSpinnerAdapter(Context context, int resource) { + super(context, resource, 0, Predefined.LICENSES); + inflater = LayoutInflater.from(context); + layoutResourceId = resource; + } + + @Override + public View getDropDownView(int position, View view, @NonNull ViewGroup parent) { + return createView(position, view, parent); + } + @Override + public View getView(int position, View view, @NonNull ViewGroup parent) { + return createView(position, view, parent); + } + private View createView(int position, View convertView, ViewGroup parent) { + License 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; + } +} \ No newline at end of file diff --git a/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java b/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java index a84ce5c5..ef14812b 100644 --- a/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java +++ b/app/src/main/java/io/lbry/browser/tasks/claim/PublishClaimTask.java @@ -21,14 +21,12 @@ import io.lbry.browser.utils.Lbry; public class PublishClaimTask extends AsyncTask { private Claim claim; private String filePath; - private boolean update; private View progressView; private ClaimResultHandler handler; private Exception error; - public PublishClaimTask(Claim claim, String filePath, boolean update, View progressView, ClaimResultHandler handler) { + public PublishClaimTask(Claim claim, String filePath, View progressView, ClaimResultHandler handler) { this.claim = claim; this.filePath = filePath; - this.update = update; this.progressView = progressView; this.handler = handler; } @@ -63,8 +61,15 @@ public class PublishClaimTask extends AsyncTask { if (claim.getSigningChannel() != null) { options.put("channel_id", claim.getSigningChannel().getClaimId()); } - - // TODO: license, license_url, languages + if (metadata.getLanguages() != null && metadata.getLanguages().size() > 0) { + options.put("languages", metadata.getLanguages()); + } + if (!Helper.isNullOrEmpty(metadata.getLicense())) { + options.put("license", metadata.getLicense()); + } + if (!Helper.isNullOrEmpty(metadata.getLicenseUrl())) { + options.put("license_url", metadata.getLicenseUrl()); + } Claim claimResult = null; try { diff --git a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java index e52eda27..bfc43bd2 100644 --- a/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/channel/ChannelFragment.java @@ -377,11 +377,12 @@ public class ChannelFragment extends BaseFragment implements FetchChannelsListen String coverUrl = claim.getCoverUrl(); textTitle.setText(Helper.isNullOrEmpty(claim.getTitle()) ? claim.getName() : claim.getTitle()); - if (!Helper.isNullOrEmpty(coverUrl)) { - Glide.with(getContext().getApplicationContext()).load(coverUrl).centerCrop().into(imageCover); + Context context = getContext(); + if (context != null && !Helper.isNullOrEmpty(coverUrl)) { + Glide.with(context.getApplicationContext()).load(coverUrl).centerCrop().into(imageCover); } - if (!Helper.isNullOrEmpty(thumbnailUrl)) { - Glide.with(getContext().getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(imageThumbnail); + if (context != null && !Helper.isNullOrEmpty(thumbnailUrl)) { + Glide.with(context.getApplicationContext()).load(thumbnailUrl).apply(RequestOptions.circleCropTransform()).into(imageThumbnail); noThumbnailView.setVisibility(View.GONE); } else { imageThumbnail.setVisibility(View.GONE); diff --git a/app/src/main/java/io/lbry/browser/ui/following/FileViewFragment.java b/app/src/main/java/io/lbry/browser/ui/following/FileViewFragment.java index 526bffb5..9bf42718 100644 --- a/app/src/main/java/io/lbry/browser/ui/following/FileViewFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/following/FileViewFragment.java @@ -574,8 +574,14 @@ public class FileViewFragment extends BaseFragment implements public void onClick(View view) { ImageView descIndicator = root.findViewById(R.id.file_view_desc_toggle_arrow); View descriptionArea = root.findViewById(R.id.file_view_description_area); + + boolean hasDescription = claim != null && !Helper.isNullOrEmpty(claim.getDescription()); + boolean hasTags = claim != null && claim.getTags() != null && claim.getTags().size() > 0; + if (descriptionArea.getVisibility() != View.VISIBLE) { - descriptionArea.setVisibility(View.VISIBLE); + if (hasDescription || hasTags) { + descriptionArea.setVisibility(View.VISIBLE); + } descIndicator.setImageResource(R.drawable.ic_arrow_dropup); } else { descriptionArea.setVisibility(View.GONE); diff --git a/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java b/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java index 705c901d..91bb967c 100644 --- a/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/publish/PublishFormFragment.java @@ -44,6 +44,7 @@ import com.google.android.material.button.MaterialButton; import com.google.android.material.snackbar.Snackbar; import com.google.android.material.switchmaterial.SwitchMaterial; import com.google.android.material.textfield.TextInputEditText; +import com.google.android.material.textfield.TextInputLayout; import org.json.JSONArray; import org.json.JSONException; @@ -53,6 +54,7 @@ import java.io.File; import java.io.FileOutputStream; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; @@ -60,6 +62,8 @@ import io.lbry.browser.BuildConfig; import io.lbry.browser.MainActivity; import io.lbry.browser.R; import io.lbry.browser.adapter.InlineChannelSpinnerAdapter; +import io.lbry.browser.adapter.LanguageSpinnerAdapter; +import io.lbry.browser.adapter.LicenseSpinnerAdapter; import io.lbry.browser.adapter.TagListAdapter; import io.lbry.browser.listener.FilePickerListener; import io.lbry.browser.listener.SdkStatusListener; @@ -68,6 +72,8 @@ import io.lbry.browser.listener.WalletBalanceListener; import io.lbry.browser.model.Claim; import io.lbry.browser.model.Fee; import io.lbry.browser.model.GalleryItem; +import io.lbry.browser.model.Language; +import io.lbry.browser.model.License; import io.lbry.browser.model.NavMenuItem; import io.lbry.browser.model.Tag; import io.lbry.browser.model.WalletBalance; @@ -142,6 +148,8 @@ public class PublishFormFragment extends BaseFragment implements private TextInputEditText inputPrice; private TextInputEditText inputAddress; private TextInputEditText inputDeposit; + private TextInputEditText inputOtherLicenseDescription; + private TextInputLayout layoutOtherLicenseDescription; private View inlineDepositBalanceContainer; private TextView inlineDepositBalanceValue; @@ -161,11 +169,11 @@ public class PublishFormFragment extends BaseFragment implements private String lastSelectedThumbnailFile; private String uploadedThumbnailUrl; private boolean editFieldsLoaded; + private boolean editChannelSpinnerLoaded; private Claim currentClaim; private GalleryItem currentGalleryItem; private String currentFilePath; private String transcodedFilePath; - private boolean fileLoaded; private View mediaContainer; private View uploadProgress; @@ -176,7 +184,6 @@ public class PublishFormFragment extends BaseFragment implements private TextView textOptimizationStatus; private TextView textOptimizationElapsed; - public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = inflater.inflate(R.layout.fragment_publish_form, container, false); @@ -215,7 +222,11 @@ public class PublishFormFragment extends BaseFragment implements inputPrice = root.findViewById(R.id.publish_form_input_price); inputAddress = root.findViewById(R.id.publish_form_input_address); inputDeposit = root.findViewById(R.id.publish_form_input_deposit); + inputOtherLicenseDescription = root.findViewById(R.id.publish_form_input_license_other); + layoutOtherLicenseDescription = root.findViewById(R.id.publish_form_license_other_layout); priceCurrencySpinner = root.findViewById(R.id.publish_form_currency_spinner); + languageSpinner = root.findViewById(R.id.publish_form_language_spinner); + licenseSpinner = root.findViewById(R.id.publish_form_license_spinner); linkPublishCancel = root.findViewById(R.id.publish_form_cancel); buttonPublish = root.findViewById(R.id.publish_form_publish_button); @@ -263,11 +274,35 @@ public class PublishFormFragment extends BaseFragment implements } private void initUi() { + Context context = getContext(); + languageSpinner.setAdapter(new LanguageSpinnerAdapter(context, R.layout.spinner_item_generic)); + licenseSpinner.setAdapter(new LicenseSpinnerAdapter(context, R.layout.spinner_item_generic)); + + licenseSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView adapterView, View view, int position, long l) { + License license = (License) adapterView.getAdapter().getItem(position); + boolean otherLicense = Arrays.asList( + Predefined.LICENSE_COPYRIGHTED.toLowerCase(), + Predefined.LICENSE_OTHER.toLowerCase()).contains(license.getName().toLowerCase()); + Helper.setViewVisibility(layoutOtherLicenseDescription, otherLicense ? View.VISIBLE : View.GONE); + if (!otherLicense) { + inputOtherLicenseDescription.setText(null); + } + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + + } + }); linkGenerateAddress.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - inputAddress.setText(Helper.generateUrl()); + if (!editMode) { + inputAddress.setText(Helper.generateUrl()); + } } }); @@ -474,9 +509,7 @@ public class PublishFormFragment extends BaseFragment implements this.currentClaim = claim; editFieldsLoaded = false; } - } - - if (params.containsKey("galleryItem")) { + } else if (params.containsKey("galleryItem")) { currentGalleryItem = (GalleryItem) params.get("galleryItem"); } else if (params.containsKey("directFilePath")) { currentFilePath = (String) params.get("directFilePath"); @@ -516,8 +549,33 @@ public class PublishFormFragment extends BaseFragment implements private void updateFieldsFromCurrentClaim() { if (currentClaim != null && !editFieldsLoaded) { + Context context = getContext(); + Claim.StreamMetadata metadata = (Claim.StreamMetadata) currentClaim.getValue(); + uploadedThumbnailUrl = currentClaim.getThumbnailUrl(); + if (context != null && !Helper.isNullOrEmpty(uploadedThumbnailUrl)) { + Glide.with(context.getApplicationContext()).load(uploadedThumbnailUrl).centerCrop().into(imageThumbnail); + } + inputTitle.setText(currentClaim.getTitle()); + inputDescription.setText(currentClaim.getDescription()); + if (addedTagsAdapter != null && currentClaim.getTagObjects() != null) { + addedTagsAdapter.addTags(currentClaim.getTagObjects()); + updateSuggestedTags(currentFilter, SUGGESTED_LIMIT, true); + } + if (metadata.getFee() != null) { + Fee fee = metadata.getFee(); + switchPrice.setChecked(true); + inputPrice.setText(fee.getAmount()); + priceCurrencySpinner.setSelection("lbc".equalsIgnoreCase(fee.getCurrency()) ? 0 : 1); + } + + inputAddress.setText(currentClaim.getName()); + inputDeposit.setText(currentClaim.getAmount()); + + inputAddress.setEnabled(false); + editMode = true; + editFieldsLoaded = true; } } @@ -858,12 +916,20 @@ public class PublishFormFragment extends BaseFragment implements } if (channelSpinnerAdapter != null && channelSpinner != null) { - if (channelSpinnerAdapter.getCount() > 2) { - // if anonymous displayed, select first channel if available - channelSpinner.setSelection(2); - } else if (channelSpinnerAdapter.getCount() > 1) { - // select anonymous - channelSpinner.setSelection(1); + if (editMode && currentClaim.getSigningChannel() != null && !editChannelSpinnerLoaded) { + int position = channelSpinnerAdapter.getItemPosition(currentClaim.getSigningChannel()); + if (position > -1) { + channelSpinner.setSelection(position); + } + editChannelSpinnerLoaded = true; + } else { + if (channelSpinnerAdapter.getCount() > 2) { + // if anonymous displayed, select first channel if available + channelSpinner.setSelection(2); + } else if (channelSpinnerAdapter.getCount() > 1) { + // select anonymous + channelSpinner.setSelection(1); + } } } } @@ -889,14 +955,26 @@ public class PublishFormFragment extends BaseFragment implements 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); } - // TODO: License, LicenseDescription, LicenseUrl, Language + 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()); + } + claim.setValueType(Claim.TYPE_STREAM); claim.setValue(metadata); @@ -916,13 +994,13 @@ public class PublishFormFragment extends BaseFragment implements showError(getString(R.string.address_invalid_characters)); return false; } - if (Helper.claimNameExists(claim.getName())) { + if (!editMode && Helper.claimNameExists(claim.getName())) { showError(getString(R.string.address_already_used)); return false; } String publishFilePath = currentGalleryItem != null ? currentGalleryItem.getFilePath() : currentFilePath; - if (Helper.isNullOrEmpty(publishFilePath) && Helper.isNullOrEmpty(transcodedFilePath)) { + if (!editMode && Helper.isNullOrEmpty(publishFilePath) && Helper.isNullOrEmpty(transcodedFilePath)) { showError(getString(R.string.no_file_selected)); return false; } @@ -936,7 +1014,7 @@ public class PublishFormFragment extends BaseFragment implements finalFilePath = currentGalleryItem != null ? currentGalleryItem.getFilePath() : currentFilePath; } saveInProgress = true; - PublishClaimTask task = new PublishClaimTask(claim, finalFilePath, editMode, progressPublish, new ClaimResultHandler() { + PublishClaimTask task = new PublishClaimTask(claim, finalFilePath, progressPublish, new ClaimResultHandler() { @Override public void beforeStart() { preSave(); @@ -946,8 +1024,6 @@ public class PublishFormFragment extends BaseFragment implements public void onSuccess(Claim claimResult) { postSave(); - android.util.Log.d("#HELP", claimResult.toString()); - // Run the logPublish task if (!BuildConfig.DEBUG) { LogPublishTask logPublish = new LogPublishTask(claimResult); diff --git a/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java b/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java index 60edf552..0ba048ff 100644 --- a/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java +++ b/app/src/main/java/io/lbry/browser/ui/publish/PublishesFragment.java @@ -34,6 +34,7 @@ import io.lbry.browser.adapter.ClaimListAdapter; import io.lbry.browser.listener.SdkStatusListener; import io.lbry.browser.listener.SelectionModeListener; import io.lbry.browser.model.Claim; +import io.lbry.browser.model.NavMenuItem; import io.lbry.browser.tasks.claim.AbandonHandler; import io.lbry.browser.tasks.claim.AbandonStreamTask; import io.lbry.browser.tasks.claim.ClaimListResultHandler; @@ -82,7 +83,7 @@ public class PublishesFragment extends BaseFragment implements ActionMode.Callba public void onClick(View view) { Context context = getContext(); if (context instanceof MainActivity) { - //((MainActivity) context).openPublishForm(null); + ((MainActivity) context).openFragment(PublishFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH); } } }; @@ -245,9 +246,7 @@ public class PublishesFragment extends BaseFragment implements ActionMode.Callba // start channel editor with the claim Context context = getContext(); if (context instanceof MainActivity) { - Map params = new HashMap<>(); - params.put("claim", claim); - /*((MainActivity) context).openFragment(PublishFormFragment.class, true, NavMenuItem.ID_ITEM_NEW_PUBLISH, params);*/ + ((MainActivity) context).openPublishForm(claim); } actionMode.finish(); diff --git a/app/src/main/java/io/lbry/browser/utils/Predefined.java b/app/src/main/java/io/lbry/browser/utils/Predefined.java index bca81608..55c75711 100644 --- a/app/src/main/java/io/lbry/browser/utils/Predefined.java +++ b/app/src/main/java/io/lbry/browser/utils/Predefined.java @@ -2,6 +2,11 @@ package io.lbry.browser.utils; import java.util.Arrays; import java.util.List; +import java.util.Map; + +import io.lbry.browser.R; +import io.lbry.browser.model.Language; +import io.lbry.browser.model.License; public final class Predefined { public static final List DEFAULT_KNOWN_TAGS = Arrays.asList( @@ -1847,4 +1852,47 @@ public final class Predefined { "Yak", "Zebra" ); + + public static final List PUBLISH_LANGUAGES = Arrays.asList( + new Language("en", "English", R.string.english), + new Language("zh", "Chinese", R.string.chinese), + new Language("fr", "French", R.string.french), + new Language("de", "German", R.string.german), + new Language("jp", "Japanese", R.string.japanese), + new Language("ru", "Russian", R.string.russian), + new Language("es", "Spanish", R.string.spanish), + new Language("id", "Indonesian", R.string.indonesian), + new Language("it", "Italian", R.string.italian), + new Language("nl", "Dutch", R.string.dutch), + new Language("tr", "Turkish", R.string.turkish), + new Language("pl", "Polish", R.string.polish), + new Language("ms", "Malay", R.string.malay), + new Language("pt", "Portuguese", R.string.portuguese), + new Language("vi", "Vietnamese", R.string.vietnamese), + new Language("th", "Thai", R.string.thai), + new Language("ar", "Arabic", R.string.arabic), + new Language("cs", "Czech", R.string.czech), + new Language("hr", "Croatian", R.string.croatian), + new Language("km", "Cambodian", R.string.cambodian), + new Language("ko", "Korean", R.string.korean), + new Language("no", "Norwegian", R.string.norwegian), + new Language("ro", "Romanian", R.string.romanian), + new Language("hi", "Hindi", R.string.hindi), + new Language("el", "Greek", R.string.greek) + ); + + public static final String LICENSE_COPYRIGHTED = "Copyrighted"; + public static final String LICENSE_OTHER = "Other"; + public static final List LICENSES = Arrays.asList( + new License("None", R.string.none), + new License("Public Domain", R.string.public_domain), + new License("Creative Commons Attribution 4.0 International", "https://creativecommons.org/licenses/by/4.0/legalcode", R.string.cca_4_0_international), + new License("Creative Commons Attribution-ShareAlike 4.0 International", "https://creativecommons.org/licenses/by-sa/4.0/legalcode", R.string.cca_sa_4_0_international), + new License("Creative Commons Attribution-NoDerivatives 4.0 International", "https://creativecommons.org/licenses/by-nd/4.0/legalcode", R.string.cca_nd_4_0_international), + new License("Creative Commons Attribution-NonCommercial 4.0 International", "https://creativecommons.org/licenses/by-nc/4.0/legalcode", R.string.cca_nc_4_0_international), + new License("Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode", R.string.cca_nc_sa_4_0_international), + new License("Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International", "https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode", R.string.cca_nc_nd_4_0_international), + new License(LICENSE_COPYRIGHTED, R.string.copyrighted), + new License(LICENSE_OTHER, R.string.other) + ); } diff --git a/app/src/main/res/layout/fragment_publish_form.xml b/app/src/main/res/layout/fragment_publish_form.xml index 52b57419..8281c382 100644 --- a/app/src/main/res/layout/fragment_publish_form.xml +++ b/app/src/main/res/layout/fragment_publish_form.xml @@ -121,7 +121,8 @@ android:id="@+id/publish_form_video_opt_card" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="16dp"> + android:layout_marginTop="16dp" + android:visibility="gone"> + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c6fd5bed..6f60f156 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -166,7 +166,7 @@ None Public Domain - Copyright + Copyrighted Creative Commons Attribution 4.0 International Creative Commons Attribution-ShareAlike 4.0 International Creative Commons Attribution-NoDerivatives 4.0 International