Added hint about roam-like-at-home

This commit is contained in:
M66B 2019-05-10 17:51:05 +02:00
parent 09d21c070b
commit 777da49bf6
4 changed files with 39 additions and 26 deletions

View File

@ -47,13 +47,13 @@ import androidx.preference.PreferenceManager;
public class FragmentOptionsConnection extends FragmentBase implements SharedPreferences.OnSharedPreferenceChangeListener {
private SwitchCompat swMetered;
private Spinner spDownload;
private SwitchCompat swRoaming;
private SwitchCompat swRlah;
private SwitchCompat swRoaming;
private TextView tvConnectionType;
private TextView tvConnectionRoaming;
private final static String[] RESET_OPTIONS = new String[]{
"metered", "download", "roaming", "rlah"
"metered", "download", "rlah", "roaming"
};
@Override
@ -68,8 +68,8 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
swMetered = view.findViewById(R.id.swMetered);
spDownload = view.findViewById(R.id.spDownload);
swRoaming = view.findViewById(R.id.swRoaming);
swRlah = view.findViewById(R.id.swRlah);
swRoaming = view.findViewById(R.id.swRoaming);
tvConnectionType = view.findViewById(R.id.tvConnectionType);
tvConnectionRoaming = view.findViewById(R.id.tvConnectionRoaming);
@ -101,14 +101,6 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}
});
swRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("roaming", checked).apply();
ServiceSynchronize.reload(getContext(), "roaming=" + checked);
}
});
swRlah.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -117,6 +109,14 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
}
});
swRoaming.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("roaming", checked).apply();
ServiceSynchronize.reload(getContext(), "roaming=" + checked);
}
});
PreferenceManager.getDefaultSharedPreferences(getContext()).registerOnSharedPreferenceChangeListener(this);
tvConnectionType.setVisibility(View.GONE);
@ -192,8 +192,8 @@ public class FragmentOptionsConnection extends FragmentBase implements SharedPre
break;
}
swRoaming.setChecked(prefs.getBoolean("roaming", true));
swRlah.setChecked(prefs.getBoolean("rlah", false));
swRoaming.setChecked(prefs.getBoolean("roaming", true));
}
private ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {

View File

@ -866,8 +866,8 @@ public class Helper {
static NetworkState getNetworkState(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean metered = prefs.getBoolean("metered", true);
boolean roaming = prefs.getBoolean("roaming", true);
boolean rlah = prefs.getBoolean("rlah", false);
boolean roaming = prefs.getBoolean("roaming", true);
NetworkState state = new NetworkState();
Boolean isMetered = isMetered(context);

View File

@ -75,16 +75,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDownload" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swRoaming"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_roaming"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spDownload"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swRlah"
android:layout_width="match_parent"
@ -92,7 +82,29 @@
android:layout_marginTop="12dp"
android:text="@string/title_advanced_rlah"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swRoaming"
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"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_roaming"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRlah"
app:switchPadding="12dp" />
<TextView
@ -106,7 +118,7 @@
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/swRlah" />
app:layout_constraintTop_toBottomOf="@+id/swRoaming" />
<TextView
android:id="@+id/tvConnectionRoaming"

View File

@ -175,8 +175,8 @@
<string name="title_advanced_metered">Use metered connections</string>
<string name="title_advanced_download">Automatically download messages and attachments on a metered connection up to</string>
<string name="title_advanced_rlah">Roam like at home</string>
<string name="title_advanced_roaming">Download messages and attachments while roaming</string>
<string name="title_advanced_rlah">Roam like at home EU</string>
<string name="title_advanced_browse">Browse messages on the server</string>
<string name="title_advanced_startup">Show on start screen</string>
@ -232,6 +232,7 @@
<string name="title_advanced_schedule_hint">Tap on a time to set a time</string>
<string name="title_advanced_metered_hint">Metered connections are generally mobile connections or paid Wi-Fi hotspots</string>
<string name="title_advanced_metered_warning">Disabling this option will disable receiving and sending messages on mobile internet connections</string>
<string name="title_advanced_rlah_hint">Disable roaming within the EU</string>
<string name="title_advanced_browse_hint">Fetch more messages when scrolling down</string>
<string name="title_advanced_threading_hint">Group messages related to each other</string>