Fix issue #681 - Remove left margin - Default disabled.

This commit is contained in:
Thomas 2022-12-26 11:43:23 +01:00
parent 7a8f07d758
commit 9f666bafc6
3 changed files with 54 additions and 0 deletions

View File

@ -68,6 +68,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.LinearLayoutCompat;
import androidx.appcompat.widget.PopupMenu;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.app.ActivityOptionsCompat;
@ -397,6 +398,47 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
boolean displayBookmark = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_BOOKMARK), true);
boolean displayTranslate = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_TRANSLATE), false);
boolean displayCounters = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COUNTER_FAV_BOOST), false);
boolean removeLeftMargin = sharedpreferences.getBoolean(context.getString(R.string.SET_REMOVE_LEFT_MARGIN), false);
if (removeLeftMargin) {
LinearLayoutCompat.MarginLayoutParams p = (LinearLayoutCompat.MarginLayoutParams) holder.binding.spoiler.getLayoutParams();
p.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.spoiler.setLayoutParams(p);
LinearLayoutCompat.MarginLayoutParams pe = (LinearLayoutCompat.MarginLayoutParams) holder.binding.spoilerExpand.getLayoutParams();
pe.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.spoilerExpand.setLayoutParams(pe);
LinearLayoutCompat.MarginLayoutParams psc = (LinearLayoutCompat.MarginLayoutParams) holder.binding.statusContent.getLayoutParams();
psc.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.statusContent.setLayoutParams(psc);
LinearLayoutCompat.MarginLayoutParams pct = (LinearLayoutCompat.MarginLayoutParams) holder.binding.containerTrans.getLayoutParams();
psc.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.containerTrans.setLayoutParams(psc);
LinearLayoutCompat.MarginLayoutParams pcv = (LinearLayoutCompat.MarginLayoutParams) holder.binding.card.getLayoutParams();
pcv.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.card.setLayoutParams(pcv);
LinearLayoutCompat.MarginLayoutParams pmc = (LinearLayoutCompat.MarginLayoutParams) holder.binding.mediaContainer.getLayoutParams();
pmc.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.mediaContainer.setLayoutParams(pmc);
LinearLayoutCompat.MarginLayoutParams pal = (LinearLayoutCompat.MarginLayoutParams) holder.binding.attachmentsListContainer.getLayoutParams();
pal.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.attachmentsListContainer.setLayoutParams(pal);
LinearLayoutCompat.MarginLayoutParams pp = (LinearLayoutCompat.MarginLayoutParams) holder.binding.poll.pollContainer.getLayoutParams();
pp.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.poll.pollContainer.setLayoutParams(pp);
LinearLayoutCompat.MarginLayoutParams pet = (LinearLayoutCompat.MarginLayoutParams) holder.binding.editTime.getLayoutParams();
pet.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.editTime.setLayoutParams(pet);
LinearLayoutCompat.MarginLayoutParams psi = (LinearLayoutCompat.MarginLayoutParams) holder.binding.statusInfo.getLayoutParams();
psi.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.statusInfo.setLayoutParams(psi);
LinearLayoutCompat.MarginLayoutParams pas = (LinearLayoutCompat.MarginLayoutParams) holder.binding.actionShareContainer.getLayoutParams();
pas.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.actionShareContainer.setLayoutParams(pas);
LinearLayoutCompat.MarginLayoutParams pab = (LinearLayoutCompat.MarginLayoutParams) holder.binding.actionButtons.getLayoutParams();
pab.setMarginStart((int) Helper.convertDpToPixel(6, context));
holder.binding.actionButtons.setLayoutParams(pab);
}
String loadMediaType = sharedpreferences.getString(context.getString(R.string.SET_LOAD_MEDIA_TYPE), "ALWAYS");
if (currentAccount != null && currentAccount.api == Account.API.PLEROMA) {

View File

@ -1402,6 +1402,8 @@
<string name="SET_DISPLAY_TRANSLATE" translatable="false">SET_DISPLAY_TRANSLATE</string>
<string name="SET_NOTIF_VALIDATION_FAV" translatable="false">SET_NOTIF_VALIDATION_FAV</string>
<string name="SET_DISPLAY_COUNTER_FAV_BOOST" translatable="false">SET_DISPLAY_COUNTER_FAV_BOOST</string>
<string name="SET_REMOVE_LEFT_MARGIN" translatable="false">SET_REMOVE_LEFT_MARGIN</string>
<string name="SET_INNER_MARKER" translatable="false">SET_INNER_MARKER</string>
<string name="SET_NOTIF_SILENT" translatable="false">SET_NOTIF_SILENT</string>
<string name="SET_REMEMBER_POSITION" translatable="false">SET_REMEMBER_POSITION</string>
@ -2112,4 +2114,6 @@
<string name="import_data">Import data</string>
<string name="group_reblogs">Group reblogs in home timeline</string>
<string name="manage_accounts">Manage accounts</string>
<string name="set_remove_left_margin_title">Remove left margin</string>
<string name="set_remove_left_margin">Remove the left margin in timelines to make messages more compact</string>
</resources>

View File

@ -20,6 +20,14 @@
app:summary="@string/set_timelines_in_a_list"
app:title="@string/set_timelines_in_a_list_title" />
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/SET_REMOVE_LEFT_MARGIN"
app:singleLineTitle="false"
app:summary="@string/set_remove_left_margin"
app:title="@string/set_remove_left_margin_title" />
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"