diff options
Diffstat (limited to 'app/src/main/java/fr/gouv/etalab/mastodon/activities')
3 files changed, 33 insertions, 3 deletions
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java index 6ffbf67f4..d2241745c 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/BaseMainActivity.java @@ -2036,7 +2036,7 @@ public abstract class BaseMainActivity extends BaseActivity } else if (id == R.id.nav_my_video) { bundle = new Bundle(); DisplayStatusFragment fragment = new DisplayStatusFragment(); - bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.USER); + bundle.putSerializable("type", RetrieveFeedsAsyncTask.Type.MYVIDEOS); bundle.putString("instanceType","PEERTUBE"); SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE); String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null); diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeEditUploadActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeEditUploadActivity.java index 2c4158a0f..7f4775099 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeEditUploadActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeEditUploadActivity.java @@ -152,7 +152,7 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie //Get params from the API - LinkedHashMap<Integer, String> categories = new LinkedHashMap<>(peertubeInformation.getCategories()); + LinkedHashMap<Integer, String> categories = new LinkedHashMap<>(peertubeInformation.getCategories()); LinkedHashMap<Integer, String> licences = new LinkedHashMap<>(peertubeInformation.getLicences()); LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies()); LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages()); @@ -236,6 +236,8 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie new RetrievePeertubeSingleAsyncTask(PeertubeEditUploadActivity.this, peertubeInstance, videoId, PeertubeEditUploadActivity.this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); channels = new LinkedHashMap<>(); + + } @@ -268,6 +270,34 @@ public class PeertubeEditUploadActivity extends BaseActivity implements OnRetrie privacyToSend = peertube.getPrivacy(); categoryToSend = peertube.getCategory(); + + if( languageToSend == null){ + LinkedHashMap<String, String> languages = new LinkedHashMap<>(peertubeInformation.getLanguages()); + Map.Entry<String,String> entryString = languages.entrySet().iterator().next(); + languageToSend = new HashMap<>(); + languageToSend.put(entryString.getKey(), entryString.getValue()); + } + + if( licenseToSend == null){ + LinkedHashMap<Integer, String> licences = new LinkedHashMap<>(peertubeInformation.getLicences()); + Map.Entry<Integer,String> entryInt = licences.entrySet().iterator().next(); + licenseToSend = new HashMap<>(); + licenseToSend.put(entryInt.getKey(), entryInt.getValue()); + } + + if( categoryToSend == null){ + LinkedHashMap<Integer, String> categories = new LinkedHashMap<>(peertubeInformation.getCategories()); + Map.Entry<Integer,String> entryInt = categories.entrySet().iterator().next(); + categoryToSend = new HashMap<>(); + categoryToSend.put(entryInt.getKey(), entryInt.getValue()); + } + if( privacyToSend == null){ + LinkedHashMap<Integer, String> privacies = new LinkedHashMap<>(peertubeInformation.getPrivacies()); + Map.Entry<Integer,String> entryInt = privacies.entrySet().iterator().next(); + privacyToSend = new HashMap<>(); + privacyToSend.put(entryInt.getKey(), entryInt.getValue()); + } + String language = null; if( languageToSend != null) { diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeUploadActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeUploadActivity.java index 62961e32f..4b8415eb7 100644 --- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeUploadActivity.java +++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/PeertubeUploadActivity.java @@ -376,7 +376,7 @@ public class PeertubeUploadActivity extends BaseActivity implements OnRetrievePe videoID = response.getJSONObject("video").get("id").toString(); SharedPreferences.Editor editor = sharedpreferences.edit(); editor.putString(Helper.VIDEO_ID, videoID); - editor.apply(); + editor.commit(); } catch (JSONException e) { e.printStackTrace(); } |