mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-29 09:01:30 +01:00
Added list item text size
This commit is contained in:
@@ -28,7 +28,6 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
@@ -112,7 +111,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
private FragmentManager fragmentManager;
|
||||
private ViewType viewType;
|
||||
private boolean outgoing;
|
||||
private int zoom;
|
||||
private boolean internet;
|
||||
private IProperties properties;
|
||||
|
||||
@@ -126,6 +124,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
private boolean debug;
|
||||
|
||||
private int dp24;
|
||||
private float textSize;
|
||||
private int colorPrimary;
|
||||
private int colorAccent;
|
||||
private int textColorSecondary;
|
||||
@@ -471,6 +470,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
tvSubject.setTypeface(null, typeface);
|
||||
tvCount.setTypeface(null, typeface);
|
||||
|
||||
if (textSize != 0) {
|
||||
tvFrom.setTextSize(textSize);
|
||||
tvSubject.setTextSize(textSize);
|
||||
}
|
||||
|
||||
int colorUnseen = (message.unseen > 0 ? colorUnread : textColorSecondary);
|
||||
tvFrom.setTextColor(colorUnseen);
|
||||
tvSize.setTextColor(colorUnseen);
|
||||
@@ -540,20 +544,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
bnvActions.getMenu().getItem(i).setVisible(false);
|
||||
bnvActions.setVisibility(View.VISIBLE);
|
||||
|
||||
TypedArray ta;
|
||||
if (zoom == 0)
|
||||
ta = context.obtainStyledAttributes(
|
||||
R.style.TextAppearance_AppCompat_Small, new int[]{android.R.attr.textSize});
|
||||
else if (zoom == 2)
|
||||
ta = context.obtainStyledAttributes(
|
||||
R.style.TextAppearance_AppCompat_Large, new int[]{android.R.attr.textSize});
|
||||
else
|
||||
ta = context.obtainStyledAttributes(
|
||||
R.style.TextAppearance_AppCompat_Medium, new int[]{android.R.attr.textSize});
|
||||
float textSize = ta.getDimension(0, 0);
|
||||
if (textSize != 0)
|
||||
tvBody.setTextSize(textSize / context.getResources().getDisplayMetrics().density);
|
||||
ta.recycle();
|
||||
tvBody.setTextSize(textSize);
|
||||
|
||||
Spanned body = properties.getBody(message.id);
|
||||
tvBody.setText(body);
|
||||
@@ -1698,7 +1690,6 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
this.fragmentManager = fragmentManager;
|
||||
this.viewType = viewType;
|
||||
this.outgoing = outgoing;
|
||||
this.zoom = zoom;
|
||||
this.internet = (Helper.isMetered(context, false) != null);
|
||||
this.properties = properties;
|
||||
|
||||
@@ -1715,6 +1706,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
this.debug = prefs.getBoolean("debug", false);
|
||||
|
||||
this.dp24 = Helper.dp2pixels(24, context);
|
||||
this.textSize = Helper.getTextSize(zoom, context);
|
||||
this.colorPrimary = Helper.resolveColor(context, R.attr.colorPrimary);
|
||||
this.colorAccent = Helper.resolveColor(context, R.attr.colorAccent);
|
||||
this.textColorSecondary = Helper.resolveColor(context, android.R.attr.textColorSecondary);
|
||||
@@ -1734,7 +1726,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
}
|
||||
|
||||
void setZoom(int zoom) {
|
||||
this.zoom = zoom;
|
||||
textSize = Helper.getTextSize(zoom, context);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user