This commit is contained in:
tom79 2019-05-18 16:47:49 +02:00
parent 25a9eb04a1
commit d5050a0ba5
6 changed files with 81 additions and 12 deletions

View File

@ -1577,7 +1577,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.status_content_container.setVisibility(View.VISIBLE);
}
}
boolean blur_sensitive = sharedpreferences.getBoolean(Helper.SET_BLUR_SENSITIVE, true);
if (status.getReblog() == null) {
if (status.getMedia_attachments().size() < 1) {
@ -1601,7 +1601,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.status_horizontal_document_container.setVisibility(View.GONE);
else
holder.status_document_container.setVisibility(View.GONE);
if(behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi)){
if(blur_sensitive && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))){
loadAttachments(status, holder, true);
}
} else {
@ -1646,7 +1646,7 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
holder.status_horizontal_document_container.setVisibility(View.GONE);
else
holder.status_document_container.setVisibility(View.GONE);
if(behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi)){
if(blur_sensitive && (behaviorWithAttachments == Helper.ATTACHMENT_ALWAYS || (behaviorWithAttachments == Helper.ATTACHMENT_WIFI && isOnWifi))){
loadAttachments(status, holder, true);
}
} else {
@ -3081,15 +3081,18 @@ public class StatusListAdapter extends RecyclerView.Adapter implements OnPostAct
}
}
});
imageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
String myDir = sharedpreferences.getString(Helper.SET_FOLDER_RECORD, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
String fileName = URLUtil.guessFileName(attachment.getUrl(), null, null);
Helper.download(context,myDir+"/"+fileName, attachment.getUrl());
return true;
}
});
boolean long_press_media = sharedpreferences.getBoolean(Helper.SET_LONG_PRESS_MEDIA, true);
if( long_press_media) {
imageView.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
String myDir = sharedpreferences.getString(Helper.SET_FOLDER_RECORD, Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath());
String fileName = URLUtil.guessFileName(attachment.getUrl(), null, null);
Helper.download(context, myDir + "/" + fileName, attachment.getUrl());
return true;
}
});
}
i++;
position++;
}

View File

@ -502,6 +502,35 @@ public class SettingsFragment extends Fragment {
}
});
boolean blur_sensitive = sharedpreferences.getBoolean(Helper.SET_BLUR_SENSITIVE, true);
final CheckBox set_blur_sensitive = rootView.findViewById(R.id.set_blur_sensitive);
set_blur_sensitive.setChecked(blur_sensitive);
set_blur_sensitive.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_BLUR_SENSITIVE, set_blur_sensitive.isChecked());
editor.apply();
}
});
boolean long_press_media = sharedpreferences.getBoolean(Helper.SET_LONG_PRESS_MEDIA, true);
final CheckBox set_long_press_media = rootView.findViewById(R.id.set_long_press_media);
set_long_press_media.setChecked(long_press_media);
set_long_press_media.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(Helper.SET_LONG_PRESS_MEDIA, set_long_press_media.isChecked());
editor.apply();
}
});
int truncate_toots_size = sharedpreferences.getInt(Helper.SET_TRUNCATE_TOOTS_SIZE, 0);
SeekBar set_truncate_size = rootView.findViewById(R.id.set_truncate_size);
set_truncate_size.setMax(20);

View File

@ -324,6 +324,8 @@ public class Helper {
public static final String SET_FEATURED_TAG_ACTION ="set_featured_tag_action";
public static final String SET_HIDE_DELETE_BUTTON_ON_TAB = "set_hide_delete_notification_on_tab";
public static final String SET_RETRIEVE_METADATA_IF_URL_FROM_EXTERAL = "set_retrieve_metadata_share_from_extras";
public static final String SET_BLUR_SENSITIVE = "set_blur_sensitive";
public static final String SET_LONG_PRESS_MEDIA = "set_long_press_media";
public static final int S_NO = 0;
static final int S_512KO = 1;
public static final int S_1MO = 2;

View File

@ -114,6 +114,23 @@
android:text="@string/set_hide_delete_notification_on_tab"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_blur_sensitive"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_blur_sensitive"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_long_press_media"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_long_press_media"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -118,6 +118,22 @@
android:text="@string/set_hide_delete_notification_on_tab"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_blur_sensitive"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_blur_sensitive"
android:layout_height="wrap_content" />
<CheckBox
android:id="@+id/set_long_press_media"
android:layout_width="wrap_content"
android:layout_marginTop="@dimen/settings_checkbox_margin"
android:layout_marginBottom="@dimen/settings_checkbox_margin"
android:text="@string/set_long_press_media"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@ -942,6 +942,8 @@
<string name="gnu_instance">GNU instance</string>
<string name="cached_status">Cached status</string>
<string name="set_forward_tags">Forward tags in replies</string>
<string name="set_long_press_media">Long press to store media</string>
<string name="set_blur_sensitive">Blur sensitive media</string>
<plurals name="number_of_vote">
<item quantity="one">%d vote</item>