mirror of https://github.com/M66B/FairEmail.git
Added option to configure number of subject lines of widget
This commit is contained in:
parent
6a288a2ed6
commit
2618006935
|
@ -6,6 +6,12 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
|
|||
|
||||
### [Rahonavis](https://en.wikipedia.org/wiki/Rahonavis)
|
||||
|
||||
### Next version
|
||||
|
||||
* Added option to configure number of widget subject lines
|
||||
* Small improvements and minor bug fixes
|
||||
* Updated [translations](https://crowdin.com/project/open-source-email)
|
||||
|
||||
### 1.2054 - 2023-03-14
|
||||
|
||||
* Added rule action option to delete keywords
|
||||
|
|
|
@ -6,6 +6,12 @@ For support you can use [the contact form](https://contact.faircode.eu/?product=
|
|||
|
||||
### [Rahonavis](https://en.wikipedia.org/wiki/Rahonavis)
|
||||
|
||||
### Next version
|
||||
|
||||
* Added option to configure number of widget subject lines
|
||||
* Small improvements and minor bug fixes
|
||||
* Updated [translations](https://crowdin.com/project/open-source-email)
|
||||
|
||||
### 1.2054 - 2023-03-14
|
||||
|
||||
* Added rule action option to delete keywords
|
||||
|
|
|
@ -47,6 +47,7 @@ import com.flask.colorpicker.ColorPickerView;
|
|||
import com.flask.colorpicker.builder.ColorPickerClickListener;
|
||||
import com.flask.colorpicker.builder.ColorPickerDialogBuilder;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
@ -67,6 +68,8 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
private CheckBox cbSeparatorLines;
|
||||
private Spinner spFontSize;
|
||||
private Spinner spPadding;
|
||||
private Spinner spSubjectLines;
|
||||
private TextView tvSubjectLinesHint;
|
||||
private CheckBox cbAvatars;
|
||||
private CheckBox cbRefresh;
|
||||
private CheckBox cbCompose;
|
||||
|
@ -79,6 +82,8 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
private ArrayAdapter<String> adapterFontSize;
|
||||
private ArrayAdapter<String> adapterPadding;
|
||||
|
||||
private NumberFormat NF = NumberFormat.getNumberInstance();
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -105,9 +110,10 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
boolean separators = prefs.getBoolean("widget." + appWidgetId + ".separators", true);
|
||||
int font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
||||
int padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||
int subject_lines = prefs.getInt("widget." + appWidgetId + ".subject_lines", 1);
|
||||
boolean avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false);
|
||||
boolean refresh = prefs.getBoolean("widget." + appWidgetId + ".refresh", false);
|
||||
boolean compose = prefs.getBoolean("widget." + appWidgetId + ".compose", false);
|
||||
boolean avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false);
|
||||
|
||||
daynight = daynight && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
|
||||
|
||||
|
@ -127,6 +133,8 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
cbSeparatorLines = findViewById(R.id.cbSeparatorLines);
|
||||
spFontSize = findViewById(R.id.spFontSize);
|
||||
spPadding = findViewById(R.id.spPadding);
|
||||
spSubjectLines = findViewById(R.id.spSubjectLines);
|
||||
tvSubjectLinesHint = findViewById(R.id.tvSubjectLinesHint);
|
||||
cbAvatars = findViewById(R.id.cbAvatars);
|
||||
cbRefresh = findViewById(R.id.cbRefresh);
|
||||
cbCompose = findViewById(R.id.cbCompose);
|
||||
|
@ -268,6 +276,7 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
editor.putBoolean("widget." + appWidgetId + ".separators", cbSeparatorLines.isChecked());
|
||||
editor.putInt("widget." + appWidgetId + ".font", tinyOut(font));
|
||||
editor.putInt("widget." + appWidgetId + ".padding", tinyOut(padding));
|
||||
editor.putInt("widget." + appWidgetId + ".subject_lines", spSubjectLines.getSelectedItemPosition() + 1);
|
||||
editor.putBoolean("widget." + appWidgetId + ".avatars", cbAvatars.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".refresh", cbRefresh.isChecked());
|
||||
editor.putBoolean("widget." + appWidgetId + ".compose", cbCompose.isChecked());
|
||||
|
@ -399,6 +408,8 @@ public class ActivityWidgetUnified extends ActivityBase {
|
|||
spFontSize.setSelection(tinyIn(font));
|
||||
spPadding.setSelection(tinyIn(padding));
|
||||
cbAvatars.setChecked(avatars);
|
||||
spSubjectLines.setSelection(subject_lines - 1);
|
||||
tvSubjectLinesHint.setText(getString(R.string.title_advanced_preview_lines_hint, NF.format(HtmlHelper.PREVIEW_SIZE)));
|
||||
cbRefresh.setChecked(refresh);
|
||||
cbCompose.setChecked(compose);
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
private int font;
|
||||
private int padding;
|
||||
private boolean avatars;
|
||||
private int subject_lines;
|
||||
private boolean prefer_contact;
|
||||
private boolean only_contact;
|
||||
private boolean distinguish_contacts;
|
||||
|
@ -116,6 +117,7 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
font = prefs.getInt("widget." + appWidgetId + ".font", 0);
|
||||
padding = prefs.getInt("widget." + appWidgetId + ".padding", 0);
|
||||
avatars = prefs.getBoolean("widget." + appWidgetId + ".avatars", false);
|
||||
subject_lines = prefs.getInt("widget." + appWidgetId + ".subject_lines", 1);
|
||||
|
||||
prefer_contact = prefs.getBoolean("prefer_contact", false);
|
||||
only_contact = prefs.getBoolean("only_contact", false);
|
||||
|
@ -279,6 +281,12 @@ public class WidgetUnifiedRemoteViewsFactory implements RemoteViewsService.Remot
|
|||
views.setInt(R.id.separator, "setBackgroundColor", colorSeparator);
|
||||
}
|
||||
|
||||
try {
|
||||
views.setInt(idSubject, "setMaxLines", subject_lines);
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
||||
views.setViewVisibility(R.id.separator, separators ? View.VISIBLE : View.GONE);
|
||||
|
||||
views.setViewVisibility(idAccount, account < 0 && !allColors ? View.VISIBLE : View.GONE);
|
||||
|
|
|
@ -169,6 +169,40 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvPadding" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubjectLines"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_widget_subject_lines"
|
||||
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/spPadding" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spSubjectLines"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:entries="@array/linesNames"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSubjectLines" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubjectLinesHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_preview_lines_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spSubjectLines" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbAvatars"
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -177,7 +211,7 @@
|
|||
android:checked="true"
|
||||
android:text="@string/title_widget_avatars"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spPadding" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSubjectLinesHint" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbRefresh"
|
||||
|
|
|
@ -2214,6 +2214,7 @@
|
|||
<string name="title_widget_separator_lines">Show separator lines</string>
|
||||
<string name="title_widget_semi_transparent">Semi transparent background</string>
|
||||
<string name="title_widget_count_top">Show unread count at the top</string>
|
||||
<string name="title_widget_subject_lines">Maximum number of subject lines</string>
|
||||
<string name="title_widget_avatars">Show contact avatars</string>
|
||||
<string name="title_widget_refresh">Show refresh messages button</string>
|
||||
<string name="title_widget_compose">Show compose new message button</string>
|
||||
|
|
|
@ -6,6 +6,12 @@ For support you can use the contact form.
|
|||
|
||||
Rahonavis
|
||||
|
||||
Next version
|
||||
|
||||
* Added option to configure number of widget subject lines
|
||||
* Small improvements and minor bug fixes
|
||||
* Updated translations
|
||||
|
||||
1.2054 - 2023-03-14
|
||||
|
||||
* Added rule action option to delete keywords
|
||||
|
|
Loading…
Reference in New Issue