Fixed scroll on select

pull/178/head
M66B 5 years ago
parent 036ade816a
commit 25ce9ddeb3

@ -47,7 +47,6 @@ import android.net.Network;
import android.net.NetworkCapabilities; import android.net.NetworkCapabilities;
import android.net.NetworkRequest; import android.net.NetworkRequest;
import android.net.Uri; import android.net.Uri;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.OperationCanceledException; import android.os.OperationCanceledException;
@ -585,12 +584,6 @@ public class FragmentCompose extends FragmentBase {
etBody.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT); etBody.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
tvReference.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT); tvReference.setTypeface(monospaced ? Typeface.MONOSPACE : Typeface.DEFAULT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
etBody.setRevealOnFocusHint(false); // Doesn't work
tvSignature.setRevealOnFocusHint(false);
tvReference.setRevealOnFocusHint(false);
}
style_bar.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { style_bar.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override @Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) { public boolean onNavigationItemSelected(@NonNull MenuItem item) {
@ -4472,6 +4465,8 @@ public class FragmentCompose extends FragmentBase {
ibReferenceEdit.setVisibility(text[1] == null ? View.GONE : View.VISIBLE); ibReferenceEdit.setVisibility(text[1] == null ? View.GONE : View.VISIBLE);
ibReferenceImages.setVisibility(ref_has_images && !show_images ? View.VISIBLE : View.GONE); ibReferenceImages.setVisibility(ref_has_images && !show_images ? View.VISIBLE : View.GONE);
setBodyPadding();
state = State.LOADED; state = State.LOADED;
final Context context = getContext(); final Context context = getContext();
@ -4508,6 +4503,14 @@ public class FragmentCompose extends FragmentBase {
}.execute(this, args, "compose:show"); }.execute(this, args, "compose:show");
} }
private void setBodyPadding() {
// Keep room for the style toolbar
boolean pad =
(grpSignature.getVisibility() == View.GONE &&
tvReference.getVisibility() == View.GONE);
etBody.setPadding(0, 0, 0, pad ? Helper.dp2pixels(getContext(), 36) : 0);
}
private AdapterView.OnItemSelectedListener identitySelected = new AdapterView.OnItemSelectedListener() { private AdapterView.OnItemSelectedListener identitySelected = new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
@ -4528,6 +4531,8 @@ public class FragmentCompose extends FragmentBase {
}, null); }, null);
tvSignature.setText(signature); tvSignature.setText(signature);
grpSignature.setVisibility(signature == null ? View.GONE : View.VISIBLE); grpSignature.setVisibility(signature == null ? View.GONE : View.VISIBLE);
setBodyPadding();
} }
@Override @Override
@ -4537,6 +4542,8 @@ public class FragmentCompose extends FragmentBase {
tvSignature.setText(null); tvSignature.setText(null);
grpSignature.setVisibility(View.GONE); grpSignature.setVisibility(View.GONE);
setBodyPadding();
} }
}; };

@ -14,7 +14,7 @@
<eu.faircode.email.ScrollViewEx <eu.faircode.email.ScrollViewEx
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/style_bar" app:layout_constraintBottom_toTopOf="@+id/media_bar"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">

Loading…
Cancel
Save