Settings for icon size

This commit is contained in:
Thomas 2022-10-24 09:55:54 +02:00
parent ea31842dba
commit e85ac8ed33
5 changed files with 47 additions and 14 deletions

View File

@ -924,6 +924,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
//final float scale = context.getResources().getDisplayMetrics().density;
final float scale = sharedpreferences.getFloat(context.getString(R.string.SET_FONT_SCALE), 1.1f);
final float scaleIcon = sharedpreferences.getFloat(context.getString(R.string.SET_FONT_SCALE_ICON), 1.1f);
if (statusToDeal.account.locked) {
Drawable img = ContextCompat.getDrawable(context, R.drawable.ic_baseline_lock_24);
assert img != null;
@ -934,22 +935,22 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
}
//Button sizes depending of the defined scale
float normalSize = Helper.convertDpToPixel(28, context);
holder.binding.actionButtonReply.getLayoutParams().width = (int) (normalSize * scale);
holder.binding.actionButtonReply.getLayoutParams().height = (int) (normalSize * scale);
holder.binding.actionButtonReply.getLayoutParams().width = (int) (normalSize * scaleIcon);
holder.binding.actionButtonReply.getLayoutParams().height = (int) (normalSize * scaleIcon);
holder.binding.actionButtonReply.requestLayout();
holder.binding.actionButtonBoost.setImageSize((int) (normalSize * scale));
holder.binding.actionButtonFavorite.setImageSize((int) (normalSize * scale));
holder.binding.actionButtonBookmark.setImageSize((int) (normalSize * scale));
holder.binding.statusAddCustomEmoji.getLayoutParams().width = (int) (normalSize * scale);
holder.binding.statusAddCustomEmoji.getLayoutParams().height = (int) (normalSize * scale);
holder.binding.actionButtonBoost.setImageSize((int) (normalSize * scaleIcon));
holder.binding.actionButtonFavorite.setImageSize((int) (normalSize * scaleIcon));
holder.binding.actionButtonBookmark.setImageSize((int) (normalSize * scaleIcon));
holder.binding.statusAddCustomEmoji.getLayoutParams().width = (int) (normalSize * scaleIcon);
holder.binding.statusAddCustomEmoji.getLayoutParams().height = (int) (normalSize * scaleIcon);
holder.binding.statusAddCustomEmoji.requestLayout();
holder.binding.statusEmoji.getLayoutParams().width = (int) (normalSize * scale);
holder.binding.statusEmoji.getLayoutParams().height = (int) (normalSize * scale);
holder.binding.actionButtonMore.getLayoutParams().width = (int) (normalSize * scale);
holder.binding.actionButtonMore.getLayoutParams().height = (int) (normalSize * scale);
holder.binding.statusEmoji.getLayoutParams().width = (int) (normalSize * scaleIcon);
holder.binding.statusEmoji.getLayoutParams().height = (int) (normalSize * scaleIcon);
holder.binding.actionButtonMore.getLayoutParams().width = (int) (normalSize * scaleIcon);
holder.binding.actionButtonMore.getLayoutParams().height = (int) (normalSize * scaleIcon);
holder.binding.actionButtonMore.requestLayout();
holder.binding.actionShare.getLayoutParams().width = (int) (normalSize * scale);
holder.binding.actionShare.getLayoutParams().height = (int) (normalSize * scale);
holder.binding.actionShare.getLayoutParams().width = (int) (normalSize * scaleIcon);
holder.binding.actionShare.getLayoutParams().height = (int) (normalSize * scaleIcon);
holder.binding.actionShare.requestLayout();
if (statusToDeal.account.bot) {

View File

@ -49,6 +49,11 @@ public class FragmentInterfaceSettings extends PreferenceFragmentCompat implemen
SET_FONT_SCALE.setMax(180);
SET_FONT_SCALE.setMin(80);
}
SeekBarPreference SET_FONT_SCALE_ICON = findPreference(getString(R.string.SET_FONT_SCALE_ICON_INT));
if (SET_FONT_SCALE_ICON != null) {
SET_FONT_SCALE_ICON.setMax(180);
SET_FONT_SCALE_ICON.setMin(80);
}
recreate = false;
}
@ -63,6 +68,12 @@ public class FragmentInterfaceSettings extends PreferenceFragmentCompat implemen
editor.putFloat(getString(R.string.SET_FONT_SCALE), scale);
recreate = true;
}
if (key.compareToIgnoreCase(getString(R.string.SET_FONT_SCALE_ICON_INT)) == 0) {
int progress = sharedPreferences.getInt(getString(R.string.SET_FONT_SCALE_ICON_INT), 110);
float scale = (float) (progress) / 100.0f;
editor.putFloat(getString(R.string.SET_FONT_SCALE_ICON), scale);
recreate = true;
}
if (key.compareToIgnoreCase(getString(R.string.SET_USE_SINGLE_TOPBAR)) == 0) {
recreate = true;
}

