mirror of https://github.com/M66B/FairEmail.git
Moved subscribe settings to receive tab
This commit is contained in:
parent
a06500acec
commit
6899d416ea
|
@ -45,9 +45,6 @@ import androidx.constraintlayout.widget.Group;
|
|||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class FragmentOptionsMisc extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swSubscriptions;
|
||||
private TextView tvSubscriptionPro;
|
||||
private SwitchCompat swSubscribedOnly;
|
||||
private Spinner spBiometricsTimeout;
|
||||
private SwitchCompat swDoubleBack;
|
||||
private SwitchCompat swEnglish;
|
||||
|
@ -65,7 +62,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private Group grpDebug;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"subscriptions", "subscribed_only", "biometrics_timeout", "double_back", "english", "watchdog", "updates", "crash_reports", "debug"
|
||||
"biometrics_timeout", "double_back", "english", "watchdog", "updates", "crash_reports", "debug"
|
||||
};
|
||||
|
||||
private final static String[] RESET_QUESTIONS = new String[]{
|
||||
|
@ -82,9 +79,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
// Get controls
|
||||
|
||||
swSubscriptions = view.findViewById(R.id.swSubscriptions);
|
||||
tvSubscriptionPro = view.findViewById(R.id.tvSubscriptionPro);
|
||||
swSubscribedOnly = view.findViewById(R.id.swSubscribedOnly);
|
||||
spBiometricsTimeout = view.findViewById(R.id.spBiometricsTimeout);
|
||||
swDoubleBack = view.findViewById(R.id.swDoubleBack);
|
||||
swEnglish = view.findViewById(R.id.swEnglish);
|
||||
|
@ -107,23 +101,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
|
||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
swSubscriptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("subscriptions", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
Helper.linkPro(tvSubscriptionPro);
|
||||
|
||||
swSubscribedOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("subscribed_only", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "subscribed_only");
|
||||
}
|
||||
});
|
||||
|
||||
spBiometricsTimeout.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
|
@ -277,11 +254,6 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
|
|||
private void setOptions() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
|
||||
boolean pro = ActivityBilling.isPro(getContext());
|
||||
swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false) && pro);
|
||||
swSubscriptions.setEnabled(pro);
|
||||
swSubscribedOnly.setChecked(prefs.getBoolean("subscribed_only", false));
|
||||
|
||||
int biometrics_timeout = prefs.getInt("biometrics_timeout", 2);
|
||||
int[] biometricTimeoutValues = getResources().getIntArray(R.array.biometricsTimeoutValues);
|
||||
for (int pos = 0; pos < biometricTimeoutValues.length; pos++)
|
||||
|
|
|
@ -59,11 +59,14 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
private SwitchCompat swDeleteUnseen;
|
||||
private SwitchCompat swSyncKept;
|
||||
private SwitchCompat swSyncFolders;
|
||||
private SwitchCompat swSubscriptions;
|
||||
private TextView tvSubscriptionPro;
|
||||
private SwitchCompat swSubscribedOnly;
|
||||
private SwitchCompat swCheckMx;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"enabled", "poll_interval", "schedule", "schedule_start", "schedule_end",
|
||||
"sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "sync_folders", "check_mx"
|
||||
"sync_unseen", "sync_flagged", "delete_unseen", "sync_kept", "sync_folders", "subscriptions", "subscribed_only", "check_mx"
|
||||
};
|
||||
|
||||
@Override
|
||||
|
@ -87,6 +90,9 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
swDeleteUnseen = view.findViewById(R.id.swDeleteUnseen);
|
||||
swSyncKept = view.findViewById(R.id.swSyncKept);
|
||||
swSyncFolders = view.findViewById(R.id.swSyncFolders);
|
||||
swSubscriptions = view.findViewById(R.id.swSubscriptions);
|
||||
tvSubscriptionPro = view.findViewById(R.id.tvSubscriptionPro);
|
||||
swSubscribedOnly = view.findViewById(R.id.swSubscribedOnly);
|
||||
swCheckMx = view.findViewById(R.id.swCheckMx);
|
||||
|
||||
setOptions();
|
||||
|
@ -201,6 +207,23 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
}
|
||||
});
|
||||
|
||||
swSubscriptions.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("subscriptions", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
Helper.linkPro(tvSubscriptionPro);
|
||||
|
||||
swSubscribedOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("subscribed_only", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "subscribed_only");
|
||||
}
|
||||
});
|
||||
|
||||
swCheckMx.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -252,6 +275,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
|
||||
private void setOptions() {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
boolean pro = ActivityBilling.isPro(getContext());
|
||||
|
||||
swEnabled.setChecked(prefs.getBoolean("enabled", true));
|
||||
|
||||
|
@ -264,7 +288,6 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
break;
|
||||
}
|
||||
|
||||
boolean pro = ActivityBilling.isPro(getContext());
|
||||
swSchedule.setChecked(prefs.getBoolean("schedule", false) && pro);
|
||||
swSchedule.setEnabled(pro);
|
||||
tvScheduleStart.setText(formatHour(getContext(), prefs.getInt("schedule_start", 0)));
|
||||
|
@ -275,6 +298,9 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
swDeleteUnseen.setChecked(prefs.getBoolean("delete_unseen", false));
|
||||
swSyncKept.setChecked(prefs.getBoolean("sync_kept", true));
|
||||
swSyncFolders.setChecked(prefs.getBoolean("sync_folders", true));
|
||||
swSubscriptions.setChecked(prefs.getBoolean("subscriptions", false) && pro);
|
||||
swSubscriptions.setEnabled(pro);
|
||||
swSubscribedOnly.setChecked(prefs.getBoolean("subscribed_only", false));
|
||||
swCheckMx.setChecked(prefs.getBoolean("check_mx", false));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,64 +19,17 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSubscriptions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_advanced_subscriptions"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubscriptionPro"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_pro_feature"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:attr/textColorLink"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSubscriptions" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSubscribedOnly"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_sync_subscribed"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSubscriptionPro"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubscribedOnlyHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_subscribed_only_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/swSubscribedOnly" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvBiometricsTimeout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_biometrics_timeout"
|
||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSubscribedOnlyHint" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spBiometricsTimeout"
|
||||
|
|
|
@ -261,6 +261,54 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSyncFolders" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSubscriptions"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_subscriptions"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSyncFolders"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubscriptionPro"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_pro_feature"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?android:attr/textColorLink"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSubscriptions" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSubscribedOnly"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_sync_subscribed"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSubscriptionPro"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSubscribedOnlyHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_subscribed_only_hint"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
android:textColor="?attr/colorWarning"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSubscribedOnly" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swCheckMx"
|
||||
android:layout_width="0dp"
|
||||
|
@ -269,7 +317,7 @@
|
|||
android:text="@string/title_advanced_check_mx"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSyncFolders"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSubscribedOnlyHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
|
Loading…
Reference in New Issue