Merge pull request #3696 from ByteHamster/white-on-white
Fixed white on white text in authentication dialog
This commit is contained in:
commit
46731178b4
|
@ -256,7 +256,8 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
|||
} else if (status.getReason() == DownloadError.ERROR_UNAUTHORIZED) {
|
||||
if (!isFinishing() && !isPaused) {
|
||||
dialog = new FeedViewAuthenticationDialog(OnlineFeedViewActivity.this,
|
||||
R.string.authentication_notification_title, downloader.getDownloadRequest().getSource());
|
||||
R.string.authentication_notification_title,
|
||||
downloader.getDownloadRequest().getSource()).create();
|
||||
dialog.show();
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -1,51 +1,29 @@
|
|||
package de.danoeh.antennapod.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
|
||||
import de.danoeh.antennapod.R;
|
||||
|
||||
/**
|
||||
* Displays a dialog with a username and password text field and an optional checkbox to save username and preferences.
|
||||
*/
|
||||
public abstract class AuthenticationDialog extends Dialog {
|
||||
public abstract class AuthenticationDialog extends AlertDialog.Builder {
|
||||
|
||||
private final int titleRes;
|
||||
private final boolean enableUsernameField;
|
||||
private final boolean showSaveCredentialsCheckbox;
|
||||
private final String usernameInitialValue;
|
||||
private final String passwordInitialValue;
|
||||
|
||||
public AuthenticationDialog(Context context, int titleRes, boolean enableUsernameField, boolean showSaveCredentialsCheckbox, String usernameInitialValue, String passwordInitialValue) {
|
||||
public AuthenticationDialog(Context context, int titleRes, boolean enableUsernameField,
|
||||
boolean showSaveCredentialsCheckbox, String usernameInitialValue,
|
||||
String passwordInitialValue) {
|
||||
super(context);
|
||||
this.titleRes = titleRes;
|
||||
this.enableUsernameField = enableUsernameField;
|
||||
this.showSaveCredentialsCheckbox = showSaveCredentialsCheckbox;
|
||||
this.usernameInitialValue = usernameInitialValue;
|
||||
this.passwordInitialValue = passwordInitialValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.authentication_dialog);
|
||||
final EditText etxtUsername = findViewById(R.id.etxtUsername);
|
||||
final EditText etxtPassword = findViewById(R.id.etxtPassword);
|
||||
final CheckBox saveUsernamePassword = findViewById(R.id.chkSaveUsernamePassword);
|
||||
final Button butConfirm = findViewById(R.id.butConfirm);
|
||||
final Button butCancel = findViewById(R.id.butCancel);
|
||||
|
||||
if (titleRes != 0) {
|
||||
setTitle(titleRes);
|
||||
} else {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
}
|
||||
View rootView = View.inflate(context, R.layout.authentication_dialog, null);
|
||||
setView(rootView);
|
||||
|
||||
final EditText etxtUsername = rootView.findViewById(R.id.etxtUsername);
|
||||
final EditText etxtPassword = rootView.findViewById(R.id.etxtPassword);
|
||||
final CheckBox saveUsernamePassword = rootView.findViewById(R.id.chkSaveUsernamePassword);
|
||||
|
||||
etxtUsername.setEnabled(enableUsernameField);
|
||||
if (showSaveCredentialsCheckbox) {
|
||||
saveUsernamePassword.setVisibility(View.VISIBLE);
|
||||
|
@ -59,13 +37,10 @@ public abstract class AuthenticationDialog extends Dialog {
|
|||
etxtPassword.setText(passwordInitialValue);
|
||||
}
|
||||
setOnCancelListener(dialog -> onCancelled());
|
||||
butCancel.setOnClickListener(v -> cancel());
|
||||
butConfirm.setOnClickListener(v -> {
|
||||
onConfirmed(etxtUsername.getText().toString(),
|
||||
etxtPassword.getText().toString(),
|
||||
showSaveCredentialsCheckbox && saveUsernamePassword.isChecked());
|
||||
dismiss();
|
||||
});
|
||||
setNegativeButton(R.string.cancel_label, null);
|
||||
setPositiveButton(R.string.confirm_label, (dialog, which)
|
||||
-> onConfirmed(etxtUsername.getText().toString(), etxtPassword.getText().toString(),
|
||||
showSaveCredentialsCheckbox && saveUsernamePassword.isChecked()));
|
||||
}
|
||||
|
||||
protected void onCancelled() {
|
||||
|
|
|
@ -4,11 +4,6 @@
|
|||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etxtUsername"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -39,53 +34,3 @@
|
|||
android:layout_margin="16dp"
|
||||
android:text="@string/save_username_password_label"/>
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/footer"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="48dp" >
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dip"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="?android:attr/dividerVertical" />
|
||||
|
||||
<View
|
||||
android:id="@+id/horizontal_divider"
|
||||
android:layout_width="1dip"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:background="?android:attr/dividerVertical" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/butCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toLeftOf="@id/horizontal_divider"
|
||||
android:layout_toStartOf="@id/horizontal_divider"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:text="@string/cancel_label" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/butConfirm"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_toRightOf="@id/horizontal_divider"
|
||||
android:layout_toEndOf="@id/horizontal_divider"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:text="@string/confirm_label" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
Loading…
Reference in New Issue