mirror of
https://github.com/danog/termux-api.git
synced 2024-11-30 04:19:20 +01:00
Add support for password input dialogs
This commit is contained in:
parent
2880427dfe
commit
d5768dc4e5
@ -5,6 +5,7 @@ import java.io.PrintWriter;
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.InputType;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.Window;
|
||||
@ -32,12 +33,19 @@ public class DialogActivity extends Activity {
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
EditText textInput = (EditText) findViewById(R.id.text_input);
|
||||
|
||||
String inputHint = getIntent().getStringExtra("input_hint");
|
||||
if (inputHint != null) {
|
||||
((EditText) findViewById(R.id.text_input)).setHint(inputHint);
|
||||
textInput.setHint(inputHint);
|
||||
}
|
||||
|
||||
findViewById(R.id.cancel_button).setOnClickListener(new OnClickListener() {
|
||||
String inputType = getIntent().getStringExtra("input_type");
|
||||
if ("password".equals(inputType)) {A
|
||||
textInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
}
|
||||
|
||||
findViewById(R.id.cancel_button).setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
ResultReturner.returnData(DialogActivity.this, getIntent(), new ResultWriter() {
|
||||
@ -49,7 +57,6 @@ public class DialogActivity extends Activity {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user