Use sp for the label font size

Make it scalable (e.g. with the font size defined in the Accessibility settings)
This commit is contained in:
Jakob Nixdorf 2017-11-27 14:26:40 +01:00
parent 5cd2a65dfe
commit 6d47f220b9
No known key found for this signature in database
GPG key ID: BE99BF86574A7DBC
3 changed files with 8 additions and 9 deletions

View file

@ -27,7 +27,6 @@ import android.graphics.ColorFilter;
import android.support.v7.widget.CardView; import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.TypedValue;
import android.view.View; import android.view.View;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
@ -133,8 +132,8 @@ public class EntryViewHolder extends RecyclerView.ViewHolder
} }
public void setLabelSize(int size) { public void setLabelSize(int size) {
label.setTextSize(TypedValue.COMPLEX_UNIT_PT, size); label.setTextSize(size);
tags.setTextSize(TypedValue.COMPLEX_UNIT_PT, size - 2); tags.setTextSize(0.75f * size);
} }
public void setLabelScroll(boolean active) { public void setLabelScroll(boolean active) {

View file

@ -77,7 +77,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textSize="8pt" /> android:textSize="18sp" />
<TextView <TextView
android:id="@+id/textViewTags" android:id="@+id/textViewTags"
@ -85,7 +85,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="1" android:maxLines="1"
android:ellipsize="end" android:ellipsize="end"
android:textSize="6pt" /> android:textSize="13.5sp" />
</LinearLayout> </LinearLayout>

View file

@ -13,7 +13,7 @@
<string name="settings_key_lang" translatable="false">pref_lang</string> <string name="settings_key_lang" translatable="false">pref_lang</string>
<string name="settings_key_theme" translatable="false">pref_theme</string> <string name="settings_key_theme" translatable="false">pref_theme</string>
<string name="settings_key_label_size" translatable="false">pref_label_size</string> <string name="settings_key_label_size" translatable="false">pref_label_size_sp</string>
<string name="settings_key_label_scroll" translatable="false">pref_label_scroll</string> <string name="settings_key_label_scroll" translatable="false">pref_label_scroll</string>
<string name="settings_key_backup_ask" translatable="false">pref_backup_ask</string> <string name="settings_key_backup_ask" translatable="false">pref_backup_ask</string>
@ -36,7 +36,7 @@
<string name="settings_default_auth" translatable="false">none</string> <string name="settings_default_auth" translatable="false">none</string>
<string name="settings_default_lang" translatable="false">system</string> <string name="settings_default_lang" translatable="false">system</string>
<string name="settings_default_theme" translatable="false">light</string> <string name="settings_default_theme" translatable="false">light</string>
<integer name="settings_default_label_size">8</integer> <integer name="settings_default_label_size">18</integer>
<!-- List values --> <!-- List values -->
<string-array name="settings_values_auth" translatable="false"> <string-array name="settings_values_auth" translatable="false">
@ -75,6 +75,6 @@
</string-array> </string-array>
<!-- Constraints --> <!-- Constraints -->
<integer name="settings_min_label_size">4</integer> <integer name="settings_min_label_size">12</integer>
<integer name="settings_max_label_size">12</integer> <integer name="settings_max_label_size">24</integer>
</resources> </resources>