mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-31 20:25:38 +00:00
Refactoring
This commit is contained in:
parent
3e9e56d878
commit
b490e49ee7
2 changed files with 36 additions and 36 deletions
|
@ -47,13 +47,13 @@ import androidx.preference.PreferenceManager;
|
|||
public class FragmentOptionsConnection extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
private SwitchCompat swMetered;
|
||||
private Spinner spDownload;
|
||||
private SwitchCompat swRlah;
|
||||
private SwitchCompat swRoaming;
|
||||
private SwitchCompat swRlah;
|
||||
private TextView tvConnectionType;
|
||||
private TextView tvConnectionRoaming;
|
||||
|
||||
private final static String[] RESET_OPTIONS = new String[]{
|
||||
"metered", "download", "rlah", "roaming"
|
||||
"metered", "download", "roaming", "rlah"
|
||||
};
|
||||
|
||||
@Override
|
||||
|
@ -68,8 +68,8 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
|
|||
|
||||
swMetered = view.findViewById(R.id.swMetered);
|
||||
spDownload = view.findViewById(R.id.spDownload);
|
||||
swRlah = view.findViewById(R.id.swRlah);
|
||||
swRoaming = view.findViewById(R.id.swRoaming);
|
||||
swRlah = view.findViewById(R.id.swRlah);
|
||||
|
||||
tvConnectionType = view.findViewById(R.id.tvConnectionType);
|
||||
tvConnectionRoaming = view.findViewById(R.id.tvConnectionRoaming);
|
||||
|
@ -101,14 +101,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
|
|||
}
|
||||
});
|
||||
|
||||
swRlah.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("rlah", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "rlah=" + checked);
|
||||
}
|
||||
});
|
||||
|
||||
swRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -117,6 +109,14 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
|
|||
}
|
||||
});
|
||||
|
||||
swRlah.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("rlah", checked).apply();
|
||||
ServiceSynchronize.reload(getContext(), "rlah=" + checked);
|
||||
}
|
||||
});
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
|
||||
|
||||
tvConnectionType.setVisibility(View.GONE);
|
||||
|
@ -192,8 +192,8 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
|
|||
break;
|
||||
}
|
||||
|
||||
swRlah.setChecked(prefs.getBoolean("rlah", true));
|
||||
swRoaming.setChecked(prefs.getBoolean("roaming", true));
|
||||
swRlah.setChecked(prefs.getBoolean("rlah", true));
|
||||
}
|
||||
|
||||
private ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
|
||||
|
|
|
@ -75,28 +75,6 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvDownload" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swRlah"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_rlah"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spDownload"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRlah"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_rlah_hint"
|
||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swRlah" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swRoaming"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -104,7 +82,7 @@
|
|||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_roaming"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvRlah"
|
||||
app:layout_constraintTop_toBottomOf="@id/spDownload"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
@ -119,6 +97,28 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swRoaming" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swRlah"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_advanced_rlah"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvRoamingHint"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvRlahHint"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:text="@string/title_advanced_rlah_hint"
|
||||
android:textAppearance="@style/Base.TextAppearance.AppCompat.Small"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/swRlah" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvConnectionType"
|
||||
android:layout_width="0dp"
|
||||
|
@ -130,7 +130,7 @@
|
|||
android:textStyle="italic"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvRoamingHint" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/tvRlahHint" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvConnectionRoaming"
|
||||
|
|
Loading…
Reference in a new issue