mirror of https://github.com/M66B/FairEmail.git
Small layout improvement
This commit is contained in:
parent
9a22a2eecd
commit
1617fd8358
|
@ -62,9 +62,9 @@ import java.util.Objects;
|
|||
|
||||
public class FragmentOptionsSynchronize extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swEnabled;
|
||||
private Spinner spPollInterval;
|
||||
private SwitchCompat swOptimize;
|
||||
private ImageButton ibOptimizeInfo;
|
||||
private Spinner spPollInterval;
|
||||
private RecyclerView rvExempted;
|
||||
private SwitchCompat swSchedule;
|
||||
private TextView tvSchedulePro;
|
||||
|
@ -105,9 +105,9 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
// Get controls
|
||||
|
||||
swEnabled = view.findViewById(R.id.swEnabled);
|
||||
spPollInterval = view.findViewById(R.id.spPollInterval);
|
||||
swOptimize = view.findViewById(R.id.swOptimize);
|
||||
ibOptimizeInfo = view.findViewById(R.id.ibOptimizeInfo);
|
||||
spPollInterval = view.findViewById(R.id.spPollInterval);
|
||||
swSchedule = view.findViewById(R.id.swSchedule);
|
||||
rvExempted = view.findViewById(R.id.rvExempted);
|
||||
tvSchedulePro = view.findViewById(R.id.tvSchedulePro);
|
||||
|
@ -150,6 +150,21 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
}
|
||||
});
|
||||
|
||||
swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("auto_optimize", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), null, false, "optimize");
|
||||
}
|
||||
});
|
||||
|
||||
ibOptimizeInfo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Helper.viewFAQ(getContext(), 39);
|
||||
}
|
||||
});
|
||||
|
||||
spPollInterval.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
|
@ -174,21 +189,6 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
}
|
||||
});
|
||||
|
||||
swOptimize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("auto_optimize", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), null, false, "optimize");
|
||||
}
|
||||
});
|
||||
|
||||
ibOptimizeInfo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Helper.viewFAQ(getContext(), 39);
|
||||
}
|
||||
});
|
||||
|
||||
rvExempted.setHasFixedSize(false);
|
||||
LinearLayoutManager llm = new LinearLayoutManager(getContext());
|
||||
rvExempted.setLayoutManager(llm);
|
||||
|
@ -391,6 +391,7 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
boolean pro = ActivityBilling.isPro(getContext());
|
||||
|
||||
swEnabled.setChecked(prefs.getBoolean("enabled", true));
|
||||
swOptimize.setChecked(prefs.getBoolean("auto_optimize", true));
|
||||
|
||||
int pollInterval = prefs.getInt("poll_interval", ServiceSynchronize.DEFAULT_POLL_INTERVAL);
|
||||
int[] pollIntervalValues = getResources().getIntArray(R.array.pollIntervalValues);
|
||||
|
@ -401,7 +402,6 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
|
|||
break;
|
||||
}
|
||||
|
||||
swOptimize.setChecked(prefs.getBoolean("auto_optimize", true));
|
||||
grpExempted.setVisibility(pollInterval == 0 ? View.GONE : View.VISIBLE);
|
||||
|
||||
swSchedule.setChecked(prefs.getBoolean("schedule", false) && pro);
|
||||
|
|
|
@ -66,28 +66,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvManualHint" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spPollInterval"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:entries="@array/pollIntervalNames"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvWhen" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvPollHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_poll_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/spPollInterval" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swOptimize"
|
||||
android:layout_width="0dp"
|
||||
|
@ -97,7 +75,7 @@
|
|||
android:text="@string/title_advanced_optimize"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvPollHint"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvWhen"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
@ -123,6 +101,28 @@
|
|||
app:layout_constraintTop_toTopOf="@id/tvOptimizeHint"
|
||||
app:srcCompat="@drawable/baseline_info_24" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/spPollInterval"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:entries="@array/pollIntervalNames"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvOptimizeHint" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvPollHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_poll_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/spPollInterval" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvExempted"
|
||||
android:layout_width="0dp"
|
||||
|
@ -134,7 +134,7 @@
|
|||
android:textColor="?android:attr/textColorPrimary"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvOptimizeHint" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tvPollHint" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvExempted"
|
||||
|
|
Loading…
Reference in New Issue