Auto identity depends on storing addresses

This commit is contained in:
M66B 2022-12-18 09:02:22 +01:00
parent 693a4b6189
commit d5f50a0ab5
2 changed files with 40 additions and 35 deletions

View File

@ -69,8 +69,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
private SwitchCompat swSuggestSent;
private SwitchCompat swSuggestReceived;
private SwitchCompat swSuggestFrequently;
private Button btnLocalContacts;
private SwitchCompat swAutoIdentity;
private Button btnLocalContacts;
private SwitchCompat swSendChips;
private SwitchCompat swSendReminders;
private SwitchCompat swSendPending;
@ -149,8 +149,8 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swSuggestSent = view.findViewById(R.id.swSuggestSent);
swSuggestReceived = view.findViewById(R.id.swSuggestReceived);
swSuggestFrequently = view.findViewById(R.id.swSuggestFrequently);
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
swAutoIdentity = view.findViewById(R.id.swAutoIdentity);
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
swSendChips = view.findViewById(R.id.swSendChips);
swSendReminders = view.findViewById(R.id.swSendReminders);
swSendPending = view.findViewById(R.id.swSendPending);
@ -249,6 +249,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("suggest_sent", checked).apply();
swSuggestFrequently.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
swAutoIdentity.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
}
});
@ -257,6 +258,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("suggest_received", checked).apply();
swSuggestFrequently.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
swAutoIdentity.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
}
});
@ -267,14 +269,6 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
btnLocalContacts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_MANAGE_LOCAL_CONTACTS));
}
});
swAutoIdentity.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -283,6 +277,14 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
}
});
btnLocalContacts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
lbm.sendBroadcast(new Intent(ActivitySetup.ACTION_MANAGE_LOCAL_CONTACTS));
}
});
swSendChips.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
@ -698,6 +700,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
swSuggestFrequently.setChecked(prefs.getBoolean("suggest_frequently", false));
swSuggestFrequently.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
swAutoIdentity.setChecked(prefs.getBoolean("auto_identity", false));
swAutoIdentity.setEnabled(swSuggestSent.isChecked() || swSuggestReceived.isChecked());
swSendChips.setChecked(prefs.getBoolean("send_chips", true));
swSendReminders.setChecked(prefs.getBoolean("send_reminders", true));
swSendPending.setChecked(prefs.getBoolean("send_pending", true));

View File

@ -182,6 +182,31 @@
app:layout_constraintTop_toBottomOf="@id/swSuggestReceived"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoIdentity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_auto_identity"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSuggestFrequently"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvAutoIdentity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_auto_identity_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/swAutoIdentity" />
<Button
android:id="@+id/btnLocalContacts"
style="?android:attr/buttonStyleSmall"
@ -193,30 +218,7 @@
android:drawablePadding="6dp"
android:text="@string/title_setup_manage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSuggestFrequently" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAutoIdentity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_auto_identity"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnLocalContacts"
app:switchPadding="12dp" />
<TextView
android:id="@+id/tvAutoIdentity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="48dp"
android:text="@string/title_advanced_auto_identity_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/swAutoIdentity" />
app:layout_constraintTop_toBottomOf="@id/tvAutoIdentity" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSendChips"
@ -227,7 +229,7 @@
android:text="@string/title_advanced_send_chips"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAutoIdentity"
app:layout_constraintTop_toBottomOf="@id/btnLocalContacts"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat