1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 02:07:12 +00:00

Show text zoom level

This commit is contained in:
M66B 2020-05-20 17:47:03 +02:00
parent 18f028f131
commit 13b5def291

View file

@ -709,15 +709,24 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
btnCalendarMaybe.setOnLongClickListener(this);
gestureDetector = new ScaleGestureDetector(context, new ScaleGestureDetector.SimpleOnScaleGestureListener() {
private float scale = 1.0f;
private Toast toast = null;
@Override
public boolean onScale(ScaleGestureDetector detector) {
TupleMessageEx message = getMessage();
if (message != null) {
float factor = detector.getScaleFactor();
float size = tvBody.getTextSize() * factor;
//Log.i("Gesture factor=" + factor + " size=" + size);
properties.setSize(message.id, size);
tvBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
scale = scale * factor;
String perc = Math.round(scale * 100) + " %";
if (toast != null)
toast.cancel();
toast = ToastEx.makeText(context, perc, Toast.LENGTH_SHORT);
toast.show();
}
return true;
}