Added language cancel button

pull/190/head
M66B 4 years ago
parent 0259da1136
commit bfe39dacb7

@ -43,6 +43,7 @@ import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
@ -83,6 +84,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private TextView tvFtsIndexed;
private TextView tvFtsPro;
private Spinner spLanguage;
private ImageButton ibResetLanguage;
private SwitchCompat swWatchdog;
private SwitchCompat swUpdates;
private SwitchCompat swExperiments;
@ -162,6 +164,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
tvFtsIndexed = view.findViewById(R.id.tvFtsIndexed);
tvFtsPro = view.findViewById(R.id.tvFtsPro);
spLanguage = view.findViewById(R.id.spLanguage);
ibResetLanguage = view.findViewById(R.id.ibResetLanguage);
swWatchdog = view.findViewById(R.id.swWatchdog);
swUpdates = view.findViewById(R.id.swUpdates);
swExperiments = view.findViewById(R.id.swExperiments);
@ -268,6 +271,13 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
}
});
ibResetLanguage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
prefs.edit().remove("language").commit(); // apply won't work here
}
});
swWatchdog.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {

@ -127,12 +127,26 @@
<Spinner
android:id="@+id/spLanguage"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginEnd="12dp"
app:layout_constraintEnd_toStartOf="@+id/ibResetLanguage"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvLanguage" />
<ImageButton
android:id="@+id/ibResetLanguage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_reset"
android:tooltipText="@string/title_reset"
app:layout_constraintBottom_toBottomOf="@id/spLanguage"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/twotone_cancel_24" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvLanguageHint"
android:layout_width="0dp"

Loading…
Cancel
Save