View File

@ -31,7 +31,8 @@
<string name="camera">Camera</string>
<string name="delete_all">Delete all</string>
<string name="schedule">Schedule</string>
<string name="text_size">Text and icon sizes</string>
<string name="text_size">Text sizes</string>
<string name="icon_size">Icon sizes</string>
<string name="next">Next</string>
<string name="previous">Previous</string>
<string name="open_with">Open with</string>
@ -915,6 +916,9 @@
<string name="SET_NOTIF_STATUS" translatable="false">SET_NOTIF_STATUS</string>
<string name="SET_FONT_SCALE" translatable="false">SET_FONT_SCALE</string>
<string name="SET_FONT_SCALE_INT" translatable="false">SET_FONT_SCALE_INT</string>
<string name="SET_FONT_SCALE_ICON" translatable="false">SET_FONT_SCALE_ICON</string>
<string name="SET_FONT_SCALE_ICON_INT" translatable="false">SET_FONT_SCALE_ICON_INT</string>
<string name="SET_FILTER_REGEX_HOME" translatable="false">SET_FILTER_REGEX_HOME</string>
<string name="SET_FILTER_REGEX_LOCAL" translatable="false">SET_FILTER_REGEX_LOCAL</string>
<string name="SET_FILTER_REGEX_PUBLIC" translatable="false">SET_FILTER_REGEX_PUBLIC</string>

View File

@ -61,6 +61,7 @@
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"
app:singleLineTitle="false"
app:key="@string/SET_RETRIEVE_METADATA_IF_URL_FROM_EXTERAL"
app:title="@string/set_retrieve_metadata_share_from_extras" />
@ -68,6 +69,7 @@
<SwitchPreferenceCompat
app:iconSpaceReserved="false"
app:key="@string/SET_CUSTOM_SHARING"
app:singleLineTitle="false"
app:summary="@string/settings_title_custom_sharing_indication"
app:title="@string/settings_title_custom_sharing" />
@ -79,6 +81,7 @@
app:useSimpleSummaryProvider="true" />
<SwitchPreferenceCompat
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:key="@string/SET_FORWARD_TAGS_IN_REPLY"
app:title="@string/set_forward_tags" />

View File

@ -70,14 +70,26 @@
<androidx.preference.SeekBarPreference
android:defaultValue="110"
android:max="180"
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:key="@string/SET_FONT_SCALE_INT"
app:showSeekBarValue="true"
app:title="@string/text_size" />
<androidx.preference.SeekBarPreference
android:defaultValue="110"
android:max="180"
app:iconSpaceReserved="false"
app:key="@string/SET_FONT_SCALE_ICON_INT"
app:showSeekBarValue="true"
app:singleLineTitle="false"
app:title="@string/icon_size" />
<androidx.preference.SeekBarPreference
android:defaultValue="100"
android:max="1000"
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:key="@string/SET_VIDEO_CACHE"
app:showSeekBarValue="true"
@ -86,6 +98,7 @@
<androidx.preference.SeekBarPreference
android:defaultValue="5"
android:max="30"
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:key="@string/SET_NSFW_TIMEOUT"
app:showSeekBarValue="true"
@ -94,6 +107,7 @@
<androidx.preference.SeekBarPreference
android:defaultValue="3"
android:max="30"
app:singleLineTitle="false"
app:iconSpaceReserved="false"
app:key="@string/SET_MED_DESC_TIMEOUT"
app:showSeekBarValue="true"