diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java
index 731964917..120177616 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/activities/TootActivity.java
@@ -782,12 +782,16 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
imageView.setAdjustViewBounds(true);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
- //Adds the url at the end of the toot
- int selectionBefore = toot_content.getSelectionStart();
- toot_content.setText(toot_content.getText().toString()+"\n"+attachment.getUrl());
- //Moves the cursor
- if( selectionBefore >= 0 )
- toot_content.setSelection(selectionBefore);
+ final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
+ boolean show_media_urls = sharedpreferences.getBoolean(Helper.SET_MEDIA_URLS, true);
+ if( show_media_urls) {
+ //Adds the url at the end of the toot
+ int selectionBefore = toot_content.getSelectionStart();
+ toot_content.setText(toot_content.getText().toString() + "\n" + attachment.getUrl());
+ //Moves the cursor
+ if (selectionBefore >= 0)
+ toot_content.setSelection(selectionBefore);
+ }
toot_picture_container.addView(imageView, attachments.size(), imParams);
imageView.setOnClickListener(new View.OnClickListener() {
@Override
@@ -826,12 +830,16 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
for(Attachment attachment: attachments){
if( Integer.valueOf(attachment.getId()) == viewId){
attachments.remove(attachment);
- //Adds the url at the end of the toot
- int selectionBefore = toot_content.getSelectionStart();
- toot_content.setText(toot_content.getText().toString().replace(attachment.getUrl(),""));
- //Moves the cursor
- if( selectionBefore >= 0 )
- toot_content.setSelection(selectionBefore);
+ final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
+ boolean show_media_urls = sharedpreferences.getBoolean(Helper.SET_MEDIA_URLS, true);
+ if( show_media_urls) {
+ //Adds the url at the end of the toot
+ int selectionBefore = toot_content.getSelectionStart();
+ toot_content.setText(toot_content.getText().toString().replace(attachment.getUrl(), ""));
+ //Moves the cursor
+ if (selectionBefore >= 0)
+ toot_content.setSelection(selectionBefore);
+ }
((ViewGroup) namebar.getParent()).removeView(namebar);
break;
}
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java
index 42971e806..1ef2549e4 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/fragments/SettingsFragment.java
@@ -113,6 +113,18 @@ public class SettingsFragment extends Fragment {
}
});
+ boolean show_media_urls = sharedpreferences.getBoolean(Helper.SET_MEDIA_URLS, true);
+ final CheckBox set_auto_add_media_url = (CheckBox) rootView.findViewById(R.id.set_auto_add_media_url);
+ set_auto_add_media_url.setChecked(show_media_urls);
+
+ set_auto_add_media_url.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ SharedPreferences.Editor editor = sharedpreferences.edit();
+ editor.putBoolean(Helper.SET_MEDIA_URLS, set_auto_add_media_url.isChecked());
+ editor.apply();
+ }
+ });
boolean notif_validation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
final CheckBox set_share_validation = (CheckBox) rootView.findViewById(R.id.set_share_validation);
diff --git a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
index d5a918554..d1eb627c9 100644
--- a/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
+++ b/app/src/main/java/fr/gouv/etalab/mastodon/helper/Helper.java
@@ -193,6 +193,7 @@ public class Helper {
public static final String SET_POPUP_PUSH = "set_popup_push";
public static final String SET_NSFW_TIMEOUT = "set_nsfw_timeout";
public static final String SET_TABS = "set_tabs";
+ public static final String SET_MEDIA_URLS = "set_media_urls";
public static final int ATTACHMENT_ALWAYS = 1;
public static final int ATTACHMENT_WIFI = 2;
public static final int ATTACHMENT_ASK = 3;
diff --git a/app/src/main/res/layout-sw600dp/fragment_settings.xml b/app/src/main/res/layout-sw600dp/fragment_settings.xml
index 67e62db04..9c9ba7c69 100644
--- a/app/src/main/res/layout-sw600dp/fragment_settings.xml
+++ b/app/src/main/res/layout-sw600dp/fragment_settings.xml
@@ -46,9 +46,13 @@
android:text="@string/set_show_error_messages"
android:layout_height="wrap_content" />
+
+
Afficher le message précédent lors d\'une réponse
Destination :
Enregistrer les brouillons automatiquement
-
+ Ajouter l\'URL des médias dans les pouets
Gestion des notifications
Notifier lorsque quelqu’un me suit
Notifier lorsque quelqu\'un demande à me suivre
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index d5e23d99b..36bb549c9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -276,6 +276,7 @@
Display previous message in responses
Path:
Save drafts automatically
+ Add URL of media in toots
Manage notifications
Notify when someone follows you
Notify when someone requests to follow you