Compare commits

...

10 Commits

Author SHA1 Message Date
adbenitez e5ddbacb2e update build.gradle 2024-11-15 22:45:17 +01:00
adbenitez 03c7d78e2b Merge remote-tracking branch 'upstream/main' 2024-11-15 22:45:10 +01:00
adb 00498b02b3 Merge pull request #3424 from deltachat/adb/issue-3423
remove internal font scaling preference
2024-11-15 22:01:51 +01:00
adbenitez ad6e2d1a9f fix typo 2024-11-15 21:20:40 +01:00
adbenitez 5cfa71cd72 add some protection against theoretical 0 value from ViewUtil.pxToSp() 2024-11-15 20:57:33 +01:00
adbenitez 0551044ef9 remove internal font size setting 2024-11-15 18:02:42 +01:00
adb 5126b3eeb2 Merge pull request #3422 from deltachat/adb/issue-3421
change proxy protocol label position
2024-11-15 04:27:31 +01:00
Hocuri cc419a9f62 perf: Return early in getTextScale() if text is empty or starts with letter (#3426)
Not sure why, but `setText()` seems to be called with an empty string
very often - for this case it's nice if getTextScale() returns early.

If the text starts with a letter, we can also return early.
2024-11-13 20:08:31 +01:00
adbenitez 2469b6efef update originalFontSize on setTextSize() 2024-11-13 17:20:14 +01:00
adbenitez 92bc53b672 change proxy protocol label position 2024-11-12 23:12:37 +01:00
11 changed files with 61 additions and 60 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ android {
useLibrary 'org.apache.http.legacy'
defaultConfig {
versionCode 30000696
versionName "1.48.5"
versionCode 30000697
versionName "1.48.6"
applicationId "chat.delta.lite"
multiDexEnabled true
@@ -72,7 +72,6 @@ import org.thoughtcrime.securesms.util.Linkifier;
import org.thoughtcrime.securesms.util.LongClickMovementMethod;
import org.thoughtcrime.securesms.util.MarkdownUtil;
import org.thoughtcrime.securesms.util.MediaUtil;
import org.thoughtcrime.securesms.util.Prefs;
import org.thoughtcrime.securesms.util.Util;
import org.thoughtcrime.securesms.util.ViewUtil;
import org.thoughtcrime.securesms.util.views.Stub;
@@ -387,7 +386,6 @@ public class ConversationItem extends BaseConversationItem
private void setBodyText(DcMsg messageRecord) {
bodyText.setClickable(false);
bodyText.setFocusable(false);
bodyText.setTextSize(TypedValue.COMPLEX_UNIT_SP, Prefs.getMessageBodyTextSize(context));
String text = messageRecord.getText();
File diff suppressed because one or more lines are too long
@@ -23,8 +23,6 @@ public class AppearancePreferenceFragment extends ListSummaryPreferenceFragment
this.findPreference(Prefs.THEME_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
initializeListSummary((ListPreference)findPreference(Prefs.THEME_PREF));
this.findPreference(Prefs.BACKGROUND_PREF).setOnPreferenceClickListener(new BackgroundClickListener());
this.findPreference(Prefs.MESSAGE_BODY_TEXT_SIZE_PREF).setOnPreferenceChangeListener(new ListSummaryListener());
initializeListSummary((ListPreference) findPreference(Prefs.MESSAGE_BODY_TEXT_SIZE_PREF));
}
@Override
@@ -47,7 +47,6 @@ public class Prefs {
public static final String DOZE_ASKED_DIRECTLY = "pref_doze_asked_directly";
public static final String ASKED_FOR_NOTIFICATION_PERMISSION= "pref_asked_for_notification_permission";
private static final String IN_THREAD_NOTIFICATION_PREF = "pref_key_inthread_notifications";
public static final String MESSAGE_BODY_TEXT_SIZE_PREF = "pref_message_body_text_size";
public static final String NOTIFICATION_PRIVACY_PREF = "pref_notification_privacy";
public static final String NOTIFICATION_PRIORITY_PREF = "pref_notification_priority";
@@ -104,10 +103,6 @@ public class Prefs {
return Integer.valueOf(getStringPreference(context, NOTIFICATION_PRIORITY_PREF, String.valueOf(NotificationCompat.PRIORITY_HIGH)));
}
public static int getMessageBodyTextSize(Context context) {
return Integer.valueOf(getStringPreference(context, MESSAGE_BODY_TEXT_SIZE_PREF, "16"));
}
public static void setDirectCaptureCameraId(Context context, int value) {
setIntegerPreference(context, DIRECT_CAPTURE_CAMERA_ID, value);
}
@@ -32,7 +32,9 @@ import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.interpolator.view.animation.FastOutSlowInInterpolator;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
@@ -202,6 +204,18 @@ public class ViewUtil {
return (int)((dp * context.getResources().getDisplayMetrics().density) + 0.5);
}
public static float pxToSp(Context context, int px) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
if (VERSION.SDK_INT >= VERSION_CODES.UPSIDE_DOWN_CAKE) {
return TypedValue.deriveDimension(TypedValue.COMPLEX_UNIT_SP, px, metrics);
} else {
if (metrics.scaledDensity == 0) {
return 0;
}
return px / metrics.scaledDensity;
}
}
public static void updateLayoutParams(@NonNull View view, int width, int height) {
view.getLayoutParams().width = width;
view.getLayoutParams().height = height;
+16 -16
View File
@@ -38,6 +38,22 @@
android:gravity="center_vertical"
>
<TextView
android:id="@+id/protocol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:textAllCaps="true"
android:textColor="?attr/conversation_list_item_date_color"
android:background="@drawable/archived_indicator_background"
style="@style/Signal.Text.Caption"
tools:text="socks5"
/>
<ImageView
android:id="@+id/checkmark"
android:layout_width="wrap_content"
@@ -53,7 +69,6 @@
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="5dp"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceSmall"
@@ -62,21 +77,6 @@
tools:text="@string/connectivity_connected"
/>
<TextView
android:id="@+id/protocol"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="1dp"
android:paddingBottom="1dp"
android:textAllCaps="true"
android:textColor="?attr/conversation_list_item_date_color"
android:background="@drawable/archived_indicator_background"
style="@style/Signal.Text.Caption"
tools:text="socks5"
/>
</LinearLayout>
<ImageButton
-14
View File
@@ -188,20 +188,6 @@
<item>#000000</item>
</array>
<string-array name="pref_message_font_size_entries">
<item>@string/small</item>
<item>@string/normal</item>
<item>@string/large</item>
<item>@string/extra_large</item>
</string-array>
<string-array name="pref_message_font_size_values">
<item>13</item>
<item>16</item>
<item>20</item>
<item>30</item>
</string-array>
<string-array name="pref_notification_priority_entries">
<item>@string/def</item>
<item>@string/notify_priority_high</item>
+1
View File
@@ -756,6 +756,7 @@
<string name="pref_app_access">App Access</string>
<string name="pref_chats">Chats</string>
<string name="pref_in_chat_sounds">In-Chat Sounds</string>
<!-- deprecated -->
<string name="pref_message_text_size">Message Font Size</string>
<string name="pref_view_log">View Log</string>
<string name="pref_saved_log">Saved the log to \"Downloads\" folder</string>
@@ -15,11 +15,4 @@
android:key="pref_chat_background"
android:title="@string/pref_background"/>
<ListPreference
android:key="pref_message_body_text_size"
android:title="@string/pref_message_text_size"
android:entries="@array/pref_message_font_size_entries"
android:entryValues="@array/pref_message_font_size_values"
android:defaultValue="16"/>
</PreferenceScreen>
@@ -15,11 +15,4 @@
android:key="pref_chat_background"
android:title="@string/pref_background"/>
<ListPreference
android:key="pref_message_body_text_size"
android:title="@string/pref_message_text_size"
android:entries="@array/pref_message_font_size_entries"
android:entryValues="@array/pref_message_font_size_values"
android:defaultValue="16"/>
</PreferenceScreen>