mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 06:01:12 +00:00
Replaced message zoom by seekbar
This commit is contained in:
parent
54e60c7b41
commit
e72c3dbef5
3 changed files with 33 additions and 46 deletions
|
@ -27,8 +27,6 @@ import android.graphics.Bitmap;
|
|||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
|
@ -39,7 +37,6 @@ import android.view.Window;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SeekBar;
|
||||
|
@ -127,7 +124,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
private TextView tvPreviewLinesHint;
|
||||
|
||||
private SwitchCompat swAddresses;
|
||||
private EditText etMessageZoom;
|
||||
private TextView tvMessageZoom;
|
||||
private SeekBar sbMessageZoom;
|
||||
private SwitchCompat swOverviewMode;
|
||||
|
||||
private SwitchCompat swContrast;
|
||||
|
@ -247,7 +245,8 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
spPreviewLines = view.findViewById(R.id.spPreviewLines);
|
||||
tvPreviewLinesHint = view.findViewById(R.id.tvPreviewLinesHint);
|
||||
swAddresses = view.findViewById(R.id.swAddresses);
|
||||
etMessageZoom = view.findViewById(R.id.etMessageZoom);
|
||||
tvMessageZoom = view.findViewById(R.id.tvMessageZoom);
|
||||
sbMessageZoom = view.findViewById(R.id.sbMessageZoom);
|
||||
swOverviewMode = view.findViewById(R.id.swOverviewMode);
|
||||
swContrast = view.findViewById(R.id.swContrast);
|
||||
swMonospaced = view.findViewById(R.id.swMonospaced);
|
||||
|
@ -792,27 +791,24 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
}
|
||||
});
|
||||
|
||||
etMessageZoom.addTextChangedListener(new TextWatcher() {
|
||||
sbMessageZoom.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
int message_zoom = progress + 50;
|
||||
if (message_zoom == 100)
|
||||
prefs.edit().remove("message_zoom").apply();
|
||||
else
|
||||
prefs.edit().putInt("message_zoom", message_zoom).apply();
|
||||
tvMessageZoom.setText(getString(R.string.title_advanced_message_text_zoom2, NF.format(message_zoom)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
try {
|
||||
int zoom = (s.length() > 0 ? Integer.parseInt(s.toString()) : 0);
|
||||
if (zoom == 0)
|
||||
prefs.edit().remove("message_zoom").apply();
|
||||
else
|
||||
prefs.edit().putInt("message_zoom", zoom).apply();
|
||||
} catch (NumberFormatException ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
// Do nothing
|
||||
}
|
||||
});
|
||||
|
@ -1120,8 +1116,11 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
|
|||
|
||||
swAddresses.setChecked(prefs.getBoolean("addresses", false));
|
||||
|
||||
int message_zoom = prefs.getInt("message_zoom", 0);
|
||||
etMessageZoom.setText(message_zoom == 0 ? null : Integer.toString(message_zoom));
|
||||
int message_zoom = prefs.getInt("message_zoom", 100);
|
||||
tvMessageZoom.setText(getString(R.string.title_advanced_message_text_zoom2, NF.format(message_zoom)));
|
||||
if (message_zoom >= 50 && message_zoom <= 250)
|
||||
sbMessageZoom.setProgress(message_zoom - 50);
|
||||
|
||||
swOverviewMode.setChecked(prefs.getBoolean("overview_mode", false));
|
||||
|
||||
swContrast.setChecked(prefs.getBoolean("contrast", false));
|
||||
|
|
|
@ -1121,34 +1121,22 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_message_text_zoom"
|
||||
android:text="@string/title_advanced_message_text_zoom2"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAddresses" />
|
||||
|
||||
<eu.faircode.email.EditTextPlain
|
||||
android:id="@+id/etMessageZoom"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="100"
|
||||
android:inputType="number"
|
||||
android:maxLength="3"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvMessageZoom" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvMessageZoomPercentage"
|
||||
<SeekBar
|
||||
android:id="@+id/sbMessageZoom"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="%"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintBottom_toBottomOf="@id/etMessageZoom"
|
||||
app:layout_constraintStart_toEndOf="@id/etMessageZoom"
|
||||
app:layout_constraintTop_toTopOf="@id/etMessageZoom" />
|
||||
android:max="200"
|
||||
android:min="0"
|
||||
android:progress="50"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvMessageZoom" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swOverviewMode"
|
||||
|
@ -1158,7 +1146,7 @@
|
|||
android:text="@string/title_advanced_overview_mode"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/etMessageZoom"
|
||||
app:layout_constraintTop_toBottomOf="@id/sbMessageZoom"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -444,7 +444,7 @@
|
|||
<string name="title_advanced_addresses">Expand address details by default</string>
|
||||
<string name="title_advanced_attachments_alt">Show attachments after the message text</string>
|
||||
<string name="title_advanced_thumbnails">Show image thumbnails after the message text</string>
|
||||
<string name="title_advanced_message_text_zoom">Default message text zoom</string>
|
||||
<string name="title_advanced_message_text_zoom2">Default message text zoom: %1$s %%</string>
|
||||
<string name="title_advanced_overview_mode">Zoom original messages to fit the screen</string>
|
||||
<string name="title_advanced_contrast">Use high contrast for message text</string>
|
||||
<string name="title_advanced_monospaced">Use monospaced font for message text by default</string>
|
||||
|
|
Loading…
Reference in a new issue