Add links in toots for media as an option in settings
This commit is contained in:
parent
e10364fd5f
commit
838e4c9791
|
@ -782,12 +782,16 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
|
imParams.height = (int) Helper.convertDpToPixel(100, getApplicationContext());
|
||||||
imageView.setAdjustViewBounds(true);
|
imageView.setAdjustViewBounds(true);
|
||||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||||
//Adds the url at the end of the toot
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
int selectionBefore = toot_content.getSelectionStart();
|
boolean show_media_urls = sharedpreferences.getBoolean(Helper.SET_MEDIA_URLS, true);
|
||||||
toot_content.setText(toot_content.getText().toString()+"\n"+attachment.getUrl());
|
if( show_media_urls) {
|
||||||
//Moves the cursor
|
//Adds the url at the end of the toot
|
||||||
if( selectionBefore >= 0 )
|
int selectionBefore = toot_content.getSelectionStart();
|
||||||
toot_content.setSelection(selectionBefore);
|
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);
|
toot_picture_container.addView(imageView, attachments.size(), imParams);
|
||||||
imageView.setOnClickListener(new View.OnClickListener() {
|
imageView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -826,12 +830,16 @@ public class TootActivity extends AppCompatActivity implements OnRetrieveSearcAc
|
||||||
for(Attachment attachment: attachments){
|
for(Attachment attachment: attachments){
|
||||||
if( Integer.valueOf(attachment.getId()) == viewId){
|
if( Integer.valueOf(attachment.getId()) == viewId){
|
||||||
attachments.remove(attachment);
|
attachments.remove(attachment);
|
||||||
//Adds the url at the end of the toot
|
final SharedPreferences sharedpreferences = getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||||
int selectionBefore = toot_content.getSelectionStart();
|
boolean show_media_urls = sharedpreferences.getBoolean(Helper.SET_MEDIA_URLS, true);
|
||||||
toot_content.setText(toot_content.getText().toString().replace(attachment.getUrl(),""));
|
if( show_media_urls) {
|
||||||
//Moves the cursor
|
//Adds the url at the end of the toot
|
||||||
if( selectionBefore >= 0 )
|
int selectionBefore = toot_content.getSelectionStart();
|
||||||
toot_content.setSelection(selectionBefore);
|
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);
|
((ViewGroup) namebar.getParent()).removeView(namebar);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
boolean notif_validation = sharedpreferences.getBoolean(Helper.SET_NOTIF_VALIDATION, true);
|
||||||
final CheckBox set_share_validation = (CheckBox) rootView.findViewById(R.id.set_share_validation);
|
final CheckBox set_share_validation = (CheckBox) rootView.findViewById(R.id.set_share_validation);
|
||||||
|
|
|
@ -193,6 +193,7 @@ public class Helper {
|
||||||
public static final String SET_POPUP_PUSH = "set_popup_push";
|
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_NSFW_TIMEOUT = "set_nsfw_timeout";
|
||||||
public static final String SET_TABS = "set_tabs";
|
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_ALWAYS = 1;
|
||||||
public static final int ATTACHMENT_WIFI = 2;
|
public static final int ATTACHMENT_WIFI = 2;
|
||||||
public static final int ATTACHMENT_ASK = 3;
|
public static final int ATTACHMENT_ASK = 3;
|
||||||
|
|
|
@ -46,9 +46,13 @@
|
||||||
android:text="@string/set_show_error_messages"
|
android:text="@string/set_show_error_messages"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/set_auto_add_media_url"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/set_auto_add_media_url"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:id="@+id/set_auto_store"
|
android:id="@+id/set_auto_store"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/set_auto_store_toot"
|
android:text="@string/set_auto_store_toot"
|
||||||
|
|
|
@ -46,9 +46,13 @@
|
||||||
android:text="@string/set_show_error_messages"
|
android:text="@string/set_show_error_messages"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/set_auto_add_media_url"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:text="@string/set_auto_add_media_url"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:id="@+id/set_auto_store"
|
android:id="@+id/set_auto_store"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="@string/set_auto_store_toot"
|
android:text="@string/set_auto_store_toot"
|
||||||
|
|
|
@ -270,7 +270,7 @@
|
||||||
<string name="set_display_reply">Afficher le message précédent lors d\'une réponse</string>
|
<string name="set_display_reply">Afficher le message précédent lors d\'une réponse</string>
|
||||||
<string name="set_folder_title">Destination : </string>
|
<string name="set_folder_title">Destination : </string>
|
||||||
<string name="set_auto_store_toot">Enregistrer les brouillons automatiquement</string>
|
<string name="set_auto_store_toot">Enregistrer les brouillons automatiquement</string>
|
||||||
|
<string name="set_auto_add_media_url">Ajouter l\'URL des médias dans les pouets</string>
|
||||||
<string name="settings_title_notifications">Gestion des notifications</string>
|
<string name="settings_title_notifications">Gestion des notifications</string>
|
||||||
<string name="set_notif_follow">Notifier lorsque quelqu’un me suit</string>
|
<string name="set_notif_follow">Notifier lorsque quelqu’un me suit</string>
|
||||||
<string name="set_notif_follow_ask">Notifier lorsque quelqu\'un demande à me suivre</string>
|
<string name="set_notif_follow_ask">Notifier lorsque quelqu\'un demande à me suivre</string>
|
||||||
|
|
|
@ -276,6 +276,7 @@
|
||||||
<string name="set_display_reply">Display previous message in responses</string>
|
<string name="set_display_reply">Display previous message in responses</string>
|
||||||
<string name="set_folder_title">Path: </string>
|
<string name="set_folder_title">Path: </string>
|
||||||
<string name="set_auto_store_toot">Save drafts automatically</string>
|
<string name="set_auto_store_toot">Save drafts automatically</string>
|
||||||
|
<string name="set_auto_add_media_url">Add URL of media in toots</string>
|
||||||
<string name="settings_title_notifications">Manage notifications</string>
|
<string name="settings_title_notifications">Manage notifications</string>
|
||||||
<string name="set_notif_follow">Notify when someone follows you</string>
|
<string name="set_notif_follow">Notify when someone follows you</string>
|
||||||
<string name="set_notif_follow_ask">Notify when someone requests to follow you</string>
|
<string name="set_notif_follow_ask">Notify when someone requests to follow you</string>
|
||||||
|
|
Loading…
Reference in New Issue