mirror of https://github.com/M66B/FairEmail.git
Pinch zoom text size
This commit is contained in:
parent
ed29c0776c
commit
6e1dd04502
2
FAQ.md
2
FAQ.md
|
@ -54,12 +54,12 @@ For authorizing:
|
||||||
* ~~Pinch zoom~~ (not reliably possible in a scrolling list; the full message view can be zoomed instead)
|
* ~~Pinch zoom~~ (not reliably possible in a scrolling list; the full message view can be zoomed instead)
|
||||||
* ~~More compact folder view~~
|
* ~~More compact folder view~~
|
||||||
* ~~Compose lists and tables~~ (this requires a rich text editor, see [this FAQ](#user-content-faq99))
|
* ~~Compose lists and tables~~ (this requires a rich text editor, see [this FAQ](#user-content-faq99))
|
||||||
|
* ~~Pinch zoom text size~~
|
||||||
* Send as attachment
|
* Send as attachment
|
||||||
* Themes
|
* Themes
|
||||||
* Search for settings
|
* Search for settings
|
||||||
* Select any day for time conditions
|
* Select any day for time conditions
|
||||||
* Widget for selected account
|
* Widget for selected account
|
||||||
* Pinch zoom
|
|
||||||
|
|
||||||
Anything on this list is in random order and *might* be added in the near future.
|
Anything on this list is in random order and *might* be added in the near future.
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
|
import android.view.ScaleGestureDetector;
|
||||||
import android.view.TouchDelegate;
|
import android.view.TouchDelegate;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewAnimationUtils;
|
import android.view.ViewAnimationUtils;
|
||||||
|
@ -227,7 +228,11 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
));
|
));
|
||||||
|
|
||||||
public class ViewHolder extends RecyclerView.ViewHolder implements
|
public class ViewHolder extends RecyclerView.ViewHolder implements
|
||||||
View.OnClickListener, View.OnLongClickListener, BottomNavigationView.OnNavigationItemSelectedListener, View.OnKeyListener {
|
View.OnKeyListener,
|
||||||
|
View.OnClickListener,
|
||||||
|
View.OnLongClickListener,
|
||||||
|
View.OnTouchListener,
|
||||||
|
BottomNavigationView.OnNavigationItemSelectedListener {
|
||||||
private View card;
|
private View card;
|
||||||
private View view;
|
private View view;
|
||||||
|
|
||||||
|
@ -331,6 +336,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
private boolean hasJunk;
|
private boolean hasJunk;
|
||||||
private boolean delete;
|
private boolean delete;
|
||||||
|
|
||||||
|
private ScaleGestureDetector gestureDetector;
|
||||||
|
|
||||||
ViewHolder(final View itemView) {
|
ViewHolder(final View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
|
|
||||||
|
@ -508,9 +515,25 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
ibImages.setOnClickListener(this);
|
ibImages.setOnClickListener(this);
|
||||||
ibDecrypt.setOnClickListener(this);
|
ibDecrypt.setOnClickListener(this);
|
||||||
|
|
||||||
|
tvBody.setOnTouchListener(this);
|
||||||
|
|
||||||
btnCalendarAccept.setOnClickListener(this);
|
btnCalendarAccept.setOnClickListener(this);
|
||||||
btnCalendarDecline.setOnClickListener(this);
|
btnCalendarDecline.setOnClickListener(this);
|
||||||
btnCalendarMaybe.setOnClickListener(this);
|
btnCalendarMaybe.setOnClickListener(this);
|
||||||
|
|
||||||
|
gestureDetector = new ScaleGestureDetector(context, new ScaleGestureDetector.SimpleOnScaleGestureListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onScale(ScaleGestureDetector detector) {
|
||||||
|
TupleMessageEx message = getMessage();
|
||||||
|
if (message != null) {
|
||||||
|
float factor = detector.getScaleFactor();
|
||||||
|
float size = tvBody.getTextSize() * factor;
|
||||||
|
properties.setSize(message.id, size);
|
||||||
|
tvBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -540,6 +563,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
ibImages.setOnClickListener(null);
|
ibImages.setOnClickListener(null);
|
||||||
ibDecrypt.setOnClickListener(null);
|
ibDecrypt.setOnClickListener(null);
|
||||||
|
|
||||||
|
tvBody.setOnTouchListener(null);
|
||||||
|
|
||||||
btnCalendarAccept.setOnClickListener(null);
|
btnCalendarAccept.setOnClickListener(null);
|
||||||
btnCalendarDecline.setOnClickListener(null);
|
btnCalendarDecline.setOnClickListener(null);
|
||||||
btnCalendarMaybe.setOnClickListener(null);
|
btnCalendarMaybe.setOnClickListener(null);
|
||||||
|
@ -950,8 +975,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
ibFull.setVisibility(View.GONE);
|
ibFull.setVisibility(View.GONE);
|
||||||
ibImages.setVisibility(View.GONE);
|
ibImages.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (textSize != 0)
|
if (textSize != 0) {
|
||||||
tvBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
|
float size = properties.getSize(message.id, textSize);
|
||||||
|
tvBody.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
|
||||||
|
}
|
||||||
|
|
||||||
tvBody.setTextColor(contrast ? textColorPrimary : textColorSecondary);
|
tvBody.setTextColor(contrast ? textColorPrimary : textColorSecondary);
|
||||||
tvBody.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
|
tvBody.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
|
||||||
|
@ -1417,6 +1444,27 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
|
|
||||||
private boolean firstClick = false;
|
private boolean firstClick = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View view, MotionEvent ev) {
|
||||||
|
if (ev.getPointerCount() > 1 &&
|
||||||
|
textSize != 0 && gestureDetector != null) {
|
||||||
|
switch (ev.getAction()) {
|
||||||
|
case MotionEvent.ACTION_DOWN:
|
||||||
|
case MotionEvent.ACTION_MOVE:
|
||||||
|
view.getParent().requestDisallowInterceptTouchEvent(true);
|
||||||
|
gestureDetector.onTouchEvent(ev);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MotionEvent.ACTION_UP:
|
||||||
|
view.getParent().requestDisallowInterceptTouchEvent(false);
|
||||||
|
gestureDetector.onTouchEvent(ev);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
final TupleMessageEx message = getMessage();
|
final TupleMessageEx message = getMessage();
|
||||||
|
@ -3477,6 +3525,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||||
|
|
||||||
boolean getValue(String name, long id);
|
boolean getValue(String name, long id);
|
||||||
|
|
||||||
|
void setSize(long id, float size);
|
||||||
|
|
||||||
|
float getSize(long id, float defaultSize);
|
||||||
|
|
||||||
void setBody(long id, Spanned body);
|
void setBody(long id, Spanned body);
|
||||||
|
|
||||||
Spanned getBody(long id);
|
Spanned getBody(long id);
|
||||||
|
|
|
@ -232,6 +232,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
private int autoCloseCount = 0;
|
private int autoCloseCount = 0;
|
||||||
private boolean autoExpanded = true;
|
private boolean autoExpanded = true;
|
||||||
private Map<String, List<Long>> values = new HashMap<>();
|
private Map<String, List<Long>> values = new HashMap<>();
|
||||||
|
private LongSparseArray<Float> sizes = new LongSparseArray<>();
|
||||||
private LongSparseArray<Spanned> bodies = new LongSparseArray<>();
|
private LongSparseArray<Spanned> bodies = new LongSparseArray<>();
|
||||||
private LongSparseArray<List<EntityAttachment>> attachments = new LongSparseArray<>();
|
private LongSparseArray<List<EntityAttachment>> attachments = new LongSparseArray<>();
|
||||||
private LongSparseArray<TupleAccountSwipes> accountSwipes = new LongSparseArray<>();
|
private LongSparseArray<TupleAccountSwipes> accountSwipes = new LongSparseArray<>();
|
||||||
|
@ -1179,6 +1180,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSize(long id, float size) {
|
||||||
|
sizes.put(id, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getSize(long id, float defaultSize) {
|
||||||
|
return sizes.get(id, defaultSize);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBody(long id, Spanned value) {
|
public void setBody(long id, Spanned value) {
|
||||||
if (value == null)
|
if (value == null)
|
||||||
|
|
Loading…
Reference in New Issue